netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v4 0/6] net: stmmac: general fixes for Ethernet functionality
@ 2020-02-05  8:55 Ong Boon Leong
  2020-02-05  8:55 ` [PATCH net v4 1/6] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues Ong Boon Leong
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Ong Boon Leong @ 2020-02-05  8:55 UTC (permalink / raw)
  To: netdev
  Cc: Tan Tee Min, Voon Weifeng, Giuseppe Cavallaro, Alexandre TORGUE,
	Jose Abreu, David S . Miller, Maxime Coquelin, Joao Pinto,
	Arnd Bergmann, Alexandru Ardelean, linux-stm32, linux-arm-kernel,
	linux-kernel

Thanks to all feedbacks from community.

We updated the patch-series to below:-

1/6: It ensures that the real_num_rx|tx_queues are set in both driver
     probe() and resume(). So, move the netif_set_real_num_rx|tx_queues()
     into stmmac_hw_setup(). Use rtnl_lock() and rtnl_unlock() for
     stmmac_hw_setup() called inside stmmac_resume().

2/6: It ensures that the previous value of GMAC_VLAN_TAG register is
     read first before for updating the register.

3/6: Similar to 2/6 patch but it is a fix for XGMAC_VLAN_TAG register
     as requested by Jose Abreu.

4/6: It ensures the GMAC IP v4.xx and above behaves correctly to:-
       ip link set <devname> multicast off|on

5/6: Added similar IFF_MULTICAST flag for xgmac2, similar to 4/6.

6/6: It ensures PCI platform data is using plat->phy_interface.

Rgds,
Boon Leong

Changes from v3:-
   patch 1/6 - add rtnl_lock() and rtnl_unlock() for stmmac_hw_setup()
               called inside stmmac_resume()
   patch 3/6 - Added new patch to fix XGMAC_VLAN_TAG register writting

v2:-
   patch 1/5 - added control for rtnl_lock() & rtnl_unlock() to ensure
               they are used forstmmac_resume()
   patch 4/5 - added IFF_MULTICAST flag check for xgmac to ensure
               multicast works correctly.

v1:-
 - Drop v1 patches (1/7, 3/7 & 4/7) that are not valid.

Aashish Verma (1):
  net: stmmac: Fix incorrect location to set real_num_rx|tx_queues

Ong Boon Leong (1):
  net: stmmac: xgmac: fix incorrect XGMAC_VLAN_TAG register writting

Tan, Tee Min (2):
  net: stmmac: fix incorrect GMAC_VLAN_TAG register writting in GMAC4+
  net: stmmac: xgmac: fix missing IFF_MULTICAST checki in
    dwxgmac2_set_filter

Verma, Aashish (1):
  net: stmmac: fix missing IFF_MULTICAST check in dwmac4_set_filter

Voon Weifeng (1):
  net: stmmac: update pci platform data to use phy_interface

 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c  |  9 +++++----
 .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c    | 10 +++++++---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 10 ++++++----
 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c   | 14 ++++++++------
 4 files changed, 26 insertions(+), 17 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net v4 1/6] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues
  2020-02-05  8:55 [PATCH net v4 0/6] net: stmmac: general fixes for Ethernet functionality Ong Boon Leong
@ 2020-02-05  8:55 ` Ong Boon Leong
  2020-02-05 13:39   ` David Miller
  2020-02-05  8:55 ` [PATCH net v4 2/6] net: stmmac: fix incorrect GMAC_VLAN_TAG register writting in GMAC4+ Ong Boon Leong
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Ong Boon Leong @ 2020-02-05  8:55 UTC (permalink / raw)
  To: netdev
  Cc: Tan Tee Min, Voon Weifeng, Giuseppe Cavallaro, Alexandre TORGUE,
	Jose Abreu, David S . Miller, Maxime Coquelin, Joao Pinto,
	Arnd Bergmann, Alexandru Ardelean, linux-stm32, linux-arm-kernel,
	linux-kernel

