net: replace CFG_TUD_NET_ENDPOINT_SIZE with actual descriptor-based ep size#3568
net: replace CFG_TUD_NET_ENDPOINT_SIZE with actual descriptor-based ep size#3568
Conversation
… bInterval to TUD_CDC_NCM_DESCRIPTOR Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com> Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/e212b526-e279-4a83-88bf-a742df293165
|
@copilot remove submodules |
|
@copilot Remove CFG_TUD_NET_ENDPOINT_SIZE, manage zlp based on real speed in drivers |
… in drivers Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com> Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/5d355974-2223-4071-8d14-b6d4ac1fd030
…ired_zlp Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com> Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/5d355974-2223-4071-8d14-b6d4ac1fd030
Done in c843e5e. Removed |
…coding 64/512 Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com> Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/4c20b579-db28-4643-b062-81881adcf6c1
There was a problem hiding this comment.
Pull request overview
This PR fixes network class ZLP handling by basing decisions on the negotiated bulk endpoint wMaxPacketSize read from descriptors at netd_open() time, instead of compile-time or hardcoded speed assumptions (important for dual-speed devices).
Changes:
- Remove
CFG_TUD_NET_ENDPOINT_SIZEand store actual bulk EP max packet size in the network interface state for ECM/RNDIS and NCM. - Update ZLP decision logic to use the stored descriptor-derived endpoint size.
- Update the net_lwip_webserver example to provide distinct FS/HS configuration descriptors and add HS support descriptors (device qualifier / other-speed config callbacks).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
src/device/usbd.h |
Extends the CDC-NCM descriptor template macro to include an interrupt bInterval parameter. |
src/class/net/net_device.h |
Removes the compile-time endpoint size macro previously used for ZLP decisions. |
src/class/net/ncm_device.c |
Stores bulk EP max packet size from descriptors and uses it for ZLP insertion logic. |
src/class/net/ecm_rndis_device.c |
Stores bulk EP max packet size from descriptors and uses it for ZLP decisions. |
examples/device/net_lwip_webserver/src/usb_descriptors.c |
Splits FS/HS configurations (64 vs 512), adds device qualifier + other-speed configuration callbacks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Size Difference ReportBecause TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds. Note: If there is no change, only one value is shown. Changes >1% in sizeNo entries. Changes <1% in size
No changes
|
…OTHER_SPEED_CONFIG and fix SEED typo Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com> Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/3d21b8d3-b2df-4603-a426-2bcfdb408f04
Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com> Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/3d21b8d3-b2df-4603-a426-2bcfdb408f04
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. |
CFG_TUD_NET_ENDPOINT_SIZEused a compile-timeTUD_OPT_HIGH_SPEEDflag to pick between 512 and 64, which is incorrect when a device supports both speeds. ZLP decisions must be based on the actual negotiated endpoint size.Changes
CFG_TUD_NET_ENDPOINT_SIZEfromnet_device.hecm_rndis_device.c/ncm_device.c: Adduint16_t ep_sizeto the interface struct; populate it duringnetd_open()by readingwMaxPacketSizedirectly from the bulk endpoint descriptor viatu_edpt_packet_size()(IN and OUT assumed equal, matching the pattern inmtp_device.c)ep_sizeinstead of runtimetud_speed_get()with hardcoded values🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.