qca-wifi: Multilink FR for 5.4

Kernel API's used for multilink FR have been modified.
Use version-appropriate API's for the feature to work
with 5.4 kenel.

Change-Id: Id5bb90136fcefccd9c6ab4c8378991695b195c7b
diff --git a/qca_multi_link/inc/qca_multi_link.h b/qca_multi_link/inc/qca_multi_link.h
index b997b32..f9bf565 100644
--- a/qca_multi_link/inc/qca_multi_link.h
+++ b/qca_multi_link/inc/qca_multi_link.h
@@ -23,6 +23,7 @@
 #include <qdf_util.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
+#include <linux/version.h>
 #include <linux/wireless.h>
 #include <net/cfg80211.h>
 #include <br_private.h>
diff --git a/qca_multi_link/src/qca_multi_link_tbl.c b/qca_multi_link/src/qca_multi_link_tbl.c
index 7d7d98e..634e5a3 100644
--- a/qca_multi_link/src/qca_multi_link_tbl.c
+++ b/qca_multi_link/src/qca_multi_link_tbl.c
@@ -45,11 +45,22 @@
 	 */
 	rcu_read_lock();
 	for (i = 0; i < BR_HASH_SIZE ; i++) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 24)
 		hlist_for_each_entry_rcu(search_fdb, &p->br->hash[i], hlist) {
+#else
+		hlist_for_each_entry_rcu(search_fdb, &p->br->fdb_list,
+					 fdb_node) {
+#endif
 			ndev = search_fdb->dst ? search_fdb->dst->dev : NULL;
 			wdev = ndev ? ndev->ieee80211_ptr : NULL;
 			if (!wdev && ndev) {
-				memcpy(qfdb->qal_mac_addr, search_fdb->addr.addr, 6);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 24)
+				memcpy(qfdb->qal_mac_addr,
+				       search_fdb->addr.addr, 6);
+#else
+				memcpy(qfdb->qal_mac_addr,
+				       search_fdb->key.addr.addr, 6);
+#endif
 				qfdb->qal_fdb_dev = ndev;
 				qfdb->qal_fdb_is_local =  search_fdb->is_local;
 				num_of_entries++;
@@ -89,7 +100,12 @@
 
 	rcu_read_lock();
 	for (i = 0; i < BR_HASH_SIZE; i++) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 24)
 		hlist_for_each_entry_rcu(search_fdb, &p->br->hash[i], hlist) {
+#else
+		hlist_for_each_entry_rcu(search_fdb, &p->br->fdb_list,
+					 fdb_node) {
+#endif
 			if (!search_fdb->is_local)
 				continue;
 
@@ -112,8 +128,14 @@
 
 QDF_STATUS qca_multi_link_tbl_delete_entry(struct net_device *net_dev, uint8_t *addr)
 {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 24)
 	int status;
+#endif
 	struct net_bridge_fdb_entry *fdb_entry = NULL;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 24)
+	struct net_bridge_port *fdb_port = NULL;
+	struct net_bridge *br = NULL;
+#endif
 
 	fdb_entry = br_fdb_has_entry(net_dev, addr, 0);
 	if (!fdb_entry) {
@@ -124,10 +146,25 @@
 		return QDF_STATUS_SUCCESS;
 	}
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 24)
+	fdb_port = br_port_get_rcu(net_dev);
+	if (!fdb_port) {
+		qdf_err("fdb port is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	br = fdb_port->br;
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 24)
 	status = br_fdb_delete_by_netdev(net_dev, addr, 0);
 	if (status < 0) {
 		return QDF_STATUS_E_FAILURE;
 	}
+#else
+	/* Use 5.4-specific API */
+	qdf_info("Needs alternative implementation");
+#endif
 	return QDF_STATUS_SUCCESS;
 }