szafonimateusz-mi opened a new pull request, #21043: URL: https://github.com/apache/nuttx/pull/21043
## Summary
Port SocketCAN changes that are used in the Xiaomi tree but are missing
upstream.
They are a prerequisite for a follow-up PR that separates the common CAN
socket state from CAN_RAW, so that other CAN protocols (ISO-TP) can be added
next to it.
## Impact
BREAKING CHANGE: the CAN socket connection options are renamed, a
configuration that sets them must use the new names:
`CONFIG_CAN_PREALLOC_CONNS` -> `CONFIG_NET_CAN_PREALLOC_CONNS`
`CONFIG_CAN_ALLOC_CONNS` -> `CONFIG_NET_CAN_ALLOC_CONNS`
`CONFIG_CAN_MAX_CONNS` -> `CONFIG_NET_CAN_MAX_CONNS`
Behavior changes for CAN_RAW sockets, all matching Linux SocketCAN:
- `CAN_RAW_LOOPBACK` is now enabled by default. A frame sent on one
CAN_RAW
socket is also delivered to the other CAN_RAW sockets on the same node
and
interface (subject to their filters). Applications that send and receive
on
the same node now see their own traffic; disable it with
`setsockopt(CAN_RAW_LOOPBACK, 0)`.
- With `CAN_RAW_RECV_OWN_MSGS` the sending socket receives its own frames
too,
flagged `MSG_CONFIRM`, which gives a TX confirmation.
- For interfaces that are not loopback devices, the stack does the
loopback
itself: each frame sent with loopback enabled is cloned (one extra IOB
per
frame) and passed through CAN input after the driver accepted it.
- Looped-back frames go through CAN input, so the `/proc/net/stat` CAN
`Received` counter also counts them.
- `getsockname()` works on CAN sockets: `AF_CAN` with the bound interface
index, or 0 when unbound.
- A blocked sender waiting for CAN send buffer space can no longer miss
its
wake-up (`NET_CAN_WRITE_BUFFERS` with `NET_SEND_BUFSIZE` > 0).
## Testing
automate tests from https://github.com/railab/nuttx-testlab on QEMU and SIM
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
