Skip to contentSkip to conversation

net: stmmac: Fix selftests in Synopsys AXS101 board

PATCH Applied Jose Abreu 4 participants 8 messages Jan 14, 2020 – Jan 15, 2020

Subsystems (7)
lore
Share & tools
lore

Jose Abreu

author
#0 lore raw

cover net: stmmac: Fix selftests in Synopsys AXS101 board

Set of fixes for sefltests so that they work in Synopsys AXS101 board.

Final output:

$ ethtool -t eth0
The test result is PASS
The test extra info:
 1. MAC Loopback                 0
 2. PHY Loopback                 -95
 3. MMC Counters                 0
 4. EEE                          -95
 5. Hash Filter MC               0
 6. Perfect Filter UC            0
 7. MC Filter                    0
 8. UC Filter                    0
 9. Flow Control                 -95
10. RSS                          -95
11. VLAN Filtering               -95
12. VLAN Filtering (perf)        -95
13. Double VLAN Filter           -95
14. Double VLAN Filter (perf)    -95
15. Flexible RX Parser           -95
16. SA Insertion (desc)          -95
17. SA Replacement (desc)        -95
18. SA Insertion (reg)           -95
19. SA Replacement (reg)         -95
20. VLAN TX Insertion            -95
21. SVLAN TX Insertion           -95
22. L3 DA Filtering              -95
23. L3 SA Filtering              -95
24. L4 DA TCP Filtering          -95
25. L4 SA TCP Filtering          -95
26. L4 DA UDP Filtering          -95
27. L4 SA UDP Filtering          -95
28. ARP Offload                  -95
29. Jumbo Frame                  0
30. Multichannel Jumbo           -95
31. Split Header                 -95

Description:

1) Fixes the unaligned accesses that caused CPU halt in Synopsys AXS101 boards.

2) Fixes the VLAN tests when filtering failed to work.

3) Fixes the VLAN Perfect tests when filtering is not available in HW.

4) Fixes the Ethernet DT bindings for AXS101 board.

---
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]
Cc: Alexey Brodkin <[email protected]>
Cc: Vineet Gupta <[email protected]>
Cc: [email protected]
---

Jose Abreu (4):
net: stmmac: selftests: Make it work in Synopsys AXS101 boards
net: stmmac: selftests: Mark as fail when received VLAN ID != expected
net: stmmac: selftests: Guard VLAN Perfect test against non supported
HW
ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node

 arch/arc/boot/dts/axs10x_mb.dtsi                   |  1 +
 .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 32 +++++++++++++++-------
 2 files changed, 23 insertions(+), 10 deletions(-)
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH 2/4 net: stmmac: selftests: Mark as fail when received VLAN ID != expected

When the VLAN ID does not match the expected one it means filter failed in HW. Fix it.

Fixes 94e18382003c ("net: stmmac: selftests: Add selftest for VLAN TX Offload")

---
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]
Cc: Alexey Brodkin <[email protected]>
Cc: Vineet Gupta <[email protected]>
Cc: [email protected]

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +5 -1
index 6516d65e84b8..7edee3c87ac9 100644
@@ -853,8 +853,12 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb,
 	if (tpriv->vlan_id) {
 		if (skb->vlan_proto != htons(proto))
 			goto out;
-		if (skb->vlan_tci != tpriv->vlan_id)
+		if (skb->vlan_tci != tpriv->vlan_id) {
+			/* Means filter did not work. */
+			tpriv->ok = false;
+			complete(&tpriv->comp);
 			goto out;
+		}
 	}
 
 	ehdr = (struct ethhdr *)skb_mac_header(skb);
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/4 net: stmmac: selftests: Make it work in Synopsys AXS101 boards

In reply to Jose Abreu

Synopsys AXS101 boards do not support unaligned memory loads or stores. Change the selftests mechanism to explicity:
- Not add extra alignment in TX SKB
- Use the unaligned version of ether_addr_equal()

Fixes 091810dbded9 ("net: stmmac: Introduce selftests support")

---
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]
Cc: Alexey Brodkin <[email protected]>
Cc: Vineet Gupta <[email protected]>
Cc: [email protected]

---
 .../net/ethernet/stmicro/stmmac/stmmac_selftests.c   | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +11 -9
