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
This commit is contained in:
Debasis Das
2020-06-19 13:51:38 +05:30
parent 0e79976e0c
commit 7fcd532cf1
2 changed files with 39 additions and 1 deletions

View File

@@ -23,6 +23,7 @@
#include <qdf_util.h> #include <qdf_util.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/version.h>
#include <linux/wireless.h> #include <linux/wireless.h>
#include <net/cfg80211.h> #include <net/cfg80211.h>
#include <br_private.h> #include <br_private.h>

View File

@@ -45,11 +45,22 @@ int qca_multi_link_tbl_get_eth_entries(struct net_device *net_dev,
*/ */
rcu_read_lock(); rcu_read_lock();
for (i = 0; i < BR_HASH_SIZE ; i++) { 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) { 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; ndev = search_fdb->dst ? search_fdb->dst->dev : NULL;
wdev = ndev ? ndev->ieee80211_ptr : NULL; wdev = ndev ? ndev->ieee80211_ptr : NULL;
if (!wdev && ndev) { 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_dev = ndev;
qfdb->qal_fdb_is_local = search_fdb->is_local; qfdb->qal_fdb_is_local = search_fdb->is_local;
num_of_entries++; num_of_entries++;
@@ -89,7 +100,12 @@ struct net_device *qca_multi_link_tbl_find_sta_or_ap(struct net_device *net_dev,
rcu_read_lock(); rcu_read_lock();
for (i = 0; i < BR_HASH_SIZE; i++) { 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) { 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) if (!search_fdb->is_local)
continue; continue;
@@ -112,8 +128,14 @@ qdf_export_symbol(qca_multi_link_tbl_find_sta_or_ap);
QDF_STATUS qca_multi_link_tbl_delete_entry(struct net_device *net_dev, uint8_t *addr) 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; int status;
#endif
struct net_bridge_fdb_entry *fdb_entry = NULL; 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); fdb_entry = br_fdb_has_entry(net_dev, addr, 0);
if (!fdb_entry) { if (!fdb_entry) {
@@ -124,10 +146,25 @@ QDF_STATUS qca_multi_link_tbl_delete_entry(struct net_device *net_dev, uint8_t *
return QDF_STATUS_SUCCESS; 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); status = br_fdb_delete_by_netdev(net_dev, addr, 0);
if (status < 0) { if (status < 0) {
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
#else
/* Use 5.4-specific API */
qdf_info("Needs alternative implementation");
#endif
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }