rtl8xxxu: Allocate larger RX skbs when aggregation is enabled
authorJes Sorensen <Jes.Sorensen@redhat.com>
Mon, 27 Jun 2016 16:32:04 +0000 (12:32 -0400)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 8 Jul 2016 13:41:56 +0000 (16:41 +0300)
This adds support for allocating larger skbs for devices which
indicate they support it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c

index e8158c053d779babcaa9b8599c33bd7c6c4ca0ae..f06e3aa92d713107726e0e4444ce3848b48e1f92 100644 (file)
@@ -1247,6 +1247,7 @@ struct rtl8xxxu_priv {
        u32 ep_tx_normal_queue:1;
        u32 ep_tx_low_queue:1;
        u32 has_xtalk:1;
+       u32 rx_buf_aggregation:1;
        u8 xtalk;
        unsigned int pipe_interrupt;
        unsigned int pipe_in;
@@ -1330,6 +1331,7 @@ struct rtl8xxxu_fileops {
        void (*report_connect) (struct rtl8xxxu_priv *priv,
                                u8 macid, bool connect);
        int writeN_block_size;
+       int rx_agg_buf_size;
        char tx_desc_size;
        char rx_desc_size;
        char has_s0s1;
index 8643bb3c18027dcf0f1d1a0ee3239422d5ef5637..75149e49f333721c08cc21b0a71d5269a4b544c4 100644 (file)
@@ -64,8 +64,6 @@ module_param_named(ht40_2g, rtl8xxxu_ht40_2g, bool, 0600);
 MODULE_PARM_DESC(ht40_2g, "Enable HT40 support on the 2.4GHz band");
 
 #define USB_VENDOR_ID_REALTEK          0x0bda
-/* Minimum IEEE80211_MAX_FRAME_LEN */
-#define RTL_RX_BUFFER_SIZE             IEEE80211_MAX_FRAME_LEN
 #define RTL8XXXU_RX_URBS               32
 #define RTL8XXXU_RX_URB_PENDING_WATER  8
 #define RTL8XXXU_TX_URBS               64
@@ -5271,12 +5269,19 @@ cleanup:
 static int rtl8xxxu_submit_rx_urb(struct rtl8xxxu_priv *priv,
                                  struct rtl8xxxu_rx_urb *rx_urb)
 {
+       struct rtl8xxxu_fileops *fops = priv->fops;
        struct sk_buff *skb;
        int skb_size;
        int ret, rx_desc_sz;
 
-       rx_desc_sz = priv->fops->rx_desc_size;
-       skb_size = rx_desc_sz + RTL_RX_BUFFER_SIZE;
+       rx_desc_sz = fops->rx_desc_size;
+
+       if (priv->rx_buf_aggregation && fops->rx_agg_buf_size)
+               skb_size = fops->rx_agg_buf_size;
+       else
+               skb_size = IEEE80211_MAX_FRAME_LEN;
+       skb_size += rx_desc_sz;
+
        skb = __netdev_alloc_skb(NULL, skb_size, GFP_KERNEL);
        if (!skb)
                return -ENOMEM;