amd-xgbe: fixes to handle corner-cases
Subsystems (3)
Raju Rangoju
maintainercover amd-xgbe: fixes to handle corner-cases
This series include bug fixes to amd-xgbe driver.
Raju Rangoju (3):
amd-xgbe: handle corner-case during sfp hotplug
amd-xgbe: handle the corner-case during tx completion
amd-xgbe: propagate the correct speed and duplex status
drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 14 ++++++++++++++ drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 11 ++++++++--- drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 14 +++++++++++++- 3 files changed, 35 insertions(+), 4 deletions(-)
Signature · 1 line
2.25.1
Raju Rangoju
maintainerPATCH 1/3 amd-xgbe: handle corner-case during sfp hotplug
Force the mode change for SFI in Fixed PHY configurations. Fixed PHY configurations needs PLL to be enabled while doing mode set. When the SFP module isn't connected during boot, driver assumes AN is ON and attempts auto-negotiation. However, if the connected SFP comes up in Fixed PHY configuration the link will not come up as PLL isn't enabled while the initial mode set command is issued. So, force the mode change for SFI in Fixed PHY configuration to fix link issues.
--- drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +13 -1
@@ -1193,7 +1193,19 @@ static int xgbe_phy_config_fixed(struct xgbe_prv_data *pdata)if (pdata->phy.duplex !=DUPLEX_FULL )return -EINVAL ; -xgbe_set_mode (pdata, mode); +/* Force the mode change for SFI in Fixed PHY config. +* Fixed PHY configs needs PLL to be enabled while doing mode set. +* When the SFP module isn't connected during boot, driver assumes +* AN is ON and attempts autonegotiation. However, if the connected +* SFP comes up in Fixed PHY config, the link will not come up as +* PLL isn't enabled while the initial mode set command is issued. +* So, force the mode change for SFI in Fixed PHY configuration to +* fix link issues. +*/ +if (mode ==XGBE_MODE_SFI ) +xgbe_change_mode (pdata, mode); +else +xgbe_set_mode (pdata, mode);return 0 ; }
Signature · 1 line
2.25.1
Raju Rangoju
maintainerPATCH 2/3 amd-xgbe: handle the corner-case during tx completion
In reply to Raju RangojuThe existing implementation uses software logic to accumulate tx completions until the specified time (1ms) is met and then poll them. However, there exists a tiny gap which leads to a race between resetting and checking the tx_activate flag. Due to this the tx completions are not reported to upper layer and tx queue timeout kicks-in restarting the device.
To address this, introduce a tx cleanup mechanism as part of the periodic maintenance process.
--- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +14 -0
@@ -682,10 +682,24 @@ static void xgbe_service(struct work_struct *work)static void xgbe_service_timer (struct timer_list *t) {struct xgbe_prv_data *pdata =from_timer (pdata, t, service_timer); +struct xgbe_channel *channel; +unsigned int i;queue_work (pdata->dev_workqueue, &pdata->service_work);mod_timer (&pdata->service_timer, jiffies +HZ ); + +if (!pdata->tx_usecs) +return ; + +for (i =0 ; i < pdata->channel_count; i++) { + channel = pdata->channel[i]; +if (!channel->tx_ring || channel->tx_timer_active) +break ; + channel->tx_timer_active =1 ; +mod_timer (&channel->tx_timer, + jiffies +usecs_to_jiffies (pdata->tx_usecs)); + } }static void xgbe_init_timers (struct xgbe_prv_data *pdata)
Signature · 1 line
2.25.1
Raju Rangoju
maintainerPATCH 3/3 amd-xgbe: propagate the correct speed and duplex status
In reply to Raju Rangojuxgbe_get_link_ksettings() does not propagate correct speed and duplex information to ethtool during cable unplug. Due to which ethtool reports incorrect values for speed and duplex.
Address this by propagating correct information.
--- drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +8 -3
@@ -314,10 +314,15 @@ static int xgbe_get_link_ksettings(struct net_device *netdev, cmd->base.phy_address = pdata->phy.address; - cmd->base.autoneg = pdata->phy.autoneg; - cmd->base.speed = pdata->phy.speed; - cmd->base.duplex = pdata->phy.duplex; +if (netif_carrier_ok (netdev)) { + cmd->base.speed = pdata->phy.speed; + cmd->base.duplex = pdata->phy.duplex; + }else { + cmd->base.speed =SPEED_UNKNOWN ; + cmd->base.duplex =DUPLEX_UNKNOWN ; + } + cmd->base.autoneg = pdata->phy.autoneg; cmd->base.port =PORT_NONE ;XGBE_LM_COPY (cmd, supported, lks, supported);
Signature · 1 line
2.25.1
Re: [PATCH net 1/3] amd-xgbe: handle corner-case during sfp hotplug
In reply to Raju RangojuQuoted 8 lines · Raju Rangoju
Force the mode change for SFI in Fixed PHY configurations. Fixed PHY configurations needs PLL to be enabled while doing mode set. When the SFP module isn't connected during boot, driver assumes AN is ON and attempts auto-negotiation. However, if the connected SFP comes up in Fixed PHY configuration the link will not come up as PLL isn't enabled while the initial mode set command is issued. So, force the mode change for SFI in Fixed PHY configuration to fix link issues.
Quoted 4 lines
Fixes e57f7a3feaef ("amd-xgbe: Prepare for working with more than one type of phy")Acked-by Shyam Sundar S K <[email protected]>Signed-off-by Raju Rangoju <[email protected]>---
Thanks for our patches!
Quoted 28 lines
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +13
-1@@ -1193,7 +1193,19 @@ static int xgbe_phy_config_fixed(struct xgbe_prv_data *pdata)if (pdata->phy.duplex !=DUPLEX_FULL )return -EINVAL ; -xgbe_set_mode (pdata, mode); +/* Force the mode change for SFI in Fixed PHY config. +* Fixed PHY configs needs PLL to be enabled while doing mode set. +* When the SFP module isn't connected during boot, driver assumes +* AN is ON and attempts autonegotiation. However, if the connected +* SFP comes up in Fixed PHY config, the link will not come up as +* PLL isn't enabled while the initial mode set command is issued. +* So, force the mode change for SFI in Fixed PHY configuration to +* fix link issues. +*/ +if (mode ==XGBE_MODE_SFI ) +xgbe_change_mode (pdata, mode); +else +xgbe_set_mode (pdata, mode);return 0 ; }
Re: [PATCH net 2/3] amd-xgbe: handle the corner-case during tx completion
In reply to Raju RangojuQuoted 7 lines · Raju Rangoju
The existing implementation uses software logic to accumulate tx completions until the specified time (1ms) is met and then poll them. However, there exists a tiny gap which leads to a race between resetting and checking the
tx_activateflag. Due to this the tx completions are not reported to upper layer and tx queue timeout kicks-in restarting the device.
Quoted 7 lines
To address this, introduce a tx cleanup mechanism as part of the periodic maintenance process.
Fixes c5aa9e3b8156 ("amd-xgbe: Initial AMD 10GbE platform driver")Acked-by Shyam Sundar S K <[email protected]>Signed-off-by Raju Rangoju <[email protected]>---
Quoted 32 lines
drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/net/ethernet/amd/xgbe/xgbe-drv.c +14
-0@@ -682,10 +682,24 @@ static void xgbe_service(struct work_struct *work)static void xgbe_service_timer (struct timer_list *t) {struct xgbe_prv_data *pdata =from_timer (pdata, t, service_timer); +struct xgbe_channel *channel; +unsigned int i;queue_work (pdata->dev_workqueue, &pdata->service_work);mod_timer (&pdata->service_timer, jiffies +HZ ); + +if (!pdata->tx_usecs) +return ; + +for (i =0 ; i < pdata->channel_count; i++) { + channel = pdata->channel[i]; +if (!channel->tx_ring || channel->tx_timer_active) +break ; + channel->tx_timer_active =1 ; +mod_timer (&channel->tx_timer, + jiffies +usecs_to_jiffies (pdata->tx_usecs)); + } }static void xgbe_init_timers (struct xgbe_prv_data *pdata)
Re: [PATCH net 3/3] amd-xgbe: propagate the correct speed and duplex status
In reply to Raju RangojuQuoted 10 lines · Raju Rangoju
xgbe_get_link_ksettings()does not propagate correct speed and duplex information to ethtool during cable unplug. Due to which ethtool reports incorrect values for speed and duplex.Address this by propagating correct information.
Fixes 7c12aa08779c ("amd-xgbe: Move the PHY support into amd-xgbe")Acked-by Shyam Sundar S K <[email protected]>Signed-off-by Raju Rangoju <[email protected]>---
Quoted 26 lines
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +8
-3@@ -314,10 +314,15 @@ static int xgbe_get_link_ksettings(struct net_device *netdev, cmd->base.phy_address = pdata->phy.address; - cmd->base.autoneg = pdata->phy.autoneg; - cmd->base.speed = pdata->phy.speed; - cmd->base.duplex = pdata->phy.duplex; +if (netif_carrier_ok (netdev)) { + cmd->base.speed = pdata->phy.speed; + cmd->base.duplex = pdata->phy.duplex; + }else { + cmd->base.speed =SPEED_UNKNOWN ; + cmd->base.duplex =DUPLEX_UNKNOWN ; + } + cmd->base.autoneg = pdata->phy.autoneg; cmd->base.port =PORT_NONE ;XGBE_LM_COPY (cmd, supported, lks, supported);
This series was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 8 lines · On Wed, 22 Nov 2023 00:44:32 +0530 you wrote:
This series include bug fixes to amd-xgbe driver.
Raju Rangoju (3):
amd-xgbe: handle corner-case during sfp hotplug
amd-xgbe: handle the corner-case during tx completion
amd-xgbe: propagate the correct speed and duplex status[...]
Here is the summary with links:
- [net,1/3] amd-xgbe: handle corner-case during sfp hotplug
https://git.kernel.org/netdev/net/c/676ec53844cb - [net,2/3] amd-xgbe: handle the corner-case during tx completion https://git.kernel.org/netdev/net/c/7121205d5330 - [net,3/3] amd-xgbe: propagate the correct speed and duplex status https://git.kernel.org/netdev/net/c/7a2323ac24a5
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Re: [PATCH net 2/3] amd-xgbe: handle the corner-case during tx completion
In reply to Raju RangojuQuoted 9 lines · Raju Rangoju
The existing implementation uses software logic to accumulate tx completions until the specified time (1ms) is met and then poll them. However, there exists a tiny gap which leads to a race between resetting and checking the
tx_activateflag. Due to this the tx completions are not reported to upper layer and tx queue timeout kicks-in restarting the device.To address this, introduce a tx cleanup mechanism as part of the periodic maintenance process.
This looks to just be a work-around that happens to work (for now) and the actual race condition should be fixed.
Thanks,
Tom
Quoted 37 lines
Fixes c5aa9e3b8156 ("amd-xgbe: Initial AMD 10GbE platform driver")Acked-by Shyam Sundar S K <[email protected]>Signed-off-by Raju Rangoju <[email protected]>--- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/net/ethernet/amd/xgbe/xgbe-drv.c +14
-0@@ -682,10 +682,24 @@ static void xgbe_service(struct work_struct *work)static void xgbe_service_timer (struct timer_list *t) {struct xgbe_prv_data *pdata =from_timer (pdata, t, service_timer); +struct xgbe_channel *channel; +unsigned int i;queue_work (pdata->dev_workqueue, &pdata->service_work);mod_timer (&pdata->service_timer, jiffies +HZ ); + +if (!pdata->tx_usecs) +return ; + +for (i =0 ; i < pdata->channel_count; i++) { + channel = pdata->channel[i]; +if (!channel->tx_ring || channel->tx_timer_active) +break ; + channel->tx_timer_active =1 ; +mod_timer (&channel->tx_timer, + jiffies +usecs_to_jiffies (pdata->tx_usecs)); + } }static void xgbe_init_timers (struct xgbe_prv_data *pdata)