Commit 9a06bec9 authored by Vladimir Kondratiev's avatar Vladimir Kondratiev Committed by John W. Linville

wil6210: Add support for large packets

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: default avatarVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e240537b
...@@ -38,6 +38,35 @@ static unsigned int itr_trsh = WIL6210_ITR_TRSH_DEFAULT; ...@@ -38,6 +38,35 @@ static unsigned int itr_trsh = WIL6210_ITR_TRSH_DEFAULT;
module_param(itr_trsh, uint, S_IRUGO); module_param(itr_trsh, uint, S_IRUGO);
MODULE_PARM_DESC(itr_trsh, " Interrupt moderation threshold, usecs."); 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_DELAY (20) /* msec, for loop in @wil_target_reset */
#define RST_COUNT (1 + 1000/RST_DELAY) /* round up to be above 1 sec total */ #define RST_COUNT (1 + 1000/RST_DELAY) /* round up to be above 1 sec total */
......
...@@ -41,7 +41,7 @@ static int wil_change_mtu(struct net_device *ndev, int new_mtu) ...@@ -41,7 +41,7 @@ static int wil_change_mtu(struct net_device *ndev, int new_mtu)
{ {
struct wil6210_priv *wil = ndev_to_wil(ndev); 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); wil_err(wil, "invalid MTU %d\n", new_mtu);
return -EINVAL; return -EINVAL;
} }
......
...@@ -206,7 +206,7 @@ static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct vring *vring, ...@@ -206,7 +206,7 @@ static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct vring *vring,
u32 i, int headroom) u32 i, int headroom)
{ {
struct device *dev = wil_to_dev(wil); 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; struct vring_rx_desc dd, *d = &dd;
volatile struct vring_rx_desc *_d = &vring->va[i].rx; volatile struct vring_rx_desc *_d = &vring->va[i].rx;
dma_addr_t pa; dma_addr_t pa;
...@@ -385,7 +385,7 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil, ...@@ -385,7 +385,7 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
struct vring_rx_desc *d; struct vring_rx_desc *d;
struct sk_buff *skb; struct sk_buff *skb;
dma_addr_t pa; dma_addr_t pa;
unsigned int sz = RX_BUF_LEN; unsigned int sz = mtu_max + ETH_HLEN;
u16 dmalen; u16 dmalen;
u8 ftype; u8 ftype;
u8 ds_bits; u8 ds_bits;
...@@ -646,7 +646,8 @@ int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size, ...@@ -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), .action = cpu_to_le32(WMI_VRING_CMD_ADD),
.vring_cfg = { .vring_cfg = {
.tx_sw_ring = { .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), .ring_size = cpu_to_le16(size),
}, },
.ringid = id, .ringid = id,
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
#define BUF_HW_OWNED (0) #define BUF_HW_OWNED (0)
/* size of max. Tx/Rx buffers, as supported by FW */ /* size of max. Tx/Rx buffers, as supported by FW */
#define RX_BUF_LEN (2242) #define TXRX_BUF_LEN_DEFAULT (2242)
#define TX_BUF_LEN (2242)
/* how many bytes to reserve for rtap header? */ /* how many bytes to reserve for rtap header? */
#define WIL6210_RTAP_SIZE (128) #define WIL6210_RTAP_SIZE (128)
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "wil_platform.h" #include "wil_platform.h"
extern bool no_fw_recovery; extern bool no_fw_recovery;
extern unsigned int mtu_max;
#define WIL_NAME "wil6210" #define WIL_NAME "wil6210"
#define WIL_FW_NAME "wil6210.fw" #define WIL_FW_NAME "wil6210.fw"
......
...@@ -1025,7 +1025,7 @@ int wmi_rx_chain_add(struct wil6210_priv *wil, struct vring *vring) ...@@ -1025,7 +1025,7 @@ int wmi_rx_chain_add(struct wil6210_priv *wil, struct vring *vring)
struct wmi_cfg_rx_chain_cmd cmd = { struct wmi_cfg_rx_chain_cmd cmd = {
.action = WMI_RX_CHAIN_ADD, .action = WMI_RX_CHAIN_ADD,
.rx_sw_ring = { .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_mem_base = cpu_to_le64(vring->pa),
.ring_size = cpu_to_le16(vring->size), .ring_size = cpu_to_le16(vring->size),
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment