1. Add Link MTU support to IP4 and TCP4 driver.

2. Integrate IPsec functionality to IP4 driver.
3. Move IP_VERSION_4/IP_VERSION_6 definition from IpIoLib to NetLib.
4. Move the Ip6/Udp6 protocol declaration from driver INF to Library INF (DxeIpIoLib and DxeUdpIoLib) for better readability.



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9413 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
tye
2009-11-11 07:06:27 +00:00
parent 0424593539
commit a1503a32a8
17 changed files with 400 additions and 25 deletions

View File

@@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Uefi.h>
#include <Protocol/IpSec.h>
#include <Protocol/Ip4.h>
#include <Protocol/Ip4Config.h>
#include <Protocol/Arp.h>
@@ -80,11 +81,23 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
typedef struct {
IP4_PROTOCOL *IpInstance;
EFI_IP4_COMPLETION_TOKEN *Token;
EFI_EVENT IpSecRecycleSignal;
NET_BUF *Packet;
BOOLEAN Sent;
INTN Life;
} IP4_TXTOKEN_WRAP;
///
/// IP4_IPSEC_WRAP wraps the packet received from MNP layer. The packet
/// will be released after it has been processed by the receiver. Upon then,
/// the IP4_IPSEC_WRAP will be released, and the IpSecRecycleSignal will be signaled
/// to notice IPsec to free the resources.
///
typedef struct {
EFI_EVENT IpSecRecycleSignal;
NET_BUF *Packet;
} IP4_IPSEC_WRAP;
///
/// IP4_RXDATA_WRAP wraps the data IP4 child delivers to the
/// upper layers. The received packet is kept in the Packet.
@@ -110,7 +123,7 @@ struct _IP4_PROTOCOL {
INTN State;
IP4_SERVICE *Service;
LIST_ENTRY Link; // Link to all the IP protocol from the service
LIST_ENTRY Link; // Link to all the IP protocol from the service
//
// User's transmit/receive tokens, and received/deliverd packets
@@ -136,7 +149,7 @@ struct _IP4_PROTOCOL {
//
// IGMP data for this instance
//
IP4_ADDR *Groups; // stored in network byte order
IP4_ADDR *Groups; // stored in network byte order
UINT32 GroupCount;
EFI_IP4_CONFIG_DATA ConfigData;
@@ -194,6 +207,8 @@ struct _IP4_SERVICE {
// NIC this IP4_SERVICE works on.
//
CHAR16 *MacString;
UINT32 MaxPacketSize;
UINT32 OldMaxPacketSize; ///< The MTU before IPsec enable.
};
#define IP4_INSTANCE_FROM_PROTOCOL(Ip4) \
@@ -335,4 +350,33 @@ Ip4SentPacketTicking (
IN NET_MAP_ITEM *Item,
IN VOID *Context
);
/**
The callback function for the net buffer which wraps the user's
transmit token. Although it seems this function is pretty simple,
there are some subtle things.
When user requests the IP to transmit a packet by passing it a
token, the token is wrapped in an IP4_TXTOKEN_WRAP and the data
is wrapped in an net buffer. the net buffer's Free function is
set to Ip4FreeTxToken. The Token and token wrap are added to the
IP child's TxToken map. Then the buffer is passed to Ip4Output for
transmission. If something error happened before that, the buffer
is freed, which in turn will free the token wrap. The wrap may
have been added to the TxToken map or not, and the user's event
shouldn't be fired because we are still in the EfiIp4Transmit. If
the buffer has been sent by Ip4Output, it should be removed from
the TxToken map and user's event signaled. The token wrap and buffer
are bound together. Check the comments in Ip4Output for information
about IP fragmentation.
@param[in] Context The token's wrap
**/
VOID
Ip4FreeTxToken (
IN VOID *Context
);
extern EFI_IPSEC_PROTOCOL *mIpSec;
#endif