linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/4] net: lan966x: lan966x fixes
@ 2022-04-09 18:41 Horatiu Vultur
  2022-04-09 18:41 ` [PATCH net 1/4] net: lan966x: Update lan966x_ptp_get_nominal_value Horatiu Vultur
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Horatiu Vultur @ 2022-04-09 18:41 UTC (permalink / raw)
  To: netdev, linux-kernel; +Cc: UNGLinuxDriver, davem, kuba, pabeni, Horatiu Vultur

This contains different fixes for lan966x in different areas like PTP, MAC,
Switchdev and IGMP processing.

Horatiu Vultur (4):
  net: lan966x: Update lan966x_ptp_get_nominal_value
  net: lan966x: Fix IGMP snooping when frames have vlan tag
  net: lan966x: Fix when a port's upper is changed.
  net: lan966x: Stop processing the MAC entry is port is wrong.

 drivers/net/ethernet/microchip/lan966x/lan966x_mac.c      | 6 ++++--
 drivers/net/ethernet/microchip/lan966x/lan966x_main.c     | 6 ++++++
 drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c      | 8 ++++----
 .../net/ethernet/microchip/lan966x/lan966x_switchdev.c    | 3 +--
 4 files changed, 15 insertions(+), 8 deletions(-)

-- 
2.33.0


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

* [PATCH net 1/4] net: lan966x: Update lan966x_ptp_get_nominal_value
  2022-04-09 18:41 [PATCH net 0/4] net: lan966x: lan966x fixes Horatiu Vultur
@ 2022-04-09 18:41 ` Horatiu Vultur
  2022-04-09 18:41 ` [PATCH net 2/4] net: lan966x: Fix IGMP snooping when frames have vlan tag Horatiu Vultur
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Horatiu Vultur @ 2022-04-09 18:41 UTC (permalink / raw)
  To: netdev, linux-kernel; +Cc: UNGLinuxDriver, davem, kuba, pabeni, Horatiu Vultur

The clk_per_cfg register represents the value added to the system clock
for each clock cycle. The issue is that the default value is wrong,
meaning that in case the DUT was a grandmaster then everone in the
network was too slow. In case there was a grandmaster, then there is no
issue because the DUT will configure clk_per_cfg register based on the
master frequency.

Fixes: d096459494a887 ("net: lan966x: Add support for ptp clocks")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
index ae782778d6dd..0a1041da4384 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
@@ -29,10 +29,10 @@ enum {
 
 static u64 lan966x_ptp_get_nominal_value(void)
 {
-	u64 res = 0x304d2df1;
-
-	res <<= 32;
-	return res;
+	/* This is the default value that for each system clock, the time of day
+	 * is increased. It has the format 5.59 nanosecond.
+	 */
+	return 0x304d4873ecade305;
 }
 
 int lan966x_ptp_hwtstamp_set(struct lan966x_port *port, struct ifreq *ifr)
-- 
2.33.0


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

* [PATCH net 2/4] net: lan966x: Fix IGMP snooping when frames have vlan tag
  2022-04-09 18:41 [PATCH net 0/4] net: lan966x: lan966x fixes Horatiu Vultur
  2022-04-09 18:41 ` [PATCH net 1/4] net: lan966x: Update lan966x_ptp_get_nominal_value Horatiu Vultur
@ 2022-04-09 18:41 ` Horatiu Vultur
  2022-04-09 18:41 ` [PATCH net 3/4] net: lan966x: Fix when a port's upper is changed Horatiu Vultur
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Horatiu Vultur @ 2022-04-09 18:41 UTC (permalink / raw)
  To: netdev, linux-kernel; +Cc: UNGLinuxDriver, davem, kuba, pabeni, Horatiu Vultur

In case an IGMP frame has a vlan tag, then the function
lan966x_hw_offload couldn't figure out that is a IGMP frame. Therefore
the SW thinks that the frame was already forward by the HW which is not
true.
Extend lan966x_hw_offload to pop the vlan tag if are any and then check
for IGMP frames.

