[TCPIP] Get max link speed, MTU and max packet size when adapter is connected

This commit is contained in:
Hervé Poussineau 2023-12-13 19:54:50 +01:00
parent 4c9037fff1
commit 3e3d34d97b
2 changed files with 34 additions and 41 deletions

View file

@ -718,7 +718,7 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
{
PLAN_ADAPTER Adapter = Context->Adapter;
PIP_INTERFACE Interface = Adapter->Context;
//NDIS_STATUS NdisStatus;
NDIS_STATUS NdisStatus;
IP_ADDRESS DefaultMask;
/* Initialize the default unspecified address (0.0.0.0) */
@ -754,21 +754,14 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
TCPUpdateInterfaceIPInformation(Interface);
TCPUpdateInterfaceLinkStatus(Interface);
/* We're done here if the adapter isn't connected */
if (Context->State != LAN_STATE_STARTED)
if (Context->State == LAN_STATE_STARTED)
{
Adapter->State = Context->State;
return TRUE;
}
/* NDIS Bug! */
#if 0
/* Get maximum link speed */
NdisStatus = NDISCall(Adapter,
NdisRequestQueryInformation,
OID_GEN_LINK_SPEED,
&Interface->Speed,
sizeof(UINT));
sizeof(Interface->Speed));
if (!NT_SUCCESS(NdisStatus))
Interface->Speed = IP_DEFAULT_LINK_SPEED;
@ -780,7 +773,7 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
NdisRequestQueryInformation,
OID_GEN_MAXIMUM_FRAME_SIZE,
&Adapter->MTU,
sizeof(UINT));
sizeof(Adapter->MTU));
if (NdisStatus != NDIS_STATUS_SUCCESS)
return FALSE;
@ -791,10 +784,10 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
NdisRequestQueryInformation,
OID_GEN_MAXIMUM_TOTAL_SIZE,
&Adapter->MaxPacketSize,
sizeof(UINT));
sizeof(Adapter->MaxPacketSize));
if (NdisStatus != NDIS_STATUS_SUCCESS)
return FALSE;
#endif
}
Adapter->State = Context->State;

View file

@ -52,7 +52,7 @@ typedef struct LAN_ADAPTER {
UCHAR BCastCheck; /* Value to check against */
UCHAR BCastOffset; /* Offset in frame to check against */
UCHAR HeaderSize; /* Size of link-level header */
USHORT MTU; /* Maximum Transfer Unit */
UINT MTU; /* Maximum Transfer Unit */
UINT MinFrameSize; /* Minimum frame size in bytes */
UINT MaxPacketSize; /* Maximum packet size when sending */
UINT MaxSendPackets; /* Maximum number of packets per send */