Skip to content

Commit d9775fb

Browse files
author
Paolo Abeni
committed
Merge branch 'amd-xgbe-fixes-to-handle-corner-cases'
Raju Rangoju says: ==================== amd-xgbe: fixes to handle corner-cases This series include bug fixes to amd-xgbe driver. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 818ad9c + 7a2323a commit d9775fb

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

drivers/net/ethernet/amd/xgbe/xgbe-drv.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,24 @@ static void xgbe_service(struct work_struct *work)
682682
static void xgbe_service_timer(struct timer_list *t)
683683
{
684684
struct xgbe_prv_data *pdata = from_timer(pdata, t, service_timer);
685+
struct xgbe_channel *channel;
686+
unsigned int i;
685687

686688
queue_work(pdata->dev_workqueue, &pdata->service_work);
687689

688690
mod_timer(&pdata->service_timer, jiffies + HZ);
691+
692+
if (!pdata->tx_usecs)
693+
return;
694+
695+
for (i = 0; i < pdata->channel_count; i++) {
696+
channel = pdata->channel[i];
697+
if (!channel->tx_ring || channel->tx_timer_active)
698+
break;
699+
channel->tx_timer_active = 1;
700+
mod_timer(&channel->tx_timer,
701+
jiffies + usecs_to_jiffies(pdata->tx_usecs));
702+
}
689703
}
690704

691705
static void xgbe_init_timers(struct xgbe_prv_data *pdata)

drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,15 @@ static int xgbe_get_link_ksettings(struct net_device *netdev,
314314

315315
cmd->base.phy_address = pdata->phy.address;
316316

317-
cmd->base.autoneg = pdata->phy.autoneg;
318-
cmd->base.speed = pdata->phy.speed;
319-
cmd->base.duplex = pdata->phy.duplex;
317+
if (netif_carrier_ok(netdev)) {
318+
cmd->base.speed = pdata->phy.speed;
319+
cmd->base.duplex = pdata->phy.duplex;
320+
} else {
321+
cmd->base.speed = SPEED_UNKNOWN;
322+
cmd->base.duplex = DUPLEX_UNKNOWN;
323+
}
320324

325+
cmd->base.autoneg = pdata->phy.autoneg;
321326
cmd->base.port = PORT_NONE;
322327

323328
XGBE_LM_COPY(cmd, supported, lks, supported);

drivers/net/ethernet/amd/xgbe/xgbe-mdio.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,19 @@ static int xgbe_phy_config_fixed(struct xgbe_prv_data *pdata)
11931193
if (pdata->phy.duplex != DUPLEX_FULL)
11941194
return -EINVAL;
11951195

1196-
xgbe_set_mode(pdata, mode);
1196+
/* Force the mode change for SFI in Fixed PHY config.
1197+
* Fixed PHY configs needs PLL to be enabled while doing mode set.
1198+
* When the SFP module isn't connected during boot, driver assumes
1199+
* AN is ON and attempts autonegotiation. However, if the connected
1200+
* SFP comes up in Fixed PHY config, the link will not come up as
1201+
* PLL isn't enabled while the initial mode set command is issued.
1202+
* So, force the mode change for SFI in Fixed PHY configuration to
1203+
* fix link issues.
1204+
*/
1205+
if (mode == XGBE_MODE_SFI)
1206+
xgbe_change_mode(pdata, mode);
1207+
else
1208+
xgbe_set_mode(pdata, mode);
11971209

11981210
return 0;
11991211
}

0 commit comments

Comments
 (0)