git: 11434103528e - stable/13 - LinuxKPI: 802.11: pass non-0/NULL arguments to MO functions

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 29 Nov 2023 16:38:22 UTC
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=11434103528ed6d78c0a6dcef33ea55db0e3df41

commit 11434103528ed6d78c0a6dcef33ea55db0e3df41
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-09-16 13:10:57 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-11-29 16:36:07 +0000

    LinuxKPI: 802.11: pass non-0/NULL arguments to MO functions
    
    In [1] we updated the KPI for various mac80211 ops functions to deal
    with MLD code.  Newer iwlwifi driver and firmware supports these
    functions so we need to pass non-dummy (0, NULL) arguments to them.
    Start extending the internel MO functions by these arguments and
    pass down values from LinuxKPI 802.11 code.
    It is assumed that further work will be needed to have all the
    right fields available to at least work in the lgeacy way of a
    single link.
    
    Sponsored by:   The FreeBSD Foundation
    Improves:       549198b1ab95 (update mac80211 KPI) [1]
    
    (cherry picked from commit 6854154638a2c04ab59da43aedbe2c0ee8ef71a5)
---
 sys/compat/linuxkpi/common/src/linux_80211.c        | 11 ++++++-----
 sys/compat/linuxkpi/common/src/linux_80211.h        |  6 +++---
 sys/compat/linuxkpi/common/src/linux_80211_macops.c | 21 ++++++++++++---------
 3 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index d0f718ae0dc7..3e654b73e18c 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -990,7 +990,8 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int
 		}
 		/* Assign vif chanctx. */
 		if (error == 0)
-			error = lkpi_80211_mo_assign_vif_chanctx(hw, vif, conf);
+			error = lkpi_80211_mo_assign_vif_chanctx(hw, vif,
+			    &vif->bss_conf, conf);
 		if (error == EOPNOTSUPP)
 			error = 0;
 		if (error != 0) {
@@ -1171,7 +1172,7 @@ lkpi_sta_auth_to_scan(struct ieee80211vap *vap, enum ieee80211_state nstate, int
 
 		conf = vif->chanctx_conf;
 		/* Remove vif context. */
-		lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->chanctx_conf);
+		lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->bss_conf, &vif->chanctx_conf);
 		/* NB: vif->chanctx_conf is NULL now. */
 
 		/* Remove chan ctx. */
@@ -1446,7 +1447,7 @@ _lkpi_sta_assoc_to_down(struct ieee80211vap *vap, enum ieee80211_state nstate, i
 
 		conf = vif->chanctx_conf;
 		/* Remove vif context. */
-		lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->chanctx_conf);
+		lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->bss_conf, &vif->chanctx_conf);
 		/* NB: vif->chanctx_conf is NULL now. */
 
 		/* Remove chan ctx. */
@@ -1908,7 +1909,7 @@ lkpi_sta_run_to_init(struct ieee80211vap *vap, enum ieee80211_state nstate, int
 
 		conf = vif->chanctx_conf;
 		/* Remove vif context. */
-		lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->chanctx_conf);
+		lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->bss_conf, &vif->chanctx_conf);
 		/* NB: vif->chanctx_conf is NULL now. */
 
 		/* Remove chan ctx. */
@@ -2199,7 +2200,7 @@ lkpi_wme_update(struct lkpi_hw *lhw, struct ieee80211vap *vap, bool planned)
 		txqp.cw_max = wmep->wmep_logcwmax;
 		txqp.txop = wmep->wmep_txopLimit;
 		txqp.aifs = wmep->wmep_aifsn;
-		error = lkpi_80211_mo_conf_tx(hw, vif, ac, &txqp);
+		error = lkpi_80211_mo_conf_tx(hw, vif, /* link_id */0, ac, &txqp);
 		if (error != 0)
 			ic_printf(ic, "%s: conf_tx ac %u failed %d\n",
 			    __func__, ac, error);
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.h b/sys/compat/linuxkpi/common/src/linux_80211.h
index 42b4192bac63..22a5f5a6377c 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.h
+++ b/sys/compat/linuxkpi/common/src/linux_80211.h
@@ -276,9 +276,9 @@ int lkpi_80211_mo_sta_state(struct ieee80211_hw *, struct ieee80211_vif *,
     struct lkpi_sta *, enum ieee80211_sta_state);
 int lkpi_80211_mo_config(struct ieee80211_hw *, uint32_t);
 int lkpi_80211_mo_assign_vif_chanctx(struct ieee80211_hw *, struct ieee80211_vif *,
-    struct ieee80211_chanctx_conf *);
+    struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);
 void lkpi_80211_mo_unassign_vif_chanctx(struct ieee80211_hw *, struct ieee80211_vif *,
-    struct ieee80211_chanctx_conf **);
+    struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf **);
 int lkpi_80211_mo_add_chanctx(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);
 void lkpi_80211_mo_change_chanctx(struct ieee80211_hw *,
     struct ieee80211_chanctx_conf *, uint32_t);
