Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH net v2 0/4] net: stmmac: general fixes for Ethernet functionality
@ 2020-01-15  7:09 Ong Boon Leong
  2020-01-15  7:10 ` [PATCH net v2 1/4] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues Ong Boon Leong
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Ong Boon Leong @ 2020-01-15  7:09 UTC (permalink / raw)
  To: netdev
  Cc: Jose Abreu, Alexandre Torgue, Voon Weifeng, Jakub Kicinski,
	linux-kernel, linux-stm32, Maxime Coquelin, Tan Tee Min,
	Ong Boon Leong, Giuseppe Cavallaro, David S . Miller,
	linux-arm-kernel

Thanks to all feedbacks from community.

We updated the patch-series to below:-

1/4: 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().

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

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

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

Rgds,
Boon Leong

Changes from 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

Tan, Tee Min (1):
  net: stmmac: fix incorrect GMAC_VLAN_TAG register writting
    implementation

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 +++++----
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |  8 ++++----
 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c  | 14 ++++++++------
 3 files changed, 17 insertions(+), 14 deletions(-)

-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net v2 1/4] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues
  2020-01-15  7:09 [PATCH net v2 0/4] net: stmmac: general fixes for Ethernet functionality Ong Boon Leong
@ 2020-01-15  7:10 ` Ong Boon Leong
  2020-01-15 16:15   ` Jose Abreu
  2020-01-15  7:10 ` [PATCH net v2 2/4] net: stmmac: fix incorrect GMAC_VLAN_TAG register writting implementation Ong Boon Leong
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Ong Boon Leong @ 2020-01-15  7:10 UTC (permalink / raw)
  To: netdev
  Cc: Jose Abreu, Alexandre Torgue, Voon Weifeng, Jakub Kicinski,
	linux-kernel, linux-stm32, Maxime Coquelin, Tan Tee Min,
	Ong Boon Leong, Giuseppe Cavallaro, David S . Miller,
	linux-arm-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().

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

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 80d59b775907..0780e00580a2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2624,6 +2624,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
 	if (priv->dma_cap.vlins)
 		stmmac_enable_vlan(priv, priv->hw, STMMAC_VLAN_INSERT);
 