Fixes: 47aeea0d57e80c ("net: lan966x: Implement the callback SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED ")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index 1f8c67f0261b..958e55596b82 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -446,6 +446,12 @@ static bool lan966x_hw_offload(struct lan966x *lan966x, u32 port,
 		     ANA_CPU_FWD_CFG_MLD_REDIR_ENA)))
 		return true;
 
+	if (eth_type_vlan(skb->protocol)) {
+		skb = skb_vlan_untag(skb);
+		if (unlikely(!skb))
+			return false;
+	}
+
 	if (skb->protocol == htons(ETH_P_IP) &&
 	    ip_hdr(skb)->protocol == IPPROTO_IGMP)
 		return false;
-- 
2.33.0


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

* [PATCH net 3/4] net: lan966x: Fix when a port's upper is changed.
  2022-04-09 18:41 [PATCH net 0/4] net: lan966x: lan966x fixes Horatiu Vultur
  2022-04-09 18:41 ` [PATCH net 1/4] net: lan966x: Update lan966x_ptp_get_nominal_value Horatiu Vultur
  2022-04-09 18:41 ` [PATCH net 2/4] net: lan966x: Fix IGMP snooping when frames have vlan tag Horatiu Vultur
@ 2022-04-09 18:41 ` Horatiu Vultur
  2022-04-09 18:41 ` [PATCH net 4/4] net: lan966x: Stop processing the MAC entry is port is wrong Horatiu Vultur
  2022-04-12  4:00 ` [PATCH net 0/4] net: lan966x: lan966x fixes patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Horatiu Vultur @ 2022-04-09 18:41 UTC (permalink / raw)
  To: netdev, linux-kernel; +Cc: UNGLinuxDriver, davem, kuba, pabeni, Horatiu Vultur

On lan966x it is not allowed to have foreign interfaces under a bridge
which already contains lan966x ports. So when a port leaves the bridge
it would call switchdev_bridge_port_unoffload which eventually will
notify the other ports that bridge left the vlan group but that is not
true because the bridge is still part of the vlan group.

Therefore when a port leaves the bridge, stop generating replays because
already the HW cleared after itself and the other ports don't need to do
anything else.

Fixes: cf2f60897e921e ("net: lan966x: Add support to offload the forwarding.")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/net/ethernet/microchip/lan966x/lan966x_switchdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_switchdev.c b/drivers/net/ethernet/microchip/lan966x/lan966x_switchdev.c
index e3555c94294d..df2bee678559 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_switchdev.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_switchdev.c
@@ -322,8 +322,7 @@ static int lan966x_port_prechangeupper(struct net_device *dev,
 
 	if (netif_is_bridge_master(info->upper_dev) && !info->linking)
 		switchdev_bridge_port_unoffload(port->dev, port,
-						&lan966x_switchdev_nb,
-						&lan966x_switchdev_blocking_nb);
+						NULL, NULL);
 
 	return NOTIFY_DONE;
 }
-- 
2.33.0


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

* [PATCH net 4/4] net: lan966x: Stop processing the MAC entry is port is wrong.
  2022-04-09 18:41 [PATCH net 0/4] net: lan966x: lan966x fixes Horatiu Vultur
                   ` (2 preceding siblings ...)
  2022-04-09 18:41 ` [PATCH net 3/4] net: lan966x: Fix when a port's upper is changed Horatiu Vultur
@ 2022-04-09 18:41 ` Horatiu Vultur
  2022-04-12  4:00 ` [PATCH net 0/4] net: lan966x: lan966x fixes patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Horatiu Vultur @ 2022-04-09 18:41 UTC (permalink / raw)
  To: netdev, linux-kernel; +Cc: UNGLinuxDriver, davem, kuba, pabeni, Horatiu Vultur

Currently when getting a new MAC is learn, the HW generates an
interrupt. So then the SW will check the new entry and checks if it
arrived on a correct port. If it didn't just generate a warning.
But this could still crash the system. Therefore stop processing that
entry when an issue is seen.

Fixes: 5ccd66e01cbef8 ("net: lan966x: add support for interrupts from analyzer")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/net/ethernet/microchip/lan966x/lan966x_mac.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_mac.c b/drivers/net/ethernet/microchip/lan966x/lan966x_mac.c
index ce5970bdcc6a..2679111ef669 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_mac.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_mac.c
@@ -346,7 +346,8 @@ static void lan966x_mac_irq_process(struct lan966x *lan966x, u32 row,
 
 			lan966x_mac_process_raw_entry(&raw_entries[column],
 						      mac, &vid, &dest_idx);
-			WARN_ON(dest_idx > lan966x->num_phys_ports);
+			if (WARN_ON(dest_idx > lan966x->num_phys_ports))
+				continue;
 
 			/* If the entry in SW is found, then there is nothing
 			 * to do
@@ -392,7 +393,8 @@ static void lan966x_mac_irq_process(struct lan966x *lan966x, u32 row,
 
 		lan966x_mac_process_raw_entry(&raw_entries[column],
 					      mac, &vid, &dest_idx);
-		WARN_ON(dest_idx > lan966x->num_phys_ports);
+		if (WARN_ON(dest_idx > lan966x->num_phys_ports))
+			continue;
 
 		mac_entry = lan966x_mac_alloc_entry(mac, vid, dest_idx);
 		if (!mac_entry)
-- 
2.33.0


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

* Re: [PATCH net 0/4] net: lan966x: lan966x fixes
  2022-04-09 18:41 [PATCH net 0/4] net: lan966x: lan966x fixes Horatiu Vultur
                   ` (3 preceding siblings ...)
  2022-04-09 18:41 ` [PATCH net 4/4] net: lan966x: Stop processing the MAC entry is port is wrong Horatiu Vultur
@ 2022-04-12  4:00 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-12  4:00 UTC (permalink / raw)
  To: Horatiu Vultur; +Cc: netdev, linux-kernel, UNGLinuxDriver, davem, kuba, pabeni

Hello:

This series was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 9 Apr 2022 20:41:39 +0200 you wrote:
> This contains different fixes for lan966x in different areas like PTP, MAC,
> Switchdev and IGMP processing.
> 
> Horatiu Vultur (4):
>   net: lan966x: Update lan966x_ptp_get_nominal_value
>   net: lan966x: Fix IGMP snooping when frames have vlan tag
>   net: lan966x: Fix when a port's upper is changed.
>   net: lan966x: Stop processing the MAC entry is port is wrong.
> 
> [...]

Here is the summary with links:
  - [net,1/4] net: lan966x: Update lan966x_ptp_get_nominal_value
    https://git.kernel.org/netdev/net/c/eb9c0d671e94
  - [net,2/4] net: lan966x: Fix IGMP snooping when frames have vlan tag
    https://git.kernel.org/netdev/net/c/6476f90aefaf
  - [net,3/4] net: lan966x: Fix when a port's upper is changed.
    https://git.kernel.org/netdev/net/c/d7a947d289dc
  - [net,4/4] net: lan966x: Stop processing the MAC entry is port is wrong.
    https://git.kernel.org/netdev/net/c/269219321eb7

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-04-12  4:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-09 18:41 [PATCH net 0/4] net: lan966x: lan966x fixes Horatiu Vultur
2022-04-09 18:41 ` [PATCH net 1/4] net: lan966x: Update lan966x_ptp_get_nominal_value Horatiu Vultur
2022-04-09 18:41 ` [PATCH net 2/4] net: lan966x: Fix IGMP snooping when frames have vlan tag Horatiu Vultur
2022-04-09 18:41 ` [PATCH net 3/4] net: lan966x: Fix when a port's upper is changed Horatiu Vultur
2022-04-09 18:41 ` [PATCH net 4/4] net: lan966x: Stop processing the MAC entry is port is wrong Horatiu Vultur
2022-04-12  4:00 ` [PATCH net 0/4] net: lan966x: lan966x fixes patchwork-bot+netdevbpf

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