Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ac97834 authored by Vladimir Kondratiev's avatar Vladimir Kondratiev Committed by Hamad Kadmany
Browse files

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.

Change-Id: I08dad5aee31066db7e296e3ac6b965681e2008c2
Signed-off-by: default avatarVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Git-commit: 9a06bec9aee0ae54f175b20a8d4f5e14aef24a9f
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git


Signed-off-by: default avatarHamad Kadmany <hkadmany@codeaurora.org>
parent 540d211a
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -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 */

+1 −1
Original line number Diff line number Diff line
@@ -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;
	}
+4 −3
Original line number Diff line number Diff line
@@ -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,
+2 −2
Original line number Diff line number Diff line
@@ -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)

+1 −0
Original line number Diff line number Diff line
@@ -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"
Loading