mirror of https://gitee.com/openkylin/linux.git
qtnfmac: pass complete channel info in regulatory notifier
Currently only a portion of per-channel information is passed to firmware. Extend logic to pass all useful per-channel data. Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
a2fbaaf757
commit
2c31129f8f
|
@ -1709,21 +1709,7 @@ int qtnf_cmd_band_info_get(struct qtnf_wmac *mac,
|
||||||
struct qlink_resp_band_info_get *resp;
|
struct qlink_resp_band_info_get *resp;
|
||||||
size_t info_len = 0;
|
size_t info_len = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
u8 qband;
|
u8 qband = qlink_utils_band_cfg2q(band->band);
|
||||||
|
|
||||||
switch (band->band) {
|
|
||||||
case NL80211_BAND_2GHZ:
|
|
||||||
qband = QLINK_BAND_2GHZ;
|
|
||||||
break;
|
|
||||||
case NL80211_BAND_5GHZ:
|
|
||||||
qband = QLINK_BAND_5GHZ;
|
|
||||||
break;
|
|
||||||
case NL80211_BAND_60GHZ:
|
|
||||||
qband = QLINK_BAND_60GHZ;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, 0,
|
cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, 0,
|
||||||
QLINK_CMD_BAND_INFO_GET,
|
QLINK_CMD_BAND_INFO_GET,
|
||||||
|
@ -2107,22 +2093,23 @@ int qtnf_cmd_send_del_sta(struct qtnf_vif *vif,
|
||||||
static void qtnf_cmd_channel_tlv_add(struct sk_buff *cmd_skb,
|
static void qtnf_cmd_channel_tlv_add(struct sk_buff *cmd_skb,
|
||||||
const struct ieee80211_channel *sc)
|
const struct ieee80211_channel *sc)
|
||||||
{
|
{
|
||||||
struct qlink_tlv_channel *qchan;
|
struct qlink_tlv_channel *tlv;
|
||||||
u32 flags = 0;
|
struct qlink_channel *qch;
|
||||||
|
|
||||||
qchan = skb_put_zero(cmd_skb, sizeof(*qchan));
|
tlv = skb_put_zero(cmd_skb, sizeof(*tlv));
|
||||||
qchan->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANNEL);
|
qch = &tlv->chan;
|
||||||
qchan->hdr.len = cpu_to_le16(sizeof(*qchan) - sizeof(qchan->hdr));
|
tlv->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANNEL);
|
||||||
qchan->chan.center_freq = cpu_to_le16(sc->center_freq);
|
tlv->hdr.len = cpu_to_le16(sizeof(*qch));
|
||||||
qchan->chan.hw_value = cpu_to_le16(sc->hw_value);
|
|
||||||
|
|
||||||
if (sc->flags & IEEE80211_CHAN_NO_IR)
|
qch->center_freq = cpu_to_le16(sc->center_freq);
|
||||||
flags |= QLINK_CHAN_NO_IR;
|
qch->hw_value = cpu_to_le16(sc->hw_value);
|
||||||
|
qch->band = qlink_utils_band_cfg2q(sc->band);
|
||||||
if (sc->flags & IEEE80211_CHAN_RADAR)
|
qch->max_power = sc->max_power;
|
||||||
flags |= QLINK_CHAN_RADAR;
|
qch->max_reg_power = sc->max_reg_power;
|
||||||
|
qch->max_antenna_gain = sc->max_antenna_gain;
|
||||||
qchan->chan.flags = cpu_to_le32(flags);
|
qch->beacon_found = sc->beacon_found;
|
||||||
|
qch->dfs_state = qlink_utils_dfs_state_cfg2q(sc->dfs_state);
|
||||||
|
qch->flags = cpu_to_le32(qlink_utils_chflags_cfg2q(sc->flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qtnf_cmd_randmac_tlv_add(struct sk_buff *cmd_skb,
|
static void qtnf_cmd_randmac_tlv_add(struct sk_buff *cmd_skb,
|
||||||
|
|
|
@ -182,3 +182,58 @@ void qlink_acl_data_cfg2q(const struct cfg80211_acl_data *acl,
|
||||||
memcpy(qacl->mac_addrs, acl->mac_addrs,
|
memcpy(qacl->mac_addrs, acl->mac_addrs,
|
||||||
acl->n_acl_entries * sizeof(*qacl->mac_addrs));
|
acl->n_acl_entries * sizeof(*qacl->mac_addrs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum qlink_band qlink_utils_band_cfg2q(enum nl80211_band band)
|
||||||
|
{
|
||||||
|
switch (band) {
|
||||||
|
case NL80211_BAND_2GHZ:
|
||||||
|
return QLINK_BAND_2GHZ;
|
||||||
|
case NL80211_BAND_5GHZ:
|
||||||
|
return QLINK_BAND_5GHZ;
|
||||||
|
case NL80211_BAND_60GHZ:
|
||||||
|
return QLINK_BAND_60GHZ;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum qlink_dfs_state qlink_utils_dfs_state_cfg2q(enum nl80211_dfs_state state)
|
||||||
|
{
|
||||||
|
switch (state) {
|
||||||
|
case NL80211_DFS_USABLE:
|
||||||
|
return QLINK_DFS_USABLE;
|
||||||
|
case NL80211_DFS_AVAILABLE:
|
||||||
|
return QLINK_DFS_AVAILABLE;
|
||||||
|
case NL80211_DFS_UNAVAILABLE:
|
||||||
|
default:
|
||||||
|
return QLINK_DFS_UNAVAILABLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 qlink_utils_chflags_cfg2q(u32 cfgflags)
|
||||||
|
{
|
||||||
|
u32 flags = 0;
|
||||||
|
|
||||||
|
if (cfgflags & IEEE80211_CHAN_DISABLED)
|
||||||
|
flags |= QLINK_CHAN_DISABLED;
|
||||||
|
|
||||||
|
if (cfgflags & IEEE80211_CHAN_NO_IR)
|
||||||
|
flags |= QLINK_CHAN_NO_IR;
|
||||||
|
|
||||||
|
if (cfgflags & IEEE80211_CHAN_RADAR)
|
||||||
|
flags |= QLINK_CHAN_RADAR;
|
||||||
|
|
||||||
|
if (cfgflags & IEEE80211_CHAN_NO_HT40PLUS)
|
||||||
|
flags |= QLINK_CHAN_NO_HT40PLUS;
|
||||||
|
|
||||||
|
if (cfgflags & IEEE80211_CHAN_NO_HT40MINUS)
|
||||||
|
flags |= QLINK_CHAN_NO_HT40MINUS;
|
||||||
|
|
||||||
|
if (cfgflags & IEEE80211_CHAN_NO_80MHZ)
|
||||||
|
flags |= QLINK_CHAN_NO_80MHZ;
|
||||||
|
|
||||||
|
if (cfgflags & IEEE80211_CHAN_NO_160MHZ)
|
||||||
|
flags |= QLINK_CHAN_NO_160MHZ;
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
|
@ -79,5 +79,8 @@ bool qtnf_utils_is_bit_set(const u8 *arr, unsigned int bit,
|
||||||
unsigned int arr_max_len);
|
unsigned int arr_max_len);
|
||||||
void qlink_acl_data_cfg2q(const struct cfg80211_acl_data *acl,
|
void qlink_acl_data_cfg2q(const struct cfg80211_acl_data *acl,
|
||||||
struct qlink_acl_data *qacl);
|
struct qlink_acl_data *qacl);
|
||||||
|
enum qlink_band qlink_utils_band_cfg2q(enum nl80211_band band);
|
||||||
|
enum qlink_dfs_state qlink_utils_dfs_state_cfg2q(enum nl80211_dfs_state state);
|
||||||
|
u32 qlink_utils_chflags_cfg2q(u32 cfgflags);
|
||||||
|
|
||||||
#endif /* _QTN_FMAC_QLINK_UTIL_H_ */
|
#endif /* _QTN_FMAC_QLINK_UTIL_H_ */
|
||||||
|
|
Loading…
Reference in New Issue