2
0

701-net-0258-net-mscc-ocelot-adjust-MTU-on-the-CPU-port-in-NPI-mo.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. From b2f7c18c351737c2a053c39c09ef50870fd78c06 Mon Sep 17 00:00:00 2001
  2. From: Vladimir Oltean <[email protected]>
  3. Date: Thu, 14 Nov 2019 17:03:25 +0200
  4. Subject: [PATCH] net: mscc: ocelot: adjust MTU on the CPU port in NPI mode
  5. When using the NPI port, the DSA tag is passed through Ethernet, so the
  6. switch's MAC needs to accept it as it comes from the DSA master. Increase
  7. the MTU on the external CPU port to account for the length of the
  8. injection header.
  9. Without this patch, MTU-sized frames are dropped by the switch's CPU
  10. port on xmit, which is especially obvious in TCP sessions.
  11. Signed-off-by: Vladimir Oltean <[email protected]>
  12. Reviewed-by: Andrew Lunn <[email protected]>
  13. Reviewed-by: Florian Fainelli <[email protected]>
  14. Signed-off-by: David S. Miller <[email protected]>
  15. ---
  16. drivers/net/ethernet/mscc/ocelot.c | 9 +++++++++
  17. drivers/net/ethernet/mscc/ocelot.h | 2 ++
  18. 2 files changed, 11 insertions(+)
  19. --- a/drivers/net/ethernet/mscc/ocelot.c
  20. +++ b/drivers/net/ethernet/mscc/ocelot.c
  21. @@ -2232,9 +2232,18 @@ void ocelot_set_cpu_port(struct ocelot *
  22. * Only one port can be an NPI at the same time.
  23. */
  24. if (cpu < ocelot->num_phys_ports) {
  25. + int mtu = VLAN_ETH_FRAME_LEN + OCELOT_TAG_LEN;
  26. +
  27. ocelot_write(ocelot, QSYS_EXT_CPU_CFG_EXT_CPUQ_MSK_M |
  28. QSYS_EXT_CPU_CFG_EXT_CPU_PORT(cpu),
  29. QSYS_EXT_CPU_CFG);
  30. +
  31. + if (injection == OCELOT_TAG_PREFIX_SHORT)
  32. + mtu += OCELOT_SHORT_PREFIX_LEN;
  33. + else if (injection == OCELOT_TAG_PREFIX_LONG)
  34. + mtu += OCELOT_LONG_PREFIX_LEN;
  35. +
  36. + ocelot_port_set_mtu(ocelot, cpu, mtu);
  37. }
  38. /* CPU port Injection/Extraction configuration */
  39. --- a/drivers/net/ethernet/mscc/ocelot.h
  40. +++ b/drivers/net/ethernet/mscc/ocelot.h
  41. @@ -65,6 +65,8 @@ struct frame_info {
  42. #define IFH_REW_OP_ORIGIN_PTP 0x5
  43. #define OCELOT_TAG_LEN 16
  44. +#define OCELOT_SHORT_PREFIX_LEN 4
  45. +#define OCELOT_LONG_PREFIX_LEN 16
  46. #define OCELOT_SPEED_2500 0
  47. #define OCELOT_SPEED_1000 1