From: Lorenzo Bianconi <lorenzo@kernel.org>
To: nbd@nbd.name
Cc: lorenzo.bianconi@redhat.com, sean.wang@mediatek.com,
ryder.lee@mediatek.com, linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org
Subject: [PATCH 2/9] mt76: mt7615: introduce mt7663u support to mt7615_write_txwi
Date: Thu, 2 Apr 2020 20:18:49 +0200 [thread overview]
Message-ID: <342c53e345ef63211943a00a46ba183f538b2ae4.1585851049.git.lorenzo@kernel.org> (raw)
In-Reply-To: <cover.1585851049.git.lorenzo@kernel.org>
Extend mt7615_write_txwi routine to support usb txwi configuration
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 12 ++++++++----
drivers/net/wireless/mediatek/mt76/mt7615/mac.h | 1 +
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
index c988a104f911..285d3af621ba 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
@@ -526,11 +526,12 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
struct ieee80211_vif *vif = info->control.vif;
struct mt76_phy *mphy = &dev->mphy;
bool ext_phy = info->hw_queue & MT_TX_HW_QUEUE_EXT_PHY;
+ bool is_usb = mt76_is_usb(&dev->mt76);
int tx_count = 8;
u8 fc_type, fc_stype, p_fmt, q_idx, omac_idx = 0, wmm_idx = 0;
__le16 fc = hdr->frame_control;
+ u32 val, sz_txd = is_usb ? MT_USB_TXD_SIZE : MT_TXD_SIZE;
u16 seqno = 0;
- u32 val;
if (vif) {
struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
@@ -554,7 +555,7 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
if (ieee80211_is_data(fc) || ieee80211_is_bufferable_mmpdu(fc)) {
q_idx = wmm_idx * MT7615_MAX_WMM_SETS +
skb_get_queue_mapping(skb);
- p_fmt = MT_TX_TYPE_CT;
+ p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT;
} else if (beacon) {
if (ext_phy)
q_idx = MT_LMAC_BCN1;
@@ -566,10 +567,10 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
q_idx = MT_LMAC_ALTX1;
else
q_idx = MT_LMAC_ALTX0;
- p_fmt = MT_TX_TYPE_CT;
+ p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT;
}
- val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len + MT_TXD_SIZE) |
+ val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len + sz_txd) |
FIELD_PREP(MT_TXD0_P_IDX, MT_TX_PORT_IDX_LMAC) |
FIELD_PREP(MT_TXD0_Q_IDX, q_idx);
txwi[0] = cpu_to_le32(val);
@@ -663,6 +664,9 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
txwi[7] = FIELD_PREP(MT_TXD7_TYPE, fc_type) |
FIELD_PREP(MT_TXD7_SUB_TYPE, fc_stype);
+ if (is_usb)
+ txwi[8] = FIELD_PREP(MT_TXD8_L_TYPE, fc_type) |
+ FIELD_PREP(MT_TXD8_L_SUB_TYPE, fc_stype);
return 0;
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.h b/drivers/net/wireless/mediatek/mt76/mt7615/mac.h
index e0b89257db90..422a140fd812 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.h
@@ -165,6 +165,7 @@ enum tx_phy_bandwidth {
#define MT_CT_INFO_NONE_CIPHER_FRAME BIT(3)
#define MT_CT_INFO_HSR2_TX BIT(4)
+#define MT_USB_TXD_SIZE (MT_TXD_SIZE + 8 * 4)
#define MT_TXD_SIZE (8 * 4)
#define MT_TXD0_P_IDX BIT(31)
--
2.25.1
next prev parent reply other threads:[~2020-04-02 18:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-02 18:18 [PATCH 0/9] add preliminary usb support to mt7615 driver Lorenzo Bianconi
2020-04-02 18:18 ` [PATCH 1/9] mt76: add headroom and tailroom to mt76_mcu_ops data structure Lorenzo Bianconi
2020-04-02 18:18 ` Lorenzo Bianconi [this message]
2020-04-02 18:18 ` [PATCH 3/9] mt76: mt7615: introduce mt7615_mac_update_rate_desc routine Lorenzo Bianconi
2020-04-02 18:18 ` [PATCH 4/9] mt76: mt7615: introduce __mt7663_load_firmware routine Lorenzo Bianconi
2020-04-02 18:18 ` [PATCH 5/9] mt76: mt7615: move mt7615_mac_wtbl_addr in mac.h Lorenzo Bianconi
2020-04-02 18:18 ` [PATCH 6/9] mt76: mt76u: rely on mt7622 queue scheme for mt7663u Lorenzo Bianconi
2020-04-02 18:18 ` [PATCH 7/9] mt76: mt7615: rework wtbl key configuration Lorenzo Bianconi
2020-04-02 18:18 ` [PATCH 8/9] mt76: mt7615: introduce mt7615_wtbl_desc data structure Lorenzo Bianconi
2020-04-02 18:18 ` [PATCH 9/9] mt76: mt7615: add address parameter to mt7615_eeprom_init 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=342c53e345ef63211943a00a46ba183f538b2ae4.1585851049.git.lorenzo@kernel.org \
--to=lorenzo@kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@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).