Hello,
I am developing NDIS IM driver on windows XP. I need to add one byte of data in IM (passthru) driver. So i tried to modify the MTU using OID_GEN_MAXIMUM_FRAME_SIZE and OID_GEN_MAXIMUM_TOTAL_SIZE in ‘MPQueryInformation’ function but the MTU does not change and i am getting “PSCHED: Requery FRAME_SIZE” error. Could anyone please tell what this means and how to resolve it.
Following is the code i wrote to modify the MTU.
NDIS_STATUS
MPQueryInformation(
IN NDIS_HANDLE MiniportAdapterContext,
IN NDIS_OID Oid,
IN PVOID InformationBuffer,
IN ULONG InformationBufferLength,
OUT PULONG BytesWritten,
OUT PULONG BytesNeeded
)
{
PADAPT pAdapt = (PADAPT)MiniportAdapterContext;
NDIS_STATUS Status = NDIS_STATUS_FAILURE;
ULONG ulInfo = 0;
PVOID pInfo = (PVOID) &ulInfo;
ULONG ulInfoLen = sizeof(ulInfo);
ULONG ulBytesAvailable = ulInfoLen;
BOOLEAN bForwardRequest = TRUE;
switch(Oid)
{
case OID_GEN_SUPPORTED_LIST:
pInfo = (PVOID) AFDXSupportedOids;
ulBytesAvailable = ulInfoLen = sizeof(AFDXSupportedOids);
break;
case OID_PNP_QUERY_POWER:
//
// Do not forward this.
//
Status = NDIS_STATUS_SUCCESS;
break;
case OID_GEN_SUPPORTED_GUIDS:
//
// Do not forward this, otherwise we will end up with multiple
// instances of private GUIDs that the underlying miniport
// supports.
//
Status = NDIS_STATUS_NOT_SUPPORTED;
break;
case OID_GEN_MAXIMUM_FRAME_SIZE:
ulInfo = ETH_MAX_PACKET_SIZE - ETH_HEADER_SIZE - 1; //-1 for AFDX seq no.
bForwardRequest = FALSE;
break;
case OID_GEN_MAXIMUM_TOTAL_SIZE:
ulInfo = ETH_MAX_PACKET_SIZE - 1; //-1 for AFDX seq no.
bForwardRequest = FALSE;
break;
default:
break;
}
if (bForwardRequest == FALSE)
{
if (Status == NDIS_STATUS_SUCCESS)
{
if (ulInfoLen <= InformationBufferLength)
{
// Copy result into InformationBuffer
*BytesWritten = ulInfoLen;
if(ulInfoLen)
{
NdisMoveMemory(InformationBuffer, pInfo, ulInfoLen);
}
}
else
{
// too short
*BytesNeeded = ulInfoLen;
Status = NDIS_STATUS_BUFFER_TOO_SHORT;
}
}
}
else
{
//
// If the miniport below is unbinding, just fail any request
//
NdisAcquireSpinLock(&pAdapt->Lock);
if (pAdapt->UnbindingInProcess == TRUE)
{
NdisReleaseSpinLock(&pAdapt->Lock);
Status = NDIS_STATUS_FAILURE;
}
NdisReleaseSpinLock(&pAdapt->Lock);
//
// All other queries are failed, if the miniport is not at D0,
//
if (pAdapt->MPDeviceState > NdisDeviceStateD0)
{
Status = NDIS_STATUS_FAILURE;
}
pAdapt->Request.RequestType = NdisRequestQueryInformation;
pAdapt->Request.DATA.QUERY_INFORMATION.Oid = Oid;
pAdapt->Request.DATA.QUERY_INFORMATION.InformationBuffer = InformationBuffer;
pAdapt->Request.DATA.QUERY_INFORMATION.InformationBufferLength = InformationBufferLength;
pAdapt->BytesNeeded = BytesNeeded;
pAdapt->BytesReadOrWritten = BytesWritten;
//
// If the miniport below is binding, fail the request
//
NdisAcquireSpinLock(&pAdapt->Lock);
if (pAdapt->UnbindingInProcess == TRUE)
{
NdisReleaseSpinLock(&pAdapt->Lock);
Status = NDIS_STATUS_FAILURE;
}
//
// If the Protocol device state is OFF, mark this request as being
// pended. We queue this until the device state is back to D0.
//
if ((pAdapt->PTDeviceState > NdisDeviceStateD0)
&& (pAdapt->StandingBy == FALSE))
{
pAdapt->QueuedRequest = TRUE;
NdisReleaseSpinLock(&pAdapt->Lock);
Status = NDIS_STATUS_PENDING;
}
//
// This is in the process of powering down the system, always fail the request
//
if (pAdapt->StandingBy == TRUE)
{
NdisReleaseSpinLock(&pAdapt->Lock);
Status = NDIS_STATUS_FAILURE;
}
pAdapt->OutstandingRequests = TRUE;
NdisReleaseSpinLock(&pAdapt->Lock);
//
// default case, most requests will be passed to the miniport below
//
NdisRequest(&Status,
pAdapt->BindingHandle,
&pAdapt->Request);
if (Status != NDIS_STATUS_PENDING)
{
PtRequestComplete(pAdapt, &pAdapt->Request, Status);
Status = NDIS_STATUS_PENDING;
}
}
return(Status);
}
I am new to driver development. Any help would be highly appreciated. Thanks!
With Regards,
Subashini
::DISCLAIMER::
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.