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

Re: [XENVIF PATCH] Remove KeGetProcessorNumberFromIndex version check



Reviewed-by: Owen Smith <owen.smith@xxxxxxxxx>

On Wed, Sep 3, 2025 at 8:20 AM Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx> wrote:
We have targeted Windows 10 and up for quite some time, so these checks
are no longer necessary.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xenvif/receiver.c    | 21 +++++++--------------
 src/xenvif/transmitter.c | 19 ++++++-------------
 2 files changed, 13 insertions(+), 27 deletions(-)

diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c
index 56586f0..a194e5d 100644
--- a/src/xenvif/receiver.c
+++ b/src/xenvif/receiver.c
@@ -2364,20 +2364,13 @@ ReceiverRingWatchdog(

     Trace("====>\n");

-    if (RtlIsNtDdiVersionAvailable(NTDDI_WIN7) ) {
-        //
-        // Affinitize this thread to the same CPU as the event channel
-        // and DPC.
-        //
-        // The following functions don't work before Windows 7
-        //
-        status = KeGetProcessorNumberFromIndex(Ring->Index, &ProcNumber);
-        ASSERT(NT_SUCCESS(status));
-
-        Affinity.Group = ProcNumber.Group;
-        Affinity.Mask = (KAFFINITY)1 << ProcNumber.Number;
-        KeSetSystemGroupAffinityThread(&Affinity, NULL);
-    }
+    // Affinitize this thread to the same CPU as the event channel and DPC.
+    status = KeGetProcessorNumberFromIndex(Ring->Index, &ProcNumber);
+    ASSERT(NT_SUCCESS(status));
+
+    Affinity.Group = ProcNumber.Group;
+    Affinity.Mask = (KAFFINITY)1 << ProcNumber.Number;
+    KeSetSystemGroupAffinityThread(&Affinity, NULL);

     Timeout.QuadPart = TIME_RELATIVE(TIME_S(XENVIF_RECEIVER_WATCHDOG_PERIOD));

diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c
index 773ebb6..0578f4d 100644
--- a/src/xenvif/transmitter.c
+++ b/src/xenvif/transmitter.c
@@ -3333,20 +3333,13 @@ TransmitterRingWatchdog(

     Trace("====>\n");

-    if (RtlIsNtDdiVersionAvailable(NTDDI_WIN7) ) {
-        //
-        // Affinitize this thread to the same CPU as the event channel
-        // and DPC.
-        //
-        // The following functions don't work before Windows 7
-        //
-        status = KeGetProcessorNumberFromIndex(Ring->Index, &ProcNumber);
-        ASSERT(NT_SUCCESS(status));
+    // Affinitize this thread to the same CPU as the event channel and DPC.
+    status = KeGetProcessorNumberFromIndex(Ring->Index, &ProcNumber);
+    ASSERT(NT_SUCCESS(status));

-        Affinity.Group = ProcNumber.Group;
-        Affinity.Mask = (KAFFINITY)1 << ProcNumber.Number;
-        KeSetSystemGroupAffinityThread(&Affinity, NULL);
-    }
+    Affinity.Group = ProcNumber.Group;
+    Affinity.Mask = (KAFFINITY)1 << ProcNumber.Number;
+    KeSetSystemGroupAffinityThread(&Affinity, NULL);

     Timeout.QuadPart = TIME_RELATIVE(TIME_S(XENVIF_TRANSMITTER_WATCHDOG_PERIOD));
     PacketsQueued = 0;
--
2.51.0.windows.1



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech


 


Rackspace

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