From: Aashish Verma <aashishx.verma@intel.com>

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().

For driver open(), rtnl_lock is acquired by network stack but not in the
resume(). Therefore, we need to rtnl_lock() and rtnl_unlock() when
calling stmmac_hw_setup() within resume(). Thanks Jose Abreu for input.

Fixes: c02b7a914551 ("net: stmmac: use netif_set_real_num_{rx,tx}_queues")
Signed-off-by: Aashish Verma <aashishx.verma@intel.com>
Tested-by: Tan, Tee Min <tee.min.tan@intel.com>
Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 5836b21edd7e..4d9afa13eeb9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2657,6 +2657,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);
 
@@ -4738,10 +4742,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 |
@@ -5091,7 +5091,9 @@ int stmmac_resume(struct device *dev)
 
 	stmmac_clear_descriptors(priv);
 
+	rtnl_lock();
 	stmmac_hw_setup(ndev, false);
+	rtnl_unlock();
 	stmmac_init_coalesce(priv);
 	stmmac_set_rx_mode(ndev);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net v4 2/6] net: stmmac: fix incorrect GMAC_VLAN_TAG register writting in GMAC4+
  2020-02-05  8:55 [PATCH net v4 0/6] net: stmmac: general fixes for Ethernet functionality Ong Boon Leong
  2020-02-05  8:55 ` [PATCH net v4 1/6] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues Ong Boon Leong
@ 2020-02-05  8:55 ` Ong Boon Leong
  2020-02-05  8:55 ` [PATCH net v4 3/6] net: stmmac: xgmac: fix incorrect XGMAC_VLAN_TAG register writting Ong Boon Leong
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Ong Boon Leong @ 2020-02-05  8:55 UTC (permalink / raw)
  To: netdev
  Cc: Tan Tee Min, Voon Weifeng, Giuseppe Cavallaro, Alexandre TORGUE,
	Jose Abreu, David S . Miller, Maxime Coquelin, Joao Pinto,
	Arnd Bergmann, Alexandru Ardelean, linux-stm32, linux-arm-kernel,
	linux-kernel

From: "Tan, Tee Min" <tee.min.tan@intel.com>

It should always do a read of current value of GMAC_VLAN_TAG instead of
directly overwriting the register value.

Fixes: c1be0022df0d ("net: stmmac: Add VLAN HASH filtering support in GMAC4+")
Signed-off-by: Tan, Tee Min <tee.min.tan@intel.com>
Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index f0c0ea616032..4d8eef9ff137 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -736,11 +736,14 @@ static void dwmac4_update_vlan_hash(struct mac_device_info *hw, u32 hash,
 				    __le16 perfect_match, bool is_double)
 {
 	void __iomem *ioaddr = hw->pcsr;
+	u32 value;
 
 	writel(hash, ioaddr + GMAC_VLAN_HASH_TABLE);
 
+	value = readl(ioaddr + GMAC_VLAN_TAG);
+
 	if (hash) {
-		u32 value = GMAC_VLAN_VTHM | GMAC_VLAN_ETV;
+		value |= GMAC_VLAN_VTHM | GMAC_VLAN_ETV;
 		if (is_double) {
 			value |= GMAC_VLAN_EDVLP;
 			value |= GMAC_VLAN_ESVL;
@@ -759,8 +762,6 @@ static void dwmac4_update_vlan_hash(struct mac_device_info *hw, u32 hash,
 
 		writel(value | perfect_match, ioaddr + GMAC_VLAN_TAG);
 	} else {
-		u32 value = readl(ioaddr + GMAC_VLAN_TAG);
-
 		value &= ~(GMAC_VLAN_VTHM | GMAC_VLAN_ETV);
 		value &= ~(GMAC_VLAN_EDVLP | GMAC_VLAN_ESVL);
 		value &= ~GMAC_VLAN_DOVLTC;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net v4 3/6] net: stmmac: xgmac: fix incorrect XGMAC_VLAN_TAG register writting
  2020-02-05  8:55 [PATCH net v4 0/6] net: stmmac: general fixes for Ethernet functionality Ong Boon Leong
  2020-02-05  8:55 ` [PATCH net v4 1/6] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues Ong Boon Leong
  2020-02-05  8:55 ` [PATCH net v4 2/6] net: stmmac: fix incorrect GMAC_VLAN_TAG register writting in GMAC4+ Ong Boon Leong
@ 2020-02-05  8:55 ` Ong Boon Leong
  2020-02-05  8:55 ` [PATCH net v4 4/6] net: stmmac: fix missing IFF_MULTICAST check in dwmac4_set_filter Ong Boon Leong
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Ong Boon Leong @ 2020-02-05  8:55 UTC (permalink / raw)
  To: netdev
  Cc: Tan Tee Min, Voon Weifeng, Giuseppe Cavallaro, Alexandre TORGUE,
	Jose Abreu, David S . Miller, Maxime Coquelin, Joao Pinto,
	Arnd Bergmann, Alexandru Ardelean, linux-stm32, linux-arm-kernel,
	linux-kernel

We should always do a read of current value of XGMAC_VLAN_TAG instead of
directly overwriting the register value.

Fixes: 3cd1cfcba26e2 ("net: stmmac: Implement VLAN Hash Filtering in XGMAC")
Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
index 2af3ac5409b7..a0e67d178280 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
@@ -569,7 +569,9 @@ static void dwxgmac2_update_vlan_hash(struct mac_device_info *hw, u32 hash,
 
 		writel(value, ioaddr + XGMAC_PACKET_FILTER);
 
-		value = XGMAC_VLAN_VTHM | XGMAC_VLAN_ETV;
+		value = readl(ioaddr + XGMAC_VLAN_TAG);
+
+		value |= XGMAC_VLAN_VTHM | XGMAC_VLAN_ETV;
 		if (is_double) {
 			value |= XGMAC_VLAN_EDVLP;
 			value |= XGMAC_VLAN_ESVL;
@@ -584,7 +586,9 @@ static void dwxgmac2_update_vlan_hash(struct mac_device_info *hw, u32 hash,
 
 		writel(value, ioaddr + XGMAC_PACKET_FILTER);
 
-		value = XGMAC_VLAN_ETV;
+		value = readl(ioaddr + XGMAC_VLAN_TAG);
+
+		value |= XGMAC_VLAN_ETV;
 		if (is_double) {
 			value |= XGMAC_VLAN_EDVLP;
 			value |= XGMAC_VLAN_ESVL;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net v4 4/6] net: stmmac: fix missing IFF_MULTICAST check in dwmac4_set_filter
  2020-02-05  8:55 [PATCH net v4 0/6] net: stmmac: general fixes for Ethernet functionality Ong Boon Leong
                   ` (2 preceding siblings ...)
  2020-02-05  8:55 ` [PATCH net v4 3/6] net: stmmac: xgmac: fix incorrect XGMAC_VLAN_TAG register writting Ong Boon Leong
@ 2020-02-05  8:55 ` Ong Boon Leong
  2020-02-05  8:55 ` [PATCH net v4 5/6] net: stmmac: xgmac: fix missing IFF_MULTICAST checki in dwxgmac2_set_filter Ong Boon Leong
  2020-02-05  8:55 ` [PATCH net v4 6/6] net: stmmac: update pci platform data to use phy_interface Ong Boon Leong
  5 siblings, 0 replies; 9+ messages in thread
