subsys: usb: host: Add USB Host CDC ECM Class Support for Ethernet#99097
subsys: usb: host: Add USB Host CDC ECM Class Support for Ethernet#99097santhosh-c-c wants to merge 2 commits intozephyrproject-rtos:mainfrom
Conversation
d9f8e29 to
3529d64
Compare
|
Thank you for this implementation! |
|
@MarkWangChinese is this related to your ongoing effort for implementing ECM? |
Thanks @josuah Hi @santhosh-c-c As the comments #95661 (comment), our side (NXP) is trying to enable the USB Host ECM too, our plan is creating the formal pr before the end of December, we will do basic function test too. Could you tell me your plan? let's align to meet both our requirements. Thanks. |
This comment was marked as outdated.
This comment was marked as outdated.
Thanks @santhosh-c-c I think our side can co-work on this pr. For example: the current codes doesn't send CDC ECM class specific control transfer, the mac address is not got from the attached device's descriptor. Our side can add commits to your pr and do test on our side too. Is it OK? |
3529d64 to
8564a97
Compare
|
|
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
8564a97 to
047fc18
Compare
|
@santhosh-c-c dependencies should now be merged. Please take out of draft and rebase on top of |
047fc18 to
0a0345f
Compare
|
|
This pull request has been marked as stale because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 7 days. Note, that you can always re-open a closed pull request at any time. |
0a0345f to
a61bc60
Compare
|
Hello @jfischer-no @josuah @MarkWangChinese Pinging this PR for review as discussed in the other thread #95661 (comment). I'm standing by to address any comments or requested changes to help get this core support merged. |
josuah
left a comment
There was a problem hiding this comment.
It seems like this PR is smaller, simpler which makes it easier to integrate.
With #100289 already going on, this means that some deduplication needs to happen, and using the current PR as a basis for #100289 is not feasible given the difference of structure.
Do you think it would be possible to refactor this PR to make it closer to #100289 while also applying your subjective improvements?
For instance, every time something is imported with changes applied, also propose the changes in #100289 as a review.
|
It is possible to merge some commits from this PR outside of CDC ECM context. It is possible to integrate some commits from #100289 into this current PR. This directly contributes to progress on CDC ECM host support. Thank you for the efforts and time on this. |
Thanks @josuah for the input. A few clarifications
@jfischer-no could you weigh in on the preferred merge strategy for ECM host support? |
a61bc60 to
5cb818e
Compare
High-speed device control endpoints are required to declare bMaxPacketSize0 of 64 per USB 2.0 spec (5.5.3). The host controller programs the EP0 pipe from this field, so the current default of 8 leaves EP0 misconfigured for high-speed and enumeration fails. For full-speed the actual MPS0 is unknown until the device descriptor is read, but 64 is a safe upper bound for the initial 8-byte control request, since data fits in a single packet at any full-speed device. Signed-off-by: Santhosh Charles <santhosh@linumiz.com>
5cb818e to
5071018
Compare
Happy to help @josuah Here is how I see the migration mapping. Splitting into phases by dependency. Phase A: Independent PRs (both drivers benefit):
Phase B: Merge Minimal ECM Core (#99097):
Phase C: Incremental Feature PRs (ported from #100289):
Reconciliation Details:
@jfischer-no @MarkWangChinese Let me know your thoughts. |
I have the impression that this can be avoided altogether. The thing is: when removing a class from the stack, all associated transfers also need to be removed, and the way to do this is to call dequeue() on each, but there is no way to get the list of all the transfers that are queued to a particular class. This could be done at the stack level maybe, as then it is a lot less effort for each and every class (implemented with an array for UVC for instance). zephyr/subsys/usb/host/class/usbh_uvc.c Line 116 in 44853cf Without this, transfers de-allocation upon class removal is not being handled? |
Hi @josuah For disconnecting, the controller will callback all the xfers that are enqueued. For the case of video: stooping the stream https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/usb/host/class/usbh_uvc.c#L3022. I think it is the controller driver interface issue, we needs one controller interface api to release the resource of "dev + endpoint" if it is no longer used, then the related usb bandwidth can be released. If needed, we can talk here #101159. Thanks. |
Add support for the USB CDC ECM (Ethernet Control Model) class to the USB host subsystem. This implementation enables Ethernet functionality for USB host. Signed-off-by: Santhosh Charles <santhosh@linumiz.com>
@josuah - Based on Mark's explanation, does the host stack actually guarantee that |
|
I think this is not guaranteed: there is a thread for endpoint events and other events, they are split in different queues there: zephyr/subsys/usb/host/usbh_core.c Lines 33 to 45 in 603fa48 That suggests full concurrency, and events such as "remove this device and all the classes" might need to go through mechanism like "atomically remove all endpoints from all queues and ask drivers they processed/errored-out the ongoing buffer. |
Thanks for the clarification @josuah |
5071018 to
7968761
Compare
|



USB Host: Add CDC ECM class support
This PR introduces the USB CDC ECM (Ethernet Control Model) class support
to the Zephyr USB host subsystem, enabling Ethernet functionality for
USB hosts.
Changes since draft:
bMaxPacketSize0 to 64 per USB 2.0 spec (85df60a)
Dependency:
Signed-off-by: Santhosh Charles santhosh@linumiz.com