[edk2-devel] [PATCH v4 1/3] UsbNetworkPkg/UsbRndis: Add USB RNDIS devices support

RichardHo [何明忠] via groups.io richardho=ami.com at groups.io
Tue Feb 21 03:01:41 UTC 2023


Hi Tinh,

Our last RNDIS driver’s code has add that.
To see https://learn.microsoft.com/en-us/windows-hardware/drivers/network/control-channel-characteristics<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fwindows-hardware%2Fdrivers%2Fnetwork%2Fcontrol-channel-characteristics&data=05%7C01%7CRichardHo%40ami.com%7C4edbc66360fa4936d99608dac8de1e74%7C27e97857e15f486cb58e86c2b3040f93%7C1%7C0%7C638043153572597130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=pfWsBTOfoNxFyg65xTKvnNeRxyvUstt4c1W%2FlGieYWM%3D&reserved=0>,
It need to read the Interrupt IN endpoint before response the RNDIS message.

The host does not continuously poll the USB Control endpoint for input control messages. Upon placing a control message
on its Control endpoint, the device must return a notification on the Communication Class interface's Interrupt IN endpoint,
which is polled by the host whenever the device can return control messages. The transfer from the device's interrupt IN endpoint
to the host is a standard USB Interrupt IN transfer. The only defined device notification is the RESPONSE_AVAILABLE notification,
defined in the following table.



Thanks,
Richard

From: Tinh Nguyen OS <tinhnguyen at os.amperecomputing.com>
Sent: 2023年2月21日 10:24 AM
To: devel at edk2.groups.io; Richard Ho (何明忠) <RichardHo at ami.com>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v4 1/3] UsbNetworkPkg/UsbRndis: Add USB RNDIS devices support


**CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**


On 18/02/2023 16:47, RichardHo [何明忠] via groups.io wrote:



+  PrintRndisMsg (RndisMsg);

+

+  Status = UsbIo->UsbControlTransfer (

+                    UsbIo,

+                    &DevReq,

+                    EfiUsbDataOut,

+                    USB_ETHERNET_TRANSFER_TIMEOUT,

+                    RndisMsg,

+                    RndisMsg->MessageLength,

+                    &UsbStatus

+                    );

+

+  DEBUG ((DEBUG_INFO, "RndisControlMsg: UsbStatus : %x Status : %r RndisMsgResponse : %lx\n", UsbStatus, Status, RndisMsgResponse));

+

+  // Error or no response expected

+  if ((EFI_ERROR (Status)) || (RndisMsgResponse == NULL)) {

+    DEBUG ((DEBUG_INFO, "RndisControlMsg: UsbStatus : %x Status : %r\n", UsbStatus, Status));

+    return Status;

+  }

+

+  for (Index = 0; Index < (RNDIS_CONTROL_TIMEOUT/100); Index++) {

+    ReadRndisResponseInterrupt (UsbRndisDevice);

Could you help review the ReadRndisResponseInterrupt function? (). While using USB Rndis, the Jade platform crashes.

I found that AMI had published the same driver here OSF-Aptio-OpenEdition/UsbRndisFunction.c at main · opencomputeproject/OSF-Aptio-OpenEdition (github.com)<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopencomputeproject%2FOSF-Aptio-OpenEdition%2Fblob%2Fmain%2FUsbRndisPkg%2FUsbRndis%2FUsbRndisFunction.c&data=05%7C01%7Crichardho%40ami.com%7Cec4d080c33d24cd6647208db13b2a4c2%7C27e97857e15f486cb58e86c2b3040f93%7C1%7C0%7C638125430210029610%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=aFtORrifBCKmIBo3XhLQYtzF0Ek3mkA5Ezk%2BDth4iVo%3D&reserved=0>,

however the RndisControlMsg function does not call ReadRndisResponseInterrupt.

Jade platform (aarch64) works well with this (OSF-Aptio-OpenEdition/UsbRndisFunction.c at main · opencomputeproject/OSF-Aptio-OpenEdition (github.com)<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopencomputeproject%2FOSF-Aptio-OpenEdition%2Fblob%2Fmain%2FUsbRndisPkg%2FUsbRndis%2FUsbRndisFunction.c&data=05%7C01%7Crichardho%40ami.com%7Cec4d080c33d24cd6647208db13b2a4c2%7C27e97857e15f486cb58e86c2b3040f93%7C1%7C0%7C638125430210029610%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=aFtORrifBCKmIBo3XhLQYtzF0Ek3mkA5Ezk%2BDth4iVo%3D&reserved=0>). Does your x86 system work without this line ?

+    ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));

+

+    DevReq.RequestType = USB_ENDPOINT_DIR_IN | USB_REQ_TYPE_CLASS | USB_TARGET_INTERFACE;

+    DevReq.Request     = GET_ENCAPSULATED_RESPONSE;

-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100397): https://edk2.groups.io/g/devel/message/100397
Mute This Topic: https://groups.io/mt/97046156/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20230221/a6b44d36/attachment-0001.htm>


More information about the edk2-devel-archive mailing list