From: Ong Boon Leong @ 2020-02-05  8:55 UTC (permalink / raw)
  To: netdev
  Cc: Tan Tee Min, Voon Weifeng, Giuseppe Cavallaro, Alexandre TORGUE,
	Jose Abreu, David S . Miller, Maxime Coquelin, Joao Pinto,
	Arnd Bergmann, Alexandru Ardelean, linux-stm32, linux-arm-kernel,
	linux-kernel

From: "Verma, Aashish" <aashishx.verma@intel.com>

Without checking for IFF_MULTICAST flag, it is wrong to assume multicast
filtering is always enabled. By checking against IFF_MULTICAST, now
the driver behaves correctly when the multicast support is toggled by below
command:-
  ip link set <devname> multicast off|on

Fixes: 477286b53f55 ("stmmac: add GMAC4 core support")
Signed-off-by: Verma, Aashish <aashishx.verma@intel.com>
Tested-by: Tan, Tee Min <tee.min.tan@intel.com>
Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index 4d8eef9ff137..dc09d2131e40 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -420,7 +420,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw,
 		value |= GMAC_PACKET_FILTER_PM;
 		/* Set all the bits of the HASH tab */
 		memset(mc_filter, 0xff, sizeof(mc_filter));
-	} else if (!netdev_mc_empty(dev)) {
+	} else if (!netdev_mc_empty(dev) && (dev->flags & IFF_MULTICAST)) {
 		struct netdev_hw_addr *ha;
 
 		/* Hash filter for multicast */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net v4 5/6] net: stmmac: xgmac: fix missing IFF_MULTICAST checki in dwxgmac2_set_filter
  2020-02-05  8:55 [PATCH net v4 0/6] net: stmmac: general fixes for Ethernet functionality Ong Boon Leong
                   ` (3 preceding siblings ...)
  2020-02-05  8:55 ` [PATCH net v4 4/6] net: stmmac: fix missing IFF_MULTICAST check in dwmac4_set_filter Ong Boon Leong
