715-28-v6.4-net-pcs-xpcs-use-Autoneg-bit-rather-than-an_enabled.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From 459fd2f11204c962e3153020f4f56748e0e10afb Mon Sep 17 00:00:00 2001
  2. From: "Russell King (Oracle)" <[email protected]>
  3. Date: Tue, 21 Mar 2023 15:58:49 +0000
  4. Subject: [PATCH] net: pcs: xpcs: use Autoneg bit rather than an_enabled
  5. The Autoneg bit in the advertising bitmap and state->an_enabled are
  6. always identical. Thus, we will be removing state->an_enabled.
  7. Use the Autoneg bit in the advertising bitmap to indicate whether
  8. autonegotiation should be used, rather than using the an_enabled
  9. member which will be going away.
  10. Signed-off-by: Russell King (Oracle) <[email protected]>
  11. Reviewed-by: Simon Horman <[email protected]>
  12. Signed-off-by: Jakub Kicinski <[email protected]>
  13. ---
  14. drivers/net/pcs/pcs-xpcs.c | 10 +++++++---
  15. 1 file changed, 7 insertions(+), 3 deletions(-)
  16. --- a/drivers/net/pcs/pcs-xpcs.c
  17. +++ b/drivers/net/pcs/pcs-xpcs.c
  18. @@ -931,6 +931,7 @@ static int xpcs_get_state_c73(struct dw_
  19. struct phylink_link_state *state,
  20. const struct xpcs_compat *compat)
  21. {
  22. + bool an_enabled;
  23. int ret;
  24. /* Link needs to be read first ... */
  25. @@ -948,11 +949,13 @@ static int xpcs_get_state_c73(struct dw_
  26. return xpcs_do_config(xpcs, state->interface, MLO_AN_INBAND, NULL);
  27. }
  28. - if (state->an_enabled && xpcs_aneg_done_c73(xpcs, state, compat)) {
  29. + an_enabled = linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
  30. + state->advertising);
  31. + if (an_enabled && xpcs_aneg_done_c73(xpcs, state, compat)) {
  32. state->an_complete = true;
  33. xpcs_read_lpa_c73(xpcs, state);
  34. xpcs_resolve_lpa_c73(xpcs, state);
  35. - } else if (state->an_enabled) {
  36. + } else if (an_enabled) {
  37. state->link = 0;
  38. } else if (state->link) {
  39. xpcs_resolve_pma(xpcs, state);
  40. @@ -1007,7 +1010,8 @@ static int xpcs_get_state_c37_1000basex(
  41. {
  42. int lpa, bmsr;
  43. - if (state->an_enabled) {
  44. + if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
  45. + state->advertising)) {
  46. /* Reset link state */
  47. state->link = false;