Skip to content

Commit

Permalink
net/txgbe: fix to set autoneg for 1G speed
Browse files Browse the repository at this point in the history
[ upstream commit 658dbfa6360fcda0a5798669f6eac8293e4a2d73 ]

Autoneg was always on for 1G speed, fix to set autoneg off.

Fixes: 01c3cf5 ("net/txgbe: add autoneg control read and write")
Fixes: e4c515a ("net/txgbe: add multi-speed link setup")

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
  • Loading branch information
Jiawen Wu authored and kevintraynor committed Jul 12, 2023
1 parent 5b72e18 commit 1077232
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
14 changes: 14 additions & 0 deletions drivers/net/txgbe/base/txgbe_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2279,10 +2279,24 @@ s32 txgbe_setup_mac_link_multispeed_fiber(struct txgbe_hw *hw,
}

if (speed & TXGBE_LINK_SPEED_1GB_FULL) {
u32 curr_autoneg;

speedcnt++;
if (highest_link_speed == TXGBE_LINK_SPEED_UNKNOWN)
highest_link_speed = TXGBE_LINK_SPEED_1GB_FULL;

status = hw->mac.check_link(hw, &link_speed, &link_up, false);
if (status != 0)
return status;

/* If we already have link at this speed, just jump out */
if (link_speed == TXGBE_LINK_SPEED_1GB_FULL) {
curr_autoneg = rd32_epcs(hw, SR_MII_MMD_CTL);
if (link_up && (hw->autoneg ==
!!(curr_autoneg & SR_MII_MMD_CTL_AN_EN)))
goto out;
}

/* Set the module link speed */
switch (hw->phy.media_type) {
case txgbe_media_type_fiber:
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/txgbe/base/txgbe_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,9 @@ txgbe_set_sgmii_an37_ability(struct txgbe_hw *hw)
wr32_epcs(hw, SR_MII_MMD_AN_CTL, 0x0105);
wr32_epcs(hw, SR_MII_MMD_DIGI_CTL, 0x0200);
value = rd32_epcs(hw, SR_MII_MMD_CTL);
value = (value & ~0x1200) | (0x1 << 12) | (0x1 << 9);
value = (value & ~0x1200) | (0x1 << 9);
if (hw->autoneg)
value |= SR_MII_MMD_CTL_AN_EN;
wr32_epcs(hw, SR_MII_MMD_CTL, value);
}

Expand Down
1 change: 1 addition & 0 deletions drivers/net/txgbe/base/txgbe_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ struct txgbe_hw {
bool allow_unsupported_sfp;
bool need_crosstalk_fix;
bool dev_start;
bool autoneg;
struct txgbe_devargs devarg;

uint64_t isb_dma;
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/txgbe/txgbe_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1776,6 +1776,7 @@ txgbe_dev_start(struct rte_eth_dev *dev)
speed = (TXGBE_LINK_SPEED_100M_FULL |
TXGBE_LINK_SPEED_1GB_FULL |
TXGBE_LINK_SPEED_10GB_FULL);
hw->autoneg = true;
} else {
if (*link_speeds & RTE_ETH_LINK_SPEED_10G)
speed |= TXGBE_LINK_SPEED_10GB_FULL;
Expand All @@ -1787,6 +1788,7 @@ txgbe_dev_start(struct rte_eth_dev *dev)
speed |= TXGBE_LINK_SPEED_1GB_FULL;
if (*link_speeds & RTE_ETH_LINK_SPEED_100M)
speed |= TXGBE_LINK_SPEED_100M_FULL;
hw->autoneg = false;
}

err = hw->mac.setup_link(hw, speed, link_up);
Expand Down

0 comments on commit 1077232

Please sign in to comment.