Skip to content

Commit 627afb3

Browse files
committed
Revert "[nrf fromlist] drivers: wifi: nrf_wifi: Add per-peer authorized flag"
This reverts commit f39dddd. Signed-off-by: Chaitanya Tata <[email protected]> (cherry picked from commit dec54af)
1 parent 1b51fbf commit 627afb3

File tree

4 files changed

+14
-69
lines changed

4 files changed

+14
-69
lines changed

drivers/wifi/nrf_wifi/inc/fmac_main.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ struct nrf_wifi_vif_ctx_zep {
7575
#endif /* CONFIG_NET_STATISTICS_ETHERNET_VENDOR */
7676
struct net_stats_eth eth_stats;
7777
#endif /* CONFIG_NET_STATISTICS_ETHERNET */
78+
#if defined(CONFIG_NRF70_STA_MODE) || defined(CONFIG_NRF70_RAW_DATA_RX)
79+
bool authorized;
80+
#endif
7881
#ifdef CONFIG_NRF70_STA_MODE
7982
unsigned int assoc_freq;
8083
enum nrf_wifi_fmac_if_carr_state if_carr_state;

drivers/wifi/nrf_wifi/src/net_if.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL);
2525

2626
#include "util.h"
2727
#include "common/fmac_util.h"
28-
#include "system/fmac_peer.h"
2928
#include "shim.h"
3029
#include "fmac_main.h"
3130
#include "wpa_supp_if.h"
@@ -389,8 +388,6 @@ int nrf_wifi_if_send(const struct device *dev,
389388
struct rpu_host_stats *host_stats = NULL;
390389
void *nbuf = NULL;
391390
bool locked = false;
392-
unsigned char *ra = NULL;
393-
int peer_id = -1;
394391

395392
if (!dev || !pkt) {
396393
LOG_ERR("%s: vif_ctx_zep is NULL", __func__);
@@ -439,20 +436,12 @@ int nrf_wifi_if_send(const struct device *dev,
439436
nbuf);
440437
} else {
441438
#endif /* CONFIG_NRF70_RAW_DATA_TX */
442-
443-
ra = nrf_wifi_util_get_ra(sys_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx], nbuf);
444-
peer_id = nrf_wifi_fmac_peer_get_id(rpu_ctx_zep->rpu_ctx, ra);
445-
if (peer_id == -1) {
446-
nrf_wifi_osal_log_dbg("%s: Invalid peer",
447-
__func__);
448-
goto out;
449-
}
450-
451439
if ((vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) ||
452-
(!sys_dev_ctx->tx_config.peers[peer_id].authorized && !is_eapol(pkt))) {
440+
(!vif_ctx_zep->authorized && !is_eapol(pkt))) {
453441
ret = -EPERM;
454442
goto drop;
455443
}
444+
456445
ret = nrf_wifi_fmac_start_xmit(rpu_ctx_zep->rpu_ctx,
457446
vif_ctx_zep->vif_idx,
458447
nbuf);

drivers/wifi/nrf_wifi/src/wifi_mgmt.c

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "system/fmac_api.h"
1919
#include "system/fmac_tx.h"
2020
#include "common/fmac_util.h"
21-
#include "common/fmac_structs_common.h"
2221
#include "fmac_main.h"
2322
#include "wifi_mgmt.h"
2423

@@ -758,8 +757,6 @@ int nrf_wifi_mode(const struct device *dev,
758757
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL;
759758
struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL;
760759
struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL;
761-
struct peers_info *peer = NULL;
762-
int i = 0;
763760
int ret = -1;
764761

765762
if (!dev || !mode) {
@@ -801,16 +798,10 @@ int nrf_wifi_mode(const struct device *dev,
801798
goto out;
802799
}
803800

804-
for (i = 0; i < MAX_PEERS; i++) {
805-
peer = &sys_dev_ctx->tx_config.peers[i];
806-
if (peer->peer_id == -1) {
807-
continue;
808-
}
809-
if (peer->authorized && (mode->mode == NRF_WIFI_MONITOR_MODE)) {
810-
LOG_ERR("%s: Cannot set monitor mode when station is connected",
811-
__func__);
812-
goto out;
813-
}
801+
if (vif_ctx_zep->authorized && (mode->mode == NRF_WIFI_MONITOR_MODE)) {
802+
LOG_ERR("%s: Cannot set monitor mode when station is connected",
803+
__func__);
804+
goto out;
814805
}
815806

816807
/**
@@ -860,8 +851,6 @@ int nrf_wifi_channel(const struct device *dev,
860851
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL;
861852
struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL;
862853
struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL;
863-
struct peers_info *peer = NULL;
864-
int i = 0;
865854
int ret = -1;
866855

867856
if (!dev || !channel) {
@@ -875,16 +864,9 @@ int nrf_wifi_channel(const struct device *dev,
875864
return ret;
876865
}
877866

878-
for (i = 0; i < MAX_PEERS; i++) {
879-
peer = &sys_dev_ctx->tx_config.peers[i];
880-
if (peer->peer_id == -1) {
881-
continue;
882-
}
883-
if (peer->authorized) {
884-
LOG_ERR("%s: Cannot change channel when in station connected mode",
885-
__func__);
886-
return ret;
887-
}
867+
if (vif_ctx_zep->authorized) {
868+
LOG_ERR("%s: Cannot change channel when in station connected mode", __func__);
869+
return ret;
888870
}
889871

890872
rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep;

drivers/wifi/nrf_wifi/src/wpa_supp_if.c

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "common/fmac_util.h"
1818
#include "wifi_mgmt.h"
1919
#include "wpa_supp_if.h"
20-
#include <system/fmac_peer.h>
2120

2221
LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL);
2322

@@ -1108,9 +1107,7 @@ int nrf_wifi_wpa_set_supp_port(void *if_priv, int authorized, char *bssid)
11081107
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL;
11091108
struct nrf_wifi_umac_chg_sta_info chg_sta_info;
11101109
struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL;
1111-
struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL;
11121110
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
1113-
int peer_id = -1;
11141111
int ret = -1;
11151112

11161113
if (!if_priv || !bssid) {
@@ -1141,6 +1138,8 @@ int nrf_wifi_wpa_set_supp_port(void *if_priv, int authorized, char *bssid)
11411138

11421139
memcpy(chg_sta_info.mac_addr, bssid, ETH_ALEN);
11431140

1141+
vif_ctx_zep->authorized = authorized;
1142+
11441143
if (authorized) {
11451144
/* BIT(NL80211_STA_FLAG_AUTHORIZED) */
11461145
chg_sta_info.sta_flags2.nrf_wifi_mask = 1 << 1;
@@ -1158,19 +1157,6 @@ int nrf_wifi_wpa_set_supp_port(void *if_priv, int authorized, char *bssid)
11581157
goto out;
11591158
}
11601159

1161-
sys_dev_ctx = wifi_dev_priv(rpu_ctx_zep->rpu_ctx);
1162-
1163-
peer_id = nrf_wifi_fmac_peer_get_id(rpu_ctx_zep->rpu_ctx, chg_sta_info.mac_addr);
1164-
if (peer_id == -1) {
1165-
nrf_wifi_osal_log_err("%s: Invalid peer",
1166-
__func__);
1167-
goto out;
1168-
}
1169-
1170-
if (chg_sta_info.sta_flags2.nrf_wifi_set & NRF_WIFI_STA_FLAG_AUTHORIZED) {
1171-
sys_dev_ctx->tx_config.peers[peer_id].authorized = true;
1172-
}
1173-
11741160
ret = 0;
11751161
out:
11761162
k_mutex_unlock(&vif_ctx_zep->vif_lock);
@@ -3003,9 +2989,7 @@ int nrf_wifi_wpa_supp_sta_set_flags(void *if_priv, const u8 *addr,
30032989
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL;
30042990
struct nrf_wifi_umac_chg_sta_info chg_sta = {0};
30052991
struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL;
3006-
struct nrf_wifi_sys_fmac_dev_ctx *sys_dev_ctx = NULL;
30072992
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
3008-
int peer_id = -1;
30092993
int ret = -1;
30102994

30112995
if (!if_priv || !addr) {
@@ -3040,19 +3024,6 @@ int nrf_wifi_wpa_supp_sta_set_flags(void *if_priv, const u8 *addr,
30403024
goto out;
30413025
}
30423026

3043-
sys_dev_ctx = wifi_dev_priv(rpu_ctx_zep->rpu_ctx);
3044-
3045-
peer_id = nrf_wifi_fmac_peer_get_id(rpu_ctx_zep->rpu_ctx, chg_sta.mac_addr);
3046-
if (peer_id == -1) {
3047-
nrf_wifi_osal_log_err("%s: Invalid peer",
3048-
__func__);
3049-
goto out;
3050-
}
3051-
3052-
if (chg_sta.sta_flags2.nrf_wifi_set & NRF_WIFI_STA_FLAG_AUTHORIZED) {
3053-
sys_dev_ctx->tx_config.peers[peer_id].authorized = true;
3054-
}
3055-
30563027
ret = 0;
30573028

30583029
out:

0 commit comments

Comments
 (0)