repository: c:/kernel.org/kvm-guest-drivers-windows
branch: master
commit 10660d8c613b1615d0193a0e983985bcb9431149
Author: Vadim Rozenfeld <vroze...@redhat.com>
Date:   Fri Oct 1 13:13:45 2010 +0200

    [NetKVM] From: Yan Vugenfirer <yvuge...@redhat.com>  Revert
published indexes.

diff --git a/NetKVM/Common/ParaNdis-Common.c
b/NetKVM/Common/ParaNdis-Common.c
index a1c8a74..a775c84 100644
--- a/NetKVM/Common/ParaNdis-Common.c
+++ b/NetKVM/Common/ParaNdis-Common.c
@@ -110,7 +110,6 @@ typedef struct _tagConfigurationEntries
        tConfigurationEntry PriorityVlanTagging;
        tConfigurationEntry VlanId;
        tConfigurationEntry UseMergeableBuffers;
-       tConfigurationEntry PublishIndices;
        tConfigurationEntry MTU;
 }tConfigurationEntries;
 
@@ -149,7 +148,6 @@ static const tConfigurationEntries
defaultConfiguration =
        { "*PriorityVLANTag", 3, 0, 3},
        { "VlanId", 0, 0, 4095},
        { "MergeableBuf", 1, 0, 1},
-       { "PublishIndices", 1, 0, 1},
        { "MTU", 1500, 500, 65500},
 };
 
@@ -279,7 +277,6 @@ static void ReadNicConfiguration(PARANDIS_ADAPTER
*pContext, PUCHAR *ppNewMACAdd
                        GetConfigurationEntry(cfg,
&pConfiguration->PriorityVlanTagging);
                        GetConfigurationEntry(cfg,
&pConfiguration->VlanId);
                        GetConfigurationEntry(cfg,
&pConfiguration->UseMergeableBuffers);
-                       GetConfigurationEntry(cfg,
&pConfiguration->PublishIndices);
                        GetConfigurationEntry(cfg,
&pConfiguration->MTU);
 
        #if !defined(WPP_EVENT_TRACING)
@@ -321,7 +318,6 @@ static void ReadNicConfiguration(PARANDIS_ADAPTER
*pContext, PUCHAR *ppNewMACAdd
                        pContext->ulPriorityVlanSetting =
pConfiguration->PriorityVlanTagging.ulValue;
                        pContext->VlanId =
pConfiguration->VlanId.ulValue;
                        pContext->bUseMergedBuffers =
pConfiguration->UseMergeableBuffers.ulValue != 0;
-                       pContext->bDoPublishIndices =
pConfiguration->PublishIndices.ulValue != 0;
                        pContext->MaxPacketSize.nMaxDataSize =
pConfiguration->MTU.ulValue;
                        if (!pContext->bDoSupportPriority)
                                pContext->ulPriorityVlanSetting = 0;
@@ -436,8 +432,6 @@ static void DumpVirtIOFeatures(VirtIODevice *pIO)
                {VIRTIO_NET_F_HOST_UFO, "VIRTIO_NET_F_HOST_UFO"},
                {VIRTIO_NET_F_MRG_RXBUF, "VIRTIO_NET_F_MRG_RXBUF"},
                {VIRTIO_NET_F_STATUS, "VIRTIO_NET_F_STATUS"},
-               {VIRTIO_F_INDIRECT, "VIRTIO_F_INDIRECT"},
-               {VIRTIO_F_PUBLISH_INDICES, "VIRTIO_F_PUBLISH_INDICES"},
        };
        UINT i;
        for (i = 0; i < sizeof(Features)/sizeof(Features[0]); ++i)
@@ -478,7 +472,7 @@ static void PrintStatistics(PARANDIS_ADAPTER
*pContext)
                pContext->nofFreeHardwareBuffers,
pContext->minFreeHardwareBuffers));
        pContext->minFreeHardwareBuffers =
pContext->nofFreeHardwareBuffers;
        DPrintf(0, ("[Diag!] TX packets to return %d",
pContext->NetTxPacketsToReturn));
-       DPrintf(0, ("[Diag!] Bytes transmitted %I64u, received %I64u,
interrupts %d", pContext->Statistics.ifHCOutOctets,
pContext->Statistics.ifHCInOctets, pContext->ulIrqReceived));
+       DPrintf(0, ("[Diag!] Bytes transmitted %I64u, received %I64u",
pContext->Statistics.ifHCOutOctets, pContext->Statistics.ifHCInOctets));
 }
 
 
@@ -620,16 +614,6 @@ NDIS_STATUS ParaNdis_InitializeContext(
                                pContext->CurrentMacAddress[4],
                                pContext->CurrentMacAddress[5]));
                }
