LinuxKPI: 80211: implement (*get_antenna) and set ic_[rt]xstream

Implement the mac80211 (*get_antenna) call and after checking any
antenna information present query the current configuration on startup
(both informations should be identical at this point in theory).
Both the wiphy variables and function call report a bitmask not a count.
Count the bits for net80211 for as long as we get away with just a
number in ic_[rt]xstream.

Sponsored by:	The FreeBSD Foundation
MFC after:	4 days
This commit is contained in:
Bjoern A. Zeeb 2022-09-03 23:11:05 +00:00
parent b35f6cd066
commit 527687a9e3
3 changed files with 36 additions and 0 deletions

View File

@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/queue.h>
#include <sys/taskqueue.h>
#include <sys/libkern.h>
#include <net/if.h>
#include <net/if_var.h>
@ -3495,6 +3496,22 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw)
ic->ic_htcaps |= IEEE80211_HTCAP_TXSTBC;
#endif
/*
* The wiphy variables report bitmasks of avail antennas.
* (*get_antenna) get the current bitmask sets which can be
* altered by (*set_antenna) for some drivers.
* XXX-BZ will the count alone do us much good long-term in net80211?
*/
if (hw->wiphy->available_antennas_rx ||
hw->wiphy->available_antennas_tx) {
uint32_t rxs, txs;
if (lkpi_80211_mo_get_antenna(hw, &txs, &rxs) == 0) {
ic->ic_rxstream = bitcount32(rxs);
ic->ic_txstream = bitcount32(txs);
}
}
ic->ic_cryptocaps = 0;
#ifdef LKPI_80211_HW_CRYPTO
if (hw->wiphy->n_cipher_suites > 0) {

View File

@ -197,6 +197,7 @@ struct lkpi_wiphy {
int lkpi_80211_mo_start(struct ieee80211_hw *);
void lkpi_80211_mo_stop(struct ieee80211_hw *);
int lkpi_80211_mo_get_antenna(struct ieee80211_hw *, u32 *, u32 *);
int lkpi_80211_mo_set_frag_threshold(struct ieee80211_hw *, uint32_t);
int lkpi_80211_mo_set_rts_threshold(struct ieee80211_hw *, uint32_t);
int lkpi_80211_mo_add_interface(struct ieee80211_hw *, struct ieee80211_vif *);

View File

@ -77,6 +77,24 @@ lkpi_80211_mo_stop(struct ieee80211_hw *hw)
lhw->sc_flags &= ~LKPI_MAC80211_DRV_STARTED;
}
int
lkpi_80211_mo_get_antenna(struct ieee80211_hw *hw, u32 *txs, u32 *rxs)
{
struct lkpi_hw *lhw;
int error;
lhw = HW_TO_LHW(hw);
if (lhw->ops->get_antenna == NULL) {
error = EOPNOTSUPP;
goto out;
}
error = lhw->ops->get_antenna(hw, txs, rxs);
out:
return (error);
}
int
lkpi_80211_mo_set_frag_threshold(struct ieee80211_hw *hw, uint32_t frag_th)
{