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

Commit 9cc0bd82 authored by Ahmad Masri's avatar Ahmad Masri
Browse files

wil6210: Support ndo_select_queue in net_device_ops



Add support for Access Category to select queue for transmit packets.
The callback wil_select_queue will return the queue id [0..3] to use for
the current skb transmission.

This feature is disabled by default. Use ac_queues parameter from
wigig.ini configuration file to enable.

Change-Id: I2891c58744eddafe16f9d74d1a87acdbf90d3d40
Signed-off-by: default avatarAhmad Masri <amasri@codeaurora.org>
parent eac6c82e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -209,6 +209,10 @@ static struct wil_config_entry config_table[] = {
			     wil_ini_param_type_signed, &agg_wsize, 0,
			     sizeof(agg_wsize), WIL_CONFIG_AGG_WSIZE_MIN,
			     WIL_CONFIG_AGG_WSIZE_MAX),
	WIL_CONFIG_INI_PARAM(WIL_CONFIG_AC_QUEUES_NAME,
			     wil_ini_param_type_unsigned, &ac_queues, 0,
			     WIL_CONFIG_BOOL_SIZE, WIL_CONFIG_BOOL_MIN,
			     WIL_CONFIG_BOOL_MAX),
	WIL_CONFIG_INI_PARAM(WIL_CONFIG_DROP_IF_FULL_NAME,
			     wil_ini_param_type_unsigned, &drop_if_ring_full,
			     0, WIL_CONFIG_BOOL_SIZE, WIL_CONFIG_BOOL_MIN,
+46 −2
Original line number Diff line number Diff line
@@ -12,10 +12,17 @@
#include "ipa.h"
#include "config.h"

#define WIL6210_TX_QUEUES (4)

static bool alt_ifname; /* = false; */
module_param(alt_ifname, bool, 0444);
MODULE_PARM_DESC(alt_ifname, " use an alternate interface name wigigN instead of wlanN");

/* enable access category for transmit packets, this parameter may be controlled
 * via wigig.ini config file, default disabled
 */
bool ac_queues;

bool wil_has_other_active_ifaces(struct wil6210_priv *wil,
				 struct net_device *ndev, bool up, bool ok)
{
@@ -94,10 +101,43 @@ static int wil_do_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
	return wil_ioctl(wil, ifr->ifr_data, cmd);
}

/**
 * AC to queue mapping
 *
 * AC_VO -> queue 3
 * AC_VI -> queue 2
 * AC_BE -> queue 1
 * AC_BK -> queue 0
 */
static u16 wil_select_queue(struct net_device *ndev,
			    struct sk_buff *skb,
			    struct net_device *sb_dev,
			    select_queue_fallback_t fallback)
{
	static const u16 wil_1d_to_queue[8] = {1, 0, 0, 1, 2, 2, 3, 3};
	struct wil6210_priv *wil = ndev_to_wil(ndev);
	u16 qid;

	if (!ac_queues)
		return 0;

	/* determine the priority */
	if (skb->priority == 0 || skb->priority > 7)
		skb->priority = cfg80211_classify8021d(skb, NULL);

	qid = wil_1d_to_queue[skb->priority];

	wil_dbg_txrx(wil, "select queue for priority %d -> queue %d\n",
		     skb->priority, qid);

	return qid;
}

static const struct net_device_ops wil_netdev_ops = {
	.ndo_open		= wil_open,
	.ndo_stop		= wil_stop,
	.ndo_start_xmit		= wil_start_xmit,
	.ndo_select_queue	= wil_select_queue,
	.ndo_set_mac_address	= eth_mac_addr,
	.ndo_validate_addr	= eth_validate_addr,
	.ndo_do_ioctl		= wil_do_ioctl,
@@ -336,6 +376,10 @@ wil_vif_alloc(struct wil6210_priv *wil, const char *name,
		return ERR_PTR(-EINVAL);
	}

	if (ac_queues)
		ndev = alloc_netdev_mqs(sizeof(*vif), name, name_assign_type,
					wil_dev_setup, WIL6210_TX_QUEUES, 1);
	else
		ndev = alloc_netdev(sizeof(*vif), name, name_assign_type,
				    wil_dev_setup);
	if (!ndev) {
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ extern bool drop_if_ring_full;
extern int n_msi;
extern uint max_assoc_sta;
extern bool drop_if_ring_full;
extern bool ac_queues;
extern uint rx_ring_order;
extern uint tx_ring_order;
extern uint bcast_ring_order;