wifi: iwlwifi: mld: add monitor internal station

This is needed for TX injection over monitor interface.

Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250430155443.5ec460d3f1c2.Ic8456efb4cdd722dcd9c4910a1569ef9d3e4e066@changeid
This commit is contained in:
Daniel Gabay
2025-04-30 15:57:23 +03:00
committed by Miri Korenblit
parent 64667ab856
commit a4911d0178
6 changed files with 60 additions and 3 deletions

View File

@@ -783,6 +783,7 @@ iwl_mld_init_link(struct iwl_mld *mld, struct ieee80211_bss_conf *link,
iwl_mld_init_internal_sta(&mld_link->bcast_sta);
iwl_mld_init_internal_sta(&mld_link->mcast_sta);
iwl_mld_init_internal_sta(&mld_link->aux_sta);
iwl_mld_init_internal_sta(&mld_link->mon_sta);
wiphy_delayed_work_init(&mld_link->rx_omi.finished_work,
iwl_mld_omi_bw_finished_work);

View File

@@ -40,6 +40,7 @@ struct iwl_probe_resp_data {
* @bcast_sta: station used for broadcast packets. Used in AP, GO and IBSS.
* @mcast_sta: station used for multicast packets. Used in AP, GO and IBSS.
* @aux_sta: station used for remain on channel. Used in P2P device.
* @mon_sta: station used for TX injection in monitor interface.
* @link_id: over the air link ID
* @ap_early_keys: The firmware cannot install keys before bcast/mcast STAs,
* but higher layers work differently, so we store the keys here for
@@ -73,6 +74,7 @@ struct iwl_mld_link {
struct iwl_mld_int_sta bcast_sta;
struct iwl_mld_int_sta mcast_sta;
struct iwl_mld_int_sta aux_sta;
struct iwl_mld_int_sta mon_sta;
u8 link_id;
struct {
@@ -107,6 +109,8 @@ iwl_mld_cleanup_link(struct iwl_mld *mld, struct iwl_mld_link *link)
iwl_mld_free_internal_sta(mld, &link->mcast_sta);
if (link->aux_sta.sta_id != IWL_INVALID_STA)
iwl_mld_free_internal_sta(mld, &link->aux_sta);
if (link->mon_sta.sta_id != IWL_INVALID_STA)
iwl_mld_free_internal_sta(mld, &link->mon_sta);
}
/* Convert a percentage from [0,100] to [0,255] */

View File

@@ -1021,12 +1021,19 @@ int iwl_mld_assign_vif_chanctx(struct ieee80211_hw *hw,
iwl_mld_send_ap_tx_power_constraint_cmd(mld, vif, link);
if (vif->type == NL80211_IFTYPE_MONITOR) {
/* TODO: task=sniffer add sniffer station */
ret = iwl_mld_add_mon_sta(mld, vif, link);
if (ret)
goto deactivate_link;
mld->monitor.p80 =
iwl_mld_chandef_get_primary_80(&vif->bss_conf.chanreq.oper);
}
return 0;
deactivate_link:
if (mld_link->active)
iwl_mld_deactivate_link(mld, link);
err:
RCU_INIT_POINTER(mld_link->chan_ctx, NULL);
return ret;
@@ -1052,7 +1059,8 @@ void iwl_mld_unassign_vif_chanctx(struct ieee80211_hw *hw,
iwl_mld_deactivate_link(mld, link);
/* TODO: task=sniffer remove sniffer station */
if (vif->type == NL80211_IFTYPE_MONITOR)
iwl_mld_remove_mon_sta(mld, vif, link);
if (n_active > 1) {
/* Indicate to mac80211 that EML is disabled */

View File

@@ -1087,6 +1087,24 @@ int iwl_mld_add_aux_sta(struct iwl_mld *mld,
0, NULL, IWL_MAX_TID_COUNT);
}
int iwl_mld_add_mon_sta(struct iwl_mld *mld,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link)
{
struct iwl_mld_link *mld_link = iwl_mld_link_from_mac80211(link);
if (WARN_ON(!mld_link))
return -EINVAL;
if (WARN_ON(vif->type != NL80211_IFTYPE_MONITOR))
return -EINVAL;
return iwl_mld_add_internal_sta(mld, &mld_link->mon_sta,
STATION_TYPE_BCAST_MGMT,
mld_link->fw_id, NULL,
IWL_MAX_TID_COUNT);
}
static void iwl_mld_remove_internal_sta(struct iwl_mld *mld,
struct iwl_mld_int_sta *internal_sta,
bool flush, u8 tid)
@@ -1156,6 +1174,22 @@ void iwl_mld_remove_aux_sta(struct iwl_mld *mld,
IWL_MAX_TID_COUNT);
}
void iwl_mld_remove_mon_sta(struct iwl_mld *mld,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link)
{
struct iwl_mld_link *mld_link = iwl_mld_link_from_mac80211(link);
if (WARN_ON(!mld_link))
return;
if (WARN_ON(vif->type != NL80211_IFTYPE_MONITOR))
return;
iwl_mld_remove_internal_sta(mld, &mld_link->mon_sta, false,
IWL_MAX_TID_COUNT);
}
static int iwl_mld_update_sta_resources(struct iwl_mld *mld,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,

View File

@@ -247,6 +247,10 @@ int iwl_mld_add_mcast_sta(struct iwl_mld *mld,
int iwl_mld_add_aux_sta(struct iwl_mld *mld,
struct iwl_mld_int_sta *internal_sta);
int iwl_mld_add_mon_sta(struct iwl_mld *mld,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link);
void iwl_mld_remove_bcast_sta(struct iwl_mld *mld,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link);
@@ -259,6 +263,10 @@ void iwl_mld_remove_aux_sta(struct iwl_mld *mld,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link);
void iwl_mld_remove_mon_sta(struct iwl_mld *mld,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link);
int iwl_mld_update_link_stas(struct iwl_mld *mld,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,

View File

@@ -649,8 +649,10 @@ iwl_mld_get_tx_queue_id(struct iwl_mld *mld, struct ieee80211_txq *txq,
WARN_ON(!ieee80211_is_mgmt(fc));
return mld_vif->deflink.aux_sta.queue_id;
case NL80211_IFTYPE_MONITOR:
mld_vif = iwl_mld_vif_from_mac80211(info->control.vif);
return mld_vif->deflink.mon_sta.queue_id;
default:
/* TODO: consider monitor (task=monitor) */
WARN_ONCE(1, "Unsupported vif type\n");
break;
}