All of lore.kernel.org
 help / color / mirror / Atom feed
From: subashab@codeaurora.org
To: Loic Poulain <loic.poulain@linaro.org>
Cc: stranche@codeaurora.org, netdev@vger.kernel.org, kuba@kernel.org
Subject: Re: [PATCH] net: rmnet: Adjust virtual device MTU on real device capability
Date: Fri, 04 Dec 2020 14:56:22 -0700	[thread overview]
Message-ID: <3a2ca2c269911de71df6dca2e981f7fe@codeaurora.org> (raw)
In-Reply-To: <1607017240-10582-1-git-send-email-loic.poulain@linaro.org>

On 2020-12-03 10:40, Loic Poulain wrote:
> A submitted qmap/rmnet packet size can not be larger than the linked
> interface (real_dev) MTU. This patch ensures that the rmnet virtual
> iface MTU is configured according real device capability.
> 
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
>  drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> index d58b51d..d1d7328 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> @@ -60,9 +60,14 @@ static netdev_tx_t rmnet_vnd_start_xmit(struct 
> sk_buff
> *skb,
> 
>  static int rmnet_vnd_change_mtu(struct net_device *rmnet_dev, int
> new_mtu)
>  {
> +	struct rmnet_priv *priv = netdev_priv(rmnet_dev);
> +
>  	if (new_mtu < 0 || new_mtu > RMNET_MAX_PACKET_SIZE)
>  		return -EINVAL;
> 
> +	if (priv->real_dev && (new_mtu + RMNET_NEEDED_HEADROOM) >
> priv->real_dev->mtu)
> +		return -EINVAL;
> +
>  	rmnet_dev->mtu = new_mtu;
>  	return 0;
>  }
> @@ -242,6 +247,9 @@ int rmnet_vnd_newlink(u8 id, struct net_device
> *rmnet_dev,
> 
>  	priv->real_dev = real_dev;
> 
> +	/* Align default MTU with real_dev MTU */
> +	rmnet_vnd_change_mtu(rmnet_dev, real_dev->mtu -
> RMNET_NEEDED_HEADROOM);
> +
>  	rc = register_netdevice(rmnet_dev);
>  	if (!rc) {
>  		ep->egress_dev = rmnet_dev;

This would need similar checks in the NETDEV_PRECHANGEMTU
netdev notifier.

  reply	other threads:[~2020-12-04 21:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 17:40 [PATCH] net: rmnet: Adjust virtual device MTU on real device capability Loic Poulain
2020-12-04 21:56 ` subashab [this message]
2020-12-07 16:45   ` Loic Poulain
2020-12-07 20:16     ` Jakub Kicinski
2020-12-08  8:19       ` subashab
2020-12-08 14:50         ` Loic Poulain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3a2ca2c269911de71df6dca2e981f7fe@codeaurora.org \
    --to=subashab@codeaurora.org \
    --cc=kuba@kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=stranche@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.