Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

can: rx-offload: add can_rx_offload_get_echo_skb_queue_tail()

Add can_rx_offload_get_echo_skb_queue_tail(). This function addds the
echo skb at the end of rx-offload the queue. This is intended for
devices without timestamp support.

Link: https://lore.kernel.org/all/20230718-gs_usb-rx-offload-v2-2-716e542d14d5@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

+30 -2
+26 -1
drivers/net/can/dev/rx-offload.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* Copyright (c) 2014 Protonic Holland, 3 3 * David Jander 4 - * Copyright (C) 2014-2021 Pengutronix, 4 + * Copyright (C) 2014-2021, 2023 Pengutronix, 5 5 * Marc Kleine-Budde <kernel@pengutronix.de> 6 6 */ 7 7 ··· 279 279 return 0; 280 280 } 281 281 EXPORT_SYMBOL_GPL(can_rx_offload_queue_tail); 282 + 283 + unsigned int 284 + can_rx_offload_get_echo_skb_queue_tail(struct can_rx_offload *offload, 285 + unsigned int idx, 286 + unsigned int *frame_len_ptr) 287 + { 288 + struct net_device *dev = offload->dev; 289 + struct net_device_stats *stats = &dev->stats; 290 + struct sk_buff *skb; 291 + unsigned int len; 292 + int err; 293 + 294 + skb = __can_get_echo_skb(dev, idx, &len, frame_len_ptr); 295 + if (!skb) 296 + return 0; 297 + 298 + err = can_rx_offload_queue_tail(offload, skb); 299 + if (err) { 300 + stats->rx_errors++; 301 + stats->tx_fifo_errors++; 302 + } 303 + 304 + return len; 305 + } 306 + EXPORT_SYMBOL_GPL(can_rx_offload_get_echo_skb_queue_tail); 282 307 283 308 void can_rx_offload_irq_finish(struct can_rx_offload *offload) 284 309 {
+4 -1
include/linux/can/rx-offload.h
··· 3 3 * linux/can/rx-offload.h 4 4 * 5 5 * Copyright (c) 2014 David Jander, Protonic Holland 6 - * Copyright (c) 2014-2017 Pengutronix, Marc Kleine-Budde <kernel@pengutronix.de> 6 + * Copyright (c) 2014-2017, 2023 Pengutronix, Marc Kleine-Budde <kernel@pengutronix.de> 7 7 */ 8 8 9 9 #ifndef _CAN_RX_OFFLOAD_H ··· 49 49 unsigned int *frame_len_ptr); 50 50 int can_rx_offload_queue_tail(struct can_rx_offload *offload, 51 51 struct sk_buff *skb); 52 + unsigned int can_rx_offload_get_echo_skb_queue_tail(struct can_rx_offload *offload, 53 + unsigned int idx, 54 + unsigned int *frame_len_ptr); 52 55 void can_rx_offload_irq_finish(struct can_rx_offload *offload); 53 56 void can_rx_offload_threaded_irq_finish(struct can_rx_offload *offload); 54 57 void can_rx_offload_del(struct can_rx_offload *offload);