Re: [PATCH v2] can: bcm: add recvmsg flags for own, local and remote traffic

From: Oliver Hartkopp
Date: Sat Jan 20 2024 - 03:19:39 EST


Hi Nicolas,

On 2024-01-14 15:08, Nicolas Maier wrote:
v2:
* add 'traffic_flags' parameter to bcm_rx_update_and_send and
bcm_rx_cmp_to_index, to put the flags in the can frame after its data
has been copied

That looks great now!

@@ -344,8 +360,16 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head,
* relevant for updates that are generated by the
* BCM, where nframes is 1
*/
- if (head->nframes == 1)
+ if (head->nframes == 1) {
+ pflags = bcm_flags(skb);
+ *pflags = 0;

This initialization of the msg flags always has to be done.

I've sent a 'v3' patch that also simplifies the sock_skb_cb_check_size() usage:

https://lore.kernel.org/linux-can/20240120081018.2319-1-socketcan@xxxxxxxxxxxx/

Please check if the changes fit for you.

I also created some user space testing code in my can-tests repo to prove the correct msg flags implementation:

https://github.com/hartkopp/can-tests/commit/67957def0b0035d79000f5baad93f8764ec11fc4

Works fine ;-)

Best regards,
Oliver