netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 3/3] sunvnet: generate ICMP PTMUD messages for smaller port MTUs
@ 2014-09-12 22:22 David L Stevens
  2014-09-12 22:26 ` David Miller
  2014-09-13 20:19 ` Sergei Shtylyov
  0 siblings, 2 replies; 4+ messages in thread
From: David L Stevens @ 2014-09-12 22:22 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

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 |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index b557ec4..1251603 100644
--- a/drivers/net/ethernet/sun/sunvnet.c
+++ b/drivers/net/ethernet/sun/sunvnet.c
@@ -17,6 +17,13 @@
 #include <linux/mutex.h>
 #include <linux/if_vlan.h>
 +#if IS_ENABLED(CONFIG_IPV6)
+#include <linux/icmpv6.h>
+#endif
+
+#include <net/icmp.h>
+#include <net/route.h>
+
 #include <asm/vio.h>
 #include <asm/ldc.h>
 @@ -752,6 +759,34 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		goto out_dropped;
  	if (skb->len > port->vio.rmtu) {
+		unsigned long localmtu = port->vio.rmtu - ETH_HLEN;
+
+		if (port->vio.ver.major == 1 && port->vio.ver.minor >= 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)
+		else if (skb->protocol == htons(ETH_P_IPV6))
+			icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu);
+#endif
 		goto out_dropped;
 	}
 -- 1.7.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 3/3] sunvnet: generate ICMP PTMUD messages for smaller port MTUs
  2014-09-12 22:22 [PATCH net-next 3/3] sunvnet: generate ICMP PTMUD messages for smaller port MTUs David L Stevens
@ 2014-09-12 22:26 ` David Miller
  2014-09-13 20:19 ` Sergei Shtylyov
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2014-09-12 22:26 UTC (permalink / raw)
  To: david.stevens; +Cc: netdev

From: David L Stevens <david.stevens@oracle.com>
Date: Fri, 12 Sep 2014 18:22:52 -0400

> +		if (skb->protocol == htons(ETH_P_IP))
> +		{

Openning braces should be on the same line as the if() statement.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 3/3] sunvnet: generate ICMP PTMUD messages for smaller port MTUs
  2014-09-12 22:22 [PATCH net-next 3/3] sunvnet: generate ICMP PTMUD messages for smaller port MTUs David L Stevens
  2014-09-12 22:26 ` David Miller
@ 2014-09-13 20:19 ` Sergei Shtylyov
  2014-09-14  2:18   ` David L Stevens
  1 sibling, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2014-09-13 20:19 UTC (permalink / raw)
  To: David L Stevens, David Miller; +Cc: netdev

Hello.

On 9/13/2014 1:22 AM, 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 |   35 +++++++++++++++++++++++++++++++++++
>   1 files changed, 35 insertions(+), 0 deletions(-)

> diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
> index b557ec4..1251603 100644
> --- a/drivers/net/ethernet/sun/sunvnet.c
> +++ b/drivers/net/ethernet/sun/sunvnet.c
> @@ -17,6 +17,13 @@
>   #include <linux/mutex.h>
>   #include <linux/if_vlan.h>
>   +#if IS_ENABLED(CONFIG_IPV6)

    Patch spoiled as well...

> +#include <linux/icmpv6.h>
> +#endif
> +
> +#include <net/icmp.h>
> +#include <net/route.h>
> +
>   #include <asm/vio.h>
>   #include <asm/ldc.h>

WBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 3/3] sunvnet: generate ICMP PTMUD messages for smaller port MTUs
  2014-09-13 20:19 ` Sergei Shtylyov
@ 2014-09-14  2:18   ` David L Stevens
  0 siblings, 0 replies; 4+ messages in thread
From: David L Stevens @ 2014-09-14  2:18 UTC (permalink / raw)
  To: Sergei Shtylyov, David Miller; +Cc: netdev



On 09/13/2014 04:19 PM, Sergei Shtylyov wrote:

>    Patch spoiled as well...

Yes, it was mangled by my mailer. I think PATCHv3, the latest I sent, is
ok, but please try that. And, of course, let me know if it doesn't work.

						+-DLS

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-14  2:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-12 22:22 [PATCH net-next 3/3] sunvnet: generate ICMP PTMUD messages for smaller port MTUs David L Stevens
2014-09-12 22:26 ` David Miller
2014-09-13 20:19 ` Sergei Shtylyov
2014-09-14  2:18   ` David L Stevens

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).