index 36a4c43a799a..6516d65e84b8 100644
@@ -80,7 +80,7 @@ static struct sk_buff *stmmac_test_get_udp_skb(struct stmmac_priv *priv,
 	if (attr->max_size && (attr->max_size > size))
 		size = attr->max_size;
 
-	skb = netdev_alloc_skb_ip_align(priv->dev, size);
+	skb = netdev_alloc_skb(priv->dev, size);
 	if (!skb)
 		return NULL;
 
@@ -244,6 +244,8 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb,
 					 struct net_device *orig_ndev)
 {
 	struct stmmac_test_priv *tpriv = pt->af_packet_priv;
+	unsigned char *src = tpriv->packet->src;
+	unsigned char *dst = tpriv->packet->dst;
 	struct stmmachdr *shdr;
 	struct ethhdr *ehdr;
 	struct udphdr *uhdr;
@@ -260,15 +262,15 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb,
 		goto out;
 
 	ehdr = (struct ethhdr *)skb_mac_header(skb);
-	if (tpriv->packet->dst) {
-		if (!ether_addr_equal(ehdr->h_dest, tpriv->packet->dst))
+	if (dst) {
+		if (!ether_addr_equal_unaligned(ehdr->h_dest, dst))
 			goto out;
 	}
 	if (tpriv->packet->sarc) {
-		if (!ether_addr_equal(ehdr->h_source, ehdr->h_dest))
+		if (!ether_addr_equal_unaligned(ehdr->h_source, ehdr->h_dest))
 			goto out;
-	} else if (tpriv->packet->src) {
-		if (!ether_addr_equal(ehdr->h_source, tpriv->packet->src))
+	} else if (src) {
+		if (!ether_addr_equal_unaligned(ehdr->h_source, src))
 			goto out;
 	}
 
@@ -714,7 +716,7 @@ static int stmmac_test_flowctrl_validate(struct sk_buff *skb,
 	struct ethhdr *ehdr;
 
 	ehdr = (struct ethhdr *)skb_mac_header(skb);
-	if (!ether_addr_equal(ehdr->h_source, orig_ndev->dev_addr))
+	if (!ether_addr_equal_unaligned(ehdr->h_source, orig_ndev->dev_addr))
 		goto out;
 	if (ehdr->h_proto != htons(ETH_P_PAUSE))
 		goto out;
@@ -856,7 +858,7 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb,
 	}
 
 	ehdr = (struct ethhdr *)skb_mac_header(skb);
-	if (!ether_addr_equal(ehdr->h_dest, tpriv->packet->dst))
+	if (!ether_addr_equal_unaligned(ehdr->h_dest, tpriv->packet->dst))
 		goto out;
 
 	ihdr = ip_hdr(skb);
@@ -1586,7 +1588,7 @@ static int stmmac_test_arp_validate(struct sk_buff *skb,
 	struct arphdr *ahdr;
 
 	ehdr = (struct ethhdr *)skb_mac_header(skb);
-	if (!ether_addr_equal(ehdr->h_dest, tpriv->packet->src))
+	if (!ether_addr_equal_unaligned(ehdr->h_dest, tpriv->packet->src))
 		goto out;
 
 	ahdr = arp_hdr(skb);
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH 3/4 net: stmmac: selftests: Guard VLAN Perfect test against non supported HW

In reply to Jose Abreu

When HW does not support perfect filtering the feature will not be enabled in the net_device. Add a check for this to prevent failures.

Fixes 1b2250a04c1f ("net: stmmac: selftests: Add tests for VLAN Perfect Filtering")

---
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]
Cc: Alexey Brodkin <[email protected]>
Cc: Vineet Gupta <[email protected]>
Cc: [email protected]

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +6 -0
index 7edee3c87ac9..450d7dac3ea6 100644
@@ -971,6 +971,9 @@ static int stmmac_test_vlanfilt_perfect(struct stmmac_priv *priv)
 {
 	int ret, prev_cap = priv->dma_cap.vlhash;
 
+	if (!(priv->dev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
+		return -EOPNOTSUPP;
+
 	priv->dma_cap.vlhash = 0;
 	ret = __stmmac_test_vlanfilt(priv);
 	priv->dma_cap.vlhash = prev_cap;
@@ -1063,6 +1066,9 @@ static int stmmac_test_dvlanfilt_perfect(struct stmmac_priv *priv)
 {
 	int ret, prev_cap = priv->dma_cap.vlhash;
 
+	if (!(priv->dev->features & NETIF_F_HW_VLAN_STAG_FILTER))
+		return -EOPNOTSUPP;
+
 	priv->dma_cap.vlhash = 0;
 	ret = __stmmac_test_dvlanfilt(priv);
 	priv->dma_cap.vlhash = prev_cap;
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH 4/4 ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node

In reply to Jose Abreu

Add a missing property to GMAC node so that multicast filtering works correctly.

Fixes 556cc1c5f528 ("ARC: [axs101] Add support for AXS101 SDP (software development platform)")

---
Cc: Alexey Brodkin <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Vineet Gupta <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/arc/boot/dts/axs10x_mb.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arc/boot/dts/axs10x_mb.dtsi +1 -0
index f9a5c9ddcae7..1d109b06e7d8 100644
@@ -78,6 +78,7 @@
 			interrupt-names = "macirq";
 			phy-mode = "rgmii";
 			snps,pbl = < 32 >;
+			snps,multicast-filter-bins = <256>;
 			clocks = <&apbclk>;
 			clock-names = "stmmaceth";
 			max-speed = <100>;
Signature · 7 lines
2.7.4


_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Acked-by on v1 4/4
#5 lore raw

RE: [PATCH net 4/4] ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node

Hi Jose,

Quoted 10 lines

-----Original Message-----
From: Jose Abreu <[email protected]>
Sent: Tuesday, January 14, 2020 7:09 PM
To: [email protected]
Cc: Joao Pinto <[email protected]>; Jose Abreu <[email protected]>; Alexey Brodkin <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>; Vineet Gupta <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: [PATCH net 4/4] ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node

Quoted 5 lines

Add a missing property to GMAC node so that multicast filtering works correctly.

Fixes 556cc1c5f528 ("ARC: [axs101] Add support for AXS101 SDP (software development platform)")
#6 lore raw

Re: [PATCH net 4/4] ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node

In reply to Jose Abreu
Quoted 5 lines · Jose Abreu

Add a missing property to GMAC node so that multicast filtering works correctly.

Fixes 556cc1c5f528 ("ARC: [axs101] Add support for AXS101 SDP (software development platform)")

Added to for-curr.

Thx,
-Vineet

maintainer Applied
#7 lore raw
In reply to Jose Abreu

From: Jose Abreu <[email protected]>
Date: Tue, 14 Jan 2020 17:09:20 +0100

Quoted 1 line

Set of fixes for sefltests so that they work in Synopsys AXS101 board.

...

Applied patches 1-3, it looks like patch 4 went into another tree.