netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: David L Stevens <david.stevens@oracle.com>,
	David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCHv5 net-next 3/3] sunvnet: generate ICMP PTMUD messages for smaller port MTUs
Date: Thu, 18 Sep 2014 00:13:32 +0300	[thread overview]
Message-ID: <5419F97C.1080105@cogentembedded.com> (raw)
In-Reply-To: <5419F3E5.4050708@oracle.com>

Hello.

On 9/17/2014 11:49 PM, David L Stevens wrote:

> This patch sends ICMP and ICMPv6 messages for Path MTU Discovery when a remote
> port MTU is smaller than the device MTU. This allows mixing newer VIO protocol
> devices that support MTU negotiation with older devices that do not on the
> same vswitch. It also allows Linux-Linux LDOMs to use 64K-1 data packets even
> though Solaris vswitch is limited to <16K MTU.

> Signed-off-by: David L Stevens <david.stevens@oracle.com>
> ---
>   drivers/net/ethernet/sun/sunvnet.c |   37 +++++++++++++++++++++++++++++++++++-
>   1 files changed, 36 insertions(+), 1 deletions(-)

> diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
> index 5e64e60..3c4ee18 100644
> --- a/drivers/net/ethernet/sun/sunvnet.c
> +++ b/drivers/net/ethernet/sun/sunvnet.c
[...]
> @@ -791,8 +798,36 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
>   	if (unlikely(!port))
>   		goto out_dropped;
>
> -	if (skb->len > port->rmtu)
> +	if (skb->len > port->rmtu) {
> +		unsigned long localmtu = port->rmtu - ETH_HLEN;
> +
> +		if (vio_version_after_eq(&port->vio, 1, 3))
> +			localmtu -= VLAN_HLEN;
> +
> +		if (skb->protocol == htons(ETH_P_IP)) {
> +			struct flowi4 fl4;
> +			struct rtable *rt = NULL;
> +
> +			memset(&fl4, 0, sizeof(fl4));
> +			fl4.flowi4_oif = dev->ifindex;
> +			fl4.flowi4_tos = RT_TOS(ip_hdr(skb)->tos);
> +			fl4.daddr = ip_hdr(skb)->daddr;
> +			fl4.saddr = ip_hdr(skb)->saddr;
> +
> +			rt = ip_route_output_key(dev_net(dev), &fl4);
> +			if (!IS_ERR(rt)) {
> +				skb_dst_set(skb, &rt->dst);
> +				icmp_send(skb, ICMP_DEST_UNREACH,
> +					  ICMP_FRAG_NEEDED,
> +					  htonl(localmtu));
> +			}
> +		}
> +#if IS_ENABLED(CONFIG_IPV6)

    This #if could be avoided by extending the *if* statement below, no?

> +		else if (skb->protocol == htons(ETH_P_IPV6))
> +			icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu);
> +#endif
>   		goto out_dropped;
> +	}

WBR, Sergei

  reply	other threads:[~2014-09-17 21:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17 20:49 [PATCHv5 net-next 3/3] sunvnet: generate ICMP PTMUD messages for smaller port MTUs David L Stevens
2014-09-17 21:13 ` Sergei Shtylyov [this message]
2014-09-17 22:03   ` David L Stevens
2014-09-17 22:43 ` Sowmini Varadhan
2014-09-17 23:41   ` David L Stevens
2014-09-18 19:23     ` Sowmini Varadhan
2014-09-18 20:09       ` David L Stevens

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=5419F97C.1080105@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=david.stevens@oracle.com \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).