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

Commit 2f6cb472 authored by Alexei Avshalom Lazar's avatar Alexei Avshalom Lazar Committed by Lior David
Browse files

wil6210: add support for headroom configuration



Add module parameter for configuring the headroom size
in the skb allocation.

Change-Id: Ie0190a6c8fa19c7121ad77b8a9a913ce876800fe
Signed-off-by: default avatarAlexei Avshalom Lazar <ailizaro@codeaurora.org>
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
[liord@codeaurora.org: SPDX license]
Signed-off-by: default avatarLior David <liord@codeaurora.org>
parent 55dd2f28
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -32,6 +32,32 @@ bool rx_large_buf;
module_param(rx_large_buf, bool, 0444);
MODULE_PARM_DESC(rx_large_buf, " allocate 8KB RX buffers, default - no");

#define WIL6210_MAX_HEADROOM_SIZE	(256)

ushort headroom_size; /* = 0; */
static int headroom_size_set(const char *val, const struct kernel_param *kp)
{
	int ret;

	ret = param_set_uint(val, kp);
	if (ret)
		return ret;

	if (headroom_size > WIL6210_MAX_HEADROOM_SIZE)
		return -EINVAL;

	return 0;
}

static const struct kernel_param_ops headroom_ops = {
	.set = headroom_size_set,
	.get = param_get_ushort,
};

module_param_cb(headroom_size, &headroom_ops, &headroom_size, 0644);
MODULE_PARM_DESC(headroom_size,
		 " headroom size for rx skb allocation, default - 0");

static inline uint wil_rx_snaplen(void)
{
	return rx_align_2 ? 6 : 0;
@@ -599,7 +625,7 @@ static int wil_rx_refill(struct wil6210_priv *wil, int count)
	u32 next_tail;
	int rc = 0;
	int headroom = ndev->type == ARPHRD_IEEE80211_RADIOTAP ?
			WIL6210_RTAP_SIZE : 0;
			WIL6210_RTAP_SIZE : headroom_size;

	for (; next_tail = wil_ring_next_tail(v),
	     (next_tail != v->swhead) && (count-- > 0);
+4 −14
Original line number Diff line number Diff line
// SPDX-License-Identifier: ISC
/*
 * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
 */

#include <linux/etherdevice.h>
@@ -177,10 +166,11 @@ static int wil_ring_alloc_skb_edma(struct wil6210_priv *wil,
		return -EAGAIN;
	}

	skb = dev_alloc_skb(sz);
	skb = dev_alloc_skb(sz + headroom_size);
	if (unlikely(!skb))
		return -ENOMEM;

	skb_reserve(skb, headroom_size);
	skb_put(skb, sz);

	/**
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ extern bool rx_large_buf;
extern bool debug_fw;
extern bool disable_ap_sme;
extern bool ftm_mode;
extern ushort headroom_size;

struct wil6210_priv;
struct wil6210_vif;