openwrt/package/kernel/qca-nss-dp/patches/0009-nss-dp-switchdev-fix-FDB-roaming.patch

112 lines
3.3 KiB
Diff
Raw Normal View History

From 25ca3308edb67aa0c6c70b83edf0e22b8ae7533f Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 29 Jun 2023 13:52:58 +0200
Subject: [PATCH] nss-dp: switchdev: fix FDB roaming
Try and solve the roaming issue by trying to replicate what NSS bridge
module is doing, but by utilizing switchdev FDB notifiers instead of
adding new notifiers to the bridge code.
We register a new non-blocking switchdev notifier and simply wait for
notification, and then process the SWITCHDEV_FDB_DEL_TO_DEVICE
notifications.
Those tell us that a certain FDB entry should be removed, then a VSI ID
is fetched for the physical PPE port and using that VSI ID and the
notification provided MAC adress existing FDB entry gets removed.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
nss_dp_switchdev.c | 73 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 72 insertions(+), 1 deletion(-)
--- a/nss_dp_switchdev.c
+++ b/nss_dp_switchdev.c
@@ -29,6 +29,8 @@
#include "nss_dp_dev.h"
#include "fal/fal_stp.h"
#include "fal/fal_ctrlpkt.h"
+#include "fal/fal_fdb.h"
+#include "ref/ref_vsi.h"
#define NSS_DP_SWITCH_ID 0
#define NSS_DP_SW_ETHTYPE_PID 0 /* PPE ethtype profile ID for slow protocols */
kernel: qca-nss-dp: update to 12.5.r2 for kernel 6.6 There is a new branch 12.5.r2 for kernel 6.6, so refresh and update patches. Delete patch 0010-nss-dp-include-net-netdev_rx_queue.h.patch Changes: 2024-04-04 -5bf8b91 [qca-nss-dp] Adding support for port ID 3 & 4 in MHT switch 2024-03-28 -ce1e4cf [qca-nss-dp] Use skb_queue_head_init instead of __skb_queue_head_init. 2024-03-11 -0d26366 [qca-nss-dp] Read MHT LAN port status for ErP phase2 2024-03-22 -8382f14 [qca-nss-dp] Fix compilation issues seen on ginger branch for Miami profile 2023-05-02 -09b0983 [qca-nss-dp] vp list processing for capwap 2024-02-22 -bc09a01 [qca-nss-dp] EDMA ring reset for PPE-DS 2024-03-12 -2fcb586 [qca-nss-dp] Fix the EDMA clock frequency for the mitigation timer configuration 2024-02-23 -44ba1be [qca-nss-dp] Add API to retrieve ethernet netdevs for ErP 2024-02-09 -a5979b7 [qca-nss-dp] send napi and ip checksum for VP handler 2024-01-12 -1b9cb5d qca-nss-dp: User netdev_alloc_skb_fast instead of dev_alloc_skb 2024-01-08 -a859b48 [qca-nss-dp] NAPI Budget and EDMA Rx size change for KPI improvement. 2024-01-06 -8935523 [qca-nss-dp] Offload L3, L4 checksum to hardware for ppe-vp. 2023-12-07 -bbd9547 [qca-nss-dp] Fix Compilation issues on kernel6.6 2023-10-12 -bc55f75 [qca-nss-dp]: Enable legacy SCS for PPE-VP. 2023-09-08 -6bd771f [qca-nss-dp] Invalidate secondary descriptor before use. 2023-12-19 -b143df8 [qca-nss-dp] Fixed nss_dp_hal_hw_reset functionality for ipq53xx. 2023-12-16 -7cfde1d [qca-nss-dp] Added nss_dp_hal_hw_reset functionality for ipq53xx. 2023-11-02 -70af6c2 [qca-nss-dp] Implement EDMA hang recovery support 2023-11-27 -2202b29 [qca-nss-dp] Add support for adding the link speed for the Miami's port connected to the internal Switch. 2023-12-06 -bef68a8 [qca-nss-dp] Resolve ring utilization reporting issue in EDMA driver 2023-12-06 -eaa7627 [qca-nss-dp] Add/Delete static fdb entries only for physical ports 2023-10-16 -4551d0f [qca-nss-dp]: Support HLOST_TID_override from PPE_VP path. 2023-11-09 -42ad3f3 [qca-nss-dp] Correct the NAPI poll implementation for DS Rx fill handling 2023-10-16 -dfeb7d3 [qca-nss-dp] Check for disabled ethernet port in ErP functions 2023-11-09 -42ad3f3 [qca-nss-dp] Correct the NAPI poll implementation for DS Rx fill handling 2023-10-16 -dfeb7d3 [qca-nss-dp] Check for disabled ethernet port in ErP functions 2023-09-22 -03f83d6 [qca-nss-dp] Correct the mht device flag 2023-08-18 -5efd7f4 [qca-nss-dp] Add EDMA Tx rings for MHT ports 2023-09-11 -7808ba2 [qca-nss-dp] Move DP standby code to new file and use new SSDK API 2023-09-28 -22ade1e [qca-nss-dp] : enable PPE-DS support in 6.x kernel 2023-08-28 -1943922 [qca-nss-dp] Support for bitmap based CPU selection. 2023-08-16 -dcb82a7 qca-nss-dp: 512M profile changes for Miami+Pebble 2023-09-01 -18e51f3 [qca-nss-dp] Fix tx descriptor completion error. 2023-08-28 -0bfde2d [qca-nss-dp] Changes to enable ErP mode 2023-09-05 -f1d635a [qca-nss-dp] Enable fast recycled changes in dp for kernel 6.1 2023-06-15 -55d35bd [qca-nss-dp] Tracking the full utilization of EDMA rings 2023-08-25 -89b9c19 [qca-nss-dp] Restricting the MTU as 9216 for all interfaces in DP 2023-01-03 -5098a4f [qca-nss-dp] Requeue Tx packet in case of Tx-failure. 2023-04-06 -3576dbb [qca-nss-dp] Adding tx napi with four queue per interface. 2023-08-10 -d2b6921 [qca-nss-dp] : changes to support ppe-qdisc for linux 6.x 2023-08-08 -a1941fb [qca-nss-dp] moving SET_NETDEV_DEV for all netdev to set. 2023-07-18 -74d3178 [qca-nss-dp] Reordering the CPU code and ACL index processing. 2023-06-30 -ab03139 [qca-nss-dp] Configure port level PPE offload flag in PPE 2023-06-06 -e9bb8c5 [qca-nss-dp] Rate limit the debug logs. 2023-07-18 -43afb9b [qca-nss-dp] Support Core selection for PPE mirrored packets. 2023-07-11 -92edcfd [qca-nss-dp] Add sysctl to invalidate RX secondary descriptor. Tested and working on WAX620. Signed-off-by: Kristian Skramstad <kristian+github@83.no> Link: https://github.com/openwrt/openwrt/pull/15383 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-05 10:36:20 +00:00
@@ -534,7 +536,76 @@ static struct notifier_block *nss_dp_sw_
#else
-static struct notifier_block *nss_dp_sw_ev_nb;
+/*
+ * nss_dp_switchdev_fdb_del_event
+ *
+ * Used for EDMA v1 to remove old MAC in order to preventing having
+ * duplicate MAC entries in FDB thus and avoid roaming issues.
+ */
+
+static int nss_dp_switchdev_fdb_del_event(struct net_device *netdev,
+ struct switchdev_notifier_fdb_info *fdb_info)
+{
+ struct nss_dp_dev *dp_priv = (struct nss_dp_dev *)netdev_priv(netdev);
+ fal_fdb_entry_t entry;
+ a_uint32_t vsi_id;
+ sw_error_t rv;
+
+ netdev_dbg(netdev, "FDB DEL %pM port %d\n", fdb_info->addr, dp_priv->macid);
+
+ rv = ppe_port_vsi_get(NSS_DP_SWITCH_ID, dp_priv->macid, &vsi_id);
+ if (rv) {
+ netdev_err(netdev, "cannot get VSI ID for port %d\n", dp_priv->macid);
+ return notifier_from_errno(rv);
+ }
+
+ memset(&entry, 0, sizeof(entry));
+ memcpy(&entry.addr, fdb_info->addr, ETH_ALEN);
+ entry.fid = vsi_id;
+
+ rv = fal_fdb_entry_del_bymac(NSS_DP_SWITCH_ID, &entry);
+ if (rv) {
+ netdev_err(netdev, "FDB entry delete failed with MAC %pM and fid %d\n",
+ &entry.addr, entry.fid);
+ return notifier_from_errno(rv);
+ }
+
+ return notifier_from_errno(rv);
+}
+
+/*
+ * nss_dp_switchdev_event_nb
+ *
+ * Non blocking switchdev event for netdevice.
+ * Used for EDMA v1 to remove old MAC and avoid roaming issues.
+ */
+static int nss_dp_switchdev_event_nb(struct notifier_block *unused,
+ unsigned long event, void *ptr)
+{
+ struct net_device *dev = switchdev_notifier_info_to_dev(ptr);
+
+ /*
+ * Handle switchdev event only for physical devices
+ */
+ if (!nss_dp_is_phy_dev(dev)) {
+ return NOTIFY_DONE;
+ }
+
+ switch (event) {
+ case SWITCHDEV_FDB_DEL_TO_DEVICE:
+ return nss_dp_switchdev_fdb_del_event(dev, ptr);
+ default:
+ netdev_dbg(dev, "Switchdev event %lu is not supported\n", event);
+ }
+
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block nss_dp_switchdev_notifier_nb = {
+ .notifier_call = nss_dp_switchdev_event_nb,
+};
+
+static struct notifier_block *nss_dp_sw_ev_nb = &nss_dp_switchdev_notifier_nb;
/*
* nss_dp_bridge_attr_set()