@@ -287,7 +287,7 @@ void lkpi_80211_mo_remove_chanctx(struct ieee80211_hw *,
 void lkpi_80211_mo_bss_info_changed(struct ieee80211_hw *, struct ieee80211_vif *,
     struct ieee80211_bss_conf *, uint64_t);
 int lkpi_80211_mo_conf_tx(struct ieee80211_hw *, struct ieee80211_vif *,
-    uint16_t, const struct ieee80211_tx_queue_params *);
+    uint32_t, uint16_t, const struct ieee80211_tx_queue_params *);
 void lkpi_80211_mo_flush(struct ieee80211_hw *, struct ieee80211_vif *,
     uint32_t, bool);
 void lkpi_80211_mo_mgd_prepare_tx(struct ieee80211_hw *, struct ieee80211_vif *,
diff --git a/sys/compat/linuxkpi/common/src/linux_80211_macops.c b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
index c386c096add7..8444c3b3f245 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211_macops.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
@@ -444,7 +444,7 @@ out:
 
 int
 lkpi_80211_mo_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-    struct ieee80211_chanctx_conf *chanctx_conf)
+    struct ieee80211_bss_conf *conf, struct ieee80211_chanctx_conf *chanctx_conf)
 {
 	struct lkpi_hw *lhw;
 	int error;
@@ -455,8 +455,9 @@ lkpi_80211_mo_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *
 		goto out;
 	}
 
-	LKPI_80211_TRACE_MO("hw %p vif %p chanctx_conf %p", hw, vif, chanctx_conf);
-	error = lhw->ops->assign_vif_chanctx(hw, vif, NULL, chanctx_conf);
+	LKPI_80211_TRACE_MO("hw %p vif %p bss_conf %p chanctx_conf %p",
+	    hw, vif, conf, chanctx_conf);
+	error = lhw->ops->assign_vif_chanctx(hw, vif, conf, chanctx_conf);
 	if (error == 0)
 		vif->chanctx_conf = chanctx_conf;
 
@@ -466,7 +467,7 @@ out:
 
 void
 lkpi_80211_mo_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-    struct ieee80211_chanctx_conf **chanctx_conf)
+    struct ieee80211_bss_conf *conf, struct ieee80211_chanctx_conf **chanctx_conf)
 {
 	struct lkpi_hw *lhw;
 
@@ -477,8 +478,9 @@ lkpi_80211_mo_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif
 	if (*chanctx_conf == NULL)
 		return;
 
-	LKPI_80211_TRACE_MO("hw %p vif %p chanctx_conf %p", hw, vif, *chanctx_conf);
-	lhw->ops->unassign_vif_chanctx(hw, vif, NULL, *chanctx_conf);
+	LKPI_80211_TRACE_MO("hw %p vif %p bss_conf %p chanctx_conf %p",
+	    hw, vif, conf, *chanctx_conf);
+	lhw->ops->unassign_vif_chanctx(hw, vif, conf, *chanctx_conf);
 	*chanctx_conf = NULL;
 }
 
@@ -548,7 +550,7 @@ lkpi_80211_mo_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vi
 
 int
 lkpi_80211_mo_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-    uint16_t ac, const struct ieee80211_tx_queue_params *txqp)
+    uint32_t link_id, uint16_t ac, const struct ieee80211_tx_queue_params *txqp)
 {
 	struct lkpi_hw *lhw;
 	int error;
@@ -559,8 +561,9 @@ lkpi_80211_mo_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		goto out;
 	}
 
-	LKPI_80211_TRACE_MO("hw %p vif %p ac %u txpq %p", hw, vif, ac, txqp);
-	error = lhw->ops->conf_tx(hw, vif, 0, ac, txqp);
+	LKPI_80211_TRACE_MO("hw %p vif %p link_id %u ac %u txpq %p",
+	    hw, vif, link_id, ac, txqp);
+	error = lhw->ops->conf_tx(hw, vif, link_id, ac, txqp);
 
 out:
 	return (error);