net: stmmac: Add ethtool support for get|set channels
Subsystems (4)
cover net: stmmac: Add ethtool support for get|set channels
This patch set is to add support for user to get or set Tx/Rx channel via ethtool. There are two patches that fixes bug introduced on upstream in order to have the feature work.
Tested on Intel Tigerlake Platform.
Aashish Verma (1):
net: stmmac: Fix incorrect location to set real_num_rx|tx_queues
Ong Boon Leong (2):
net: stmmac: add ethtool support for get/set channels
net: stmmac: use netif_tx_start|stop_all_queues() function
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 26 ++++ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 135 +++++++++--------- 3 files changed, 98 insertions(+), 64 deletions(-)
Signature · 1 line
2.17.0
PATCH 1/3 net: stmmac: add ethtool support for get/set channels
From: Ong Boon Leong <[email protected]>
Restructure NAPI add and delete process so that we can call them accordingly in open() and ethtool_set_channels() accordingly.
Introduced stmmac_reinit_queues() to handle the transition needed for changing Rx & Tx channels accordingly.
--- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 26 +++++ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 94 +++++++++++++------ 3 files changed, 93 insertions(+), 28 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac.h +1 -0
@@ -264,6 +264,7 @@ int stmmac_dvr_probe(struct device *device, struct stmmac_resources *res);void stmmac_disable_eee_mode (struct stmmac_priv *priv);bool stmmac_eee_init (struct stmmac_priv *priv); +int stmmac_reinit_queues (struct net_device *dev,u32 rx_cnt,u32 tx_cnt);#if IS_ENABLED (CONFIG_STMMAC_SELFTESTS ) void stmmac_selftest_run(struct net_device *dev,
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +26 -0
@@ -840,6 +840,30 @@ static int stmmac_set_rxfh(struct net_device *dev, const u32 *indir, priv->plat->rx_queues_to_use); } +static void stmmac_get_channels (struct net_device *dev, +struct ethtool_channels *chan) +{ +struct stmmac_priv *priv =netdev_priv (dev); + + chan->rx_count = priv->plat->rx_queues_to_use; + chan->tx_count = priv->plat->tx_queues_to_use; + chan->max_rx = priv->dma_cap.number_rx_queues; + chan->max_tx = priv->dma_cap.number_tx_queues; +} + +static int stmmac_set_channels (struct net_device *dev, +struct ethtool_channels *chan) +{ +struct stmmac_priv *priv =netdev_priv (dev); + +if (chan->rx_count > priv->dma_cap.number_rx_queues || + chan->tx_count > priv->dma_cap.number_tx_queues || + !chan->rx_count || !chan->tx_count) +return -EINVAL ; + +return stmmac_reinit_queues (dev, chan->rx_count, chan->tx_count); +} +static int stmmac_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info) {
@@ -941,6 +965,8 @@ static const struct ethtool_ops stmmac_ethtool_ops = { .get_ts_info = stmmac_get_ts_info, .get_coalesce = stmmac_get_coalesce, .set_coalesce = stmmac_set_coalesce, + .get_channels = stmmac_get_channels, + .set_channels = stmmac_set_channels, .get_tunable = stmmac_get_tunable, .set_tunable = stmmac_set_tunable, .get_link_ksettings = stmmac_ethtool_get_link_ksettings,
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +66 -28
118 lines not on this page · raw message
Signature · 7 lines
2.17.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 2/3 net: stmmac: Fix incorrect location to set real_num_rx|tx_queues
In reply to Wong Vee KheeFrom: Aashish Verma <[email protected]>
netif_set_real_num_tx_queues() & netif_set_real_num_rx_queues() should be used to inform network stack about the real Tx & Rx queue (active) number in both stmmac_open() and stmmac_resume(), therefore, we move the code from stmmac_dvr_probe() to stmmac_hw_setup().
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 -4
@@ -2733,6 +2733,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)stmmac_enable_tbs (priv, priv->ioaddr, enable, chan); } +/* Configure real RX and TX queues */ +netif_set_real_num_rx_queues (dev, priv->plat->rx_queues_to_use); +netif_set_real_num_tx_queues (dev, priv->plat->tx_queues_to_use); +/* Start the ball rolling... */ stmmac_start_all_dma (priv);
@@ -4883,10 +4887,6 @@ int stmmac_dvr_probe(struct device *device,stmmac_check_ether_addr (priv); -/* Configure real RX and TX queues */ -netif_set_real_num_rx_queues (ndev, priv->plat->rx_queues_to_use); -netif_set_real_num_tx_queues (ndev, priv->plat->tx_queues_to_use); - ndev->netdev_ops = &stmmac_netdev_ops; ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
Signature · 1 line
2.17.0
PATCH 3/3 net: stmmac: use netif_tx_start|stop_all_queues() function
In reply to Wong Vee KheeFrom: Ong Boon Leong <[email protected]>
The current implementation of stmmac_stop_all_queues() and stmmac_start_all_queues() will not work correctly when the value of tx_queues_to_use is changed through ethtool -L DEVNAME rx N tx M command.
Also, netif_tx_start|stop_all_queues() are only needed in driver open() and close() only.
--- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 33 +------------------ 1 file changed, 1 insertion(+), 32 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -32
@@ -176,32 +176,6 @@ static void stmmac_enable_all_queues(struct stmmac_priv *priv) } } -/** -* stmmac_stop_all_queues - Stop all queues -* @priv: driver private structure -*/ -static void stmmac_stop_all_queues (struct stmmac_priv *priv) -{ -u32 tx_queues_cnt = priv->plat->tx_queues_to_use; -u32 queue; - -for (queue =0 ; queue < tx_queues_cnt; queue++) -netif_tx_stop_queue (netdev_get_tx_queue (priv->dev, queue)); -} - -/** -* stmmac_start_all_queues - Start all queues -* @priv: driver private structure -*/ -static void stmmac_start_all_queues (struct stmmac_priv *priv) -{ -u32 tx_queues_cnt = priv->plat->tx_queues_to_use; -u32 queue; - -for (queue =0 ; queue < tx_queues_cnt; queue++) -netif_tx_start_queue (netdev_get_tx_queue (priv->dev, queue)); -} -static void stmmac_service_event_schedule (struct stmmac_priv *priv) { if (!test_bit(STMMAC_DOWN, &priv->state) &&
@@ -2865,7 +2839,7 @@ static int stmmac_open(struct net_device *dev) }stmmac_enable_all_queues (priv); -stmmac_start_all_queues (priv); +netif_tx_start_all_queues (priv->dev);return 0 ;
@@ -2908,8 +2882,6 @@ static int stmmac_release(struct net_device *dev)phylink_stop (priv->phylink);phylink_disconnect_phy (priv->phylink); -stmmac_stop_all_queues (priv); -stmmac_disable_all_queues (priv);for (chan =0 ; chan < priv->plat->tx_queues_to_use; chan++)
@@ -5117,7 +5089,6 @@ int stmmac_suspend(struct device *dev)mutex_lock (&priv->lock);netif_device_detach (ndev); -stmmac_stop_all_queues (priv);stmmac_disable_all_queues (priv);
@@ -5244,8 +5215,6 @@ int stmmac_resume(struct device *dev)stmmac_enable_all_queues (priv); -stmmac_start_all_queues (priv); -mutex_unlock (&priv->lock);if (!device_may_wakeup (priv->device) || !priv->plat->pmt) {
Signature · 7 lines
2.17.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
David Miller
maintainerFrom: Wong Vee Khee <[email protected]>
Date: Tue, 15 Sep 2020 09:28:37 +0800
Quoted 5 lines
This patch set is to add support for user to get or set Tx/Rx channel via ethtool. There are two patches that fixes bug introduced on upstream in order to have the feature work.
Tested on Intel Tigerlake Platform.
Series applied, thank you.
Quoted 10 lines · David Miller
From: Wong Vee Khee <[email protected]>
Date: Tue, 15 Sep 2020 09:28:37 +0800Quoted 5 lines
This patch set is to add support for user to get or set Tx/Rx channel via ethtool. There are two patches that fixes bug introduced on upstream in order to have the feature work.
Tested on Intel Tigerlake Platform.
Series applied, thank you.
patch #2 does not have a proper Fixes: tag format, it should be:
Signature · 1 line
Florian
My bad...
Hi David Miller,
Can you help with the commit message fix or do you want to to send a new patch with the fix since the patches are applied on net-next?
Regards,
Vee Khee
Quoted 29 lines
-----Original Message-----
From: Florian Fainelli <[email protected]>
Sent: Wednesday, September 16, 2020 6:54 AM
To: David Miller <[email protected]>; Wong, Vee Khee <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Ong, Boon Leong <[email protected]>; Voon, Weifeng <[email protected]>; Vijaya Balan, Sadhishkhanna <[email protected]>; Seow, Chen Yong <[email protected]>
Subject: Re: [PATCH net-next 0/3] net: stmmac: Add ethtool support for get|set channelsQuoted 9 lines · David Miller
From: Wong Vee Khee <[email protected]>
Date: Tue, 15 Sep 2020 09:28:37 +0800Quoted 5 lines
This patch set is to add support for user to get or set Tx/Rx channel via ethtool. There are two patches that fixes bug introduced on upstream in order to have the feature work.
Tested on Intel Tigerlake Platform.
Quoted 7 lines
Quoted 1 line
Series applied, thank you.
patch #2 does not have a proper Fixes: tag format, it should be:
Fixes cafebabed00d ("some super subject")--
Florian
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 3 lines · Vee Khee
My bad...
Hi David Miller,
(please don't top post)
Quoted 2 lines
Can you help with the commit message fix or do you want to to send a new patch with the fix since the patches are applied on net-next?
It has already been applied, so this is too late, just telling you so you can avoid it next time. And it should be part of David's CI while applying patching, too.
Signature · 1 line
Florian