processor load balancing under NDIS

Does anyone have any tips on forcing part of a network driver to execute
on a particular processor, or to ask for the TCP/IP stack thread that
handles a particular stream be allocated on a particular processor? I
know there are Kernel calls to request a DPC to run on a particular
processor, but I don’t know how to call these from within an NDIS
driver.

The issue I’m trying to resolve is not load-balancing per se, but
currently under high-load situations XP seems to be offloading
processing to other processors (which is a good thing), but it doesn’t
do it consistently. I’ve been asked to make my driver more determinate

  • either always offload or never offload. I presume Windows is starting
    new TCP/IP threads on other processors because processor 0 is highly
    loaded. Can anyone validate that?

The Windows help seems to imply that using polling as opposed to
interrupt handling in a high-load situation is a good idea. Does anyone
feel that this might affect the processor-load / balancing at all? I
guess it would be a very small polling interval for Gigabit Ethernet,
based on the buffering I have available.

“Robinson, John (John)” wrote in message news:xxxxx@ntdev…
Does anyone have any tips on forcing part of a network driver to execute on a particular processor, or to ask for the TCP/IP stack thread that handles a particular stream be allocated on a particular processor? I know there are Kernel calls to request a DPC to run on a particular processor, but I don’t know how to call these from within an NDIS driver.

The issue I’m trying to resolve is not load-balancing per se, but currently under high-load situations XP seems to be offloading processing to other processors (which is a good thing), but it doesn’t do it consistently. I’ve been asked to make my driver more determinate - either always offload or never offload. I presume Windows is starting new TCP/IP threads on other processors because processor 0 is highly loaded. Can anyone validate that?

The Windows help seems to imply that using polling as opposed to interrupt handling in a high-load situation is a good idea. Does anyone feel that this might affect the processor-load / balancing at all? I guess it would be a very small polling interval for Gigabit Ethernet, based on the buffering I have available.

There may be some information that will give insight into this issue on the Microsoft WHDC site. Search WHDC for “chimney”. This topic describes some of the problems you are seeing as well as Microsoft’s solution for later versions of Windows and Vista.

Good luck,

Thomas F. Divine, Windows DDK MVP

http://www.pcausa.com

John,

I don’t think there is a particularly straight forward way to do this and
remain within the boundaries of a signable NDIS Miniport. This is a
particularly sore point on NDIS5 and earlier. NDIS6 is supposed to help
this very problem quite specifically (that was in part all of the hullabaloo
over Chimney in Longhorn).

AFAIK TCPIP.SYS does not proactively start threads on other processors when
it thinks it is overloaded. Maybe that has changed in recent versions but
last I observed it was more or less just taking what it got by way of
scheduling with executive work items and system threads. Your preception
that the system is doing something entirely clever may be just that it is
doing something in reaction to the scheduling load and you are deriving the
clever part through observation and hope.

I don’t think the help file advice has the network throughput in mind when
it suggests you poll if polling means sitting at passive level and
continuously asking the NIC if it has work to do. It is suggesting you not
cause an interrupt storm when you could ‘check’ in your DPC-For-ISR
MiniportHandleInterrupt(). The Miniport architecture already *encourages*
this sort of behavior by *discouraging* doing anything in MiniportISR()
other than passivating additional interrupts and asking that
MiniportHandleInterrupt() be called. I think it would be typical that a
MiniportHandleInterrupt() would run round in circles until all interrupts
that could be ‘handled’ were handled. Your hardware may make this more or
less convenient. Hopefully, you can just keep asking the NIC if it has
another ‘interrupt’ task to perform without actually having to re-enable
interrupts and wait for one.

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Robinson, John (John)
Sent: Wednesday, December 07, 2005 10:38 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] processor load balancing under NDIS

Does anyone have any tips on forcing part of a network driver to execute on
a particular processor, or to ask for the TCP/IP stack thread that handles a
particular stream be allocated on a particular processor? I know there are
Kernel calls to request a DPC to run on a particular processor, but I don?t
know how to call these from within an NDIS driver.

The issue I?m trying to resolve is not load-balancing per se, but currently
under high-load situations XP seems to be offloading processing to other
processors (which is a good thing), but it doesn?t do it consistently. I?ve
been asked to make my driver more determinate ? either always offload or
never offload. I presume Windows is starting new TCP/IP threads on other
processors because processor 0 is highly loaded. Can anyone validate that?

The Windows help seems to imply that using polling as opposed to interrupt
handling in a high-load situation is a good idea. Does anyone feel that
this might affect the processor-load / balancing at all? I guess it would
be a very small polling interval for Gigabit Ethernet, based on the
buffering I have available.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

>Does anyone have any tips on forcing part of a network driver to execute

on a particular processor, or to ask for the TCP/IP stack thread that
handles a particular stream be allocated on a particular processor?

I don’t think TCPIP has any worker threads. Receive processing is done in the
context of ndisMDpc -> MiniportHandleInterrupt ->
disMIndicateReceivePacket -> IP stuff -> TCP stuff -> ClientEventReceive in
the TDI client.

know there are Kernel calls to request a DPC to run on a particular
processor, but I don’t know how to call these from within an NDIS
driver.

Am I wrong that NDIS allows the miniport driver writer to set the ISR affinity
for a card?

The Windows help seems to imply that using polling as opposed to
interrupt handling in a high-load situation is a good idea.

Yes. This allows to run the receive processing code when you have already many
packets received and copied to the host RAM (not once per packet as in
interrupt case).

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com