drivers/net/wireless/realtek/rtw89/mac80211.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtw89/mac80211.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/realtek/rtw89/mac80211.c
Extension
.c
Size
55054 bytes
Lines
2043
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct rtw89_iter_bitrate_mask_data {
	struct rtw89_dev *rtwdev;
	struct ieee80211_vif *vif;
	const struct cfg80211_bitrate_mask *mask;
};

static void rtw89_ra_mask_info_update_iter(void *data, struct ieee80211_sta *sta)
{
	struct rtw89_iter_bitrate_mask_data *br_data = data;
	struct rtw89_sta *rtwsta = sta_to_rtwsta(sta);
	struct rtw89_vif *rtwvif = rtwsta->rtwvif;
	struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif);
	struct rtw89_sta_link *rtwsta_link;
	unsigned int link_id;

	if (vif != br_data->vif || vif->p2p)
		return;

	rtw89_sta_for_each_link(rtwsta, rtwsta_link, link_id) {
		rtwsta_link->use_cfg_mask = true;
		rtwsta_link->mask = *br_data->mask;
	}

	rtw89_phy_ra_update_sta(br_data->rtwdev, sta, IEEE80211_RC_SUPP_RATES_CHANGED);
}

static void rtw89_ra_mask_info_update(struct rtw89_dev *rtwdev,
				      struct ieee80211_vif *vif,
				      const struct cfg80211_bitrate_mask *mask)
{
	struct rtw89_iter_bitrate_mask_data br_data = { .rtwdev = rtwdev,
							.vif = vif,
							.mask = mask};

	ieee80211_iterate_stations_atomic(rtwdev->hw, rtw89_ra_mask_info_update_iter,
					  &br_data);
}

static int rtw89_ops_set_bitrate_mask(struct ieee80211_hw *hw,
				      struct ieee80211_vif *vif,
				      const struct cfg80211_bitrate_mask *mask)
{
	struct rtw89_dev *rtwdev = hw->priv;

	lockdep_assert_wiphy(hw->wiphy);

	rtw89_phy_rate_pattern_vif(rtwdev, vif, mask);
	rtw89_ra_mask_info_update(rtwdev, vif, mask);

	return 0;
}

static
int rtw89_ops_set_antenna(struct ieee80211_hw *hw, int radio_idx, u32 tx_ant, u32 rx_ant)
{
	struct rtw89_dev *rtwdev = hw->priv;
	struct rtw89_hal *hal = &rtwdev->hal;
	const struct rtw89_chip_info *chip;

	lockdep_assert_wiphy(hw->wiphy);

	chip = rtwdev->chip;

	if (hal->ant_diversity) {
		if (tx_ant != rx_ant || hweight32(tx_ant) != 1)
			return -EINVAL;
	} else if (chip->ops->cfg_txrx_path) {
		/* With cfg_txrx_path ops, chips can configure rx_ant */
	} else if (rx_ant != hw->wiphy->available_antennas_rx && rx_ant != hal->antenna_rx) {
		return -EINVAL;
	}

	hal->antenna_tx = tx_ant;
	hal->antenna_rx = rx_ant;
	hal->tx_path_diversity = false;
	hal->ant_diversity_fixed = true;

	return 0;
}

static
int rtw89_ops_get_antenna(struct ieee80211_hw *hw, int radio_idx, u32 *tx_ant,
			  u32 *rx_ant)
{
	struct rtw89_dev *rtwdev = hw->priv;
	struct rtw89_hal *hal = &rtwdev->hal;

	*tx_ant = hal->antenna_tx;
	*rx_ant = hal->antenna_rx;

Annotation

Implementation Notes