@ 2020-02-05  8:55 ` Ong Boon Leong
  2020-02-05  8:55 ` [PATCH net v4 6/6] net: stmmac: update pci platform data to use phy_interface Ong Boon Leong
  5 siblings, 0 replies; 9+ messages in thread
From: Ong Boon Leong @ 2020-02-05  8:55 UTC (permalink / raw)
  To: netdev
  Cc: Tan Tee Min, Voon Weifeng, Giuseppe Cavallaro, Alexandre TORGUE,
	Jose Abreu, David S . Miller, Maxime Coquelin, Joao Pinto,
	Arnd Bergmann, Alexandru Ardelean, linux-stm32, linux-arm-kernel,
	linux-kernel

From: "Tan, Tee Min" <tee.min.tan@intel.com>

Without checking for IFF_MULTICAST flag, it is wrong to assume multicast
filtering is always enabled. By checking against IFF_MULTICAST, now
the driver behaves correctly when the multicast support is toggled by below
command:-
  ip link set <devname> multicast off|on

Fixes: 0efedbf11f07a ("net: stmmac: xgmac: Fix XGMAC selftests")
Signed-off-by: Tan, Tee Min <tee.min.tan@intel.com>
Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
index a0e67d178280..67b754a56288 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
@@ -458,7 +458,7 @@ static void dwxgmac2_set_filter(struct mac_device_info *hw,
 
 		for (i = 0; i < XGMAC_MAX_HASH_TABLE; i++)
 			writel(~0x0, ioaddr + XGMAC_HASH_TABLE(i));
-	} else if (!netdev_mc_empty(dev)) {
+	} else if (!netdev_mc_empty(dev) && (dev->flags & IFF_MULTICAST)) {
 		struct netdev_hw_addr *ha;
 
 		value |= XGMAC_FILTER_HMC;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net v4 6/6] net: stmmac: update pci platform data to use phy_interface
  2020-02-05  8:55 [PATCH net v4 0/6] net: stmmac: general fixes for Ethernet functionality Ong Boon Leong
                   ` (4 preceding siblings ...)
  2020-02-05  8:55 ` [PATCH net v4 5/6] net: stmmac: xgmac: fix missing IFF_MULTICAST checki in dwxgmac2_set_filter Ong Boon Leong
