net: stmmac: Fixes for -net
Subsystems (4)
v2 cover net: stmmac: Fixes for -net
Misc fixes for stmmac.
Patch 1/10, corrects a sparse warning reported by kbuild.
Patch 2/10 and 3/10, use the correct variable type for bitrev32() calls.
Patch 4/10, fixes the random failures the we were seing when running selftests. This commit was re-worded because the old commit log no longer applied so we didn't add the history log to the commit. So far, no selftests failures were seen with the new re-worked commit.
Patch 5/10, prevents a crash that can occur when receiving AVB packets and with SPH feature enabled on XGMAC.
Patch 6/10, fixes the correct settings for CBS on XGMAC.
Patch 7/10, corrects the interpretation of AVB feature on XGMAC.
Patch 8/10, disables Flow Control for AVB enabled queues on XGMAC.
Patch 9/10, disables MMC interrupts on XGMAC, preventing a storm of interrupts.
Patch 10/10, was added in this version and it fixes the incorrect number of packets that were being passed to NAPI.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Jose Abreu (10):
net: stmmac: Fix sparse warning
net: stmmac: gmac4: bitrev32 returns u32
net: stmmac: xgmac: bitrev32 returns u32
net: stmmac: selftests: Prevent false positives in filter tests
net: stmmac: xgmac: Only get SPH header len if available
net: stmmac: xgmac: Fix TSA selection
net: stmmac: xgmac: Fix AV Feature detection
net: stmmac: xgmac: Disable Flow Control when 1 or more queues are in
AV
net: stmmac: xgmac: Disable MMC interrupts by default
net: stmmac: Fix the packet count in stmmac_rx()
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 4 +- .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 5 +- .../net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 3 +- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 4 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +- drivers/net/ethernet/stmicro/stmmac/mmc_core.c | 6 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 +- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 134 +++++++++++++++------ 8 files changed, 115 insertions(+), 53 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/10 net: stmmac: Fix sparse warning
The VID is converted to le16 so the variable must be __le16 type.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 2 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +1 -1
@@ -733,7 +733,7 @@ static void dwmac4_set_mac_loopback(void __iomem *ioaddr, bool enable) }static void dwmac4_update_vlan_hash (struct mac_device_info *hw,u32 hash, -u16 perfect_match,bool is_double) +__le16 perfect_match,bool is_double) {void __iomem *ioaddr = hw->pcsr;
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +1 -1
@@ -555,7 +555,7 @@ static int dwxgmac2_rss_configure(struct mac_device_info *hw, }static void dwxgmac2_update_vlan_hash (struct mac_device_info *hw,u32 hash, -u16 perfect_match,bool is_double) +__le16 perfect_match,bool is_double) {void __iomem *ioaddr = hw->pcsr;
drivers/net/ethernet/stmicro/stmmac/hwif.h +1 -1
@@ -357,7 +357,7 @@ struct stmmac_ops { struct stmmac_rss *cfg, u32 num_rxq);/* VLAN */ void (*update_vlan_hash)(struct mac_device_info *hw,u32 hash, -u16 perfect_match,bool is_double); +__le16 perfect_match,bool is_double);void (*enable_vlan)(struct mac_device_info *hw,u32 type);/* TX Timestamp */ int (*get_mac_tx_timestamp)(struct mac_device_info *hw,u64 *ts);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 -2
@@ -4207,6 +4207,7 @@ static u32 stmmac_vid_crc32_le(__le16 vid_le)static int stmmac_vlan_update (struct stmmac_priv *priv,bool is_double) {u32 crc, hash =0 ; +__le16 pmatch =0 ;int count =0 ;u16 vid =0 ;
@@ -4221,11 +4222,11 @@ static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_double)if (count >2 )/* VID = 0 always passes filter */ return -EOPNOTSUPP ; - vid =cpu_to_le16 (vid); + pmatch =cpu_to_le16 (vid); hash =0 ; } -return stmmac_update_vlan_hash (priv, priv->hw, hash, vid, is_double); +return stmmac_update_vlan_hash (priv, priv->hw, hash, pmatch, is_double); }static int stmmac_vlan_rx_add_vid (struct net_device *ndev,__be16 proto,u16 vid)
Signature · 1 line
2.7.4
David Miller
maintainerRe: [PATCH net v2 01/10] net: stmmac: Fix sparse warning
From: Jose Abreu <[email protected]>
Date: Thu, 31 Oct 2019 12:00:39 +0100
Quoted 5 lines
The VID is converted to le16 so the variable must be
__le16type.Reported-by kbuild test robot <[email protected]>Fixes c7ab0b8088d7 ("net: stmmac: Fallback to VLAN Perfect filtering if HASH is not available")Signed-off-by Jose Abreu <[email protected]>
This doesn't even come close to applying to my 'net' tree.
[davem@localhost net]$ git am --signoff bundle-19989-stmmac-fixes.mbox
Applying: net: stmmac: Fix sparse warning
error: patch failed: drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:733
error: drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c: patch does not apply
error: patch failed: drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c:555
error: drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c: patch does not apply
error: patch failed: drivers/net/ethernet/stmicro/stmmac/hwif.h:357
error: drivers/net/ethernet/stmicro/stmmac/hwif.h: patch does not apply
error: patch failed: drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:4207
error: drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: patch does not apply
Patch failed at 0001 net: stmmac: Fix sparse warning
hint: Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort". [davem@localhost net]$ patch -p1 <.git/rebase-apply/patch
patching file drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
Hunk #1 FAILED at 733.
1 out of 1 hunk FAILED -- saving rejects to file drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c.rej patching file drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
Hunk #1 FAILED at 555.
1 out of 1 hunk FAILED -- saving rejects to file drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c.rej patching file drivers/net/ethernet/stmicro/stmmac/hwif.h
Hunk #1 FAILED at 357.
1 out of 1 hunk FAILED -- saving rejects to file drivers/net/ethernet/stmicro/stmmac/hwif.h.rej patching file drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Hunk #1 FAILED at 4207.
Hunk #2 FAILED at 4221.
2 out of 2 hunks FAILED -- saving rejects to file drivers/net/ethernet/stmicro/stmmac/stmmac_main.c.rej [davem@localhost net]$
PATCH v2 2/10 net: stmmac: gmac4: bitrev32 returns u32
In reply to Jose AbreuThe bitrev32 function returns an u32 var, not an int. Fix it.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +1 -1
@@ -432,7 +432,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw,* bits used depends on the hardware configuration * selected at core configuration time. */ -int bit_nr =bitrev32 (~crc32_le (~0 , ha->addr, +u32 bit_nr =bitrev32 (~crc32_le (~0 , ha->addr,ETH_ALEN )) >> (32 - mcbitslog2);/* The most significant bit determines the register to * use (H/L) while the other 5 bits determine the bit
Signature · 1 line
2.7.4
PATCH v2 3/10 net: stmmac: xgmac: bitrev32 returns u32
In reply to Jose AbreuThe bitrev32 function returns an u32 var, not an int. Fix it.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +1 -1
@@ -463,7 +463,7 @@ static void dwxgmac2_set_filter(struct mac_device_info *hw, value |=XGMAC_FILTER_HMC ;netdev_for_each_mc_addr (ha, dev) { -int nr = (bitrev32 (~crc32_le (~0 , ha->addr,6 )) >> +u32 nr = (bitrev32 (~crc32_le (~0 , ha->addr,6 )) >> (32 - mcbitslog2)); mc_filter[nr >>5 ] |= (1 << (nr &0x1F )); }
Signature · 1 line
2.7.4
PATCH v2 4/10 net: stmmac: selftests: Prevent false positives in filter tests
In reply to Jose AbreuIn L2 tests that filter packets by destination MAC address we need to prevent false positives that can occur if we add an address that collides with the existing ones.
To fix this, lets manually check if the new address to be added is already present in the NIC and use a different one if so. For Hash filtering this also envolves converting the address to the hash.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 134 +++++++++++++++------ 1 file changed, 94 insertions(+), 40 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +94 -40
@@ -6,7 +6,9 @@* Author: Jose Abreu <[email protected]> */ +#include <linux/bitrev.h> #include <linux/completion.h> +#include <linux/crc32.h> #include <linux/ethtool.h> #include <linux/ip.h> #include <linux/phy.h>
@@ -485,12 +487,48 @@ static int stmmac_filter_check(struct stmmac_priv *priv)return -EOPNOTSUPP ; } +static bool stmmac_hash_check (struct stmmac_priv *priv,unsigned char *addr) +{ +int mc_offset =32 - priv->hw->mcast_bits_log2; +struct netdev_hw_addr *ha; +u32 hash, hash_nr; + +/* First compute the hash for desired addr */ + hash =bitrev32 (~crc32_le (~0 , addr,6 )) >> mc_offset; + hash_nr = hash >>5 ; + hash =1 << (hash &0x1f ); + +/* Now, check if it collides with any existing one */ +netdev_for_each_mc_addr (ha, priv->dev) { +u32 nr =bitrev32 (~crc32_le (~0 , ha->addr,ETH_ALEN )) >> mc_offset; +if (((nr >>5 ) == hash_nr) && ((1 << (nr &0x1f )) == hash)) +return false; + } + +/* No collisions, address is good to go */ +return true; +} + +static bool stmmac_perfect_check (struct stmmac_priv *priv,unsigned char *addr) +{ +struct netdev_hw_addr *ha; + +/* Check if it collides with any existing one */ +netdev_for_each_uc_addr (ha, priv->dev) { +if (!memcmp (ha->addr, addr,ETH_ALEN )) +return false; + } + +/* No collisions, address is good to go */ +return true; +} +static int stmmac_test_hfilt (struct stmmac_priv *priv) { -unsigned char gd_addr[ETH_ALEN ] = {0x01 ,0xee ,0xdd ,0xcc ,0xbb ,0xaa }; -unsigned char bd_addr[ETH_ALEN ] = {0x01 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 }; +unsigned char gd_addr[ETH_ALEN ] = {0xf1 ,0xee ,0xdd ,0xcc ,0xbb ,0xaa }; +unsigned char bd_addr[ETH_ALEN ] = {0xf1 ,0xff ,0xff ,0xff ,0xff ,0xff };struct stmmac_packet_attrs attr = { }; -int ret; +int ret, tries =256 ; ret =stmmac_filter_check (priv);if (ret)
@@ -499,6 +537,16 @@ static int stmmac_test_hfilt(struct stmmac_priv *priv)if (netdev_mc_count (priv->dev) >= priv->hw->multicast_filter_bins)return -EOPNOTSUPP ; +while (--tries) { +/* We only need to check the bd_addr for collisions */ + bd_addr[ETH_ALEN -1 ] = tries; +if (stmmac_hash_check (priv, bd_addr)) +break ; + } + +if (!tries) +return -EOPNOTSUPP ; + ret =dev_mc_add (priv->dev, gd_addr);if (ret)return ret;
@@ -523,13 +571,25 @@ static int stmmac_test_hfilt(struct stmmac_priv *priv)static int stmmac_test_pfilt (struct stmmac_priv *priv) { -unsigned char gd_addr[ETH_ALEN ] = {0x00 ,0x01 ,0x44 ,0x55 ,0x66 ,0x77 }; -unsigned char bd_addr[ETH_ALEN ] = {0x08 ,0x00 ,0x22 ,0x33 ,0x44 ,0x55 }; +unsigned char gd_addr[ETH_ALEN ] = {0xf0 ,0x01 ,0x44 ,0x55 ,0x66 ,0x77 }; +unsigned char bd_addr[ETH_ALEN ] = {0xf0 ,0xff ,0xff ,0xff ,0xff ,0xff };struct stmmac_packet_attrs attr = { }; -int ret; +int ret, tries =256 ;if (stmmac_filter_check (priv))return -EOPNOTSUPP ; +if (netdev_uc_count (priv->dev) >= priv->hw->unicast_filter_entries) +return -EOPNOTSUPP ; + +while (--tries) { +/* We only need to check the bd_addr for collisions */ + bd_addr[ETH_ALEN -1 ] = tries; +if (stmmac_perfect_check (priv, bd_addr)) +break ; + } + +if (!tries) +return -EOPNOTSUPP ; ret =dev_uc_add (priv->dev, gd_addr);if (ret)
@@ -553,39 +613,31 @@ static int stmmac_test_pfilt(struct stmmac_priv *priv)return ret; } -static int stmmac_dummy_sync (struct net_device *netdev,const u8 *addr) -{ -return 0 ; -} - -static void stmmac_test_set_rx_mode (struct net_device *netdev) -{ -/* As we are in test mode of ethtool we already own the rtnl lock -* so no address will change from user. We can just call the -* ndo_set_rx_mode() callback directly */ -if (netdev->netdev_ops->ndo_set_rx_mode) - netdev->netdev_ops->ndo_set_rx_mode (netdev); -} -static int stmmac_test_mcfilt (struct stmmac_priv *priv) { -unsigned char uc_addr[ETH_ALEN ] = {0x00 ,0x01 ,0x44 ,0x55 ,0x66 ,0x77 }; -unsigned char mc_addr[ETH_ALEN ] = {0x01 ,0x01 ,0x44 ,0x55 ,0x66 ,0x77 }; +unsigned char uc_addr[ETH_ALEN ] = {0xf0 ,0xff ,0xff ,0xff ,0xff ,0xff }; +unsigned char mc_addr[ETH_ALEN ] = {0xf1 ,0xff ,0xff ,0xff ,0xff ,0xff };struct stmmac_packet_attrs attr = { }; -int ret; +int ret, tries =256 ;if (stmmac_filter_check (priv))return -EOPNOTSUPP ; -if (!priv->hw->multicast_filter_bins) +if (netdev_uc_count (priv->dev) >= priv->hw->unicast_filter_entries)return -EOPNOTSUPP ; -/* Remove all MC addresses */ -__dev_mc_unsync (priv->dev,NULL ); -stmmac_test_set_rx_mode (priv->dev); +while (--tries) { +/* We only need to check the mc_addr for collisions */ + mc_addr[ETH_ALEN -1 ] = tries; +if (stmmac_hash_check (priv, mc_addr)) +break ; + } + +if (!tries) +return -EOPNOTSUPP ; ret =dev_uc_add (priv->dev, uc_addr);if (ret) - goto cleanup; +return ret; attr.dst = uc_addr;
@@ -602,30 +654,34 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv) cleanup:dev_uc_del (priv->dev, uc_addr); -__dev_mc_sync (priv->dev, stmmac_dummy_sync,NULL ); -stmmac_test_set_rx_mode (priv->dev);return ret; }static int stmmac_test_ucfilt (struct stmmac_priv *priv) { -unsigned char uc_addr[ETH_ALEN ] = {0x00 ,0x01 ,0x44 ,0x55 ,0x66 ,0x77 }; -unsigned char mc_addr[ETH_ALEN ] = {0x01 ,0x01 ,0x44 ,0x55 ,0x66 ,0x77 }; +unsigned char uc_addr[ETH_ALEN ] = {0xf0 ,0xff ,0xff ,0xff ,0xff ,0xff }; +unsigned char mc_addr[ETH_ALEN ] = {0xf1 ,0xff ,0xff ,0xff ,0xff ,0xff };struct stmmac_packet_attrs attr = { }; -int ret; +int ret, tries =256 ;if (stmmac_filter_check (priv))return -EOPNOTSUPP ; -if (!priv->hw->multicast_filter_bins) +if (netdev_mc_count (priv->dev) >= priv->hw->multicast_filter_bins)return -EOPNOTSUPP ; -/* Remove all UC addresses */ -__dev_uc_unsync (priv->dev,NULL ); -stmmac_test_set_rx_mode (priv->dev); +while (--tries) { +/* We only need to check the uc_addr for collisions */ + uc_addr[ETH_ALEN -1 ] = tries; +if (stmmac_perfect_check (priv, uc_addr)) +break ; + } + +if (!tries) +return -EOPNOTSUPP ; ret =dev_mc_add (priv->dev, mc_addr);if (ret) - goto cleanup; +return ret; attr.dst = mc_addr;
@@ -642,8 +698,6 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv) cleanup:dev_mc_del (priv->dev, mc_addr); -__dev_uc_sync (priv->dev, stmmac_dummy_sync,NULL ); -stmmac_test_set_rx_mode (priv->dev);return ret; }
Signature · 1 line
2.7.4
PATCH v2 5/10 net: stmmac: xgmac: Only get SPH header len if available
In reply to Jose AbreuSplit Header length is only available when L34T != 0. Fix this by correctly checking if L34T is not zero before trying to get Header length.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +2 -1
@@ -288,7 +288,8 @@ static int dwxgmac2_get_rx_hash(struct dma_desc *p, u32 *hash,static int dwxgmac2_get_rx_header_len (struct dma_desc *p,unsigned int *len) { - *len =le32_to_cpu (p->des2) &XGMAC_RDES2_HL ; +if (le32_to_cpu (p->des3) &XGMAC_RDES3_L34T ) + *len =le32_to_cpu (p->des2) &XGMAC_RDES2_HL ;return 0 ; }
Signature · 1 line
2.7.4
PATCH v2 6/10 net: stmmac: xgmac: Fix TSA selection
In reply to Jose AbreuWhen we change between Transmission Scheduling Algorithms, we need to clear previous values so that the new chosen algorithm is correctly selected.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +1 -0
@@ -224,6 +224,7 @@ static void dwxgmac2_config_cbs(struct mac_device_info *hw,writel (low_credit, ioaddr +XGMAC_MTL_TCx_LOCREDIT (queue)); value =readl (ioaddr +XGMAC_MTL_TCx_ETS_CONTROL (queue)); + value &= ~XGMAC_TSA ; value |=XGMAC_CC |XGMAC_CBS ;writel (value, ioaddr +XGMAC_MTL_TCx_ETS_CONTROL (queue)); }
Signature · 1 line
2.7.4
PATCH v2 7/10 net: stmmac: xgmac: Fix AV Feature detection
In reply to Jose AbreuFix incorrect precedence of operators. For reference: AV implies AV Feature but RAV implies only RX side AV Feature. As we want full AV features we need to check RAV.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +1 -1
@@ -372,7 +372,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, dma_cap->eee = (hw_cap &XGMAC_HWFEAT_EEESEL ) >>13 ; dma_cap->atime_stamp = (hw_cap &XGMAC_HWFEAT_TSSEL ) >>12 ; dma_cap->av = (hw_cap &XGMAC_HWFEAT_AVSEL ) >>11 ; - dma_cap->av &= !(hw_cap &XGMAC_HWFEAT_RAVSEL ) >>10 ; + dma_cap->av &= !((hw_cap &XGMAC_HWFEAT_RAVSEL ) >>10 ); dma_cap->arpoffsel = (hw_cap &XGMAC_HWFEAT_ARPOFFSEL ) >>9 ; dma_cap->rmon = (hw_cap &XGMAC_HWFEAT_MMCSEL ) >>8 ; dma_cap->pmt_magic_frame = (hw_cap &XGMAC_HWFEAT_MGKSEL ) >>7 ;
Signature · 1 line
2.7.4
PATCH v2 8/10 net: stmmac: xgmac: Disable Flow Control when 1 or more queues are in AV
In reply to Jose AbreuWhen in AVB mode we need to disable flow control to prevent MAC from pausing in TX side.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +2 -0
@@ -473,6 +473,7 @@ static void dwxgmac2_enable_tso(void __iomem *ioaddr, bool en, u32 chan)static void dwxgmac2_qmode (void __iomem *ioaddr,u32 channel,u8 qmode) {u32 value =readl (ioaddr +XGMAC_MTL_TXQ_OPMODE (channel)); +u32 flow =readl (ioaddr +XGMAC_RX_FLOW_CTRL ); value &= ~XGMAC_TXQEN ;if (qmode !=MTL_QUEUE_AVB ) {
@@ -480,6 +481,7 @@ static void dwxgmac2_qmode(void __iomem *ioaddr, u32 channel, u8 qmode)writel (0 , ioaddr +XGMAC_MTL_TCx_ETS_CONTROL (channel)); }else { value |=0x1 <<XGMAC_TXQEN_SHIFT ; +writel (flow & (~XGMAC_RFE ), ioaddr +XGMAC_RX_FLOW_CTRL ); }writel (value, ioaddr +XGMAC_MTL_TXQ_OPMODE (channel));
Signature · 1 line
2.7.4
PATCH v2 9/10 net: stmmac: xgmac: Disable MMC interrupts by default
In reply to Jose AbreuMMC interrupts were being enabled, which is not what we want because it will lead to a storm of interrupts that are not handled at all. Fix it by disabling all MMC interrupts for XGMAC.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/mmc_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/mmc_core.c +4 -2
@@ -176,6 +176,7 @@#define MMC_XGMAC_RX_PKT_SMD_ERR 0x22c#define MMC_XGMAC_RX_PKT_ASSEMBLY_OK 0x230#define MMC_XGMAC_RX_FPE_FRAG 0x234 +#define MMC_XGMAC_RX_IPC_INTR_MASK 0x25cstatic void dwmac_mmc_ctrl (void __iomem *mmcaddr,unsigned int mode) {
@@ -333,8 +334,9 @@ static void dwxgmac_mmc_ctrl(void __iomem *mmcaddr, unsigned int mode)static void dwxgmac_mmc_intr_all_mask (void __iomem *mmcaddr) { -writel (MMC_DEFAULT_MASK , mmcaddr +MMC_RX_INTR_MASK ); -writel (MMC_DEFAULT_MASK , mmcaddr +MMC_TX_INTR_MASK ); +writel (0x0 , mmcaddr +MMC_RX_INTR_MASK ); +writel (0x0 , mmcaddr +MMC_TX_INTR_MASK ); +writel (MMC_DEFAULT_MASK , mmcaddr +MMC_XGMAC_RX_IPC_INTR_MASK ); }static void dwxgmac_read_mmc_reg (void __iomem *addr,u32 reg,u32 *dest)
Signature · 1 line
2.7.4
PATCH v2 10/10 net: stmmac: Fix the packet count in stmmac_rx()
In reply to Jose AbreuCurrently, stmmac_rx() is counting the number of descriptors but it should count the number of packets as specified by the NAPI limit.
Fix this.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 -2
@@ -3505,8 +3505,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)if (unlikely (status & dma_own))break ; - count++; - rx_q->cur_rx =STMMAC_GET_ENTRY (rx_q->cur_rx,DMA_RX_SIZE ); next_entry = rx_q->cur_rx;
@@ -3533,6 +3531,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) goto read_again;if (unlikely (error)) {dev_kfree_skb (skb); + count++;continue ; }
@@ -3572,6 +3571,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) skb =napi_alloc_skb (&ch->rx_napi, len);if (!skb) { priv->dev->stats.rx_dropped++; + count++;continue ; }
@@ -3637,6 +3637,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) priv->dev->stats.rx_packets++; priv->dev->stats.rx_bytes += len; + count++; }if (status & rx_not_ls) {
Signature · 1 line
2.7.4