aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/net
Commit message (Collapse)AuthorAgeFilesLines
* ure(4): Fix spurious link flaps from MIIRafael Kitover2026-03-161-3/+66
| | | | | | | | | | | | | A race condition in the MII layer causes spurious link down events. In `statchg`, on link down, check if the PHY reports the link as actually down using the BMSR register, if not, force the status of the link to back up and restart TX. Do the same in a MII `linkchg` handler. On actual link up, restart TX in case it went idle and down. PR: 252165 Signed-off-by: Rafael Kitover <rkitover@gmail.com> Reviewed by: pouria Differential Revision: https://reviews.freebsd.org/D55682
* chore: replace {0, 0} with {DEV,KOBJ}METHOD_ENDEnji Cooper2026-02-251-1/+1
| | | | | | | | | | | | | | Both of the aforementioned macros have been present in FreeBSD for well over a decade: 2009 for `KOBJMETHOD_END`; 2011 for `DEVMETHOD_END`. Adapt all hardcoded references of `{0, 0}` with `DEVMETHOD_END` and `KOBJMETHOD_END` as appropriate. This helps ensure that future adaptations to drivers following patterns documented in driver(9) can be made more easily/without issue. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55414
* ure: improve receive checksum offloadingMichael Tuexen2026-02-101-23/+15
| | | | | | | | | | | Let the receive checksum offload for TCP/IPv6 and UDP/IPv6 be controlled by ifconfig rxcsum6 and not by ifconfig rxcsum. While there, make the code more compact and improve stlye.9 conformity. Reviewed by: Timo Völker MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55188
* ure: improve transmit checksum offloadingMichael Tuexen2026-02-081-6/+10
| | | | | | | | | | | Apparently, the name of the variable l4off was correct. Providing the offset to the TCP or UDP header allows the transmit checksum offload to work for TCP/IPv4, TCP/IPv6, UDP/IPv4, and UDP/IPv6. Reported by: vishwin Reviewed by: vishwin MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55187
* ure: improve checksum offloadingMichael Tuexen2026-01-311-0/+3
| | | | | | | | | | | | | | | | | | This patch fixes three issues: (1) Initially, set the hwassist flags correctly when enabling transmit checksum offload for TCP/IPv6 and UDP/IPv6. (2) Keep the hwassist flags in sync with the capabilities when changing txcsum. (3) Keep the hwasssit flags in sync with the capabilities when changing txcsum6. Without this patch, transmit checksum offloading for TCP/IPv6 and UDP/IPv6 is never used and transmit checksum offloading for IPv4, TCP/IPv4 and UDP/IPv4 is always used, even if disabled via ifconfig ue? -txcsum. Reviewed by: Timo Völker MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D54974
* sys: RealTek -> Realtekykla2025-11-273-6/+6
| | | | | | | | | | | Realtek changed how it styled its name 25 or so years ago, but the old style persisted in many places. These products use the new styling in their datasheets. Signed-off-by: ykla yklaxds@gmail.com Sponsored by: Chinese FreeBSD Community Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1901
* umb: Fix setting the input routineZhenlei Huang2025-09-031-4/+0
| | | | | | | | | | | | | | | This driver does not depend on netmap, and umb_input() works greatly without netmap. Remove the #ifdef DEV_NETMAP so that when "device netmap" is not configured this driver can still correctly pass the inbound packets to the net stack. Otherwise the input routine will be if_input_default() which will silently drop all inbound packets. PR: 263783 Reported by: Andre Albsmeier <mail@fbsd2.e4m.org> Tested by: Andre Albsmeier <mail@fbsd2.e4m.org> Differential Revision: https://reviews.freebsd.org/D52182
* if_umb: Fix a typo in a source code commentGordon Bergling2025-08-251-1/+1
| | | | | | - s/tranfers/transfers/ MFC after: 3 days
* ipheth(4): Add CDC-NCM support for RXShengYi Hung2025-08-152-46/+189
| | | | | | | | | | | | | | | The CDC-NCM (USB Communications Device Class – Network Control Model) protocol allows multiple Ethernet frames to be encapsulated into a single USB transfer. On iOS, CDC-NCM is currently implemented for RX only and uses a fixed number of entries (16). To maintain compatibility with older iOS versions, we attempt to enable NCM on the USB device first; if this fails, we fall back to the original behavior. Approved by: lwhsu (mentor), markj (mentor) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* umb: avoid wild pointer dereference in umb_decap()Pierre Pronchery2025-05-291-2/+4
| | | | | | | | | | | | | | | | | When processing messages produced by the USB device, umb_decap() trusts ptroff and later dlen and doff with pointer arithmetic, without sufficient sanity checks. The resulting pointer address may be outside of the valid boundary, causing the wrong memory to be copied or a page fault. This fix from Gerhard Roth was obtained after coordination upstream with OpenBSD. It converts the variables to 64-bit integers, which should mitigate the risk of overflows. PR: 284920 Reported by: Robert Morris <rtm@lcs.mit.edu> Approved by: philip (mentor) Sponsored by: The FreeBSD Foundation
* umb: avoid buffer overflow in umb_getinfobuf()Pierre Pronchery2025-05-291-3/+2
| | | | | | | | | | | | | | | | umb_getinfobuf() is called with offs and size taken from messages sent by the USB device. The sanity check is not sufficient, due to a possible integer wrap. This can allow a broken or malicious USB device, or possibly the network operator, to cause a buffer overflow. This fix from Gerhard Roth was obtained after coordination upstream with OpenBSD. It converts the variables to 64-bit integers, which should mitigate the risk of overflows. PR: 284906 Reported by: Robert Morris <rtm@lcs.mit.edu> Approved by: philip (mentor) Sponsored by: The FreeBSD Foundation
* umb: avoid buffer overflow in umb_in_len2mask()Pierre Pronchery2025-05-291-1/+2
| | | | | | | | | | | | | | len comes from ipv4elem.prefixlen in a MBIM_CID_IP_CONFIGURATION message from the USB device, and should not be trusted, as it could be any uint32_t value. Without this extra check, a potential buffer overflow could subsequently occur in umb_in_len2mask(). Fix from Gerhard Roth, after coordination upstream with OpenBSD. PR: 284904 Reported by: Robert Morris <rtm@lcs.mit.edu> Approved by: philip (mentor) Sponsored by: The FreeBSD Foundation
* usb/if_mos.c: Fix incorrect SPDX IDAlexander Ziaee2025-05-281-2/+2
| | | | | | | | Fixes: 718cf2ccb995 (further adoption of SPDX) MFC after: 3 days Reviewed by: carlavilla, imp, mhorne Approved by: carlavilla, mhorne (mentors) Differential Revision: https://reviews.freebsd.org/D50374
* usb: if_ure: stop touching the mbuf accounting on rxq insertionKyle Evans2025-04-202-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | uether_rxmbuf() assumes the uether_newbuf() model where the caller has just set m_len to the entire size of the mbuf, and passed the final size into uether_rxmbuf() for finalization. In if_ure we're creating our own mbuf chains, and the accounting is all already accurate. uether_rxmbuf's logic won't work at all for a chain, so let's add an assertion to that effect (but I think the other callers were all OK). This fixes a panic on my Windows DevKit when undergoing any kind of network stress that surfaces after the bogus mbuf is injected into the network stack (usually observed in `m_dup`). markj and I had spent some time investigating it and decided there's some kind of buffer underrun happening; the rx packet descriptor reports a length longer than what's actually available. We discard the rest of the transfer, but then we end up fetching it in a subsequent transfer and end up casting packet data to a `struct ure_rxpkt` incorrectly. It would be better to fix the underlying root cause, but this is a reasonable mitigation in the interim. Reviewed by: markj Fixes: 7d5522e16a ("A major update to the ure driver.") Differential Revision: https://reviews.freebsd.org/D43465
* usb: Kill left-over cdefs.h includesWarner Losh2025-03-0415-15/+0
| | | | | | | | | These includes were for __FBSD_RCSID() macro. They weren't formatted like the rest of the tree so weren't trimmed automatically when that script was run. Trim them now. MFC After: 1 week Sponsored by: Netflix
* ure(4): Add support for ELECOM EDC-QUA3CFUKAUMI Naoki2025-01-241-0/+1
| | | | | | | | | | | | | | ELECOM EDC-QUA3C is a USB3.1 Gen1 Type-A/C 2.5GBASE-T network adapter. This also works as a cdce(4) device by: usbconfig -d X.Y set_config 1 or usbconfig -d X.Y set_config 2 Signed-off-by: FUKAUMI Naoki <naoki@radxa.com> MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/1578
* umb: Introduce the USB umb(4) network driverAdrian Chadd2025-01-203-0/+4100
| | | | | | | | | | | | | | | | | | | | | | | This includes the port of a driver originally from OpenBSD, later ported to NetBSD by the author: * The umb(4) kernel driver * The umbctl(8) companion tool This driver supports USB network devices implementing the Mobile Broadband Interface Model (MBIM), often found in modern (internal) USB models for 4G/LTE mobile broadband access. It is currently limited to IPv4. umbctl has to be used to display or set MBIM cellular modem interface parameters (4G/LTE). Differential Revision: https://reviews.freebsd.org/D48167 Approved by: adrian, zlei Sponsored by: FreeBSD Foundation PR: kern/263783 Submitted by: Pierre Pronchery <khorben@defora.org>
* Use bus_generic_detach to detach and delete child devices during detachJohn Baldwin2025-01-021-5/+3
| | | | | | | This is simpler and more robust than individual calls to device_delete_child. Differential Revision: https://reviews.freebsd.org/D47972
* if_usie: fix typoKristof Provost2024-09-211-1/+3
| | | | | | | Fix a 'case AF_INET;' typo, and ensure we include 'opt_inet6.h' so #ifdef INET6 actually works. Sponsored by: Rubicon Communications, LLC ("Netgate")
* ure(4): Add ID for LAN port in Thinkpad OneLink+ dockAlexander Motin2024-09-191-0/+1
| | | | | | That's a pretty old dock for Thinkpad X1 Carbon Gen4 and few others. MFC after: 1 week
* Move support of Realtek 8156/8156B from cdce(4) to ure(4)Li-Wen Hsu2024-08-122-2/+1
| | | | | | | Reviewed by: kevlo, imp, hrs MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45088
* if_urndis: Organize buffer layouts more naturallyMark Johnston2024-07-091-11/+11
| | | | | | | | | | | | | | | | | | | | - Group the request header and I/O buffer in one structure, rather than assuming that both request structures have the same size. - Pass a pointer to the whole structure to urndis_ctrl_query() and urndis_ctrl_set() rather than just the header. Otherwise, on CHERI platforms, these functions violate subobject bounds since they modify the buffer following the header. While here, there is no apparent reason for the request structure used in urndis_attach() to be allocated statically. Change it so that it's allocated on the stack. No functional change intended. Reviewed by: jhb MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D45866
* net: Remove unneeded NULL check for the allocated ifnetZhenlei Huang2024-06-283-14/+0
| | | | | | | | | | | Change 4787572d0580 made if_alloc_domain() never fail, then also do the wrappers if_alloc(), if_alloc_dev(), and if_gethandle(). No functional change intended. Reviewed by: kp, imp, glebius, stevek MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D45740
* smsc(4): update to mention MicrochipEd Maste2024-05-081-2/+2
| | | | | | | | | | | Microchip Technology acquired SMSC in 2012, and all current products and datasheets refer to the devices supported by this driver as Microchip parts. Mention SMSC in a parenthetical comment to explain the driver's name. Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45115
* muge(4): Fix a typo in a source code commentGordon Bergling2024-04-181-1/+1
| | | | | | - s/addres/address/ MFC after: 3 days
* if_smsc: fix build on armv6 & armv7Ronald Klop2023-12-071-1/+1
| | | | | | | | | | | | compile error was: /usr/src/sys/dev/usb/net/if_smsc.c:1597:40: error: format specifies type 'unsigned long' but the argument has type 'ssize_t' (aka 'int') [-Werror,-Wformat] "failed alloc for bootargs (%lu)", len); ~~~ ^~~ %zd PR: 274092 Approved by: karels MFC after: 1 month
* Teach if_smsc to get MAC from bootargs.Ronald Klop2023-12-071-3/+83
| | | | | | | | | | | | | | | Some Raspberry Pi pass smsc95xx.macaddr=XX:XX:XX:XX:XX:XX as bootargs. Use this if no ethernet address is found in an EEPROM. As last resort fall back to ether_gen_addr() instead of random MAC. PR: 274092 Reported by: Patrick M. Hausen (via ML) Reviewed by: imp, karels, zlei Tested by: Patrick M. Hausen Approved by: karels MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D42463
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-274-4/+1
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Move (LENOVO, TBT3LAN) from if_ure til if_cdce where it works much betterPoul-Henning Kamp2023-10-111-1/+0
|
* axge: Add support for AX88179ADamien Broka2023-10-042-8/+38
| | | | | | | | | | | | | The AX88179A has two firmware modes, one of which is backward compatible with existing AX88178A/179 driver. The active firmware mode can be controlled through a register. Update axge(4) man page to mention 179A support and ensure that, when bound to a AX88179A, the driver activates the compatible firmware mode. Reviewed by: markj Pull Request: https://github.com/freebsd/freebsd-src/pull/854 MFC after: 1 week
* axge: Skip dummy packet headersDamien Broka2023-09-131-1/+18
| | | | | | | | | | | | | | | Newer versions of the AX88179 interweave dummies alongside valid packet headers in bulk IN transfer data. This was probably done for backward compatibility with existing drivers. However current driver records these dummy headers as dropped frames, leading to stats misreporting one Ierr per Ipkt. This skips those dummy headers silently, thereby not generating Ierrs for them. Reviewed by: emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/842
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1619-38/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-168-8/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1614-28/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* ure(4): add support for Thinkpad Hybrid USB-C with USB-A dockJoerg Pulz2023-07-041-0/+1
| | | | | | | | | | | Add support for LAN port found on Thinkpad Hybrid USB-C with USB-A dock. While here fix a small typo - s/UBS/USB/ Sponsored by: Technical University of Munich Reviewed by: markj MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/791
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1218-18/+18
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* if_mos: Remove set but unused variable.John Baldwin2023-04-101-3/+0
| | | | | | Reviewed by: hselasky Reported by: GCC Differential Revision: https://reviews.freebsd.org/D39356
* Mechanically convert usb ethernet drivers to DrvAPIJustin Hibbits2023-03-0618-516/+508
| | | | | | Reviewed by: zlei Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37812
* usb: Remove unused member in struct mos_softcZhenlei Huang2023-02-151-1/+0
| | | | | | | | Spotted by jhibbits in D37812. Reviewed by: #network, glebius MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D38581
* Mechanically convert usb_ethernet(4) to IfAPIJustin Hibbits2023-02-072-48/+47
| | | | | | Reviewed by: zlei Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37802
* usb: add support for Huawei E5573Cs322Michael Paepcke2023-02-041-1/+2
| | | | | | | | | | | | | | | | | | | | Switch the now added E5573Cs322_ECM (0x14db) as well per default to NCM. With this patch we default all devices to simple NCM mode to avoid the problem and get a consistent reliable behavior. No matter what firmware version and provider mix are involved. Rationale: Even the bigger SOC shows under complex load in ECM (double-nat) mode the same performance drop from 25Mbit to 2Mbit Line Speed, similar to E3372h. Reason: Thermal problems (reported via serial debug interface in ACM Mode) after 2-3 minutes load. Fix the root cause and bundle a working firmware is out of reach because Huawei sells the same hardware, different (crippled) firmware versions at different price points in different markets as strategy. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/633
* usb: add new scsi_huawei eject3 & eject4 driver supportMichael Paepcke2023-02-041-0/+2
| | | | | | | | | | | | | Add initialization for new Huawei 4G E3372_NCM, E3372v153_NCM, E5573Cs322_NCM, E5573Cs322_ECM, and E5573Cs322_ACM. Remove now-obsolete Huawei 3G E3131 init sequence. These devices are obsolete, share IDs with new devices and the 3G networks are shutdown. These old devices work correctly via the 4G code while still allowing the shared IDs to work differently for the new devices. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/633
* Add Windows Dev Kit 2023 support to if_ureAndrew Turner2023-01-041-0/+1
| | | | | | | | | The Windows Dev Kit 2023 has an if_ure NIC with custom vendor and procuct IDs. Add them to the driver. Tested by: Robert Clausecker <fuz@fuz.su> Obtained from: OpenBSD Sponsored by: Arm Ltd
* usb(4): Substitute "unsigned int" using the equivalent and shorter ↵Hans Petter Selasky2022-10-075-14/+14
| | | | | | | "unsigned" keyword. MFC after: 1 week Sponsored by: NVIDIA Networking
* Revert "usb: Remove a double words in a source code comments"Gordon Bergling2022-09-052-2/+2
| | | | | | | | This reverts commit 8ca67bf1273a5168f8a3787183159c477632e582. The original comment was correct; changing it loses a key part. Reported by: jrtc27
* usb: Remove a double words in a source code commentsGordon Bergling2022-09-042-2/+2
| | | | | | - s/that that/that/ MFC after: 3 days
* usb: Fix two typos in source code commentsGordon Bergling2022-09-032-2/+2
| | | | | | - s/overriden/overridden/ MFC after: 3 days
* USB id of yet another Lenovo USB-C ethernet dongle.Poul-Henning Kamp2022-08-281-0/+1
|
* usb: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-0618-52/+18
|
* Remove unused miibus_devclass and miibus_fdt_devclass.John Baldwin2022-05-069-9/+9
|