]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mt76: reserve enough room for USB tx skbs
authorStanislaw Gruszka <sgruszka@redhat.com>
Mon, 8 Oct 2018 11:22:00 +0000 (13:22 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 13 Oct 2018 15:39:31 +0000 (17:39 +0200)
Reserve enough room for USB skb, so we don not need to check
the room every time we send frame.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76x0/init.c
drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
drivers/net/wireless/mediatek/mt76/mt76x2/init.c

index 578f1b34f0f1300d4fbfa0d10d1afe9c4a3c4a74..4a9408801260122d8040a6ddd4ddae21d93e5863 100644 (file)
@@ -368,7 +368,10 @@ int mt76x0_register_device(struct mt76x02_dev *dev)
        hw->max_rates = 1;
        hw->max_report_rates = 7;
        hw->max_rate_tries = 1;
-       hw->extra_tx_headroom = sizeof(struct mt76x02_txwi) + 4 + 2;
+       hw->extra_tx_headroom = 2;
+       if (mt76_is_usb(dev))
+               hw->extra_tx_headroom += sizeof(struct mt76x02_txwi) +
+                                        MT_DMA_HDR_LEN;
 
        hw->sta_data_size = sizeof(struct mt76x02_sta);
        hw->vif_data_size = sizeof(struct mt76x02_vif);
index e43c53e8e6beec893a8a53333746bdbc42fdabbe..dc2226c722dd1bb70ca9b8f77d0c90d915fee6b0 100644 (file)
@@ -34,17 +34,6 @@ void mt76x02u_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q,
 }
 EXPORT_SYMBOL_GPL(mt76x02u_tx_complete_skb);
 
-static int mt76x02u_check_skb_rooms(struct sk_buff *skb)
-{
-       int hdr_len = ieee80211_get_hdrlen_from_skb(skb);
-       u32 need_head;
-
-       need_head = sizeof(struct mt76x02_txwi) + MT_DMA_HDR_LEN;
-       if (hdr_len % 4)
-               need_head += 2;
-       return skb_cow(skb, need_head);
-}
-
 int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags)
 {
        struct sk_buff *iter, *last = skb;
@@ -106,11 +95,7 @@ int mt76x02u_tx_prepare_skb(struct mt76_dev *mdev, void *data,
 {
        struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
        struct mt76x02_txwi *txwi;
-       int err, len = skb->len;
-
-       err = mt76x02u_check_skb_rooms(skb);
-       if (err < 0)
-               return -ENOMEM;
+       int len = skb->len;
 
        mt76x02_insert_hdr_pad(skb);
 
index ccd9bc9d3e1ed024362fbbc1a733c53ccbdc374a..3c73fdeaf30f5870e575f9782db35f8510393f18 100644 (file)
@@ -167,6 +167,9 @@ void mt76x2_init_device(struct mt76x02_dev *dev)
        hw->max_report_rates = 7;
        hw->max_rate_tries = 1;
        hw->extra_tx_headroom = 2;
+       if (mt76_is_usb(dev))
+               hw->extra_tx_headroom += sizeof(struct mt76x02_txwi) +
+                                        MT_DMA_HDR_LEN;
 
        hw->sta_data_size = sizeof(struct mt76x02_sta);
        hw->vif_data_size = sizeof(struct mt76x02_vif);