+	/* 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);
 
@@ -4622,10 +4626,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 |
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net v2 2/4] net: stmmac: fix incorrect GMAC_VLAN_TAG register writting implementation
  2020-01-15  7:09 [PATCH net v2 0/4] net: stmmac: general fixes for Ethernet functionality Ong Boon Leong
  2020-01-15  7:10 ` [PATCH net v2 1/4] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues Ong Boon Leong
@ 2020-01-15  7:10 ` Ong Boon Leong
  2020-01-15  7:10 ` [PATCH net v2 3/4] net: stmmac: fix missing IFF_MULTICAST check in dwmac4_set_filter Ong Boon Leong
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Ong Boon Leong @ 2020-01-15  7:10 UTC (permalink / raw)
  To: netdev
  Cc: Jose Abreu, Alexandre Torgue, Voon Weifeng, Jakub Kicinski,
	linux-kernel, linux-stm32, Maxime Coquelin, Tan Tee Min,
	Ong Boon Leong, Giuseppe Cavallaro, David S . Miller,
	linux-arm-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 40ca00e596dd..6e3d0ab0ecd6 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net v2 3/4] net: stmmac: fix missing IFF_MULTICAST check in dwmac4_set_filter
  2020-01-15  7:09 [PATCH net v2 0/4] net: stmmac: general fixes for Ethernet functionality Ong Boon Leong
  2020-01-15  7:10 ` [PATCH net v2 1/4] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues Ong Boon Leong
  2020-01-15  7:10 ` [PATCH net v2 2/4] net: stmmac: fix incorrect GMAC_VLAN_TAG register writting implementation Ong Boon Leong
@ 2020-01-15  7:10 ` Ong Boon Leong
  2020-01-15  7:10 ` [PATCH net v2 4/4] net: stmmac: update pci platform data to use phy_interface Ong Boon Leong
  2020-01-16  8:30 ` [PATCH net v2 0/4] net: stmmac: general fixes for Ethernet functionality Jose Abreu
  4 siblings, 0 replies; 7+ messages in thread
From: Ong Boon Leong @ 2020-01-15  7:10 UTC (permalink / raw)
  To: netdev
  Cc: Jose Abreu, Alexandre Torgue, Voon Weifeng, Jakub Kicinski,
	linux-kernel, linux-stm32, Maxime Coquelin, Tan Tee Min,
	Ong Boon Leong, Giuseppe Cavallaro, David S . Miller,
	linux-arm-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>
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 6e3d0ab0ecd6..53be936137d0 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net v2 4/4] net: stmmac: update pci platform data to use phy_interface
  2020-01-15  7:09 [PATCH net v2 0/4] net: stmmac: general fixes for Ethernet functionality Ong Boon Leong
                   ` (2 preceding siblings ...)
  2020-01-15  7:10 ` [PATCH net v2 3/4] net: stmmac: fix missing IFF_MULTICAST check in dwmac4_set_filter Ong Boon Leong
@ 2020-01-15  7:10 ` Ong Boon Leong
  2020-01-16  8:30 ` [PATCH net v2 0/4] net: stmmac: general fixes for Ethernet functionality Jose Abreu
  4 siblings, 0 replies; 7+ messages in thread
From: Ong Boon Leong @ 2020-01-15  7:10 UTC (permalink / raw)
  To: netdev
  Cc: Jose Abreu, Alexandre Torgue, Voon Weifeng, Jakub Kicinski,
	linux-kernel, linux-stm32, Maxime Coquelin, Tan Tee Min,
	Ong Boon Leong, Giuseppe Cavallaro, David S . Miller,
	linux-arm-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>
---
 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 8237dbc3e991..d2bc04dedd7c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -96,7 +96,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;
@@ -220,7 +220,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);
 }
 
@@ -233,7 +234,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);
 }
 
@@ -261,7 +263,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);
 }
 
@@ -361,7 +363,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;
@@ -418,7 +420,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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* RE: [PATCH net v2 1/4] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues
  2020-01-15  7:10 ` [PATCH net v2 1/4] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues Ong Boon Leong
@ 2020-01-15 16:15   ` Jose Abreu
  0 siblings, 0 replies; 7+ messages in thread
From: Jose Abreu @ 2020-01-15 16:15 UTC (permalink / raw)
  To: Ong Boon Leong, netdev
  Cc: Alexandre Torgue, Voon Weifeng, Jakub Kicinski, linux-kernel,
	linux-stm32, Maxime Coquelin, Tan Tee Min, Giuseppe Cavallaro,
	David S . Miller, linux-arm-kernel

From: Ong Boon Leong <boon.leong.ong@intel.com>
Date: Jan/15/2020, 07:10:00 (UTC+00:00)

> 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().
> 
> Fixes: c02b7a914551 ("net: stmmac: use netif_set_real_num_{rx,tx}_queues")
> Signed-off-by: Aashish Verma <aashishx.verma@intel.com>
> Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 80d59b775907..0780e00580a2 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2624,6 +2624,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
>  	if (priv->dma_cap.vlins)
>  		stmmac_enable_vlan(priv, priv->hw, STMMAC_VLAN_INSERT);
>  
> +	/* 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);
> +

Nack. You need to hold rtnl lock when calling this and at suspend / resume 
you don't.

---
Thanks,
Jose Miguel Abreu

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* RE: [PATCH net v2 0/4] net: stmmac: general fixes for Ethernet functionality
  2020-01-15  7:09 [PATCH net v2 0/4] net: stmmac: general fixes for Ethernet functionality Ong Boon Leong
                   ` (3 preceding siblings ...)
  2020-01-15  7:10 ` [PATCH net v2 4/4] net: stmmac: update pci platform data to use phy_interface Ong Boon Leong
@ 2020-01-16  8:30 ` Jose Abreu
  4 siblings, 0 replies; 7+ messages in thread
From: Jose Abreu @ 2020-01-16  8:30 UTC (permalink / raw)
  To: Ong Boon Leong, netdev
  Cc: Alexandre Torgue, Voon Weifeng, Jakub Kicinski, linux-kernel,
	linux-stm32, Maxime Coquelin, Tan Tee Min, Giuseppe Cavallaro,
	David S . Miller, linux-arm-kernel

From: Ong Boon Leong <boon.leong.ong@intel.com>
Date: Jan/15/2020, 07:09:59 (UTC+00:00)

> 2/4: It ensures that the previous value of GMAC_VLAN_TAG register is
>      read first before for updating the register.
> 
> 3/4: It ensures the GMAC IP v4.xx and above behaves correctly to:-
>        ip link set <devname> multicast off|on

Can we please also get these fixes in XGMAC core ? The code base is very 
similar so it should be pretty straight forward.

---
Thanks,
Jose Miguel Abreu

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15  7:09 [PATCH net v2 0/4] net: stmmac: general fixes for Ethernet functionality Ong Boon Leong
2020-01-15  7:10 ` [PATCH net v2 1/4] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues Ong Boon Leong
2020-01-15 16:15   ` Jose Abreu
2020-01-15  7:10 ` [PATCH net v2 2/4] net: stmmac: fix incorrect GMAC_VLAN_TAG register writting implementation Ong Boon Leong
2020-01-15  7:10 ` [PATCH net v2 3/4] net: stmmac: fix missing IFF_MULTICAST check in dwmac4_set_filter Ong Boon Leong
2020-01-15  7:10 ` [PATCH net v2 4/4] net: stmmac: update pci platform data to use phy_interface Ong Boon Leong
2020-01-16  8:30 ` [PATCH net v2 0/4] net: stmmac: general fixes for Ethernet functionality Jose Abreu

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git