[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH 1/2] Revert previous commit



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@xxxxxxxxxx>
---
 src/xennet/driver.c          |  2 --
 src/xennet/receiver.c        | 53 ++++++++++++--------------------------------
 vs2012/xennet/xennet.vcxproj |  4 ++--
 vs2013/xennet/xennet.vcxproj |  4 ++--
 4 files changed, 18 insertions(+), 45 deletions(-)

diff --git a/src/xennet/driver.c b/src/xennet/driver.c
index e77ae6e..c6a4896 100644
--- a/src/xennet/driver.c
+++ b/src/xennet/driver.c
@@ -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");
 
diff --git a/src/xennet/receiver.c b/src/xennet/receiver.c
index 95285cd..dcd88af 100644
--- a/src/xennet/receiver.c
+++ b/src/xennet/receiver.c
@@ -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);
diff --git a/vs2012/xennet/xennet.vcxproj b/vs2012/xennet/xennet.vcxproj
index 0e2fc22..03ddf91 100644
--- a/vs2012/xennet/xennet.vcxproj
+++ b/vs2012/xennet/xennet.vcxproj
@@ -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>
diff --git a/vs2013/xennet/xennet.vcxproj b/vs2013/xennet/xennet.vcxproj
index 2eaf191..6cb09d2 100644
--- a/vs2013/xennet/xennet.vcxproj
+++ b/vs2013/xennet/xennet.vcxproj
@@ -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>
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.