linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maya Erez <merez@codeaurora.org>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: Ahmad Masri <amasri@codeaurora.org>,
	linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com,
	Maya Erez <merez@codeaurora.org>
Subject: [PATCH 03/12] wil6210: support ndo_select_queue in net_device_ops
Date: Sun,  2 Dec 2018 11:43:28 +0200	[thread overview]
Message-ID: <1543743817-10298-4-git-send-email-merez@codeaurora.org> (raw)
In-Reply-To: <1543743817-10298-1-git-send-email-merez@codeaurora.org>

From: Ahmad Masri <amasri@codeaurora.org>

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 module param to enable.

Signed-off-by: Ahmad Masri <amasri@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
---
 drivers/net/wireless/ath/wil6210/netdev.c       | 43 +++++++++++++++++++++++--
 drivers/net/wireless/ath/wil6210/wil_platform.h |  2 ++
 2 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/netdev.c b/drivers/net/wireless/ath/wil6210/netdev.c
index b99470c..bab457d 100644
--- a/drivers/net/wireless/ath/wil6210/netdev.c
+++ b/drivers/net/wireless/ath/wil6210/netdev.c
@@ -20,6 +20,8 @@
 #include "wil6210.h"
 #include "txrx.h"
 
+#define WIL6210_TX_QUEUES (4)
+
 bool wil_has_other_active_ifaces(struct wil6210_priv *wil,
 				 struct net_device *ndev, bool up, bool ok)
 {
@@ -91,10 +93,43 @@ static int wil_stop(struct net_device *ndev)
 	return rc;
 }
 
+/**
+ * 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 (!wil->config.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,
 };
@@ -317,8 +352,12 @@ struct wil6210_vif *
 		return ERR_PTR(-EINVAL);
 	}
 
-	ndev = alloc_netdev(sizeof(*vif), name, name_assign_type,
-			    wil_dev_setup);
+	if (wil->config.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) {
 		dev_err(wil_to_dev(wil), "alloc_netdev failed\n");
 		return ERR_PTR(-ENOMEM);
diff --git a/drivers/net/wireless/ath/wil6210/wil_platform.h b/drivers/net/wireless/ath/wil6210/wil_platform.h
index 7090e68..ac47e9d 100644
--- a/drivers/net/wireless/ath/wil6210/wil_platform.h
+++ b/drivers/net/wireless/ath/wil6210/wil_platform.h
@@ -59,6 +59,8 @@ struct wil_platform_config {
 	bool disable_ap_sme;
 	/* Max number of stations associated to the AP */
 	unsigned int max_assoc_sta;
+	/* enable access category for transmit packets, default - no */
+	bool ac_queues;
 };
 
 /**
-- 
1.9.1


  parent reply	other threads:[~2018-12-02  9:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-02  9:43 [PATCH 00/12] wil6210 patches Maya Erez
2018-12-02  9:43 ` [PATCH 01/12] wil6210: remove rtap_include_phy_info module param Maya Erez
2018-12-02  9:43 ` [PATCH 02/12] wil6210: use platform specific configuration Maya Erez
2018-12-02  9:43 ` Maya Erez [this message]
2018-12-02  9:43 ` [PATCH 04/12] wil6210: add support for AC queues per station Maya Erez
2018-12-02  9:43 ` [PATCH 05/12] wil6210: add option to drop Tx packets when tx ring is full Maya Erez
2018-12-02  9:43 ` [PATCH 06/12] wil6210: support up to 20 stations in AP mode Maya Erez
2018-12-02  9:43 ` [PATCH 07/12] wil6210: accessing 802.3 addresses via utility functions Maya Erez
2018-12-02  9:43 ` [PATCH 08/12] wil6210: fix invalid sta statistics update Maya Erez
2018-12-02  9:43 ` [PATCH 09/12] wil6210: ignore HALP ICR if already handled Maya Erez
2018-12-02  9:43 ` [PATCH 10/12] wil6210: check null pointer in _wil_cfg80211_merge_extra_ies Maya Erez
2018-12-02  9:43 ` [PATCH 11/12] wil6210: align to latest auto generated wmi.h Maya Erez
2018-12-02  9:43 ` [PATCH 12/12] wil6210: prevent device memory access while in reset or suspend Maya Erez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1543743817-10298-4-git-send-email-merez@codeaurora.org \
    --to=merez@codeaurora.org \
    --cc=amasri@codeaurora.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=wil6210@qti.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).