OSDN Git Service

mt76x0: reserve enough space in mac80211
authorStanislaw Gruszka <sgruszka@redhat.com>
Tue, 4 Sep 2018 14:41:13 +0000 (16:41 +0200)
committerFelix Fietkau <nbd@nbd.name>
Wed, 19 Sep 2018 10:29:23 +0000 (12:29 +0200)
Allocate skg with enough headroom by mac80211 , this eliminate need
to add extra skb headroom by the mt76x0 driver.

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/mt76x0/tx.c

index 84fc306..45c9f1f 100644 (file)
@@ -685,6 +685,7 @@ int mt76x0_register_device(struct mt76x0_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->sta_data_size = sizeof(struct mt76x02_sta);
        hw->vif_data_size = sizeof(struct mt76x02_vif);
index fa902ac..35db385 100644 (file)
@@ -55,18 +55,6 @@ void mt76x0_tx_status(struct mt76x0_dev *dev, struct sk_buff *skb)
        spin_unlock(&dev->mac_lock);
 }
 
-static int mt76x0_skb_rooms(struct mt76x0_dev *dev, struct sk_buff *skb)
-{
-       int hdr_len = ieee80211_get_hdrlen_from_skb(skb);
-       u32 need_head;
-
-       need_head = sizeof(struct mt76x02_txwi) + 4;
-       if (hdr_len % 4)
-               need_head += 2;
-
-       return skb_cow(skb, need_head);
-}
-
 static struct mt76x02_txwi *
 mt76x0_push_txwi(struct mt76x0_dev *dev, struct sk_buff *skb,
                  struct ieee80211_sta *sta, struct mt76_wcid *wcid,
@@ -158,10 +146,7 @@ void mt76x0_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
        BUILD_BUG_ON(ARRAY_SIZE(info->status.status_driver_data) < 1);
        info->status.status_driver_data[0] = (void *)(unsigned long)pkt_len;
 
-       if (mt76x0_skb_rooms(dev, skb) || mt76x0_insert_hdr_pad(skb)) {
-               ieee80211_free_txskb(dev->mt76.hw, skb);
-               return;
-       }
+       mt76x0_insert_hdr_pad(skb);
 
        if (sta) {
                msta = (struct mt76x02_sta *) sta->drv_priv;