]> xenbits.xensource.com Git - pvdrivers/win/xennet.git/commitdiff
Revert previous commit
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 24 Mar 2015 13:14:19 +0000 (13:14 +0000)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 24 Mar 2015 13:37:22 +0000 (13:37 +0000)
This patch reverts the previous commit which attempted to make XENNET
aware of multiple processor groups. The changes don't seem to work on NDIS
drivers and lead to corruption of the receiver GetLists.

A different approach is needed.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/xennet/driver.c
src/xennet/receiver.c
vs2012/xennet/xennet.vcxproj
vs2013/xennet/xennet.vcxproj

index e77ae6e6dd00c08cc1d6e8e9dabbfb87c60d9844..c6a4896db2c37a243587076fe52b1d29c20333fd 100644 (file)
@@ -32,7 +32,6 @@
 #define INITGUID 1
 
 #include <ndis.h>
-#include <procgrp.h>
 #include "adapter.h"
 #include <version.h>
 #include "dbg_print.h"
@@ -412,7 +411,6 @@ DriverEntry (
     ULONG FailDeviceControl;
 
     ExInitializeDriverRuntime(DrvRtPoolNxOptIn);
-    WdmlibProcgrpInitialize();
 
     Trace("====>\n");
 
index 95285cdbae5cd6d9e76629901a67edb4f5c5d586..dcd88af7d8375602cdac96ca89fa206e0ac563b6 100644 (file)
@@ -29,8 +29,6 @@
  * SUCH DAMAGE.
  */
 
-#include <ndis.h>
-#include <procgrp.h>
 #include "receiver.h"
 #include "adapter.h"
 #include <util.h>
@@ -41,8 +39,7 @@ struct _XENNET_RECEIVER {
     PXENNET_ADAPTER             Adapter;
     NDIS_HANDLE                 NetBufferListPool;
     PNET_BUFFER_LIST            PutList;
-    PNET_BUFFER_LIST            *GetList;
-    ULONG                       GetListCount;
+    PNET_BUFFER_LIST            GetList[MAXIMUM_PROCESSORS];
     LONG                        InNDIS;
     LONG                        InNDISMax;
     XENVIF_VIF_OFFLOAD_OPTIONS  OffloadOptions;
@@ -59,23 +56,22 @@ __ReceiverAllocateNetBufferList(
     IN  ULONG               Length
     )
 {
-    ULONG                   Index;
+    ULONG                   Cpu;
     PNET_BUFFER_LIST        NetBufferList;
 
-    Index = KeGetCurrentProcessorNumberEx(NULL);
-    ASSERT3U(Index, <, Receiver->GetListCount);
+    Cpu = KeGetCurrentProcessorNumber();
 
-    NetBufferList = Receiver->GetList[Index];
+    NetBufferList = Receiver->GetList[Cpu];
 
-    if (NetBufferList == NULL) {
-        Receiver->GetList[Index] = InterlockedExchangePointer(&Receiver->PutList, NULL);
-        NetBufferList = Receiver->GetList[Index];
-    }
+    if (NetBufferList == NULL)
+        Receiver->GetList[Cpu] = InterlockedExchangePointer(&Receiver->PutList, NULL);
+
+    NetBufferList = Receiver->GetList[Cpu];
 
     if (NetBufferList != NULL) {
         PNET_BUFFER NetBuffer;
 
-        Receiver->GetList[Index] = NET_BUFFER_LIST_NEXT_NBL(NetBufferList);
+        Receiver->GetList[Cpu] = NET_BUFFER_LIST_NEXT_NBL(NetBufferList);
         NET_BUFFER_LIST_NEXT_NBL(NetBufferList) = NULL;
 
         NetBuffer = NET_BUFFER_LIST_FIRST_NB(NetBufferList);
@@ -289,16 +285,6 @@ ReceiverInitialize(
     RtlZeroMemory(*Receiver, sizeof(XENNET_RECEIVER));
     (*Receiver)->Adapter = Adapter;
 
-    (*Receiver)->GetListCount = KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS);
-    (*Receiver)->GetList = ExAllocatePoolWithTag(NonPagedPool,
-                                                 sizeof(PNET_BUFFER_LIST) *
-                                                 (*Receiver)->GetListCount,
-                                                 RECEIVER_POOL_TAG);
-
-    status = NDIS_STATUS_RESOURCES;
-    if ((*Receiver)->GetList == NULL)
-        goto fail2;
-
     RtlZeroMemory(&Params, sizeof(NET_BUFFER_LIST_POOL_PARAMETERS));
     Params.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
     Params.Header.Revision = NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1;
@@ -313,18 +299,11 @@ ReceiverInitialize(
 
     status = NDIS_STATUS_RESOURCES;
     if ((*Receiver)->NetBufferListPool == NULL)
-        goto fail3;
+        goto fail2;
 
     return NDIS_STATUS_SUCCESS;
 
-fail3:
-    ExFreePoolWithTag((*Receiver)->GetList, RECEIVER_POOL_TAG);
-    (*Receiver)->GetListCount = 0;
-
 fail2:
-    ExFreePoolWithTag(*Receiver, RECEIVER_POOL_TAG);
-    *Receiver = NULL;
-
 fail1:
     return status;
 }
@@ -334,14 +313,13 @@ ReceiverTeardown(
     IN  PXENNET_RECEIVER    Receiver
     )
 {
-    ULONG                   Index;
-    PNET_BUFFER_LIST        NetBufferList;
+    ULONG               Cpu;
+    PNET_BUFFER_LIST    NetBufferList;
 
     ASSERT(Receiver != NULL);
 
-    for (Index = 0; Index < Receiver->GetListCount; Index++) {
-        NetBufferList = Receiver->GetList[Index];
-
+    for (Cpu = 0; Cpu < MAXIMUM_PROCESSORS; Cpu++) {
+        NetBufferList = Receiver->GetList[Cpu];
         while (NetBufferList != NULL) {
             PNET_BUFFER_LIST    Next;
 
@@ -369,9 +347,6 @@ ReceiverTeardown(
     NdisFreeNetBufferListPool(Receiver->NetBufferListPool);
     Receiver->NetBufferListPool = NULL;
 
-    ExFreePoolWithTag(Receiver->GetList, RECEIVER_POOL_TAG);
-    Receiver->GetListCount = 0;
-
     Receiver->Adapter = NULL;
 
     ExFreePoolWithTag(Receiver, RECEIVER_POOL_TAG);
index 0e2fc22d450e44fdaa15986d4fae9c632f537359..03ddf91d6ed5baf4e6485d6eaa398086d164193a 100644 (file)
@@ -42,7 +42,7 @@
             <Inputs>..\..\src\xennet.inf;..\..\include\version.hx</Inputs>
         </CustomBuildStep>
                <ClCompile>
-                       <PreprocessorDefinitions>__MODULE__="XENNET";NDIS_MINIPORT_DRIVER;NDIS60_MINIPORT=1;POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+                       <PreprocessorDefinitions>__MODULE__="XENNET";NDIS_MINIPORT_DRIVER;NDIS60_MINIPORT=1;POOL_NX_OPTIN=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
                        <WarningLevel>EnableAllWarnings</WarningLevel>
                        <DisableSpecificWarnings>4711;4548;4820;4668;4255;6001;6054;28196;%(DisableSpecificWarnings)</DisableSpecificWarnings>
                        <MultiProcessorCompilation>true</MultiProcessorCompilation>
@@ -50,7 +50,7 @@
                </ClCompile>
                <Link>
                        <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
-                       <AdditionalDependencies>$(DDK_LIB_PATH)\ndis.lib;$(DDK_LIB_PATH)\procgrp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+                       <AdditionalDependencies>$(DDK_LIB_PATH)\ndis.lib;%(AdditionalDependencies)</AdditionalDependencies>
                        <EnableCOMDATFolding>false</EnableCOMDATFolding>
                </Link>
                <Inf>
index 2eaf191a8219800cfc93c1023a8952e869ee3295..6cb09d24738fa97567cbac69e47ab13189e41228 100644 (file)
@@ -74,7 +74,7 @@
       <Inputs>..\..\src\xennet.inf;..\..\include\version.hx</Inputs>
     </CustomBuildStep>
     <ClCompile>
-      <PreprocessorDefinitions>__MODULE__="XENNET";NDIS_MINIPORT_DRIVER;NDIS60_MINIPORT=1;POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>__MODULE__="XENNET";NDIS_MINIPORT_DRIVER;NDIS60_MINIPORT=1;POOL_NX_OPTIN=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <WarningLevel>EnableAllWarnings</WarningLevel>
       <DisableSpecificWarnings>4711;4548;4820;4668;4255;6001;6054;28196;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
@@ -82,7 +82,7 @@
     </ClCompile>
     <Link>
       <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
-      <AdditionalDependencies>$(DDK_LIB_PATH)\ndis.lib;$(DDK_LIB_PATH)\procgrp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(DDK_LIB_PATH)\ndis.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <EnableCOMDATFolding>false</EnableCOMDATFolding>
     </Link>
     <Inf>