Commit graph

680 commits

Author SHA1 Message Date
liqinhui
3843f7b4fe wifi: Support the wifi operations based on the bss file.
Add support for BSS file-based WiFi simulation.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2026-01-14 09:22:54 +08:00
liqinhui
58110f3d1a drivers/net: Fix crash in wifi_sim disconnect.
Add WLAN_STA_STATE_DISCONNECTED state to prevent race conditions or invalid state handling during disconnect.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2026-01-14 09:22:40 +08:00
zhanghongyu
3bb8749672 drivers/net/igc.c: fix build error
otherwise, enable CONFIG_NETDEV_STATISTICS will result in a compile error

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-13 02:17:15 +08:00
zhanghongyu
02645974cb drivers/net/igc.c: add device id 0x15f3 support
add the network card models whose functions have been confirmed to the
id table.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-08 09:49:07 -03:00
zhanghongyu
446aecdd61 drivers/net/e1000.c: add PIDVID of e1000 NIC
add the network card models whose functions have been confirmed to the
id table.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-08 09:49:07 -03:00
zhanghongyu
fa6c8579dd driver/net: replace net_lock with netdev_lock
modify the code of the adapted protocol stack to avoid deadlocks and the
logic that cannot be protected by locks after modification.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-06 16:08:30 +08:00
zhanghongyu
b0ab56aca2 netdev_upperhalf: add direct rx mode
avoid packet processing delays caused by task switching,
to support those applications that are extremely time-sensitive.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-29 14:29:24 +08:00
zhanghongyu
3e18d72661 netdev_upperhalf.c: add vlan lock in rxpoll flow
Protect the RX process of the VLAN network card.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-29 09:42:18 +08:00
zhanghongyu
eb60667561 net/utils/net_lock.c: add api to lock conn and netdev
add new api to protect access and operation to conn and dev

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-29 09:42:18 +08:00
gaohedong
292276101b net/vlan: make a judgment before calling fuction
Make a judgment before calling fuction.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2025-12-27 20:46:04 +08:00
zhanghongyu
6144b51848 netdev_upperhalf.c: support alloc iob from CAN buffer pool
when the network card type is NET_LL_CAN, packets are defaultly
allocated from the can buffer.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-25 08:56:12 -03:00
wangchen
fac6c2a82c loopback:setting loopback network driver sending task to the HPWORK queue
The loopback network driver sending task is placed in the LPWORK queue, which may result in delayed scheduling when the CPU usage reaches 100%, leading to the timely sending of cached messages from the loopback network driver and causing issues with post waitsem being too late​.we decied to set loopback sending task to the HPWORK queue.

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2025-12-23 09:27:20 -03:00
wangchen
07247be9f6 wifi_sim.c:resolve issue in wapi save_config & wapi reconnect command
resolve issue in wapi save_config & wapi reconnect command in qemu

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2025-12-23 09:06:11 -03:00
zhanghongyu
2ebb08e78f netdev_upperhalf: avoid recursion during transmission
to avoid uncontrollable stack overhead, we actively
avoid scenarios where recursion occurs.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-20 10:58:16 +08:00
zhanghongyu
16947ddacd netdev_upperhalf: modify txavail to be sent directly in the current thread
avoid packet processing delays caused by task switching,
to support those applications that are extremely time-sensitive.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-20 10:58:16 +08:00
zhanghongyu
aa8ffea3cf netdev_upperhalf: convert Kconfig to variable
Upperhalf supports multiple working modes at the same time,
which is specified by NIC when register

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-14 10:01:22 +08:00
zhanghongyu
84895c8e70 Revert "e1000: add polling mode support for tx/rx"
Remove the previously supported polling mode. If necessary in the
future, switch to a new solution for implementation.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-14 10:01:22 +08:00
zhangkai25
ad422684d4 drivers/net: Ethernet protocol stack key abnormal point pile for DFX
add log output for error flow

Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2025-12-09 07:56:20 -03:00
zhanghongyu
4f7e03db2e netdev_upperhalf.c: add net_lock when vlan_foreach
avoid illegal address access caused by removing vlan
network cards during the traversal of vlan network cards

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-09 07:56:20 -03:00
gaohedong
00dfb5d1f3 ethernet: Release iob when dropping ethernet packets
Release iob when dropping ethernet packets

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2025-12-09 07:56:20 -03:00
Zhe Weng
8d7799d6c1 net/vlan: Allow setting default priority (PCP)
1. We add default PCP because some of our apps may not want to set PCP
   manually (e.g. Our user may just ping with pre-set PCP)