@ 2020-02-05  8:55 ` Ong Boon Leong
  5 siblings, 0 replies; 9+ messages in thread
From: Ong Boon Leong @ 2020-02-05  8:55 UTC (permalink / raw)
  To: netdev
  Cc: Tan Tee Min, Voon Weifeng, Giuseppe Cavallaro, Alexandre TORGUE,
	Jose Abreu, David S . Miller, Maxime Coquelin, Joao Pinto,
	Arnd Bergmann, Alexandru Ardelean, linux-stm32, linux-arm-kernel,
	linux-kernel

From: Voon Weifeng <weifeng.voon@intel.com>

The recent patch to support passive mode converter did not take care the
phy interface configuration in PCI platform data. Hence, converting all
the PCI platform data from plat->interface to plat->phy_interface as the
default mode is meant for PHY.

Fixes: 0060c8783330 ("net: stmmac: implement support for passive mode converters via dt")
Signed-off-by: Voon Weifeng <weifeng.voon@intel.com>
Tested-by: Tan, Tee Min <tee.min.tan@intel.com>
Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index 623521052152..fe2c9fa6a71c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -95,7 +95,7 @@ static int stmmac_default_data(struct pci_dev *pdev,
 
 	plat->bus_id = 1;
 	plat->phy_addr = 0;
-	plat->interface = PHY_INTERFACE_MODE_GMII;
+	plat->phy_interface = PHY_INTERFACE_MODE_GMII;
 
 	plat->dma_cfg->pbl = 32;
 	plat->dma_cfg->pblx8 = true;
@@ -217,7 +217,8 @@ static int ehl_sgmii_data(struct pci_dev *pdev,
 {
 	plat->bus_id = 1;
 	plat->phy_addr = 0;
-	plat->interface = PHY_INTERFACE_MODE_SGMII;
+	plat->phy_interface = PHY_INTERFACE_MODE_SGMII;
+
 	return ehl_common_data(pdev, plat);
 }
 
@@ -230,7 +231,8 @@ static int ehl_rgmii_data(struct pci_dev *pdev,
 {
 	plat->bus_id = 1;
 	plat->phy_addr = 0;
-	plat->interface = PHY_INTERFACE_MODE_RGMII;
+	plat->phy_interface = PHY_INTERFACE_MODE_RGMII;
+
 	return ehl_common_data(pdev, plat);
 }
 
@@ -258,7 +260,7 @@ static int tgl_sgmii_data(struct pci_dev *pdev,
 {
 	plat->bus_id = 1;
 	plat->phy_addr = 0;
-	plat->interface = PHY_INTERFACE_MODE_SGMII;
+	plat->phy_interface = PHY_INTERFACE_MODE_SGMII;
 	return tgl_common_data(pdev, plat);
 }
 
@@ -358,7 +360,7 @@ static int quark_default_data(struct pci_dev *pdev,
 
 	plat->bus_id = pci_dev_id(pdev);
 	plat->phy_addr = ret;
-	plat->interface = PHY_INTERFACE_MODE_RMII;
+	plat->phy_interface = PHY_INTERFACE_MODE_RMII;
 
 	plat->dma_cfg->pbl = 16;
 	plat->dma_cfg->pblx8 = true;
@@ -415,7 +417,7 @@ static int snps_gmac5_default_data(struct pci_dev *pdev,
 
 	plat->bus_id = 1;
 	plat->phy_addr = -1;
-	plat->interface = PHY_INTERFACE_MODE_GMII;
+	plat->phy_interface = PHY_INTERFACE_MODE_GMII;
 
 	plat->dma_cfg->pbl = 32;
 	plat->dma_cfg->pblx8 = true;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net v4 1/6] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues
  2020-02-05  8:55 ` [PATCH net v4 1/6] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues Ong Boon Leong
@ 2020-02-05 13:39   ` David Miller
  2020-02-07  7:21     ` Ong, Boon Leong
  0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2020-02-05 13:39 UTC (permalink / raw)
  To: boon.leong.ong
  Cc: netdev, tee.min.tan, weifeng.voon, peppe.cavallaro,
	alexandre.torgue, Jose.Abreu, mcoquelin.stm32, Joao.Pinto, arnd,
	alexandru.ardelean, linux-stm32, linux-arm-kernel, linux-kernel

