# Re: \[PATCH\] can: dev: extend can\_put\_echo\_skb() to handle frame\_len

- From: Marc Kleine-Budde \<mkl@pengutronix.de\>
- Date: 2021-01-11 09:40:02 
- List: linux-can
- Page: https://ratatoskr.run/linux-can/2021/01/9355023
- Thread: https://ratatoskr.run/linux-can/2021/01/9354995/t.md

```text
On 1/11/21 7:13 AM, Vincent Mailhol wrote:
[...]

> diff --git a/drivers/net/can/dev/skb.c b/drivers/net/can/dev/skb.c
> index 568dc28f7a4e..64bd2b60febc 100644
> --- a/drivers/net/can/dev/skb.c
> +++ b/drivers/net/can/dev/skb.c
> @@ -38,7 +38,7 @@ void can_flush_echo_skb(struct net_device *dev)
>   * priv->echo_skb, if necessary.
>   */
>  int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
> -		     unsigned int idx)
> +		     unsigned int idx, unsigned int frame_len)
>  {
>  	struct can_priv *priv = netdev_priv(dev);
>  
> @@ -62,6 +62,10 @@ int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
>  		skb->ip_summed = CHECKSUM_UNNECESSARY;
>  		skb->dev = dev;
>  
> +		/* save frame_len to reuse it when transmission is completed */
> +		if (frame_len)
> +			can_skb_prv(skb)->frame_len = frame_len;
> +

I think we can assign it unconditionally?

>  		/* save this skb for tx interrupt echo handling */
>  		priv->echo_skb[idx] = skb;
>  	} else {

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

```

## Attachments

- [signature.asc](https://ratatoskr.run/linux-can/2021/01/9355023/attachment/0) (application/pgp-signature, 488 bytes)
