All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Haiyang Zhang <haiyangz@microsoft.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, olaf@aepfle.de,
	jasowang@redhat.com, driverdev-devel@linuxdriverproject.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] hv_netvsc: Add support to set MTU reservation from guest side
Date: Fri, 3 Jul 2015 14:28:47 +0300	[thread overview]
Message-ID: <20150703112847.GA28762@mwanda> (raw)
In-Reply-To: <1435868255-10865-1-git-send-email-haiyangz@microsoft.com>

On Thu, Jul 02, 2015 at 01:17:35PM -0700, Haiyang Zhang wrote:
> When packet encapsulation is in use, the MTU needs to be reduced for
> headroom reservation.
> The existing code takes the updated MTU value only from the host side.
> But vSwitch extensions, such as Open vSwitch, require the flexibility
> to change the MTU to different values from within a guest during the
> lifecycle of a vNIC, when the encapsulation protocol is changed. The
> patch supports this kind of MTU changes.
> 
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
>  drivers/net/hyperv/netvsc_drv.c   |    3 +--
>  drivers/net/hyperv/rndis_filter.c |    2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index 358475e..68e7ece 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -743,8 +743,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
>  	if (nvdev->nvsp_version >= NVSP_PROTOCOL_VERSION_2)
>  		limit = NETVSC_MTU - ETH_HLEN;
>  
> -	/* Hyper-V hosts don't support MTU < ETH_DATA_LEN (1500) */
> -	if (mtu < ETH_DATA_LEN || mtu > limit)
> +	if (mtu < 68 || mtu > limit)

How did you calculate 68?  Avoid magic numbers like this, make it a
define.

regards,
dan carpenter


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Haiyang Zhang <haiyangz@microsoft.com>
Cc: olaf@aepfle.de, netdev@vger.kernel.org, jasowang@redhat.com,
	driverdev-devel@linuxdriverproject.org,
	linux-kernel@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH net-next] hv_netvsc: Add support to set MTU reservation from guest side
Date: Fri, 3 Jul 2015 14:28:47 +0300	[thread overview]
Message-ID: <20150703112847.GA28762@mwanda> (raw)
In-Reply-To: <1435868255-10865-1-git-send-email-haiyangz@microsoft.com>

On Thu, Jul 02, 2015 at 01:17:35PM -0700, Haiyang Zhang wrote:
> When packet encapsulation is in use, the MTU needs to be reduced for
> headroom reservation.
> The existing code takes the updated MTU value only from the host side.
> But vSwitch extensions, such as Open vSwitch, require the flexibility
> to change the MTU to different values from within a guest during the
> lifecycle of a vNIC, when the encapsulation protocol is changed. The
> patch supports this kind of MTU changes.
> 
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
>  drivers/net/hyperv/netvsc_drv.c   |    3 +--
>  drivers/net/hyperv/rndis_filter.c |    2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index 358475e..68e7ece 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -743,8 +743,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
>  	if (nvdev->nvsp_version >= NVSP_PROTOCOL_VERSION_2)
>  		limit = NETVSC_MTU - ETH_HLEN;
>  
> -	/* Hyper-V hosts don't support MTU < ETH_DATA_LEN (1500) */
> -	if (mtu < ETH_DATA_LEN || mtu > limit)
> +	if (mtu < 68 || mtu > limit)

How did you calculate 68?  Avoid magic numbers like this, make it a
define.

regards,
dan carpenter

  reply	other threads:[~2015-07-03 11:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-02 20:17 [PATCH net-next] hv_netvsc: Add support to set MTU reservation from guest side Haiyang Zhang
2015-07-02 20:17 ` Haiyang Zhang
2015-07-03 11:28 ` Dan Carpenter [this message]
2015-07-03 11:28   ` Dan Carpenter
2015-07-03 16:17   ` David Miller
2015-07-06 19:32     ` Haiyang Zhang
2015-07-06 19:32       ` Haiyang Zhang
  -- strict thread matches above, loose matches on Subject: below --
2015-06-26 19:06 Haiyang Zhang
2015-06-26 19:06 ` Haiyang Zhang

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=20150703112847.GA28762@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olaf@aepfle.de \
    /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.