1. Add DPC protocol and DpcLib library in MdeModulePkg.
2. Add DpcDxe module and DxeDpcLib module in MdeModulePkg 3. Port network stack module to use DPC. 4. Use MIN, and MAX defined in MdePkg to replace NET_MIN and NET_MAX. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4307 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -395,7 +395,7 @@ MnpInitializeServiceData (
|
||||
//
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL | EVT_TIMER,
|
||||
NET_TPL_EVENT,
|
||||
NET_TPL_TIMER,
|
||||
MnpCheckPacketTimeout,
|
||||
MnpServiceData,
|
||||
&MnpServiceData->TimeoutCheckTimer
|
||||
@@ -411,7 +411,7 @@ MnpInitializeServiceData (
|
||||
//
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_TIMER,
|
||||
NET_TPL_SLOW_TIMER,
|
||||
NET_TPL_TIMER,
|
||||
NULL,
|
||||
NULL,
|
||||
&MnpServiceData->TxTimeoutEvent
|
||||
@@ -635,17 +635,17 @@ MnpCancelTokens (
|
||||
|
||||
TokenToCancel = (EFI_MANAGED_NETWORK_COMPLETION_TOKEN *) Item->Key;
|
||||
|
||||
//
|
||||
// Remove the item from the map.
|
||||
//
|
||||
NetMapRemoveItem (Map, Item, NULL);
|
||||
|
||||
//
|
||||
// Cancel this token with status set to EFI_ABORTED.
|
||||
//
|
||||
TokenToCancel->Status = EFI_ABORTED;
|
||||
gBS->SignalEvent (TokenToCancel->Event);
|
||||
|
||||
//
|
||||
// Remove the item from the map.
|
||||
//
|
||||
NetMapRemoveItem (Map, Item, NULL);
|
||||
|
||||
if (Arg != NULL) {
|
||||
//
|
||||
// Only abort the token specified by Arg if Arg isn't NULL.
|
||||
@@ -1027,7 +1027,7 @@ MnpConfigureInstance (
|
||||
|
||||
if (ConfigData == NULL) {
|
||||
|
||||
NetMapIterate (&Instance->RxTokenMap, MnpCancelTokens, NULL);
|
||||
Instance->ManagedNetwork.Cancel (&Instance->ManagedNetwork, NULL);
|
||||
}
|
||||
|
||||
if (!NewConfigData->EnableMulticastReceive) {
|
||||
|
@@ -26,7 +26,7 @@ Abstract:
|
||||
|
||||
#define NET_ETHER_FCS_SIZE 4
|
||||
|
||||
#define MNP_SYS_POLL_INTERVAL (2 * TICKS_PER_MS) // 2 milliseconds
|
||||
#define MNP_SYS_POLL_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
|
||||
#define MNP_TIMEOUT_CHECK_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
|
||||
#define MNP_TX_TIMEOUT_TIME (500 * TICKS_PER_MS) // 500 milliseconds
|
||||
#define MNP_INIT_NET_BUFFER_NUM 512
|
||||
|
@@ -294,6 +294,11 @@ SIGNAL_TOKEN:
|
||||
Token->Status = Status;
|
||||
gBS->SignalEvent (Token->Event);
|
||||
|
||||
//
|
||||
// Dispatch the DPC queued by the NotifyFunction of Token->Event.
|
||||
//
|
||||
NetLibDispatchDpc ();
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -562,12 +567,6 @@ MnpMatchPacket (
|
||||
|
||||
ConfigData = &Instance->ConfigData;
|
||||
|
||||
if (ConfigData->EnablePromiscuousReceive) {
|
||||
//
|
||||
// Always match if this instance is configured to be promiscuous.
|
||||
//
|
||||
return TRUE;
|
||||
}
|
||||
//
|
||||
// Check the protocol type.
|
||||
//
|
||||
@@ -575,6 +574,13 @@ MnpMatchPacket (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ConfigData->EnablePromiscuousReceive) {
|
||||
//
|
||||
// Always match if this instance is configured to be promiscuous.
|
||||
//
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// The protocol type is matched, check receive filter, include unicast and broadcast.
|
||||
//
|
||||
@@ -987,6 +993,11 @@ MnpReceivePacket (
|
||||
//
|
||||
MnpDeliverPacket (MnpServiceData);
|
||||
|
||||
//
|
||||
// Dispatch the DPC queued by the NotifyFunction of rx token's events.
|
||||
//
|
||||
NetLibDispatchDpc ();
|
||||
|
||||
EXIT:
|
||||
|
||||
ASSERT (Nbuf->TotalSize == MnpServiceData->BufferLength);
|
||||
@@ -1087,4 +1098,6 @@ MnpSystemPoll (
|
||||
// Try to receive packets from Snp.
|
||||
//
|
||||
MnpReceivePacket (MnpServiceData);
|
||||
|
||||
NetLibDispatchDpc ();
|
||||
}
|
||||
|
@@ -531,6 +531,11 @@ MnpReceive (
|
||||
// Try to deliver any buffered packets.
|
||||
//
|
||||
Status = MnpInstanceDeliverPacket (Instance);
|
||||
|
||||
//
|
||||
// Dispatch the DPC queued by the NotifyFunction of Token->Event.
|
||||
//
|
||||
NetLibDispatchDpc ();
|
||||
}
|
||||
|
||||
ON_EXIT:
|
||||
@@ -596,6 +601,11 @@ MnpCancel (
|
||||
Status = (Status == EFI_ABORTED) ? EFI_SUCCESS : EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// Dispatch the DPC queued by the NotifyFunction of the cancled token's events.
|
||||
//
|
||||
NetLibDispatchDpc ();
|
||||
|
||||
ON_EXIT:
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
|
||||
@@ -648,8 +658,11 @@ MnpPoll (
|
||||
//
|
||||
Status = MnpReceivePacket (Instance->MnpServiceData);
|
||||
|
||||
NetLibDispatchDpc ();
|
||||
|
||||
ON_EXIT:
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user