]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
wil6210: Add support for large packets
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Tue, 28 Oct 2014 14:51:27 +0000 (16:51 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 30 Oct 2014 19:26:52 +0000 (15:26 -0400)
It is possible to configure driver using mtu_max module parameter
by setting it to value in range of 68..7920 inclusive.
This is sub-optimal performance-wise in case packet is larger than 1 page.
mtu_max default value is 2228.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/wil6210/main.c
drivers/net/wireless/ath/wil6210/netdev.c
drivers/net/wireless/ath/wil6210/txrx.c
drivers/net/wireless/ath/wil6210/txrx.h
drivers/net/wireless/ath/wil6210/wil6210.h
drivers/net/wireless/ath/wil6210/wmi.c

index 92705c0d97a4b2b1a7cd8e839185ac6fe2c38883..6212983fede27d36ce520f78f40668531e7e96ff 100644 (file)
@@ -38,6 +38,35 @@ static unsigned int itr_trsh = WIL6210_ITR_TRSH_DEFAULT;
 module_param(itr_trsh, uint, S_IRUGO);
 MODULE_PARM_DESC(itr_trsh, " Interrupt moderation threshold, usecs.");
 
+/* We allow allocation of more than 1 page buffers to support large packets.
+ * It is suboptimal behavior performance wise in case MTU above page size.
+ */
+unsigned int mtu_max = TXRX_BUF_LEN_DEFAULT - ETH_HLEN;
+static int mtu_max_set(const char *val, const struct kernel_param *kp)
+{
+       int ret;
+
+       /* sets mtu_max directly. no need to restore it in case of
+        * illegal value since we assume this will fail insmod
+        */
+       ret = param_set_uint(val, kp);
+       if (ret)
+               return ret;
+
+       if (mtu_max < 68 || mtu_max > IEEE80211_MAX_DATA_LEN_DMG)
+               ret = -EINVAL;
+
+       return ret;
+}
+
+static struct kernel_param_ops mtu_max_ops = {
+       .set = mtu_max_set,
+       .get = param_get_uint,
+};
+
+module_param_cb(mtu_max, &mtu_max_ops, &mtu_max, S_IRUGO);
+MODULE_PARM_DESC(mtu_max, " Max MTU value.");
+
 #define RST_DELAY (20) /* msec, for loop in @wil_target_reset */
 #define RST_COUNT (1 + 1000/RST_DELAY) /* round up to be above 1 sec total */
 
index 239965106c05d1f878f52cd8b552047d2743d998..e81703ca7701cbc1e04413d51c3af25a2d4d7986 100644 (file)
@@ -41,7 +41,7 @@ static int wil_change_mtu(struct net_device *ndev, int new_mtu)
 {
        struct wil6210_priv *wil = ndev_to_wil(ndev);
 
-       if (new_mtu < 68 || new_mtu > (TX_BUF_LEN - ETH_HLEN)) {
+       if (new_mtu < 68 || new_mtu > mtu_max) {
                wil_err(wil, "invalid MTU %d\n", new_mtu);
                return -EINVAL;
        }
index 2936ef0c18cbc700003760e5a93a9f504b9d8840..c680906bc0dc6ebbcba1aa270c11d7cc7c0681fc 100644 (file)
@@ -206,7 +206,7 @@ static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct vring *vring,
                               u32 i, int headroom)
 {
        struct device *dev = wil_to_dev(wil);
-       unsigned int sz = RX_BUF_LEN;
+       unsigned int sz = mtu_max + ETH_HLEN;
        struct vring_rx_desc dd, *d = &dd;
        volatile struct vring_rx_desc *_d = &vring->va[i].rx;
        dma_addr_t pa;
@@ -385,7 +385,7 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
        struct vring_rx_desc *d;
        struct sk_buff *skb;
        dma_addr_t pa;
-       unsigned int sz = RX_BUF_LEN;
+       unsigned int sz = mtu_max + ETH_HLEN;
        u16 dmalen;
        u8 ftype;
        u8 ds_bits;
@@ -646,7 +646,8 @@ int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size,
                .action = cpu_to_le32(WMI_VRING_CMD_ADD),
                .vring_cfg = {
                        .tx_sw_ring = {
-                               .max_mpdu_size = cpu_to_le16(TX_BUF_LEN),
+                               .max_mpdu_size =
+                                       cpu_to_le16(mtu_max + ETH_HLEN),
                                .ring_size = cpu_to_le16(size),
                        },
                        .ringid = id,
index de046716d2b7e2de3c96e2f8aaff266796c78967..630aeb5fa7f4a50f37b90d99137ce591bc4c2b9e 100644 (file)
@@ -21,8 +21,8 @@
 #define BUF_HW_OWNED    (0)
 
 /* size of max. Tx/Rx buffers, as supported by FW */
-#define RX_BUF_LEN      (2242)
-#define TX_BUF_LEN      (2242)
+#define TXRX_BUF_LEN_DEFAULT (2242)
+
 /* how many bytes to reserve for rtap header? */
 #define WIL6210_RTAP_SIZE (128)
 
index 3674e2732192a758af8c817c00fa08f51dc7a296..95d3a062d35c57d9634dba7bf10a836891de9c50 100644 (file)
@@ -24,6 +24,7 @@
 #include "wil_platform.h"
 
 extern bool no_fw_recovery;
+extern unsigned int mtu_max;
 
 #define WIL_NAME "wil6210"
 #define WIL_FW_NAME "wil6210.fw"
index 9661fa1501676a8a763221b9d8a3dfcc75d03c40..bb1e066f756a88cd3920cbc62ccf251c5fa6aa4e 100644 (file)
@@ -1025,7 +1025,7 @@ int wmi_rx_chain_add(struct wil6210_priv *wil, struct vring *vring)
        struct wmi_cfg_rx_chain_cmd cmd = {
                .action = WMI_RX_CHAIN_ADD,
                .rx_sw_ring = {
-                       .max_mpdu_size = cpu_to_le16(RX_BUF_LEN),
+                       .max_mpdu_size = cpu_to_le16(mtu_max + ETH_HLEN),
                        .ring_mem_base = cpu_to_le64(vring->pa),
                        .ring_size = cpu_to_le16(vring->size),
                },