Problem:
- `iob_copyout` to `d_buf` doesn't set `io_len` of the IOB, so `devif_poll` failed to copy the data into `buf` by `iob_copyout`
Modification:
- Just Move the IOB in `devif_forward`.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
1.Add cellular link layer enum definition and register flow
2.Add ioctl flow to set cellular NICs parameters
Signed-off-by: luojun1 <luojun1@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
1. separate command catagory of bt/pktradio from wireless ioctl
2. Remove commoand count limit to support vendor command
Signed-off-by: chao an <anchao@xiaomi.com>
* net/netdev/netdev_ioctl.c:
(netdev_ifr_ioctl): The ioctl SIOCGIFHWADDR provides the hardware
address (e.g., Ethernet MAC, etc.) of a network interface. It is
based on Linux. (BSD-based systems don't have this ioctl.) The Linux
implementation sets sa_family to ARPHRD_ETHER for Ethernet and IEEE
802.11 interfaces [1]. NuttX was setting it to NET_SOCK_FAMILY for
these interface types as well as 6LoWPAN and PKTRADIO; this was
incorrect and also the value of NET_SOCK_FAMILY varies based on
Kconfig settings. Correcting this to ARPHRD_ETHER for Ethernet and
IEEE 802.11 and ARPHRD_IEEE802154 for 6LoWPAN and PKTRADIO.
References:
[1] 'man 7 netdevice' on Linux.
* net/netdev/netdev_ioctl.c:
(netdev_ifr_ioctl): The ioctl SIOCSIFHWADDR sets the hardware address
(e.g., Ethernet MAC, etc.) of a network interface. Radio devices may
have different lengths of hardware addresses, such as
NET_6LOWPAN_EADDRSIZE (8), NET_6LOWPAN_SADDRSIZE (2), or
RADIO_MAX_ADDRLEN (8). Also, Kconfig CONFIG_PKTRADIO_ADDRLEN allows
the user to set any arbitrary size. Note that while the sister ioctl
SIOCGIFHWADDR "get hardware address" copies
`dev->d_mac.radio.nv_addrlen` bytes, SIOCSIFHWADDR was copying
NET_6LOWPAN_ADDRSIZE bytes unconditionally. Depending on which radio
is used, this could be incorrect. Fixing it to use
`dev->d_mac.radio.nv_addrlen` for SIOCSIFHWADDR as well. Also adding
DEBUGASSERT to ensure this is within bounds of source and
destination of the copy.
This fixes a regression caused by the following commit,
which prevents the file flag from being updated.
```
commit 28860b5242
Author: chao.an <anchao@xiaomi.com>
Date: Sat Mar 19 14:47:37 2022 +0800
net/netdev: fix switch case missing break
Signed-off-by: chao.an <anchao@xiaomi.com>
```
Note: some applications like mbedtls uses F_GETFL to confirm
the nonblock-ness of the socket. This is critical for such
applications.
error:
--------------------------------------
netdev/netdev_lladdrsize.c: In function ‘netdev_lladdrsize’:
netdev/netdev_lladdrsize.c:148:7: error: duplicate case value
148 | case NET_LL_BLUETOOTH:
| ^~~~
netdev/netdev_lladdrsize.c:119:7: note: previously used here
119 | case NET_LL_BLUETOOTH:
| ^~~~
BLUETOOTH_HDRLEN has been removed by:
---------------------------------
|commit aae0d92598
|Author: Gregory Nutt <gnutt@nuttx.org>
|Date: Sun Apr 1 15:21:58 2018 -0600
|
|wireless/bluetooth and net/bluetooth:
|
|Clean up some garbage left in Kconfig file that broke 'make menuconfig'.
|Clean up some craziness with Bluetooth frame length definitions.
Signed-off-by: chao.an <anchao@xiaomi.com>
Fix the arp address changed if netdev renew, since the
arp table should be cleared when the netdev carrier off
Signed-off-by: songlinzhang <songlinzhang@xiaomi.com>
In case of enabled packet forwarding mode, packets were forwarded in a reverse order
because of LIFO behavior of the connection event list.
The issue exposed only during high network traffic. Thus the event list started to grow
that resulted in changing the order of packets inside of groups of several packets
like the following: 3, 2, 1, 6, 5, 4, 8, 7 etc.
Remarks concerning the connection event list implementation:
* Now the queue (list) is FIFO as it should be.
* The list is singly linked.
* The list has a head pointer (inside of outer net_driver_s structure),
and a tail pointer is added into outer net_driver_s structure.
* The list item is devif_callback_s structure.
It still has two pointers to two different list chains (*nxtconn and *nxtdev).
* As before the first argument (*dev) of the list functions can be NULL,
while the other argument (*list) is effective (not NULL).
* An extra (*tail) argument is added to devif_callback_alloc()
and devif_conn_callback_free() functions.
* devif_callback_alloc() time complexity is O(1) (i.e. O(n) to fill the whole list).
* devif_callback_free() time complexity is O(n) (i.e. O(n^2) to empty the whole list).
* devif_conn_event() time complexity is O(n).
In the current net stack implementation, there is no mechanism
for notifying the loss of the wireless connection, if the network
is disconnected then application sends data packets through tcp,
the tcp_timer will keep retrying fetch the ack for awhile, the
connection status will not be able to be switched timely.
Change-Id: I84d1121527edafc6ee6ad56ba164838694e7e11c
Signed-off-by: chao.an <anchao@xiaomi.com>