diff options
author | Lorenzo Bianconi | 2020-09-05 11:26:04 +0200 |
---|---|---|
committer | Felix Fietkau | 2020-09-24 18:10:19 +0200 |
commit | e98e6df6d6820c8609315630409cd8766953d122 (patch) | |
tree | 94e5e889261c890e199436277c813e987582dbb9 /drivers | |
parent | ab25d9d46760d8e5450edd8e12386654940803a5 (diff) |
mt76: move pad estimation out of mt76_skb_adjust_pad
Move frame pad computation out of mt76_skb_adjust_pad routine.
This is a preliminary patch to introduce sdio tx aggregation.
Tested-by: Sean Wang <sean.wang@mediatek.com>
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>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/sdio.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/tx.c | 6 |
7 files changed, 18 insertions, 14 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index bc06d67f7452..72aa19e0e6ec 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -1043,7 +1043,7 @@ mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int *actual_len, return usb_bulk_msg(udev, pipe, data, len, actual_len, timeout); } -int mt76_skb_adjust_pad(struct sk_buff *skb); +int mt76_skb_adjust_pad(struct sk_buff *skb, int pad); int mt76u_vendor_request(struct mt76_dev *dev, u8 req, u8 req_type, u16 val, u16 offset, void *buf, size_t len); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c index ebae2a24c45b..4754b3abd0a2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c @@ -190,6 +190,8 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, enum mt76_txq_id qid) &ple_sz)) break; + __skb_put_zero(e->skb, 4); + err = __mt7663s_xmit_queue(dev, e->skb->data, e->skb->len); if (err) return err; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c index adbed373798e..4d8be366af31 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c @@ -18,8 +18,7 @@ mt7663u_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, int cmd, bool wait_resp) { struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76); - int ret, seq, ep; - u32 len; + int ret, seq, ep, len, pad; mutex_lock(&mdev->mcu.mutex); @@ -31,7 +30,8 @@ mt7663u_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, len = skb->len; put_unaligned_le32(len, skb_push(skb, sizeof(len))); - ret = mt76_skb_adjust_pad(skb); + pad = round_up(skb->len, 4) + 4 - skb->len; + ret = mt76_skb_adjust_pad(skb, pad); if (ret < 0) goto out; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c b/drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c index 56d82bd3a615..c24f26499537 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c @@ -247,6 +247,7 @@ int mt7663_usb_sdio_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76); struct sk_buff *skb = tx_info->skb; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + int pad; if ((info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) && !msta->rate_probe) { @@ -262,9 +263,12 @@ int mt7663_usb_sdio_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, u32 len = skb->len; put_unaligned_le32(len, skb_push(skb, sizeof(len))); + pad = round_up(skb->len, 4) + 4 - skb->len; + } else { + pad = round_up(skb->len, 4) - skb->len; } - return mt76_skb_adjust_pad(skb); + return mt76_skb_adjust_pad(skb, pad); } EXPORT_SYMBOL_GPL(mt7663_usb_sdio_tx_prepare_skb); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c index 5d0a2857f193..2c2f56112b57 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c @@ -45,7 +45,7 @@ EXPORT_SYMBOL_GPL(mt76x02u_mac_start); int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags) { - u32 info; + u32 info, pad; /* Buffer layout: * | 4B | xfer len | pad | 4B | @@ -57,7 +57,8 @@ int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags) FIELD_PREP(MT_TXD_INFO_DPORT, port) | flags; put_unaligned_le32(info, skb_push(skb, sizeof(info))); - return mt76_skb_adjust_pad(skb); + pad = round_up(skb->len, 4) + 4 - skb->len; + return mt76_skb_adjust_pad(skb, pad); } int mt76x02u_tx_prepare_skb(struct mt76_dev *mdev, void *data, diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index 7777d4944081..9a4d95a2a707 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -226,12 +226,13 @@ mt76s_tx_queue_skb_raw(struct mt76_dev *dev, enum mt76_txq_id qid, struct sk_buff *skb, u32 tx_info) { struct mt76_queue *q = dev->q_tx[qid]; - int ret = -ENOSPC, len = skb->len; + int ret = -ENOSPC, len = skb->len, pad; if (q->queued == q->ndesc) goto error; - ret = mt76_skb_adjust_pad(skb); + pad = round_up(skb->len, 4) - skb->len; + ret = mt76_skb_adjust_pad(skb, pad); if (ret) goto error; diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c index bf7a6b3a8db0..44ef4bc7a46e 100644 --- a/drivers/net/wireless/mediatek/mt76/tx.c +++ b/drivers/net/wireless/mediatek/mt76/tx.c @@ -589,13 +589,9 @@ u8 mt76_ac_to_hwq(u8 ac) } EXPORT_SYMBOL_GPL(mt76_ac_to_hwq); -int mt76_skb_adjust_pad(struct sk_buff *skb) +int mt76_skb_adjust_pad(struct sk_buff *skb, int pad) { struct sk_buff *iter, *last = skb; - u32 pad; - - /* Add zero pad of 4 - 7 bytes */ - pad = round_up(skb->len, 4) + 4 - skb->len; /* First packet of a A-MSDU burst keeps track of the whole burst * length, need to update length of it and the last packet. |