2. The `vlan_qos` is used as PCP when setting Linux's priority mapping:
   https://github.com/torvalds/linux/blob/v6.12/net/8021q/vlan.c#L590
   Although `vlan_qos` is not used when creating VLAN on Linux, we can
   use it as PCP on creating VLAN (without changing its meaning), and
   keep compatible with Linux's creating (Exactly the same when
   `vlan_qos` is 0).

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2025-12-09 07:56:20 -03:00
Zhe Weng
2b34bcfcb1 netdev/ioctl: Add support for simple VLAN ioctl
Supporting ADD_VLAN_CMD and DEL_VLAN_CMD of SIOCSIFVLAN
Ref: https://github.com/torvalds/linux/blob/v6.12/net/8021q/vlan.c#L621

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2025-12-09 07:56:20 -03:00
Zhe Weng
242c253178 net: Add VLAN device support
Inspired by Linux's way, we also create VLAN devices for managing VLAN,
which will become interfaces like `eth0.58`.

QinQ is also supported, we can create VLAN devices above another VLAN
devices, like `eth0.100.101` (or even `eth0.1.2.3.4`, also supported on
Linux).

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2025-12-09 07:56:20 -03:00
Zhe Weng
750fae4cca netdev/lower: Support share quota between devices
To prepare for VLAN device support, a VLAN device will share quota with
its real device.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2025-12-09 07:56:20 -03:00
daichuan
afc210667d netdev_upperhalf.c: modify for maybe use after free with upper pointer
avoid continuing to access the released memory after the netdev_register
error occurs.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2025-12-09 07:56:20 -03:00
Zhe Weng
b2db3a6430 net/netdev: Add netdev_iob_replace_l2 for netdev to avoid misuse
And fix wrong `d_len` for IOBs from `upper->txq` in TX.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2025-12-09 07:56:20 -03:00
zhanghongyu
521e319aa3 drivers/net: replace critical_section with spinlock
so as to better support multi-core scenarios

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-09 14:43:59 +08:00
wangchen
fe822145a3 tun:modify issue of repeatly tun_close failed
after the network card is turned off, read and write operations need
to return -ENETDOWN, and it is necessary to wake up the waiting read
and write operations.

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2025-12-09 14:43:59 +08:00
chao an
87f134cfaa sched/sleep: replace all Signal-based sleep implement to Scheduled sleep
Nuttx currently has 2 types of sleep interfaces:

1. Signal-scheduled sleep: nxsig_sleep() / nxsig_usleep() / nxsig_nanosleep()
Weaknesses:
a. Signal-dependent: The signal-scheduled sleep method is bound to the signal framework, while some driver sleep operations do not depend on signals.
b. Timespec conversion: Signal-scheduled sleep involves timespec conversion, which has a significant impact on performance.

2. Busy sleep: up_mdelay() / up_udelay()
Weaknesses:
a. Does not actively trigger scheduling, occupy the CPU loading.

3. New interfaces: Scheduled sleep: nxsched_sleep() / nxsched_usleep() / nxsched_msleep() / nxsched_ticksleep()
Strengths:
a. Does not depend on the signal framework.
b. Tick-based, without additional computational overhead.

Currently, the Nuttx driver framework extensively uses nxsig_* interfaces. However, the driver does not need to rely on signals or timespec conversion.
Therefore, a new set of APIs is added to reduce dependencies on other modules.

(This PR also aims to make signals optional, further reducing the code size of Nuttx.)

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-10-17 14:05:02 +08:00
LuchianMihai
95efa6f7cf net/mdio: add mdio bus
Currently the mdio communication is part of the monolithic 'full netdevs'.
This commit serves as an way to add modularity for the netdevs drivers.
A new upperhalf/lowerhalf mdio device comes with this commit that manages the data transfer ofer mdio interface.

Signed-off-by: Luchian Mihai <luchiann.mihai@gmail.com>
2025-09-25 16:24:18 +08:00
michal matias
0f498005f0 drivers/net/oa_tc6: Add driver for the Microchip LAN865x SPI MAC-PHY
Add driver for the LAN865x 10BASE-T1S SPI MAC-PHY.
The driver is a lower-half driver to the OA-TC6 base driver.

Signed-off-by: michal matias <mich4l.matias@gmail.com>
2025-09-03 00:53:03 +08:00
michal matias
fbb3b6d07b drivers/net/oa_tc6: Add driver for the Onsemi NCV7410 (NCN26010) SPI MAC-PHY
Add driver for the Onsemi NCV7410 10BASE-T1S SPI MAC-PHY.
The driver also works for the NCN26010, which is an identical chip.
The driver is a lower-half driver to the OA-TC6 base driver.

Signed-off-by: michal matias <mich4l.matias@gmail.com>
2025-09-03 00:53:03 +08:00
michal matias
95b3b65778 drivers/net: Add base driver for the OA-T6 protocol MAC-PHYs
Add base driver common for OPEN Alliance 10BASE-T1x MAC-PHY Serial Interface (OA-TC6)
protocol SPI MAC-PHYs.