From: Ong Boon Leong <boon.leong.ong@intel.com>
Date: Wed,  5 Feb 2020 16:55:05 +0800

> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 5836b21edd7e..4d9afa13eeb9 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2657,6 +2657,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);
>  

It is only safe to ignore the return values from
netif_set_real_num_{rx,tx}_queues() if you call them before the
network device is registered.  Because only in that case are these
functions guaranteed to succeed.

But now that you have moved these calls here, they can fail.

Therefore you must check the return value and unwind the state
completely upon failures.

Honestly, I think this change will have several undesirable side effects:

1) Lots of added new code complexity

2) A new failure mode when resuming the device, users will find this
   very hard to diagnose and recover from

What real value do you get from doing these calls after probe?

If you can't come up with a suitable answer to that question, you
should reconsider this change.

Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH net v4 1/6] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues
  2020-02-05 13:39   ` David Miller
@ 2020-02-07  7:21     ` Ong, Boon Leong
  0 siblings, 0 replies; 9+ messages in thread
From: Ong, Boon Leong @ 2020-02-07  7:21 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, Tan, Tee Min, Voon, Weifeng, peppe.cavallaro,
	alexandre.torgue, Jose.Abreu, mcoquelin.stm32, Joao.Pinto, arnd,
	alexandru.ardelean, linux-stm32, linux-arm-kernel, linux-kernel

From: David Miller <davem@davemloft.net>
Date: Wednesday, February 5, 2020 9:39 PM

>From: Ong Boon Leong <boon.leong.ong@intel.com>
>Date: Wed,  5 Feb 2020 16:55:05 +0800
>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index 5836b21edd7e..4d9afa13eeb9 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> @@ -2657,6 +2657,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);
>>
>
>It is only safe to ignore the return values from
>netif_set_real_num_{rx,tx}_queues() if you call them before the
>network device is registered.  Because only in that case are these
>functions guaranteed to succeed.
>
>But now that you have moved these calls here, they can fail.
>
>Therefore you must check the return value and unwind the state
>completely upon failures.
>
>Honestly, I think this change will have several undesirable side effects:
>
>1) Lots of added new code complexity
>
>2) A new failure mode when resuming the device, users will find this
>   very hard to diagnose and recover from
>
>What real value do you get from doing these calls after probe?
>
>If you can't come up with a suitable answer to that question, you
>should reconsider this change.
>
>Thanks.

We have patch that implements get|set_channels() that depends on this fix.
Anyway, we understand your insight and perspective now. So, we will drop
this patch in v5 series.

Thanks

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-02-07  7:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05  8:55 [PATCH net v4 0/6] net: stmmac: general fixes for Ethernet functionality Ong Boon Leong
2020-02-05  8:55 ` [PATCH net v4 1/6] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues Ong Boon Leong
2020-02-05 13:39   ` David Miller
2020-02-07  7:21     ` Ong, Boon Leong
2020-02-05  8:55 ` [PATCH net v4 2/6] net: stmmac: fix incorrect GMAC_VLAN_TAG register writting in GMAC4+ Ong Boon Leong
2020-02-05  8:55 ` [PATCH net v4 3/6] net: stmmac: xgmac: fix incorrect XGMAC_VLAN_TAG register writting Ong Boon Leong
2020-02-05  8:55 ` [PATCH net v4 4/6] net: stmmac: fix missing IFF_MULTICAST check in dwmac4_set_filter Ong Boon Leong
2020-02-05  8:55 ` [PATCH net v4 5/6] net: stmmac: xgmac: fix missing IFF_MULTICAST checki in dwxgmac2_set_filter Ong Boon Leong
2020-02-05  8:55 ` [PATCH net v4 6/6] net: stmmac: update pci platform data to use phy_interface Ong Boon Leong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).