Re: [PATCH v1 03/10] j1939: move j1939_tp_max_packet_size to priv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed,  5 Dec 2018 07:07:50 +0100
Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> wrote:

> Potentially we will be able to configure max packet size per interface.

from userspace right?

> 
> Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> ---
>  net/can/j1939/j1939-priv.h |  1 +
>  net/can/j1939/transport.c  | 10 ++++------
>  2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/net/can/j1939/j1939-priv.h b/net/can/j1939/j1939-priv.h
> index 30fb7e03b102..c9ad7b26b8d4 100644
> --- a/net/can/j1939/j1939-priv.h
> +++ b/net/can/j1939/j1939-priv.h
> @@ -63,6 +63,7 @@ struct j1939_priv {
>  	struct list_head tp_sessionq;
>  	struct list_head tp_extsessionq;
>  	wait_queue_head_t tp_wait;
> +	unsigned int tp_max_packet_size;
>  };
>  
>  void j1939_ecu_put(struct j1939_ecu *ecu);
> diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
> index 3770d11a7775..2e85b2538682 100644
> --- a/net/can/j1939/transport.c
> +++ b/net/can/j1939/transport.c
> @@ -41,7 +41,6 @@ enum j1939_xtp_abort {
>  #define J1939_MAX_ETP_PACKET_SIZE (7 * 0x00ffffff)
>  
>  static unsigned int j1939_tp_block = 255;
> -static unsigned int j1939_tp_max_packet_size = J1939_MAX_ETP_PACKET_SIZE;
>  static unsigned int j1939_tp_retry_ms = 20;
>  static unsigned int j1939_tp_packet_delay;
>  static unsigned int j1939_tp_padding = 1;
> @@ -1018,8 +1017,7 @@ static void j1939_xtp_rx_rts(struct j1939_priv *priv, struct sk_buff *skb,
>  			len = j1939_etp_ctl_to_size(dat);
>  			if (len > J1939_MAX_ETP_PACKET_SIZE)
>  				abort = J1939_XTP_ABORT_FAULT;
> -			else if (j1939_tp_max_packet_size &&
> -				 (len > j1939_tp_max_packet_size))
> +			else if (len > priv->tp_max_packet_size)
>  				abort = J1939_XTP_ABORT_RESOURCE;
>  			else if (len <= J1939_MAX_TP_PACKET_SIZE)
>  				abort = J1939_XTP_ABORT_FAULT;
> @@ -1027,8 +1025,7 @@ static void j1939_xtp_rx_rts(struct j1939_priv *priv, struct sk_buff *skb,
>  			len = j1939_tp_ctl_to_size(dat);
>  			if (len > J1939_MAX_TP_PACKET_SIZE)
>  				abort = J1939_XTP_ABORT_FAULT;
> -			else if (j1939_tp_max_packet_size &&
> -				 (len > j1939_tp_max_packet_size))
> +			else if (len > priv->tp_max_packet_size)
>  				abort = J1939_XTP_ABORT_RESOURCE;
>  		}
>  		if (abort) {
> @@ -1232,7 +1229,7 @@ int j1939_tp_send(struct j1939_priv *priv, struct sk_buff *skb)
>  		/* avoid conflict */
>  		return -EDOM;
>  
> -	if (skb->len > j1939_tp_max_packet_size)
> +	if (skb->len > priv->tp_max_packet_size)
>  		return -EMSGSIZE;
>  
>  	if (skb->len > J1939_MAX_TP_PACKET_SIZE)
> @@ -1394,4 +1391,5 @@ void j1939_tp_init(struct j1939_priv *priv)
>  	INIT_LIST_HEAD(&priv->tp_sessionq);
>  	INIT_LIST_HEAD(&priv->tp_extsessionq);
>  	init_waitqueue_head(&priv->tp_wait);
> +	priv->tp_max_packet_size = J1939_MAX_ETP_PACKET_SIZE;
>  }

Ack

-- 
Robin van der Gracht
Protonic Holland




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux