Scrubbed more.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6454 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jgong5 2008-11-11 09:23:25 +00:00
parent a8d048d54d
commit 96e1079fa4
11 changed files with 170 additions and 169 deletions

View File

@ -66,9 +66,9 @@ typedef enum {
#define IP4_ALLSYSTEM_ADDRESS 0xE0000001u
#define IP4_ALLROUTER_ADDRESS 0xE0000002u
//
// Compose the fragment field to be used in the IP4 header.
//
///
/// Compose the fragment field to be used in the IP4 header.
///
#define IP4_HEAD_FRAGMENT_FIELD(Df, Mf, Offset) \
((UINT16)(((Df) ? 0x4000 : 0) | ((Mf) ? 0x2000 : 0) | (((Offset) >> 3) & 0x1fff)))
@ -80,10 +80,10 @@ typedef enum {
#define IP4_IS_BROADCAST(CastType) ((CastType) >= IP4_LOCAL_BROADCAST)
//
// Conver the Microsecond to second. IP transmit/receive time is
// in the unit of microsecond. IP ticks once per second.
//
///
/// Conver the Microsecond to second. IP transmit/receive time is
/// in the unit of microsecond. IP ticks once per second.
///
#define IP4_US_TO_SEC(Us) (((Us) + 999999) / 1000000)
INTN

View File

@ -64,12 +64,12 @@ VOID
IN VOID *Context
);
//
// Each receive request is wrapped in an IP4_LINK_RX_TOKEN.
// Upon completion, the Callback will be called. Only one
// receive request is send to MNP. IpInstance is always NULL.
// Reference MNP's spec for information.
//
///
/// Each receive request is wrapped in an IP4_LINK_RX_TOKEN.
/// Upon completion, the Callback will be called. Only one
/// receive request is send to MNP. IpInstance is always NULL.
/// Reference MNP's spec for information.
///
typedef struct {
UINT32 Signature;
IP4_INTERFACE *Interface;
@ -81,10 +81,10 @@ typedef struct {
EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken;
} IP4_LINK_RX_TOKEN;
//
// Each transmit request is wrapped in an IP4_LINK_TX_TOKEN.
// Upon completion, the Callback will be called.
//
///
/// Each transmit request is wrapped in an IP4_LINK_TX_TOKEN.
/// Upon completion, the Callback will be called.
///
typedef struct {
UINT32 Signature;
LIST_ENTRY Link;
@ -103,12 +103,12 @@ typedef struct {
EFI_MANAGED_NETWORK_TRANSMIT_DATA MnpTxData;
} IP4_LINK_TX_TOKEN;
//
// Only one ARP request is requested for all the frames in
// a time. It is started for the first frames to the Ip. Any
// subsequent transmission frame will be linked to Frames, and
// be sent all at once the ARP requests succeed.
//
///
/// Only one ARP request is requested for all the frames in
/// a time. It is started for the first frames to the Ip. Any
/// subsequent transmission frame will be linked to Frames, and
/// be sent all at once the ARP requests succeed.
///
typedef struct {
UINT32 Signature;
LIST_ENTRY Link;

View File

@ -31,12 +31,12 @@ typedef struct {
} IGMP_HEAD;
#pragma pack()
//
// The status of multicast group. It isn't necessary to maintain
// explicit state of host state diagram. A group with non-zero
// DelayTime is in "delaying member" state. otherwise, it is in
// "idle member" state.
//
///
/// The status of multicast group. It isn't necessary to maintain
/// explicit state of host state diagram. A group with non-zero
/// DelayTime is in "delaying member" state. otherwise, it is in
/// "idle member" state.
///
typedef struct {
LIST_ENTRY Link;
INTN RefCnt;
@ -46,11 +46,11 @@ typedef struct {
EFI_MAC_ADDRESS Mac;
} IGMP_GROUP;
//
// The IGMP status. Each IP4 service instance has a IGMP_SERVICE_DATA
// attached. The Igmpv1QuerySeen remember whether the server on this
// connected network is v1 or v2.
//
///
/// The IGMP status. Each IP4 service instance has a IGMP_SERVICE_DATA
/// attached. The Igmpv1QuerySeen remember whether the server on this
/// connected network is v1 or v2.
///
typedef struct {
INTN Igmpv1QuerySeen;
LIST_ENTRY Groups;

View File

@ -2435,7 +2435,7 @@ EfiIp4Poll (
/**
Decrease the life of the transmitted packets. If it is
decreased to zero, cancel the packet. This function is
called by Ip4packetTimerTicking which time out both the
called by Ip4PacketTimerTicking which time out both the
received-but-not-delivered and transmitted-but-not-recycle
packets.

View File

@ -76,15 +76,15 @@ typedef enum {
IP4_SERVICE_DESTORY
} IP4_IMPL_ENUM_TYPES;
//
// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.
// The user's data is kept in the Packet. When fragment is
// needed, each fragment of the Packet has a reference to the
// Packet, no data is actually copied. The Packet will be
// released when all the fragments of it have been recycled by
// MNP. Upon then, the IP4_TXTOKEN_WRAP will be released, and
// user's event signalled.
//
///
/// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.
/// The user's data is kept in the Packet. When fragment is
/// needed, each fragment of the Packet has a reference to the
/// Packet, no data is actually copied. The Packet will be
/// released when all the fragments of it have been recycled by
/// MNP. Upon then, the IP4_TXTOKEN_WRAP will be released, and
/// user's event signalled.
///
typedef struct {
IP4_PROTOCOL *IpInstance;
EFI_IP4_COMPLETION_TOKEN *Token;
@ -93,15 +93,15 @@ typedef struct {
INTN Life;
} IP4_TXTOKEN_WRAP;
//
// IP4_RXDATA_WRAP wraps the data IP4 child delivers to the
// upper layers. The received packet is kept in the Packet.
// The Packet itself may be constructured from some fragments.
// All the fragments of the Packet is organized by a
// IP4_ASSEMBLE_ENTRY structure. If the Packet is recycled by
// the upper layer, the assemble entry and its associated
// fragments will be freed at last.
//
///
/// IP4_RXDATA_WRAP wraps the data IP4 child delivers to the
/// upper layers. The received packet is kept in the Packet.
/// The Packet itself may be constructured from some fragments.
/// All the fragments of the Packet is organized by a
/// IP4_ASSEMBLE_ENTRY structure. If the Packet is recycled by
/// the upper layer, the assemble entry and its associated
/// fragments will be freed at last.
///
typedef struct {
LIST_ENTRY Link;
IP4_PROTOCOL *IpInstance;

View File

@ -24,7 +24,7 @@ Abstract:
/**
Create a empty assemble entry for the packet identified by
Create an empty assemble entry for the packet identified by
(Dst, Src, Id, Protocol). The default life for the packet is
120 seconds.
@ -72,7 +72,7 @@ Ip4CreateAssembleEntry (
/**
Release all the fragments of a packet, then free the assemble entry
Release all the fragments of a packet, then free the assemble entry.
@param Assemble The assemble entry to free
@ -110,7 +110,7 @@ Ip4FreeAssembleEntry (
**/
VOID
Ip4InitAssembleTable (
IN IP4_ASSEMBLE_TABLE *Table
IN OUT IP4_ASSEMBLE_TABLE *Table
)
{
UINT32 Index;
@ -164,7 +164,7 @@ Ip4CleanAssembleTable (
**/
VOID
Ip4TrimPacket (
IN NET_BUF *Packet,
IN OUT NET_BUF *Packet,
IN INTN Start,
IN INTN End
)
@ -220,17 +220,19 @@ Ip4OnFreeFragments (
return it to caller. If the packet can't be assembled, NULL is
return.
@param Table The assemble table used.
@param Packet The fragment to assemble
@param Table The assemble table used. New assemble entry will be created
if the Packet is from a new chain of fragments.
@param Packet The fragment to assemble. It might be freed if the fragment
can't be re-assembled.
@return NULL if the packet can't be reassemble. The point to just assembled
@return packet if all the fragments of the packet have arrived.
packet if all the fragments of the packet have arrived.
**/
NET_BUF *
Ip4Reassemble (
IN IP4_ASSEMBLE_TABLE *Table,
IN NET_BUF *Packet
IN OUT IP4_ASSEMBLE_TABLE *Table,
IN OUT NET_BUF *Packet
)
{
IP4_HEAD *IpHead;
@ -393,7 +395,7 @@ Ip4Reassemble (
//
// Deliver the whole packet if all the fragments received.
// All fragments received if:
// 1. received the last one, so, the totoal length is know
// 1. received the last one, so, the total length is know
// 2. received all the data. If the last fragment on the
// queue ends at the total length, all data is received.
//
@ -481,7 +483,7 @@ Ip4AccpetFrame (
}
//
// Check that the IP4 header is correctly formated
// Check that the IP4 header is correctly formatted
//
if (Packet->TotalSize < IP4_MIN_HEADLEN) {
goto RESTART;
@ -627,7 +629,8 @@ DROP:
@param Head The IP header of the packet
@param Packet The data of the packet
@return TRUE if the child wants to receive the packet, otherwise return FALSE.
@retval TRUE If the child wants to receive the packet.
@retval FALSE Otherwise.
**/
BOOLEAN
@ -648,7 +651,7 @@ Ip4InstanceFrameAcceptable (
//
// Dirty trick for the Tiano UEFI network stack implmentation. If
// ReceiveTimeout == -1, the receive of the packet for this instance
// is disabled. The UEFI spec don't have such captibility. We add
// is disabled. The UEFI spec don't have such capability. We add
// this to improve the performance because IP will make a copy of
// the received packet for each accepting instance. Some IP instances
// used by UDP/TCP only send packets, they don't wants to receive.
@ -1114,7 +1117,7 @@ Ip4InterfaceDeliverPacket (
to each IP4 child that accepts the packet. The second pass will
deliver a non-shared copy of the packet to each IP4 child that
has pending receive requests. Data is copied if more than one
child wants to consume the packet bacause each IP child need
child wants to consume the packet because each IP child needs
its own copy of the packet to make changes.
@param IpSb The IP4 service instance that received the packet

View File

@ -21,25 +21,25 @@ Abstract:
#ifndef __EFI_IP4_INPUT_H__
#define __EFI_IP4_INPUT_H__
enum {
typedef enum {
IP4_MIN_HEADLEN = 20,
IP4_MAX_HEADLEN = 60,
IP4_ASSEMLE_HASH_SIZE = 31,
IP4_FRAGMENT_LIFE = 120,
IP4_MAX_PACKET_SIZE = 65535
};
} IP4_INPUT_ENUM_TYPES;
//
// Per packet information for input process. LinkFlag specifies whether
// the packet is received as Link layer unicast, multicast or broadcast.
// The CastType is the IP layer cast type, such as IP multicast or unicast.
// Start, End and Length are staffs used to assemble the packets. Start
// is the sequence number of the first byte of data in the packet. Length
// is the number of bytes of data. End = Start + Length, that is, the
// sequence number of last byte + 1. Each assembled packet has a count down
// life. If it isn't consumed before Life reaches zero, the packet is released.
//
///
/// Per packet information for input process. LinkFlag specifies whether
/// the packet is received as Link layer unicast, multicast or broadcast.
/// The CastType is the IP layer cast type, such as IP multicast or unicast.
/// Start, End and Length are staffs used to assemble the packets. Start
/// is the sequence number of the first byte of data in the packet. Length
/// is the number of bytes of data. End = Start + Length, that is, the
/// sequence number of last byte + 1. Each assembled packet has a count down
/// life. If it isn't consumed before Life reaches zero, the packet is released.
///
typedef struct {
UINTN LinkFlag;
INTN CastType;
@ -50,9 +50,9 @@ typedef struct {
EFI_STATUS Status;
} IP4_CLIP_INFO;
//
// Structure used to assemble IP packets.
//
///
/// Structure used to assemble IP packets.
///
typedef struct {
LIST_ENTRY Link;
@ -74,11 +74,11 @@ typedef struct {
INTN Life; // Count down life for the packet.
} IP4_ASSEMBLE_ENTRY;
//
// Each Ip service instance has an assemble table to reassemble
// the packets before delivery to its children. It is organized
// as hash table.
//
///
/// Each Ip service instance has an assemble table to reassemble
/// the packets before delivery to its children. It is organized
/// as hash table.
///
typedef struct {
LIST_ENTRY Bucket[IP4_ASSEMLE_HASH_SIZE];
} IP4_ASSEMBLE_TABLE;

View File

@ -33,8 +33,8 @@ Abstract:
@param Rcvd The option is from the packet we received if TRUE,
otherwise the option we wants to transmit.
@return TRUE: The option is properly formated
@return FALSE: The option is mal-formated
@retval TRUE The option is properly formatted
@retval FALSE The option is mal-formated
**/
BOOLEAN
@ -74,7 +74,7 @@ Ip4OptionIsValid (
Point = Option[Cur + 2];
//
// SRR/RR options are formated as |Type|Len|Point|Ip1|Ip2|...
// SRR/RR options are formatted as |Type|Len|Point|Ip1|Ip2|...
//
if ((OptionLen - Cur < Len) || (Len < 3) || ((Len - 3) % 4 != 0)) {
IcmpPoint = Cur + 1;
@ -125,16 +125,16 @@ Ip4OptionIsValid (
handles the details such as:
1. whether copy the single IP4 option to the first/non-first
fragments.
2. Pad the options copied over to aligened to 4 bytes.
2. Pad the options copied over to aligned to 4 bytes.
@param Option The original option to copy from
@param OptionLen The length of the original option
@param FirstFragment Whether it is the first fragment
@param Buf The buffer to copy options to
@param Buf The buffer to copy options to. NULL
@param BufLen The length of the buffer
@retval EFI_SUCCESS The options are copied over
@retval EFI_BUFFER_TOO_SMALL The buffer caller provided is too small.
@retval EFI_BUFFER_TOO_SMALL Buf is NULL or BufLen provided is too small.
**/
EFI_STATUS
@ -142,7 +142,7 @@ Ip4CopyOption (
IN UINT8 *Option,
IN UINT32 OptionLen,
IN BOOLEAN FirstFragment,
IN UINT8 *Buf, OPTIONAL
IN OUT UINT8 *Buf, OPTIONAL
IN OUT UINT32 *BufLen
)
{

View File

@ -45,7 +45,7 @@ UINT16 mIp4Id;
**/
EFI_STATUS
Ip4PrependHead (
IN NET_BUF *Packet,
IN OUT NET_BUF *Packet,
IN IP4_HEAD *Head,
IN UINT8 *Option,
IN UINT32 OptLen
@ -106,7 +106,7 @@ Ip4PrependHead (
@param Src The source of the packet
@return NULL if no proper interface is found, otherwise the interface that
@return can be used to send the system packet from.
can be used to send the system packet from.
**/
IP4_INTERFACE *
@ -269,8 +269,8 @@ Ip4Output (
if (IP4_IS_BROADCAST (Ip4GetNetCast (Dest, IpIf)) || (Dest == IP4_ALLONE_ADDRESS)) {
//
// Set the gateway to local broadcast if the Dest is
// is the broadcast address for the connected network
// or it is local broadcast.
// the broadcast address for the connected network or
// it is local broadcast.
//
GateWay = IP4_ALLONE_ADDRESS;
@ -423,8 +423,8 @@ ON_ERROR:
**/
BOOLEAN
Ip4CancelPacketFragments (
IP4_LINK_TX_TOKEN *Frame,
VOID *Context
IN IP4_LINK_TX_TOKEN *Frame,
IN VOID *Context
)
{
if ((Frame->Packet == (NET_BUF *) Context) || (Frame->Context == Context)) {

View File

@ -31,7 +31,7 @@ Abstract:
@param GateWay The nexthop address
@return NULL if failed to allocate memeory, otherwise the newly created
@return route entry.
route entry.
**/
IP4_ROUTE_ENTRY *
@ -83,7 +83,7 @@ Ip4FreeRouteEntry (
/**
Allocate and initialize a IP4 route cache entry.
Allocate and initialize an IP4 route cache entry.
@param Dst The destination address
@param Src The source address
@ -92,7 +92,7 @@ Ip4FreeRouteEntry (
entries spawned from one route table entry.
@return NULL if failed to allocate memory for the cache, other point
@return to the created route cache entry.
to the created route cache entry.
**/
IP4_ROUTE_CACHE_ENTRY *
@ -154,7 +154,7 @@ Ip4FreeRouteCacheEntry (
**/
VOID
Ip4InitRouteCache (
IN IP4_ROUTE_CACHE *RtCache
IN OUT IP4_ROUTE_CACHE *RtCache
)
{
UINT32 Index;
@ -199,10 +199,8 @@ Ip4CleanRouteCache (
/**
Create an empty route table, includes its internal route cache
None
@return NULL if failed to allocate memory for the route table, otherwise
@return the point to newly created route table.
the point to newly created route table.
**/
IP4_ROUTE_TABLE *
@ -291,7 +289,7 @@ Ip4FreeRouteTable (
**/
VOID
Ip4PurgeRouteCache (
IN IP4_ROUTE_CACHE *RtCache,
IN OUT IP4_ROUTE_CACHE *RtCache,
IN UINTN Tag
)
{
@ -330,7 +328,7 @@ Ip4PurgeRouteCache (
**/
EFI_STATUS
Ip4AddRoute (
IN IP4_ROUTE_TABLE *RtTable,
IN OUT IP4_ROUTE_TABLE *RtTable,
IN IP4_ADDR Dest,
IN IP4_ADDR Netmask,
IN IP4_ADDR Gateway
@ -392,7 +390,7 @@ Ip4AddRoute (
**/
EFI_STATUS
Ip4DelRoute (
IN IP4_ROUTE_TABLE *RtTable,
IN OUT IP4_ROUTE_TABLE *RtTable,
IN IP4_ADDR Dest,
IN IP4_ADDR Netmask,
IN IP4_ADDR Gateway
@ -433,7 +431,7 @@ Ip4DelRoute (
@param Src The source address
@return NULL if no route entry to the (Dest, Src). Otherwise the point
@return to the correct route cache entry.
to the correct route cache entry.
**/
IP4_ROUTE_CACHE_ENTRY *
@ -464,8 +462,8 @@ Ip4FindRouteCache (
/**
Search the route table for a most specific match to the Dst. It searches
from the longest route area (mask length == 32) to the shortest route area (
default routes). In each route area, it will first search the instance's
from the longest route area (mask length == 32) to the shortest route area
(default routes). In each route area, it will first search the instance's
route table, then the default route table. This is required by the following
requirements:
1. IP search the route table for a most specific match
@ -510,7 +508,7 @@ Ip4FindRouteEntry (
/**
Search the route table to route the packet. Return/creat a route
Search the route table to route the packet. Return/create a route
cache if there is a route to the destination.
@param RtTable The route table to search from
@ -518,7 +516,7 @@ Ip4FindRouteEntry (
@param Src The source address to search for
@return NULL if failed to route packet, otherwise a route cache
@return entry that can be used to route packet.
entry that can be used to route packet.
**/
IP4_ROUTE_CACHE_ENTRY *
@ -562,9 +560,9 @@ Ip4Route (
//
// Found a route to the Dest, if it is a direct route, the packet
// will be send directly to the destination, such as for connected
// will be sent directly to the destination, such as for connected
// network. Otherwise, it is an indirect route, the packet will be
// send the next hop router.
// sent to the next hop router.
//
if ((RtEntry->Flag & IP4_DIRECT_ROUTE) != 0) {
NextHop = Dest;

View File

@ -35,13 +35,13 @@ typedef enum {
#define IP4_ROUTE_CACHE_HASH(Dst, Src) (((Dst) ^ (Src)) % IP4_ROUTE_CACHE_HASH)
//
// The route entry in the route table. Dest/Netmask is the destion
// network. The nexthop is the gateway to send the packet to in
// order to reach the Dest/Netmask. If the Flag has IP4_DIRECT_ROUTE
// on, the gateway is the destination of the IP packet itself. Route
// enties of the connected network have the flag on.
//
///
/// The route entry in the route table. Dest/Netmask is the destion
/// network. The nexthop is the gateway to send the packet to in
/// order to reach the Dest/Netmask. If the Flag has IP4_DIRECT_ROUTE
/// on, the gateway is the destination of the IP packet itself. Route
/// enties of the connected network have the flag on.
///
typedef struct {
LIST_ENTRY Link;
INTN RefCnt;
@ -51,16 +51,16 @@ typedef struct {
UINT32 Flag;
} IP4_ROUTE_ENTRY;
//
// The route cache entry. The route cache entry is optional.
// But it is necessary to support the ICMP redirect message.
// Check Ip4ProcessIcmpRedirect for information.
//
// The cache entry field Tag is used to tag all the route
// cache entry spawned from a route table entry. This makes
// it simple to delete all the route cache entries from a
// to-be-deleted route entry.
//
///
/// The route cache entry. The route cache entry is optional.
/// But it is necessary to support the ICMP redirect message.
/// Check Ip4ProcessIcmpRedirect for information.
///
/// The cache entry field Tag is used to tag all the route
/// cache entry spawned from a route table entry. This makes
/// it simple to delete all the route cache entries from a
/// to-be-deleted route entry.
///
typedef struct {
LIST_ENTRY Link;
INTN RefCnt;
@ -70,25 +70,25 @@ typedef struct {
UINTN Tag;
} IP4_ROUTE_CACHE_ENTRY;
//
// The route cache table is organized as a hash table. Each
// IP4 route table has a embedded route cache. For now the
// route cache and route table are binded togehter. But keep
// the route cache a seperated structure in case we want to
// detach them later.
//
///
/// The route cache table is organized as a hash table. Each
/// IP4 route table has a embedded route cache. For now the
/// route cache and route table are binded togehter. But keep
/// the route cache a seperated structure in case we want to
/// detach them later.
///
typedef struct {
LIST_ENTRY CacheBucket[IP4_ROUTE_CACHE_HASH];
} IP4_ROUTE_CACHE;
//
// Each IP4 instance has its own route table. Each ServiceBinding
// instance has a default route table and default address.
//
// All the route table entries with the same mask are linked
// together in one route area. For example, RouteArea[0] contains
// the default routes. A route table also contains a route cache.
//
///
/// Each IP4 instance has its own route table. Each ServiceBinding
/// instance has a default route table and default address.
///
/// All the route table entries with the same mask are linked
/// together in one route area. For example, RouteArea[0] contains
/// the default routes. A route table also contains a route cache.
///
typedef struct _IP4_ROUTE_TABLE IP4_ROUTE_TABLE;
struct _IP4_ROUTE_TABLE {