950-0513-net-bcmgenet-Add-eee-module-parameter.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From d69cdb1cc4e3f717f63910cb2c40ca26f912ea34 Mon Sep 17 00:00:00 2001
  2. From: Phil Elwell <[email protected]>
  3. Date: Wed, 14 Dec 2022 15:00:51 +0000
  4. Subject: [PATCH] net: bcmgenet: Add 'eee' module parameter
  5. On some switches, having EEE enabled causes the link to become
  6. unstable. With this patch, adding 'genet.eee=N' to the kernel command
  7. line will cause EEE to be disabled on the link.
  8. See: https://github.com/raspberrypi/linux/issues/4289
  9. Signed-off-by: Phil Elwell <[email protected]>
  10. ---
  11. drivers/net/ethernet/broadcom/genet/bcmgenet.c | 14 ++++++++++++++
  12. 1 file changed, 14 insertions(+)
  13. --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
  14. +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
  15. @@ -70,6 +70,9 @@ static void bcmgenet_set_rx_mode(struct
  16. static bool skip_umac_reset = false;
  17. module_param(skip_umac_reset, bool, 0444);
  18. MODULE_PARM_DESC(skip_umac_reset, "Skip UMAC reset step");
  19. +static bool eee = true;
  20. +module_param(eee, bool, 0444);
  21. +MODULE_PARM_DESC(eee, "Enable EEE (default Y)");
  22. static inline void bcmgenet_writel(u32 value, void __iomem *offset)
  23. {
  24. @@ -3440,6 +3443,17 @@ static int bcmgenet_open(struct net_devi
  25. bcmgenet_phy_pause_set(dev, priv->rx_pause, priv->tx_pause);
  26. + if (!eee) {
  27. + struct ethtool_eee eee_data;
  28. +
  29. + ret = bcmgenet_get_eee(dev, &eee_data);
  30. + if (ret == 0) {
  31. + eee_data.eee_enabled = 0;
  32. + bcmgenet_set_eee(dev, &eee_data);
  33. + netdev_warn(dev, "EEE disabled\n");
  34. + }
  35. + }
  36. +
  37. bcmgenet_netif_start(dev);
  38. netif_tx_start_all_queues(dev);