Skip to content

Commit

Permalink
wifi: mt76: connac: add helpers for EHT capability
Browse files Browse the repository at this point in the history
Add helpers to get eht cap and phymode on different bands and vifs.
This is the preliminary patch to add EHT support for mt7996.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
csyuanc authored and nbd168 committed Feb 2, 2023
1 parent b375845 commit 68b17a2
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
46 changes: 46 additions & 0 deletions mt76_connac_mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1329,6 +1329,40 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
}
EXPORT_SYMBOL_GPL(mt76_connac_get_phy_mode);

u8 mt76_connac_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif,
enum nl80211_band band)
{
const struct ieee80211_sta_eht_cap *eht_cap;
struct ieee80211_supported_band *sband;
u8 mode = 0;

if (band == NL80211_BAND_6GHZ)
mode |= PHY_MODE_AX_6G;

sband = phy->hw->wiphy->bands[band];
eht_cap = ieee80211_get_eht_iftype_cap(sband, vif->type);

if (!eht_cap || !eht_cap->has_eht)
return mode;

switch (band) {
case NL80211_BAND_6GHZ:
mode |= PHY_MODE_BE_6G;
break;
case NL80211_BAND_5GHZ:
mode |= PHY_MODE_BE_5G;
break;
case NL80211_BAND_2GHZ:
mode |= PHY_MODE_BE_24G;
break;
default:
break;
}

return mode;
}
EXPORT_SYMBOL_GPL(mt76_connac_get_phy_mode_ext);

const struct ieee80211_sta_he_cap *
mt76_connac_get_he_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif)
{
Expand All @@ -1341,6 +1375,18 @@ mt76_connac_get_he_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif)
}
EXPORT_SYMBOL_GPL(mt76_connac_get_he_phy_cap);

const struct ieee80211_sta_eht_cap *
mt76_connac_get_eht_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif)
{
enum nl80211_band band = phy->chandef.chan->band;
struct ieee80211_supported_band *sband;

sband = phy->hw->wiphy->bands[band];

return ieee80211_get_eht_iftype_cap(sband, vif->type);
}
EXPORT_SYMBOL_GPL(mt76_connac_get_eht_phy_cap);

#define DEFAULT_HE_PE_DURATION 4
#define DEFAULT_HE_DURATION_RTS_THRES 1023
static void
Expand Down
4 changes: 4 additions & 0 deletions mt76_connac_mcu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1872,8 +1872,12 @@ void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val);

const struct ieee80211_sta_he_cap *
mt76_connac_get_he_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif);
const struct ieee80211_sta_eht_cap *
mt76_connac_get_eht_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif);
u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
enum nl80211_band band, struct ieee80211_sta *sta);
u8 mt76_connac_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif,
enum nl80211_band band);

int mt76_connac_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
struct mt76_connac_sta_key_conf *sta_key_conf,
Expand Down

0 comments on commit 68b17a2

Please sign in to comment.