diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2018-10-08 07:22:00 -0400 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2018-10-13 11:39:31 -0400 |
commit | f3727daed83279bc1571b23222e7937949e978c6 (patch) | |
tree | 1f35563d30b62a31cd123890464ab15657ab7dd5 /drivers/net/wireless | |
parent | 4ce78b048c4908118cfd5345f16241f58b85e5c6 (diff) |
mt76: reserve enough room for USB tx skbs
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>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76x0/init.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c | 17 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76x2/init.c | 3 |
3 files changed, 8 insertions, 17 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c index 578f1b34f0f1..4a9408801260 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c | |||
@@ -368,7 +368,10 @@ int mt76x0_register_device(struct mt76x02_dev *dev) | |||
368 | hw->max_rates = 1; | 368 | hw->max_rates = 1; |
369 | hw->max_report_rates = 7; | 369 | hw->max_report_rates = 7; |
370 | hw->max_rate_tries = 1; | 370 | hw->max_rate_tries = 1; |
371 | hw->extra_tx_headroom = sizeof(struct mt76x02_txwi) + 4 + 2; | 371 | hw->extra_tx_headroom = 2; |
372 | if (mt76_is_usb(dev)) | ||
373 | hw->extra_tx_headroom += sizeof(struct mt76x02_txwi) + | ||
374 | MT_DMA_HDR_LEN; | ||
372 | 375 | ||
373 | hw->sta_data_size = sizeof(struct mt76x02_sta); | 376 | hw->sta_data_size = sizeof(struct mt76x02_sta); |
374 | hw->vif_data_size = sizeof(struct mt76x02_vif); | 377 | hw->vif_data_size = sizeof(struct mt76x02_vif); |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c index e43c53e8e6be..dc2226c722dd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c | |||
@@ -34,17 +34,6 @@ void mt76x02u_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q, | |||
34 | } | 34 | } |
35 | EXPORT_SYMBOL_GPL(mt76x02u_tx_complete_skb); | 35 | EXPORT_SYMBOL_GPL(mt76x02u_tx_complete_skb); |
36 | 36 | ||
37 | static int mt76x02u_check_skb_rooms(struct sk_buff *skb) | ||
38 | { | ||
39 | int hdr_len = ieee80211_get_hdrlen_from_skb(skb); | ||
40 | u32 need_head; | ||
41 | |||
42 | need_head = sizeof(struct mt76x02_txwi) + MT_DMA_HDR_LEN; | ||
43 | if (hdr_len % 4) | ||
44 | need_head += 2; | ||
45 | return skb_cow(skb, need_head); | ||
46 | } | ||
47 | |||
48 | int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags) | 37 | int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags) |
49 | { | 38 | { |
50 | struct sk_buff *iter, *last = skb; | 39 | struct sk_buff *iter, *last = skb; |
@@ -106,11 +95,7 @@ int mt76x02u_tx_prepare_skb(struct mt76_dev *mdev, void *data, | |||
106 | { | 95 | { |
107 | struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); | 96 | struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); |
108 | struct mt76x02_txwi *txwi; | 97 | struct mt76x02_txwi *txwi; |
109 | int err, len = skb->len; | 98 | int len = skb->len; |
110 | |||
111 | err = mt76x02u_check_skb_rooms(skb); | ||
112 | if (err < 0) | ||
113 | return -ENOMEM; | ||
114 | 99 | ||
115 | mt76x02_insert_hdr_pad(skb); | 100 | mt76x02_insert_hdr_pad(skb); |
116 | 101 | ||
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/init.c index ccd9bc9d3e1e..3c73fdeaf30f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/init.c | |||
@@ -167,6 +167,9 @@ void mt76x2_init_device(struct mt76x02_dev *dev) | |||
167 | hw->max_report_rates = 7; | 167 | hw->max_report_rates = 7; |
168 | hw->max_rate_tries = 1; | 168 | hw->max_rate_tries = 1; |
169 | hw->extra_tx_headroom = 2; | 169 | hw->extra_tx_headroom = 2; |
170 | if (mt76_is_usb(dev)) | ||
171 | hw->extra_tx_headroom += sizeof(struct mt76x02_txwi) + | ||
172 | MT_DMA_HDR_LEN; | ||
170 | 173 | ||
171 | hw->sta_data_size = sizeof(struct mt76x02_sta); | 174 | hw->sta_data_size = sizeof(struct mt76x02_sta); |
172 | hw->vif_data_size = sizeof(struct mt76x02_vif); | 175 | hw->vif_data_size = sizeof(struct mt76x02_vif); |