diff mbox series

[net-next,5/5,v2] net: gemini: Indicate that we can handle jumboframes

Message ID 20180704183324.10605-5-linus.walleij@linaro.org
State Superseded
Headers show
Series [net-next,1/5,v2] net: gemini: Look up L3 maxlen from table | expand

Commit Message

Linus Walleij July 4, 2018, 6:33 p.m. UTC
The hardware supposedly handles frames up to 10236 bytes and
implements .ndo_change_mtu() so accept 10236 minus the ethernet
header for a VLAN tagged frame on the netdevices. Use
ETH_MIN_MTU as minimum MTU.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
ChangeLog v1->v2:
- Change the min MTU from 256 (vendor code) to ETH_MIN_MTU
  which makes more sense.
---
 drivers/net/ethernet/cortina/gemini.c | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.17.1

Comments

Andrew Lunn July 4, 2018, 8:35 p.m. UTC | #1
On Wed, Jul 04, 2018 at 08:33:24PM +0200, Linus Walleij wrote:
> The hardware supposedly handles frames up to 10236 bytes and

> implements .ndo_change_mtu() so accept 10236 minus the ethernet

> header for a VLAN tagged frame on the netdevices. Use

> ETH_MIN_MTU as minimum MTU.

> 

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


Hi Linus

Did you try with an MTU of 68? Maybe the vendor picked 256 because of
a hardware limit?

Otherwise the change looks good.

	  Andrew
Linus Walleij July 11, 2018, 7:10 p.m. UTC | #2
On Wed, Jul 4, 2018 at 10:35 PM Andrew Lunn <andrew@lunn.ch> wrote:
>

> On Wed, Jul 04, 2018 at 08:33:24PM +0200, Linus Walleij wrote:

> > The hardware supposedly handles frames up to 10236 bytes and

> > implements .ndo_change_mtu() so accept 10236 minus the ethernet

> > header for a VLAN tagged frame on the netdevices. Use

> > ETH_MIN_MTU as minimum MTU.

> >

> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

>

> Hi Linus

>

> Did you try with an MTU of 68? Maybe the vendor picked 256 because of

> a hardware limit?


Yeah works fine:

ping -s 68 169.254.1.2
PING 169.254.1.2 (169.254.1.2) 68(96) bytes of data.
76 bytes from 169.254.1.2: icmp_seq=1 ttl=64 time=0.359 ms
76 bytes from 169.254.1.2: icmp_seq=2 ttl=64 time=0.346 ms
76 bytes from 169.254.1.2: icmp_seq=3 ttl=64 time=0.351 ms

This also works fine:

ping -s 9000 169.254.1.2
PING 169.254.1.2 (169.254.1.2) 9000(9028) bytes of data.
9008 bytes from 169.254.1.2: icmp_seq=1 ttl=64 time=1.45 ms
9008 bytes from 169.254.1.2: icmp_seq=2 ttl=64 time=1.68 ms
9008 bytes from 169.254.1.2: icmp_seq=3 ttl=64 time=1.55 ms

I'll send new patches with all suggested changes soon :)

Thanks a lot for your help!

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
index 4e341570047f..af38f9869734 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -2476,6 +2476,11 @@  static int gemini_ethernet_port_probe(struct platform_device *pdev)
 
 	netdev->hw_features = GMAC_OFFLOAD_FEATURES;
 	netdev->features |= GMAC_OFFLOAD_FEATURES | NETIF_F_GRO;
+	/* We can handle jumbo frames up to 10236 bytes so, let's accept
+	 * payloads of 10236 bytes minus VLAN and ethernet header
+	 */
+	netdev->min_mtu = ETH_MIN_MTU;
+	netdev->max_mtu = 10236 - VLAN_ETH_HLEN;
 
 	port->freeq_refill = 0;
 	netif_napi_add(netdev, &port->napi, gmac_napi_poll,