Skip to content

Commit

Permalink
wifi: mac80211: make mgd_protect_tdls_discover MLO-aware
Browse files Browse the repository at this point in the history
Since userspace can choose now what link to establish the
TDLS on, we should know on what channel to do session protection.
Add a link id parameter to this callback.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230928172905.ef12ce3eb835.If864f406cfd9e24f36a2b88fd13a37328633fcf9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Miri Korenblit authored and jmberg-intel committed Oct 23, 2023
1 parent ec06bdb commit 271d14b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -2345,7 +2345,8 @@ void iwl_mvm_teardown_tdls_peers(struct iwl_mvm *mvm);
void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
bool sta_added);
void iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw,
struct ieee80211_vif *vif);
struct ieee80211_vif *vif,
unsigned int link_id);
int iwl_mvm_tdls_channel_switch(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta, u8 oper_class,
Expand Down
5 changes: 3 additions & 2 deletions drivers/net/wireless/intel/iwlwifi/mvm/tdls.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* Copyright (C) 2014 Intel Mobile Communications GmbH
* Copyright (C) 2017 Intel Deutschland GmbH
* Copyright (C) 2018-2020, 2022 Intel Corporation
* Copyright (C) 2018-2020, 2022-2023 Intel Corporation
*/
#include <linux/etherdevice.h>
#include "mvm.h"
Expand Down Expand Up @@ -144,7 +144,8 @@ void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
}

void iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
struct ieee80211_vif *vif,
unsigned int link_id)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
u32 duration = 2 * vif->bss_conf.dtim_period * vif->bss_conf.beacon_int;
Expand Down
3 changes: 2 additions & 1 deletion include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -4522,7 +4522,8 @@ struct ieee80211_ops {
struct ieee80211_prep_tx_info *info);

void (*mgd_protect_tdls_discover)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif);
struct ieee80211_vif *vif,
unsigned int link_id);

int (*add_chanctx)(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *ctx);
Expand Down
8 changes: 6 additions & 2 deletions net/mac80211/driver-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,8 @@ static inline void drv_mgd_complete_tx(struct ieee80211_local *local,

static inline void
drv_mgd_protect_tdls_discover(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata)
struct ieee80211_sub_if_data *sdata,
int link_id)
{
might_sleep();
lockdep_assert_wiphy(local->hw.wiphy);
Expand All @@ -964,9 +965,12 @@ drv_mgd_protect_tdls_discover(struct ieee80211_local *local,
return;
WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);

link_id = link_id > 0 ? link_id : 0;

trace_drv_mgd_protect_tdls_discover(local, sdata);
if (local->ops->mgd_protect_tdls_discover)
local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif);
local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif,
link_id);
trace_drv_return_void(local);
}

Expand Down
2 changes: 1 addition & 1 deletion net/mac80211/tdls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
* response frame. It is transmitted directly and not buffered
* by the AP.
*/
drv_mgd_protect_tdls_discover(sdata->local, sdata);
drv_mgd_protect_tdls_discover(sdata->local, sdata, link_id);
fallthrough;
case WLAN_TDLS_SETUP_CONFIRM:
case WLAN_PUB_ACTION_TDLS_DISCOVER_RES:
Expand Down

0 comments on commit 271d14b

Please sign in to comment.