-               if (pContext->bDoPublishIndices)
-                       pContext->bDoPublishIndices =
VirtIODeviceGetHostFeature(&pContext->IODevice,
VIRTIO_F_PUBLISH_INDICES) != 0;
-               if (pContext->bDoPublishIndices &&
VirtIODeviceHasFeature(VIRTIO_F_PUBLISH_INDICES))
-               {
-
VirtIODeviceEnableGuestFeature(&pContext->IODevice,
VIRTIO_F_PUBLISH_INDICES);
-               }
-               else
-               {
-                       pContext->bDoPublishIndices = FALSE;
-               }
        }
        else
        {
@@ -1723,7 +1707,7 @@ static UINT
ParaNdis_ProcessRxPath(PARANDIS_ADAPTER *pContext)
        NdisReleaseSpinLock(&pContext->ReceiveLock);
        if (nReceived && pBatchOfPackets)
        {
-               DPrintf(1, ("[%s] received %d buffers", __FUNCTION__,
nReceived));
+               DPrintf(1, ("[%s]%d: received %d buffers", __FUNCTION__,
KeGetCurrentProcessorNumber(), nReceived));
                ParaNdis_IndicateReceivedBatch(pContext,
pBatchOfPackets, nReceived);
        }
        if (pBatchOfPackets) NdisFreeMemory(pBatchOfPackets, 0, 0);
@@ -1790,19 +1774,29 @@ ULONG ParaNdis_DPCWorkBody(PARANDIS_ADAPTER
*pContext)
                                int nRestartResult = 2, nLoop = 0;
                                while (nRestartResult)
                                {
-                                       UINT n =
ParaNdis_ProcessRxPath(pContext);
-
-
NdisAcquireSpinLock(&pContext->ReceiveLock);
-                                       nRestartResult =
ParaNdis_SynchronizeWithInterrupt(
-                                               pContext,
pContext->ulRxMessage, RestartQueueSynchronously, isReceive); 
-
NdisReleaseSpinLock(&pContext->ReceiveLock);
-                                       DPrintf(nRestartResult ? 2 : 6,
("[%s] queue restarted%s", __FUNCTION__, nRestartResult ? "(Rerun)" :
"(Done)"));
-                                       
-                                       ++nLoop;
-                                       if (nLoop > MAX_RX_LOOPS)
+                                       UINT n;
+                                       LONG rxActive =
InterlockedIncrement(&pContext->dpcReceiveActive);
+                                       if (rxActive == 1)
                                        {
-                                               DPrintf(0, ("[%s]
Breaking Rx loop on %d-th operation", __FUNCTION__, nLoop));
-                                               break;
+                                               n =
ParaNdis_ProcessRxPath(pContext);
+
InterlockedDecrement(&pContext->dpcReceiveActive);
+
NdisAcquireSpinLock(&pContext->ReceiveLock);
+                                               nRestartResult =
ParaNdis_SynchronizeWithInterrupt(
+                                                       pContext,
pContext->ulRxMessage, RestartQueueSynchronously, isReceive); 
+
NdisReleaseSpinLock(&pContext->ReceiveLock);
+                                               DPrintf(nRestartResult ?
2 : 6, ("[%s] queue restarted%s", __FUNCTION__, nRestartResult ?
"(Rerun)" : "(Done)"));
+                                               ++nLoop;
+                                               if (nLoop >
MAX_RX_LOOPS)
+                                               {
+                                                       DPrintf(0, ("[%
s] Breaking Rx loop on %d-th operation", __FUNCTION__, nLoop));
+                                                       break;
+                                               }
+                                       }
+                                       else
+                                       {
+
InterlockedDecrement(&pContext->dpcReceiveActive);
+                                               nRestartResult = 0;
+                                               DPrintf(1, ("[%s] Skip
Rx processing no.%d", __FUNCTION__, rxActive));
                                        }
                                }
                                if (nRestartResult)
stillRequiresProcessing |= isReceive;
@@ -2098,8 +2092,6 @@ VOID ParaNdis_PowerOn(PARANDIS_ADAPTER *pContext)
        Dummy = VirtIODeviceGetHostFeature(&pContext->IODevice,
VIRTIO_NET_F_MAC);
        if (pContext->bUseMergedBuffers)
                VirtIODeviceEnableGuestFeature(&pContext->IODevice,
VIRTIO_NET_F_MRG_RXBUF);
-       if (pContext->bDoPublishIndices)
-               VirtIODeviceEnableGuestFeature(&pContext->IODevice,
VIRTIO_F_PUBLISH_INDICES);
 
        VirtIODeviceRenewVirtualQueue(pContext->NetReceiveQueue);
        VirtIODeviceRenewVirtualQueue(pContext->NetSendQueue);
diff --git a/NetKVM/Common/ndis56common.h b/NetKVM/Common/ndis56common.h
index 7200538..3f53758 100644
--- a/NetKVM/Common/ndis56common.h
+++ b/NetKVM/Common/ndis56common.h
@@ -83,7 +83,6 @@
 #define VIRTIO_NET_F_MRG_RXBUF 15  /* Host can handle merged Rx buffers
and requires bigger header for that. */
 #define VIRTIO_NET_F_STATUS     16
 
-
 #define VIRTIO_NET_S_LINK_UP    1       /* Link is up */
 
 #define VIRTIO_NET_INVALID_INTERRUPT_STATUS            0xFF
@@ -266,15 +265,14 @@ typedef struct _tagPARANDIS_ADAPTER
        BOOLEAN                                 bDoIPCheck;
        BOOLEAN                                 bFixIPChecksum;
        BOOLEAN                                 bUseMergedBuffers;
-       BOOLEAN                                 bDoPublishIndices;
        BOOLEAN                                 bDoKickOnNoBuffer;
        BOOLEAN                                 bSurprizeRemoved;
        BOOLEAN                                 bUsingMSIX;
        NDIS_DEVICE_POWER_STATE powerState;
+       LONG                                    dpcReceiveActive;
        LONG                                    counterDPCInside;
        LONG                                    bDPCInactive;
        LONG                                    InterruptStatus;
-       ULONG                                   ulIrqReceived;
        ULONG                                   ulPriorityVlanSetting;
        ULONG                                   VlanId;
        ULONG                                   ulFormalLinkSpeed;
@@ -358,6 +356,7 @@ typedef struct _tagPARANDIS_ADAPTER
        NDIS_HANDLE                                     DmaHandle;
        NDIS_HANDLE                                     ConnectTimer;
        NDIS_HANDLE
InterruptRecoveryTimer;
+       ULONG                                           ulIrqReceived;
        NDIS_OFFLOAD
ReportedOffloadCapabilities;
        NDIS_OFFLOAD
ReportedOffloadConfiguration;
        BOOLEAN                                         bOffloadEnabled;
diff --git a/NetKVM/wlh/netkvm.inf b/NetKVM/wlh/netkvm.inf
index 058380e..8143375 100644
--- a/NetKVM/wlh/netkvm.inf
+++ b/NetKVM/wlh/netkvm.inf
@@ -229,12 +229,6 @@ HKR, Ndi\Params\MergeableBuf,              type,
0,                      "enum"
 HKR, Ndi\Params\MergeableBuf\enum,     "1",            0,
%Enable%
 HKR, Ndi\Params\MergeableBuf\enum,     "0",            0,
%Disable%
 
-HKR, Ndi\Params\PublishIndices,                ParamDesc,      0,
%PublishIndices%
-HKR, Ndi\Params\PublishIndices,                Default,        0,
"1"
-HKR, Ndi\Params\PublishIndices,                type,           0,
"enum"
-HKR, Ndi\Params\PublishIndices\enum,   "1",            0,
%Enable%
-HKR, Ndi\Params\PublishIndices\enum,   "0",            0,
%Disable%
-
 
 [kvmnet6.CopyFiles]
 netkvm.sys,,,2
@@ -314,5 +308,4 @@ PriorityOnly = "Priority"
 VLan = "VLan"
 Priority_Vlan = "All"
 MergeableBuf = "Use mergeable buffers"
-PublishIndices = "Publish Indices"
 MTU = "MTU size"
diff --git a/NetKVM/wxp/ParaNdis5-Driver.c
b/NetKVM/wxp/ParaNdis5-Driver.c
index 72f5672..160f579 100644
--- a/NetKVM/wxp/ParaNdis5-Driver.c
+++ b/NetKVM/wxp/ParaNdis5-Driver.c
@@ -351,7 +351,6 @@ static VOID ParaNdis5_MiniportISR(OUT PBOOLEAN
InterruptRecognized,
        *QueueMiniportHandleInterrupt = FALSE;
        b = ParaNdis_OnInterrupt(pContext, QueueMiniportHandleInterrupt,
isAny);
        *InterruptRecognized = b;
-       pContext->ulIrqReceived += b;
        DEBUG_EXIT_STATUS(7, (ULONG)b);
 }
 
diff --git a/NetKVM/wxp/netkvm.inf b/NetKVM/wxp/netkvm.inf
index 428882d..c7f1fca 100644
--- a/NetKVM/wxp/netkvm.inf
+++ b/NetKVM/wxp/netkvm.inf
@@ -201,11 +201,6 @@ HKR, Ndi\Params\MergeableBuf,              type,
0,                      "enum"
 HKR, Ndi\Params\MergeableBuf\enum,     "1",            0,
%Enable%
 HKR, Ndi\Params\MergeableBuf\enum,     "0",            0,
%Disable%
 
-HKR, Ndi\Params\PublishIndices,                ParamDesc,      0,
%PublishIndices%
-HKR, Ndi\Params\PublishIndices,                Default,        0,
"1"
-HKR, Ndi\Params\PublishIndices,                type,           0,
"enum"
-HKR, Ndi\Params\PublishIndices\enum,   "1",            0,
%Enable%
-HKR, Ndi\Params\PublishIndices\enum,   "0",            0,
%Disable%
 
 [kvmnet5.CopyFiles]
 netkvm.sys,,,2
@@ -280,5 +275,4 @@ PriorityOnly = "Priority"
 VLan = "VLan"
 Priority_Vlan = "All"
 MergeableBuf = "Use mergeable buffers"
-PublishIndices = "Publish Indices"
 MTU = "MTU size"

--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to