Signed-off-by: michal matias <mich4l.matias@gmail.com>
2025-09-03 00:53:03 +08:00
simbit18
aadb929526 drivers/net/CMakeLists.txt: Aligned Cmake with Make
Add KSZ9477 driver #10503

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-08-27 11:05:32 +08:00
Jani Paalijarvi
e2b1d186d7 drivers/net/ksz9477.c: Errata 16, reset SGMII always on init 2025-08-26 09:10:43 -03:00
Jari Nippula
56870fb0ea ksz9477: MMD indirect access check fix
Instead of verifying MMD indirect access by checking
EEE ADVERTISEMENT register has value 0x6 (which may be changed),
the verification is done by write and check LED MODE register.
1. Backup current LED_MODE register value
2. Write value Single-LED mode (0x10) to LED_MODE
3. Read LED_MODE register and verify it returns value 0x10
4. Write original (backup) value to LED_MODE
2025-08-26 09:10:43 -03:00
Jani Paalijarvi
fcab00d3a8 drivers/net/ksz9477: Implement errata fixes
From the ksz9477 errata, setup the configuration which is tested to work.

- Improve PHY receive performance
- Disable EEE for ports 1-5
- Fix supply current values

Signed-off-by: Jani Paalijarvi <jani.paalijarvi@unikie.com>
2025-08-26 09:10:43 -03:00
michal matias
4a4235b5a2 drivers/net: Remove the NCV7410 10BASE-T1S MAC-PHY driver
This commit removes existing support for the NCV7410 10BASE-T1S MAC-PHY.
The driver will be replaced by its generalized version with different organization.
The new driver has naming clashes with the old, therefore the old has to be removed first.

Signed-off-by: michal matias <mich4l.matias@gmail.com>
2025-08-25 20:32:35 +08:00
p-szafonimateusz
880c8e5d26 drivers/net: add IGB network card support
Add support for Intel IGB type of network cards.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-07-08 10:02:15 +02:00
p-szafonimateusz
bba1741421 drivers/net/{e1000|igc}: align descriptors to 8
A descriptor ring length must be aligned to 128, one descriptor is 16B length,
so we can provide this condition with the appropriate number of descriptors

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-07-03 21:57:02 +08:00
p-szafonimateusz
5a9530855c drivers/net/{e1000|igc}: drop TX packets if TX ring is full
drop TX packets if TX ring is full, so we don't overwrite
not handled TX descriptors

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-07-03 21:57:02 +08:00
p-szafonimateusz
0f537dcb97 drivers/net/{e1000|igc}: fix reinit for RX/TX rings
Descriptor head is managed by HW and should not be modified by SW unless:
1. device is after a reset
2. device is before enabling TX or RX

Also set correct tail for RX which should point at the end of ring
(descriptor ring is zero-indexed).

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-07-03 21:57:02 +08:00
p-szafonimateusz
bdde180d7a drivers/net/{e1000|igc}: disable TX by modify only TX enable bit
disable TX by modify only TX enable bit, otherwise we lose TX configuration

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-07-03 21:57:02 +08:00
p-szafonimateusz
0a8ef045ab drivers/net/{e1000|igc}: update link status when card is enabled
Update link status in case link status interrupt is missing.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-07-03 21:57:02 +08:00
p-szafonimateusz
7a8ac49836 drivers/net/{e1000|igc}: do not touch RX/TX rings when link status change
Do not reset RX/TX rings when link status change.
This can break internal card state which is impossible to recovery.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-07-03 21:57:02 +08:00
p-szafonimateusz
bccee707d6 drivers/net/{e1000|igc}: reset RX/TX rings after RX/TX disabled
reset RX/TX rings **after** RX/TX are disabled to make sure the rings are
not used by hardware when software modify rings state.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-07-03 21:57:02 +08:00
LuchianMihai
f4e8def270 drivers/net/Kconfig: Move NET_IGC_TXDESC and NET_IGC_RXDESC to NET_IGC menu 2025-07-03 00:16:24 +08:00
michal matias
c5a3089e87 drivers/net: Add support for the NCV7410 10BASE-T1S MAC-PHY
This commit adds driver for the Onsemi NCV7410 10BASE-T1S
Ethernet MAC-PHY.

Signed-off-by: michal matias <mich4l.matias@gmail.com>
2025-06-28 08:49:46 -03:00
dongjiuzhu1
a12d21e830 fs/file: unify prefix about file_xxx api, like file_open, file_ioctl
old:
fs_getfilep, fs_putfilep, fs_reffilep
new:
file_get, file_put, file_ref

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
Lars Kruse
3ce85ca54e style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00