From: John on
I have been playing with NDISTest 6.5 in WLK 1.0.c. My driver keeps
failing the offloadlso test, NOT because of broken packets. The
problem is that when the driver receives OID_TCP_OFFLOAD_PARAMETERS
and then indicates NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG with the
updated NDIS_OFFLOAD structure, the upper protocol drivers do NOT see
the indication. Any idea why? Other indications from the driver show
up in the protocol driver. Does NDIS perform sanity checks on
NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG from the miniport and reject
it? How would I find out the reason?

Here's more details. The offloadlso test first installs its own test
protocol driver and binds it to the test miniport. Then, it enables
LsoV2.IPv6 capability through OID_TCP_OFFLOAD_PARAMETERS. When IPv6
LSO test completes, offloadlso then disables LsoV6.IPv6, again,
through OID_TCP_OFFLOAD_PARAMETERS. After the OID completes,
offloadlso reads the latest NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG
that the test protocol driver has received. And then it checks if the
latest status also shows that LsoV2.IPv6 is really disabled. The
miniport indicates that status with the latest NDIS_OFFLOAD just
before returning from the OID handler. So, according to the WDK
manual, all the protocol drivers should receive that status. However,
the protocol drivers do not receive that status indication. I checked
this by installing the instrumented ndisprot driver that comes with
WDK. Because the protocol drivers never see the new status
indications, offloadlso thinks the miniport is not indicating the new
status and fails the test.

The following is how the miniport indicates the status. Is there
anything wrong?

NDIS_STATUS_INDICATION si;
NDIS_OFFLOAD off;

NdisZeroMemory(&si, sizeof(si));
si.Header.Type = NDIS_OBJECT_TYPE_STATUS_INDICATION;
si.Header.Revision = NDIS_STATUS_INDICATION_REVISION_1;
si.Header.Size = sizeof(si);
si.SourceHandle = mgp->MAH;
si.PortNumber = 0;
si.StatusCode = NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG;
si.StatusBuffer = (PVOID)&off;
si.StatusBufferSize = sizeof(off);
si.Flags = 0;
si.DestinationHandle = NULL;
si.RequestId = NULL;

NdisZeroMemory(&off, sizeof(off));
off.Header.Type = NDIS_OBJECT_TYPE_OFFLOAD;
off.Header.Revision = NDIS_OFFLOAD_REVISION_1;
off.Header.Size = sizeof(off);

off.Checksum.IPv4Transmit.Encapsulation =
NDIS_ENCAPSULATION_IEEE_802_3;
off.Checksum.IPv4Transmit.IpOptionsSupported = NDIS_OFFLOAD_SET_ON;
off.Checksum.IPv4Transmit.TcpOptionsSupported = NDIS_OFFLOAD_SET_ON;
[...]

NdisMIndicateStatusEx([...], &si);