From: Lorenzo Bianconi <lorenzo@kernel.org>
To: sean.wang@mediatek.com
Cc: nbd@nbd.name, lorenzo.bianconi@redhat.com,
Soul.Huang@mediatek.com, YN.Chen@mediatek.com,
Leon.Yen@mediatek.com, Eric-SY.Chang@mediatek.com,
Deren.Wu@mediatek.com, km.lin@mediatek.com,
jenhao.yang@mediatek.com, robin.chiu@mediatek.com,
Eddie.Chen@mediatek.com, ch.yeh@mediatek.com,
posh.sun@mediatek.com, ted.huang@mediatek.com,
Stella.Chang@mediatek.com, Tom.Chou@mediatek.com,
steve.lee@mediatek.com, jsiuda@google.com, frankgor@google.com,
kuabhs@google.com, druth@google.com, abhishekpandit@google.com,
shawnku@google.com, linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 2/9] wifi: mt76: connac: add mt76_connac_mcu_uni_set_chctx
Date: Wed, 17 Aug 2022 09:13:27 +0200 [thread overview]
Message-ID: <YvyVF9DDOYr0XjP8@lore-desk> (raw)
In-Reply-To: <57ebfc95640b3f062a1211bf939f9edfd9f58372.1660606893.git.objelf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4320 bytes --]
On Aug 16, Sean Wang wrote:
> From: Sean Wang <sean.wang@mediatek.com>
>
> add mt76_connac_mcu_uni_set_chctx to set up the channel context per BSS
> in the firmware
>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> .../wireless/mediatek/mt76/mt76_connac_mcu.c | 83 +++++++++++++++++++
> .../wireless/mediatek/mt76/mt76_connac_mcu.h | 3 +
> 2 files changed, 86 insertions(+)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> index 0afcadce87fc..3d5c70765d4f 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> @@ -1311,6 +1311,89 @@ mt76_connac_mcu_uni_bss_he_tlv(struct mt76_phy *phy, struct ieee80211_vif *vif,
> he->max_nss_mcs[CMD_HE_MCS_BW8080] = cap->he_mcs_nss_supp.tx_mcs_80p80;
> }
>
> +int mt76_connac_mcu_uni_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif,
> + struct ieee80211_chanctx_conf *ctx)
> +{
> + struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->chandef;
> + int freq1 = chandef->center_freq1, freq2 = chandef->center_freq2;
> + enum nl80211_band band = chandef->chan->band;
> + struct mt76_dev *mdev = phy->dev;
> +
nit: remove new-line here.
> + struct {
> + struct {
> + u8 bss_idx;
> + u8 pad[3];
> + } __packed hdr;
> + struct rlm_tlv {
> + __le16 tag;
> + __le16 len;
> + u8 control_channel;
> + u8 center_chan;
> + u8 center_chan2;
> + u8 bw;
> + u8 tx_streams;
> + u8 rx_streams;
> + u8 short_st;
> + u8 ht_op_info;
> + u8 sco;
> + u8 band;
> + u8 pad[2];
> + } __packed rlm;
> + } __packed rlm_req = {
> + .hdr = {
> + .bss_idx = mvif->idx,
> + },
> + .rlm = {
> + .tag = cpu_to_le16(UNI_BSS_INFO_RLM),
> + .len = cpu_to_le16(sizeof(struct rlm_tlv)),
> + .control_channel = chandef->chan->hw_value,
> + .center_chan = ieee80211_frequency_to_channel(freq1),
> + .center_chan2 = ieee80211_frequency_to_channel(freq2),
> + .tx_streams = hweight8(phy->antenna_mask),
> + .ht_op_info = 4, /* set HT 40M allowed */
> + .rx_streams = phy->chainmask,
> + .short_st = true,
> + .band = band,
> + },
> + };
> +
> + switch (chandef->width) {
> + case NL80211_CHAN_WIDTH_40:
> + rlm_req.rlm.bw = CMD_CBW_40MHZ;
> + break;
> + case NL80211_CHAN_WIDTH_80:
> + rlm_req.rlm.bw = CMD_CBW_80MHZ;
> + break;
> + case NL80211_CHAN_WIDTH_80P80:
> + rlm_req.rlm.bw = CMD_CBW_8080MHZ;
> + break;
> + case NL80211_CHAN_WIDTH_160:
> + rlm_req.rlm.bw = CMD_CBW_160MHZ;
> + break;
> + case NL80211_CHAN_WIDTH_5:
> + rlm_req.rlm.bw = CMD_CBW_5MHZ;
> + break;
> + case NL80211_CHAN_WIDTH_10:
> + rlm_req.rlm.bw = CMD_CBW_10MHZ;
> + break;
> + case NL80211_CHAN_WIDTH_20_NOHT:
> + case NL80211_CHAN_WIDTH_20:
> + default:
> + rlm_req.rlm.bw = CMD_CBW_20MHZ;
> + rlm_req.rlm.ht_op_info = 0;
> + break;
> + }
> +
> + if (rlm_req.rlm.control_channel < rlm_req.rlm.center_chan)
> + rlm_req.rlm.sco = 1; /* SCA */
> + else if (rlm_req.rlm.control_channel > rlm_req.rlm.center_chan)
> + rlm_req.rlm.sco = 3; /* SCB */
> +
> + return mt76_mcu_send_msg(mdev, MCU_UNI_CMD(BSS_INFO_UPDATE), &rlm_req,
> + sizeof(rlm_req), true);
> +}
> +EXPORT_SYMBOL_GPL(mt76_connac_mcu_uni_set_chctx);
> +
> int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy,
> struct ieee80211_vif *vif,
> struct mt76_wcid *wcid,
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> index f1d7c05bd794..bf60b00d6020 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> @@ -1727,6 +1727,9 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
> int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
> struct ieee80211_ampdu_params *params,
> int cmd, bool enable, bool tx);
> +int mt76_connac_mcu_uni_set_chctx(struct mt76_phy *phy,
> + struct mt76_vif *vif,
> + struct ieee80211_chanctx_conf *ctx);
> int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy,
> struct ieee80211_vif *vif,
> struct mt76_wcid *wcid,
> --
> 2.25.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2022-08-17 7:13 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-16 0:03 [PATCH 0/9] wifi: mt76: mt7921: introduce chanctx support sean.wang
2022-08-16 0:03 ` [PATCH 1/9] wifi: mac80211: allow enabling chanctx until hw registration sean.wang
2022-08-16 8:03 ` Johannes Berg
2022-08-17 8:28 ` Sean Wang
2022-08-17 8:30 ` Johannes Berg
2022-08-18 0:11 ` Sean Wang
2022-08-18 10:49 ` Johannes Berg
2022-08-18 23:40 ` Sean Wang
2022-08-19 17:16 ` Johannes Berg
2022-08-19 17:36 ` Johannes Berg
2022-08-16 0:03 ` [PATCH 2/9] wifi: mt76: connac: add mt76_connac_mcu_uni_set_chctx sean.wang
2022-08-17 7:13 ` Lorenzo Bianconi [this message]
2022-08-16 0:03 ` [PATCH 3/9] wifi: mt76: connac: rely on mt76_connac_mcu_uni_set_chctx sean.wang
2022-08-17 7:13 ` Lorenzo Bianconi
2022-08-16 0:03 ` [PATCH 4/9] wifi: mt76: mt7921: add chanctx parameter to mt76_connac_mcu_uni_add_bss signature sean.wang
2022-08-16 0:03 ` [PATCH 5/9] wifi: mt76: mt7921: add unified ROC cmd/event support sean.wang
2022-08-17 7:15 ` Lorenzo Bianconi
2022-08-16 0:03 ` [PATCH 6/9] wifi: mt76: mt7921: drop ieee80211_[start, stop]_queues in driver sean.wang
2022-08-17 7:16 ` Lorenzo Bianconi
2022-08-18 0:44 ` Sean Wang
2022-08-16 0:03 ` [PATCH 7/9] wifi: mt76: connac: accept hw scan request at a time sean.wang
2022-08-16 0:03 ` [PATCH 8/9] wifi: mt76: mt7921: introduce remain_on_channel support sean.wang
2022-08-17 7:12 ` Lorenzo Bianconi
2022-08-18 1:03 ` Sean Wang
2022-08-18 7:39 ` Lorenzo Bianconi
2022-08-25 0:10 ` Sean Wang
2022-08-30 5:18 ` Kalle Valo
2022-08-16 0:03 ` [PATCH 9/9] wifi: mt76: mt7921: introduce chanctx support sean.wang
2022-08-17 7:24 ` Lorenzo Bianconi
2022-08-18 0:37 ` Sean Wang
2022-08-18 7:43 ` Lorenzo Bianconi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YvyVF9DDOYr0XjP8@lore-desk \
--to=lorenzo@kernel.org \
--cc=Deren.Wu@mediatek.com \
--cc=Eddie.Chen@mediatek.com \
--cc=Eric-SY.Chang@mediatek.com \
--cc=Leon.Yen@mediatek.com \
--cc=Soul.Huang@mediatek.com \
--cc=Stella.Chang@mediatek.com \
--cc=Tom.Chou@mediatek.com \
--cc=YN.Chen@mediatek.com \
--cc=abhishekpandit@google.com \
--cc=ch.yeh@mediatek.com \
--cc=druth@google.com \
--cc=frankgor@google.com \
--cc=jenhao.yang@mediatek.com \
--cc=jsiuda@google.com \
--cc=km.lin@mediatek.com \
--cc=kuabhs@google.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=nbd@nbd.name \
--cc=posh.sun@mediatek.com \
--cc=robin.chiu@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shawnku@google.com \
--cc=steve.lee@mediatek.com \
--cc=ted.huang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).