/** @file\r
Declaration of structures and functions of MnpDxe driver.\r
\r
-Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
of the BSD License which accompanies this distribution. The full\r
#define MNP_INIT_NET_BUFFER_NUM 512\r
#define MNP_NET_BUFFER_INCREASEMENT 64\r
#define MNP_MAX_NET_BUFFER_NUM 65536\r
+#define MNP_TX_BUFFER_INCREASEMENT 64\r
+#define MNP_MAX_TX_BUFFER_NUM 65536\r
\r
#define MNP_MAX_RCVD_PACKET_QUE_SIZE 256\r
\r
UINT64 TimeoutTick;\r
} MNP_RXDATA_WRAP;\r
\r
+#define MNP_TX_BUF_WRAP_SIGNATURE SIGNATURE_32 ('M', 'T', 'B', 'W')\r
+\r
+typedef struct {\r
+ UINT32 Signature;\r
+ LIST_ENTRY WrapEntry; // Link to FreeTxBufList\r
+ LIST_ENTRY AllEntry; // Link to AllTxBufList\r
+ BOOLEAN InUse;\r
+ UINT8 TxBuf[1];\r
+} MNP_TX_BUF_WRAP;\r
\r
/**\r
Initialize the mnp device context data.\r
@param[out] PktLen Pointer to a UINT32 variable used to record the packet's\r
length.\r
\r
+ @retval EFI_SUCCESS TxPackage is built.\r
+ @retval EFI_OUT_OF_RESOURCES The deliver fails due to lack of memory resource.\r
+\r
**/\r
-VOID\r
+EFI_STATUS\r
MnpBuildTxPacket (\r
IN MNP_SERVICE_DATA *MnpServiceData,\r
IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData,\r
);\r
\r
/**\r
- Synchronously send out the packet.\r
+ Synchronously send out the packet. \r
+\r
+ This functon places the packet buffer to SNP driver's tansmit queue. The packet\r
+ can be considered successfully sent out once SNP acccetp the packet, while the\r
+ packet buffer recycle is deferred for better performance.\r
\r
@param[in] MnpServiceData Pointer to the mnp service context data.\r
@param[in] Packet Pointer to the pakcet buffer.\r
IN OUT NET_BUF *Nbuf\r
);\r
\r
+/**\r
+ Allocate a free TX buffer from MnpDeviceData->FreeTxBufList. If there is none\r
+ in the queue, first try to recycle some from SNP, then try to allocate some and add \r
+ them into the queue, then fetch the NET_BUF from the updated FreeTxBufList.\r
+\r
+ @param[in, out] MnpDeviceData Pointer to the MNP_DEVICE_DATA.\r
+\r
+ @return Pointer to the allocated free NET_BUF structure, if NULL the\r
+ operation is failed.\r
+\r
+**/\r
+UINT8 *\r
+MnpAllocTxBuf (\r
+ IN OUT MNP_DEVICE_DATA *MnpDeviceData\r
+ );\r
+\r
+/**\r
+ Try to recycle all the transmitted buffer address from SNP.\r
+\r
+ @param[in, out] MnpDeviceData Pointer to the mnp device context data.\r
+\r
+ @retval EFI_SUCCESS Successed to recyclethe transmitted buffer address.\r
+ @retval Others Failed to recyclethe transmitted buffer address.\r
+\r
+**/\r
+EFI_STATUS\r
+MnpRecycleTxBuf (\r
+ IN OUT MNP_DEVICE_DATA *MnpDeviceData\r
+ );\r
+\r
/**\r
Remove the received packets if timeout occurs.\r
\r