linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 03/23] wilc1000: move receive-queue stats from txq to wilc structure
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 02/23] wilc1000: switch txq_event from completion to waitqueue David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 01/23] wilc1000: don't hold txq_spinlock while initializing AC queue limits David Mosberger-Tang
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

This is in preparation of switching the transmit queue to struct
sk_buffs.  There is no functional change other than moving the
location of the structure.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 .../net/wireless/microchip/wilc1000/netdev.h  |  1 +
 .../net/wireless/microchip/wilc1000/wlan.c    | 28 +++++++++----------
 .../net/wireless/microchip/wilc1000/wlan.h    |  1 -
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h
index 65cf296a8689e..ce79bdcc28000 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.h
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.h
@@ -254,6 +254,7 @@ struct wilc {
 
 	struct txq_handle txq[NQUEUES];
 	int txq_entries;
+	struct txq_fw_recv_queue_stat fw[NQUEUES];
 
 	struct wilc_tx_queue_status tx_q_limit;
 	struct rxq_entry_t rxq_head;
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index fafeabe2537a3..2d103131b2e93 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -373,32 +373,32 @@ static inline int ac_balance(struct wilc *wl, u8 *ratio)
 		return -EINVAL;
 
 	for (i = 0; i < NQUEUES; i++)
-		if (wl->txq[i].fw.count > max_count)
-			max_count = wl->txq[i].fw.count;
+		if (wl->fw[i].count > max_count)
+			max_count = wl->fw[i].count;
 
 	for (i = 0; i < NQUEUES; i++)
-		ratio[i] = max_count - wl->txq[i].fw.count;
+		ratio[i] = max_count - wl->fw[i].count;
 
 	return 0;
 }
 
 static inline void ac_update_fw_ac_pkt_info(struct wilc *wl, u32 reg)
 {
-	wl->txq[AC_BK_Q].fw.count = FIELD_GET(BK_AC_COUNT_FIELD, reg);
-	wl->txq[AC_BE_Q].fw.count = FIELD_GET(BE_AC_COUNT_FIELD, reg);
-	wl->txq[AC_VI_Q].fw.count = FIELD_GET(VI_AC_COUNT_FIELD, reg);
-	wl->txq[AC_VO_Q].fw.count = FIELD_GET(VO_AC_COUNT_FIELD, reg);
-
-	wl->txq[AC_BK_Q].fw.acm = FIELD_GET(BK_AC_ACM_STAT_FIELD, reg);
-	wl->txq[AC_BE_Q].fw.acm = FIELD_GET(BE_AC_ACM_STAT_FIELD, reg);
-	wl->txq[AC_VI_Q].fw.acm = FIELD_GET(VI_AC_ACM_STAT_FIELD, reg);
-	wl->txq[AC_VO_Q].fw.acm = FIELD_GET(VO_AC_ACM_STAT_FIELD, reg);
+	wl->fw[AC_BK_Q].count = FIELD_GET(BK_AC_COUNT_FIELD, reg);
+	wl->fw[AC_BE_Q].count = FIELD_GET(BE_AC_COUNT_FIELD, reg);
+	wl->fw[AC_VI_Q].count = FIELD_GET(VI_AC_COUNT_FIELD, reg);
+	wl->fw[AC_VO_Q].count = FIELD_GET(VO_AC_COUNT_FIELD, reg);
+
+	wl->fw[AC_BK_Q].acm = FIELD_GET(BK_AC_ACM_STAT_FIELD, reg);
+	wl->fw[AC_BE_Q].acm = FIELD_GET(BE_AC_ACM_STAT_FIELD, reg);
+	wl->fw[AC_VI_Q].acm = FIELD_GET(VI_AC_ACM_STAT_FIELD, reg);
+	wl->fw[AC_VO_Q].acm = FIELD_GET(VO_AC_ACM_STAT_FIELD, reg);
 }
 
 static inline u8 ac_change(struct wilc *wilc, u8 *ac)
 {
 	do {
-		if (wilc->txq[*ac].fw.acm == 0)
+		if (wilc->fw[*ac].acm == 0)
 			return 0;
 		(*ac)++;
 	} while (*ac < NQUEUES);
@@ -920,7 +920,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 		kfree(tqe);
 	} while (--entries);
 	for (i = 0; i < NQUEUES; i++)
-		wilc->txq[i].fw.count += ac_pkt_num_to_chip[i];
+		wilc->fw[i].count += ac_pkt_num_to_chip[i];
 
 	acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
 
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.h b/drivers/net/wireless/microchip/wilc1000/wlan.h
index eb7978166d73e..9b33262909e2f 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.h
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.h
@@ -341,7 +341,6 @@ struct txq_fw_recv_queue_stat {
 struct txq_handle {
 	struct txq_entry_t txq_head;
 	u16 count;
-	struct txq_fw_recv_queue_stat fw;
 };
 
 struct rxq_entry_t {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout
@ 2021-12-18 23:54 David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 02/23] wilc1000: switch txq_event from completion to waitqueue David Mosberger-Tang
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

Based on the earlier discussion (RFC: wilc1000: refactor TX path to
use sk_buff queue), here is the full patch series to clean up and
simplify the TX path.

The biggest patch is 0016, which is the one actually switching the
queue data type, but I worked hard to minimize it to only direct
changes due to the type changes.

There is no significant performance difference due to this patch.  I'd
expect the new code to be slightly faster, but my WLAN
test-environment is not sufficiently controlled to be sure of that.

original iperf3 performance (duration 120 seconds):

                TX [Mbps]	RX [Mbps]
  PSM off:	14.8		18.9
  PSM  on:	10.5		17.1

iperf3 performance with this patch-series applied:

		TX [Mbps]	RX [Mbps]
  PSM off:	15.6		19.5
  PSM  on:	11.2		17.7

(PSM == power-save-mode; controlled by iw dev wlan0 set power_save on/off)

David Mosberger-Tang (23):
  wilc1000: don't hold txq_spinlock while initializing AC queue limits
  wilc1000: switch txq_event from completion to waitqueue
  wilc1000: move receive-queue stats from txq to wilc structure
  wilc1000: factor common code in wilc_wlan_cfg_set() and wilc_wlan_cfg_get()
  wilc1000: add wilc_wlan_tx_packet_done() function
  wilc1000: move tx packet drop code into its own function
  wilc1000: increment tx_dropped stat counter on tx packet drop
  wilc1000: fix management packet type inconsistency
  wilc1000: prepare wilc_wlan_tx_packet_done() for sk_buff changes
  wilc1000: factor initialization of tx queue-specific packet fields
  wilc1000: convert tqx_entries from "int" to "atomic_t"
  wilc1000: refactor wilc_wlan_cfg_commit() a bit
  wilc1000: sanitize config packet sequence number management a bit
  wilc1000: if there is no tx packet, don't increment packets-sent counter
  wilc1000: Add struct wilc_skb_tx_cb as an alias of struct txq_entry_t
  wilc1000: switch tx queue to normal sk_buff entries
  wilc1000: remove no longer used "vif" argument from init_txq_entry()
  wilc1000: split huge tx handler into subfunctions
  wilc1000: don't tell the chip to go to sleep while copying tx packets
  wilc1000: eliminate "max_size_over" variable in fill_vmm_table
  wilc1000: declare read-only ac_preserve_ratio as static and const
  wilc1000: minor syntax cleanup
  wilc1000: introduce symbolic names for two tx-related control bits

 .../wireless/microchip/wilc1000/cfg80211.c    |  37 +-
 drivers/net/wireless/microchip/wilc1000/mon.c |  36 +-
 .../net/wireless/microchip/wilc1000/netdev.c  |  40 +-
 .../net/wireless/microchip/wilc1000/netdev.h  |  13 +-
 .../net/wireless/microchip/wilc1000/wlan.c    | 755 +++++++++---------
 .../net/wireless/microchip/wilc1000/wlan.h    |  52 +-
 6 files changed, 442 insertions(+), 491 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 01/23] wilc1000: don't hold txq_spinlock while initializing AC queue limits
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 02/23] wilc1000: switch txq_event from completion to waitqueue David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 03/23] wilc1000: move receive-queue stats from txq to wilc structure David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 05/23] wilc1000: add wilc_wlan_tx_packet_done() function David Mosberger-Tang
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

The wilc_tx_queue_status queue is relatively large and there is
absolutely no need to initialize it while holding a spinlock.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 .../net/wireless/microchip/wilc1000/netdev.h  |  1 -
 .../net/wireless/microchip/wilc1000/wlan.c    | 32 +++++++++++--------
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h
index b9a88b3e322f1..fd0cb01e538a2 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.h
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.h
@@ -202,7 +202,6 @@ struct wilc_tx_queue_status {
 	u16 end_index;
 	u16 cnt[NQUEUES];
 	u16 sum;
-	bool initialized;
 };
 
 struct wilc {
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 1aa4236a2fe41..721e6131125e8 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -12,6 +12,8 @@
 
 #define WAKE_UP_TRIAL_RETRY		10000
 
+static const u8 factors[NQUEUES] = {1, 1, 1, 1};
+
 static inline bool is_wilc1000(u32 id)
 {
 	return (id & (~WILC_CHIP_REV_FIELD)) == WILC_1000_BASE_ID;
@@ -283,10 +285,23 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer,
 	return 1;
 }
 
+static void init_q_limits(struct wilc *wl)
+{
+	struct wilc_tx_queue_status *q = &wl->tx_q_limit;
+	int i;
+
+	for (i = 0; i < AC_BUFFER_SIZE; i++)
+		q->buffer[i] = i % NQUEUES;
+
+	for (i = 0; i < NQUEUES; i++) {
+		q->cnt[i] = AC_BUFFER_SIZE * factors[i] / NQUEUES;
+		q->sum += q->cnt[i];
+	}
+	q->end_index = AC_BUFFER_SIZE - 1;
+}
+
 static bool is_ac_q_limit(struct wilc *wl, u8 q_num)
 {
-	u8 factors[NQUEUES] = {1, 1, 1, 1};
-	u16 i;
 	unsigned long flags;
 	struct wilc_tx_queue_status *q = &wl->tx_q_limit;
 	u8 end_index;
@@ -294,17 +309,6 @@ static bool is_ac_q_limit(struct wilc *wl, u8 q_num)
 	bool ret = false;
 
 	spin_lock_irqsave(&wl->txq_spinlock, flags);
-	if (!q->initialized) {
-		for (i = 0; i < AC_BUFFER_SIZE; i++)
-			q->buffer[i] = i % NQUEUES;
-
-		for (i = 0; i < NQUEUES; i++) {
-			q->cnt[i] = AC_BUFFER_SIZE * factors[i] / NQUEUES;
-			q->sum += q->cnt[i];
-		}
-		q->end_index = AC_BUFFER_SIZE - 1;
-		q->initialized = 1;
-	}
 
 	end_index = q->end_index;
 	q->cnt[q->buffer[end_index]] -= factors[q->buffer[end_index]];
@@ -1485,6 +1489,8 @@ int wilc_wlan_init(struct net_device *dev)
 		goto fail;
 	}
 
+	init_q_limits(wilc);
+
 	if (!wilc->tx_buffer)
 		wilc->tx_buffer = kmalloc(WILC_TX_BUFF_SIZE, GFP_KERNEL);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 05/23] wilc1000: add wilc_wlan_tx_packet_done() function
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (2 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 01/23] wilc1000: don't hold txq_spinlock while initializing AC queue limits David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 07/23] wilc1000: increment tx_dropped stat counter on tx packet drop David Mosberger-Tang
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

Factor common tx packet-done handling code into a function.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 .../net/wireless/microchip/wilc1000/wlan.c    | 31 +++++++++----------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 1c487342c1a88..caaa03c8e5df8 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -190,6 +190,16 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 }
 
+static void wilc_wlan_tx_packet_done(struct txq_entry_t *tqe, int status)
+{
+	tqe->status = status;
+	if (tqe->tx_complete_func)
+		tqe->tx_complete_func(tqe->priv, tqe->status);
+	if (tqe->ack_idx != NOT_TCP_ACK && tqe->ack_idx < MAX_PENDING_ACKS)
+		tqe->vif->ack_filter.pending_acks[tqe->ack_idx].txqe = NULL;
+	kfree(tqe);
+}
+
 static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 {
 	struct wilc_vif *vif = netdev_priv(dev);
@@ -220,11 +230,7 @@ static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 			tqe = f->pending_acks[i].txqe;
 			if (tqe) {
 				wilc_wlan_txq_remove(wilc, tqe->q_num, tqe);
-				tqe->status = 1;
-				if (tqe->tx_complete_func)
-					tqe->tx_complete_func(tqe->priv,
-							      tqe->status);
-				kfree(tqe);
+				wilc_wlan_tx_packet_done(tqe, 1);
 			}
 		}
 	}
@@ -911,13 +917,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 		       tqe->buffer, tqe->buffer_size);
 		offset += vmm_sz;
 		i++;
-		tqe->status = 1;
-		if (tqe->tx_complete_func)
-			tqe->tx_complete_func(tqe->priv, tqe->status);
-		if (tqe->ack_idx != NOT_TCP_ACK &&
-		    tqe->ack_idx < MAX_PENDING_ACKS)
-			vif->ack_filter.pending_acks[tqe->ack_idx].txqe = NULL;
-		kfree(tqe);
+		wilc_wlan_tx_packet_done(tqe, 1);
 	} while (--entries);
 	for (i = 0; i < NQUEUES; i++)
 		wilc->fw[i].count += ac_pkt_num_to_chip[i];
@@ -1236,11 +1236,8 @@ void wilc_wlan_cleanup(struct net_device *dev)
 
 	wilc->quit = 1;
 	for (ac = 0; ac < NQUEUES; ac++) {
-		while ((tqe = wilc_wlan_txq_remove_from_head(wilc, ac))) {
-			if (tqe->tx_complete_func)
-				tqe->tx_complete_func(tqe->priv, 0);
-			kfree(tqe);
-		}
+		while ((tqe = wilc_wlan_txq_remove_from_head(wilc, ac)))
+			wilc_wlan_tx_packet_done(tqe, 0);
 	}
 
 	while ((rqe = wilc_wlan_rxq_remove(wilc)))
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 04/23] wilc1000: factor common code in wilc_wlan_cfg_set() and wilc_wlan_cfg_get()
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (5 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 06/23] wilc1000: move tx packet drop code into its own function David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 19/23] wilc1000: don't tell the chip to go to sleep while copying tx packets David Mosberger-Tang
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

The functions are almost identical, so factor the common code into new
function wilc_wlan_cfg_apply_wid().  No functional change.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 .../net/wireless/microchip/wilc1000/wlan.c    | 65 ++++++++-----------
 1 file changed, 27 insertions(+), 38 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 2d103131b2e93..1c487342c1a88 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -1276,8 +1276,14 @@ static int wilc_wlan_cfg_commit(struct wilc_vif *vif, int type,
 	return 0;
 }
 
-int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer,
-		      u32 buffer_size, int commit, u32 drv_handler)
+/**
+ * Add a WID set/query to the current config packet and optionally
+ * submit the resulting packet to the chip and wait for its reply.
+ * Returns 0 on failure, positive number on success.
+ */
+static int wilc_wlan_cfg_apply_wid(struct wilc_vif *vif, int start, u16 wid,
+				   u8 *buffer, u32 buffer_size, int commit,
+				   u32 drv_handler, bool set)
 {
 	u32 offset;
 	int ret_size;
@@ -1289,8 +1295,12 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer,
 		wilc->cfg_frame_offset = 0;
 
 	offset = wilc->cfg_frame_offset;
-	ret_size = wilc_wlan_cfg_set_wid(wilc->cfg_frame.frame, offset,
-					 wid, buffer, buffer_size);
+	if (set)
+		ret_size = wilc_wlan_cfg_set_wid(wilc->cfg_frame.frame, offset,
+						 wid, buffer, buffer_size);
+	else
+		ret_size = wilc_wlan_cfg_get_wid(wilc->cfg_frame.frame, offset,
+						 wid);
 	offset += ret_size;
 	wilc->cfg_frame_offset = offset;
 
@@ -1299,9 +1309,11 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer,
 		return ret_size;
 	}
 
-	netdev_dbg(vif->ndev, "%s: seqno[%d]\n", __func__, wilc->cfg_seq_no);
+	netdev_dbg(vif->ndev, "%s: %s seqno[%d]\n",
+		   __func__, set ? "set" : "get", wilc->cfg_seq_no);
 
-	if (wilc_wlan_cfg_commit(vif, WILC_CFG_SET, drv_handler))
+	if (wilc_wlan_cfg_commit(vif, set ? WILC_CFG_SET : WILC_CFG_QUERY,
+				 drv_handler))
 		ret_size = 0;
 
 	if (!wait_for_completion_timeout(&wilc->cfg_event,
@@ -1317,41 +1329,18 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer,
 	return ret_size;
 }
 
+int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer,
+		      u32 buffer_size, int commit, u32 drv_handler)
+{
+	return wilc_wlan_cfg_apply_wid(vif, start, wid, buffer, buffer_size,
+				       commit, drv_handler, true);
+}
+
 int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit,
 		      u32 drv_handler)
 {
-	u32 offset;
-	int ret_size;
-	struct wilc *wilc = vif->wilc;
-
-	mutex_lock(&wilc->cfg_cmd_lock);
-
-	if (start)
-		wilc->cfg_frame_offset = 0;
-
-	offset = wilc->cfg_frame_offset;
-	ret_size = wilc_wlan_cfg_get_wid(wilc->cfg_frame.frame, offset, wid);
-	offset += ret_size;
-	wilc->cfg_frame_offset = offset;
-
-	if (!commit) {
-		mutex_unlock(&wilc->cfg_cmd_lock);
-		return ret_size;
-	}
-
-	if (wilc_wlan_cfg_commit(vif, WILC_CFG_QUERY, drv_handler))
-		ret_size = 0;
-
-	if (!wait_for_completion_timeout(&wilc->cfg_event,
-					 WILC_CFG_PKTS_TIMEOUT)) {
-		netdev_dbg(vif->ndev, "%s: Timed Out\n", __func__);
-		ret_size = 0;
-	}
-	wilc->cfg_frame_offset = 0;
-	wilc->cfg_seq_no += 1;
-	mutex_unlock(&wilc->cfg_cmd_lock);
-
-	return ret_size;
+	return wilc_wlan_cfg_apply_wid(vif, start, wid, NULL, 0,
+				       commit, drv_handler, false);
 }
 
 int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 02/23] wilc1000: switch txq_event from completion to waitqueue
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 03/23] wilc1000: move receive-queue stats from txq to wilc structure David Mosberger-Tang
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

Completion structs are essentially counting semaphores: every
complete() call wakes up exactly one thread, either immediately (when
there are waiters queued) or in the future (when a waiter arrives).
This isn't really the appropriate synchronization structure for the
wilc1000 transmit queue handler (wilc_wlan_handle_txq) because it will
consume zero, one, or more packets on each call.  Instead, use a
waitqueue as a condition variable: wake_up_interruptible() wakes up
the tx queue handler from a call to wait_event_interruptible()
whenever something interesting happens and it then takes the
appropriate action.  This has a couple of benefits:

 - Since the transmit queue handler often transfers multiple packets
   to the chip on each call, repeated calls to wait_for_completion()
   when there is no actual work to do are avoided.

 - When the transmit queue handler cannot transfer any packets at all,
   it'll simply give up the current time slice and then tries again.
   Previously, the transmit would stall until a new packet showed up
   (which potentially could cause extended stalls).  It would be even
   better to wait for a "tx queue not full" interrupt but, sadly, I'm
   told the wilc1000 firmware doesn't provide that.

 - There is no longer any need for wilc_wlan_txq_filter_dup_tcp_ack()
   to adjust the completion structs wait count by calling
   wait_for_completion_timeout() for each dropped packet.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/cfg80211.c |  2 +-
 drivers/net/wireless/microchip/wilc1000/netdev.c   | 13 +++++++++----
 drivers/net/wireless/microchip/wilc1000/netdev.h   |  2 +-
 drivers/net/wireless/microchip/wilc1000/wlan.c     | 12 ++----------
 4 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
index 8d8378bafd9b0..be387a8abb6af 100644
--- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c
+++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
@@ -1692,7 +1692,7 @@ static void wlan_init_locks(struct wilc *wl)
 	spin_lock_init(&wl->txq_spinlock);
 	mutex_init(&wl->txq_add_to_head_cs);
 
-	init_completion(&wl->txq_event);
+	init_waitqueue_head(&wl->txq_event);
 	init_completion(&wl->cfg_event);
 	init_completion(&wl->sync_event);
 	init_completion(&wl->txq_thread_started);
diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c
index 03e3485d7e7fa..4dd7c8137c204 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.c
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.c
@@ -144,10 +144,12 @@ static int wilc_txq_task(void *vp)
 	int ret;
 	u32 txq_count;
 	struct wilc *wl = vp;
+	long timeout;
 
 	complete(&wl->txq_thread_started);
 	while (1) {
-		wait_for_completion(&wl->txq_event);
+		wait_event_interruptible(wl->txq_event,
+					 (wl->txq_entries > 0 || wl->close));
 
 		if (wl->close) {
 			complete(&wl->txq_thread_started);
@@ -170,6 +172,11 @@ static int wilc_txq_task(void *vp)
 				}
 				srcu_read_unlock(&wl->srcu, srcu_idx);
 			}
+			if (ret == WILC_VMM_ENTRY_FULL_RETRY) {
+				timeout = msecs_to_jiffies(1);
+				set_current_state(TASK_INTERRUPTIBLE);
+				schedule_timeout(timeout);
+			}
 		} while (ret == WILC_VMM_ENTRY_FULL_RETRY && !wl->close);
 	}
 	return 0;
@@ -419,12 +426,11 @@ static void wlan_deinitialize_threads(struct net_device *dev)
 
 	wl->close = 1;
 
-	complete(&wl->txq_event);
-
 	if (wl->txq_thread) {
 		kthread_stop(wl->txq_thread);
 		wl->txq_thread = NULL;
 	}
+	wake_up_interruptible(&wl->txq_event);
 }
 
 static void wilc_wlan_deinitialize(struct net_device *dev)
@@ -446,7 +452,6 @@ static void wilc_wlan_deinitialize(struct net_device *dev)
 			wl->hif_func->disable_interrupt(wl);
 			mutex_unlock(&wl->hif_cs);
 		}
-		complete(&wl->txq_event);
 
 		wlan_deinitialize_threads(dev);
 		deinit_irq(dev);
diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h
index fd0cb01e538a2..65cf296a8689e 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.h
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.h
@@ -235,7 +235,7 @@ struct wilc {
 
 	struct completion cfg_event;
 	struct completion sync_event;
-	struct completion txq_event;
+	wait_queue_head_t txq_event;
 	struct completion txq_thread_started;
 
 	struct task_struct *txq_thread;
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 721e6131125e8..fafeabe2537a3 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -75,7 +75,7 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, u8 q_num,
 
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 
-	complete(&wilc->txq_event);
+	wake_up_interruptible(&wilc->txq_event);
 }
 
 static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, u8 q_num,
@@ -94,7 +94,7 @@ static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, u8 q_num,
 
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 	mutex_unlock(&wilc->txq_add_to_head_cs);
-	complete(&wilc->txq_event);
+	wake_up_interruptible(&wilc->txq_event);
 }
 
 #define NOT_TCP_ACK			(-1)
@@ -196,7 +196,6 @@ static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 	struct wilc *wilc = vif->wilc;
 	struct tcp_ack_filter *f = &vif->ack_filter;
 	u32 i = 0;
-	u32 dropped = 0;
 	unsigned long flags;
 
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
@@ -226,7 +225,6 @@ static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 					tqe->tx_complete_func(tqe->priv,
 							      tqe->status);
 				kfree(tqe);
-				dropped++;
 			}
 		}
 	}
@@ -239,12 +237,6 @@ static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 		f->pending_base = 0;
 
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
-
-	while (dropped > 0) {
-		wait_for_completion_timeout(&wilc->txq_event,
-					    msecs_to_jiffies(1));
-		dropped--;
-	}
 }
 
 void wilc_enable_tcp_ack_filter(struct wilc_vif *vif, bool value)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 06/23] wilc1000: move tx packet drop code into its own function
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (4 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 07/23] wilc1000: increment tx_dropped stat counter on tx packet drop David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 04/23] wilc1000: factor common code in wilc_wlan_cfg_set() and wilc_wlan_cfg_get() David Mosberger-Tang
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

This is just to improve code clarity.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index caaa03c8e5df8..a9bfd71b0e667 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -200,6 +200,14 @@ static void wilc_wlan_tx_packet_done(struct txq_entry_t *tqe, int status)
 	kfree(tqe);
 }
 
+static void wilc_wlan_txq_drop_net_pkt(struct txq_entry_t *tqe)
+{
+	struct wilc *wilc = tqe->vif->wilc;
+
+	wilc_wlan_txq_remove(wilc, tqe->q_num, tqe);
+	wilc_wlan_tx_packet_done(tqe, 1);
+}
+
 static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 {
 	struct wilc_vif *vif = netdev_priv(dev);
@@ -228,10 +236,8 @@ static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 			struct txq_entry_t *tqe;
 
 			tqe = f->pending_acks[i].txqe;
-			if (tqe) {
-				wilc_wlan_txq_remove(wilc, tqe->q_num, tqe);
-				wilc_wlan_tx_packet_done(tqe, 1);
-			}
+			if (tqe)
+				wilc_wlan_txq_drop_net_pkt(tqe);
 		}
 	}
 	f->pending_acks_idx = 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 07/23] wilc1000: increment tx_dropped stat counter on tx packet drop
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (3 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 05/23] wilc1000: add wilc_wlan_tx_packet_done() function David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 06/23] wilc1000: move tx packet drop code into its own function David Mosberger-Tang
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

Packet drops are important events so we should remember to count them.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index a9bfd71b0e667..b85ceda8409e6 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -202,7 +202,10 @@ static void wilc_wlan_tx_packet_done(struct txq_entry_t *tqe, int status)
 
 static void wilc_wlan_txq_drop_net_pkt(struct txq_entry_t *tqe)
 {
-	struct wilc *wilc = tqe->vif->wilc;
+	struct wilc_vif *vif = tqe->vif;
+	struct wilc *wilc = vif->wilc;
+
+	vif->ndev->stats.tx_dropped++;
 
 	wilc_wlan_txq_remove(wilc, tqe->q_num, tqe);
 	wilc_wlan_tx_packet_done(tqe, 1);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 13/23] wilc1000: sanitize config packet sequence number management a bit
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (16 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 23/23] wilc1000: introduce symbolic names for two tx-related control bits David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 12/23] wilc1000: refactor wilc_wlan_cfg_commit() " David Mosberger-Tang
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

Always keep the config packet sequence number in the valid range from
0..255.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 8cd2ede8d2775..6484e4ab8e159 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -1275,10 +1275,9 @@ static int wilc_wlan_cfg_commit(struct wilc_vif *vif, int type,
 
 	hdr = &cfg->hdr;
 	hdr->cmd_type = (type == WILC_CFG_SET) ? 'W' : 'Q';
-	hdr->seq_no = wilc->cfg_seq_no % 256;
+	hdr->seq_no = wilc->cfg_seq_no;
 	hdr->total_len = cpu_to_le16(t_len);
 	hdr->driver_handler = cpu_to_le32(drv_handler);
-	wilc->cfg_seq_no = cfg->hdr.seq_no;
 
 	if (!wilc_wlan_txq_add_cfg_pkt(vif, (u8 *)&cfg->hdr, t_len))
 		return -1;
@@ -1333,7 +1332,7 @@ static int wilc_wlan_cfg_apply_wid(struct wilc_vif *vif, int start, u16 wid,
 	}
 
 	wilc->cfg_frame_offset = 0;
-	wilc->cfg_seq_no += 1;
+	wilc->cfg_seq_no = (wilc->cfg_seq_no + 1) % 256;
 	mutex_unlock(&wilc->cfg_cmd_lock);
 
 	return ret_size;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 08/23] wilc1000: fix management packet type inconsistency
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (18 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 12/23] wilc1000: refactor wilc_wlan_cfg_commit() " David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 10/23] wilc1000: factor initialization of tx queue-specific packet fields David Mosberger-Tang
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

The queue type for management packets was initialized to AC_BE_Q
(best-effort queue) but the packet was then actually added to the
AC_VO_Q queue (voice, or highest-priority queue).  This fixes the
inconsistency by setting the type to AC_VO_Q.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index b85ceda8409e6..c72eb4244508c 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -507,7 +507,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
 	tqe->buffer_size = buffer_size;
 	tqe->tx_complete_func = tx_complete_fn;
 	tqe->priv = priv;
-	tqe->q_num = AC_BE_Q;
+	tqe->q_num = AC_VO_Q;
 	tqe->ack_idx = NOT_TCP_ACK;
 	tqe->vif = vif;
 	wilc_wlan_txq_add_to_tail(dev, AC_VO_Q, tqe);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 09/23] wilc1000: prepare wilc_wlan_tx_packet_done() for sk_buff changes
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (14 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 14/23] wilc1000: if there is no tx packet, don't increment packets-sent counter David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 23/23] wilc1000: introduce symbolic names for two tx-related control bits David Mosberger-Tang
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

This patch just adds some helper variables.  I suppose they improve
readability, but the real reason for this patch is to make the
forthcoming sk_buff rework patch shorter and more obvious.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index c72eb4244508c..eeb9961adfa34 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -192,11 +192,14 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 
 static void wilc_wlan_tx_packet_done(struct txq_entry_t *tqe, int status)
 {
+	struct wilc_vif *vif = tqe->vif;
+	int ack_idx = tqe->ack_idx;
+
 	tqe->status = status;
 	if (tqe->tx_complete_func)
 		tqe->tx_complete_func(tqe->priv, tqe->status);
-	if (tqe->ack_idx != NOT_TCP_ACK && tqe->ack_idx < MAX_PENDING_ACKS)
-		tqe->vif->ack_filter.pending_acks[tqe->ack_idx].txqe = NULL;
+	if (ack_idx != NOT_TCP_ACK && ack_idx < MAX_PENDING_ACKS)
+		vif->ack_filter.pending_acks[ack_idx].txqe = NULL;
 	kfree(tqe);
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 11/23] wilc1000: convert tqx_entries from "int" to "atomic_t"
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (7 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 19/23] wilc1000: don't tell the chip to go to sleep while copying tx packets David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 17/23] wilc1000: remove no longer used "vif" argument from init_txq_entry() David Mosberger-Tang
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

This is in preparation of converting the tx queue to struct sk_buffs
entries.  atomic_t isn't necessary for the current code, but it is a
safe change.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/netdev.c |  3 ++-
 drivers/net/wireless/microchip/wilc1000/netdev.h |  2 +-
 drivers/net/wireless/microchip/wilc1000/wlan.c   | 12 ++++++------
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c
index 4dd7c8137c204..3b9f5d3e65998 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.c
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.c
@@ -149,7 +149,8 @@ static int wilc_txq_task(void *vp)
 	complete(&wl->txq_thread_started);
 	while (1) {
 		wait_event_interruptible(wl->txq_event,
-					 (wl->txq_entries > 0 || wl->close));
+					 (atomic_read(&wl->txq_entries) > 0 ||
+					  wl->close));
 
 		if (wl->close) {
 			complete(&wl->txq_thread_started);
diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h
index ce79bdcc28000..d51095ac54730 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.h
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.h
@@ -253,7 +253,7 @@ struct wilc {
 	u8 *tx_buffer;
 
 	struct txq_handle txq[NQUEUES];
-	int txq_entries;
+	atomic_t txq_entries;
 	struct txq_fw_recv_queue_stat fw[NQUEUES];
 
 	struct wilc_tx_queue_status tx_q_limit;
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index dd669f9ea88a8..8435e1abdd515 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -41,7 +41,7 @@ static void wilc_wlan_txq_remove(struct wilc *wilc, u8 q_num,
 				 struct txq_entry_t *tqe)
 {
 	list_del(&tqe->list);
-	wilc->txq_entries -= 1;
+	atomic_dec(&wilc->txq_entries);
 	wilc->txq[q_num].count--;
 }
 
@@ -57,7 +57,7 @@ wilc_wlan_txq_remove_from_head(struct wilc *wilc, u8 q_num)
 		tqe = list_first_entry(&wilc->txq[q_num].txq_head.list,
 				       struct txq_entry_t, list);
 		list_del(&tqe->list);
-		wilc->txq_entries -= 1;
+		atomic_dec(&wilc->txq_entries);
 		wilc->txq[q_num].count--;
 	}
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
@@ -87,7 +87,7 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, u8 type, u8 q_num,
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
 
 	list_add_tail(&tqe->list, &wilc->txq[q_num].txq_head.list);
-	wilc->txq_entries += 1;
+	atomic_inc(&wilc->txq_entries);
 	wilc->txq[q_num].count++;
 
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
@@ -108,7 +108,7 @@ static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, u8 type, u8 q_num,
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
 
 	list_add(&tqe->list, &wilc->txq[q_num].txq_head.list);
-	wilc->txq_entries += 1;
+	atomic_inc(&wilc->txq_entries);
 	wilc->txq[q_num].count++;
 
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
@@ -484,7 +484,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev,
 		kfree(tqe);
 	}
 
-	return wilc->txq_entries;
+	return atomic_read(&wilc->txq_entries);
 }
 
 int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
@@ -952,7 +952,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 	mutex_unlock(&wilc->txq_add_to_head_cs);
 
 out_update_cnt:
-	*txq_count = wilc->txq_entries;
+	*txq_count = atomic_read(&wilc->txq_entries);
 	return ret;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 15/23] wilc1000: Add struct wilc_skb_tx_cb as an alias of struct txq_entry_t
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (21 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 20/23] wilc1000: eliminate "max_size_over" variable in fill_vmm_table David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

This is in preparation of the next patch, which removes struct
wilc_skb_tx_cb in favor of struct sk_buffs.  That change requires
moving the driver-private state for tx packets from struct txq_entry_t
to the "control buffer" (cb field) of struct sk_buff.  Making that
move now makes the next patch a bit smaller and easier to understand.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 .../net/wireless/microchip/wilc1000/wlan.c    | 36 +++++++++++--------
 .../net/wireless/microchip/wilc1000/wlan.h    |  7 ++++
 2 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 8e8f0e1de7c4c..5aa7bcf82054f 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -67,10 +67,12 @@ wilc_wlan_txq_remove_from_head(struct wilc *wilc, u8 q_num)
 static void init_txq_entry(struct txq_entry_t *tqe, struct wilc_vif *vif,
 			   u8 type, enum ip_pkt_priority q_num)
 {
+	struct wilc_skb_tx_cb *tx_cb = WILC_SKB_TX_CB(tqe);
+
 	tqe->vif = vif;
-	tqe->q_num = q_num;
-	tqe->type = type;
-	tqe->ack_idx = NOT_TCP_ACK;
+	tx_cb->type = type;
+	tx_cb->q_num = q_num;
+	tx_cb->ack_idx = NOT_TCP_ACK;
 }
 
 static void wilc_wlan_txq_add_to_tail(struct net_device *dev, u8 type, u8 q_num,
@@ -143,6 +145,7 @@ static inline void add_tcp_pending_ack(struct wilc_vif *vif, u32 ack,
 				       u32 session_index,
 				       struct txq_entry_t *txqe)
 {
+	struct wilc_skb_tx_cb *tx_cb = WILC_SKB_TX_CB(txqe);
 	struct tcp_ack_filter *f = &vif->ack_filter;
 	u32 i = f->pending_base + f->pending_acks_idx;
 
@@ -150,7 +153,7 @@ static inline void add_tcp_pending_ack(struct wilc_vif *vif, u32 ack,
 		f->pending_acks[i].ack_num = ack;
 		f->pending_acks[i].txqe = txqe;
 		f->pending_acks[i].session_index = session_index;
-		txqe->ack_idx = i;
+		tx_cb->ack_idx = i;
 		f->pending_acks_idx++;
 	}
 }
@@ -210,7 +213,8 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 static void wilc_wlan_tx_packet_done(struct txq_entry_t *tqe, int status)
 {
 	struct wilc_vif *vif = tqe->vif;
-	int ack_idx = tqe->ack_idx;
+	struct wilc_skb_tx_cb *tx_cb = WILC_SKB_TX_CB(tqe);
+	int ack_idx = tx_cb->ack_idx;
 
 	tqe->status = status;
 	if (tqe->tx_complete_func)
@@ -224,10 +228,11 @@ static void wilc_wlan_txq_drop_net_pkt(struct txq_entry_t *tqe)
 {
 	struct wilc_vif *vif = tqe->vif;
 	struct wilc *wilc = vif->wilc;
+	struct wilc_skb_tx_cb *tx_cb = WILC_SKB_TX_CB(tqe);
 
 	vif->ndev->stats.tx_dropped++;
 
-	wilc_wlan_txq_remove(wilc, tqe->q_num, tqe);
+	wilc_wlan_txq_remove(wilc, tx_cb->q_num, tqe);
 	wilc_wlan_tx_packet_done(tqe, 1);
 }
 
@@ -728,6 +733,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 	bool max_size_over = 0, ac_exist = 0;
 	int vmm_sz = 0;
 	struct txq_entry_t *tqe_q[NQUEUES];
+	struct wilc_skb_tx_cb *tx_cb;
 	int ret = 0;
 	int counter;
 	int timeout;
@@ -772,9 +778,10 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 					break;
 				}
 
-				if (tqe_q[ac]->type == WILC_CFG_PKT)
+				tx_cb = WILC_SKB_TX_CB(tqe_q[ac]);
+				if (tx_cb->type == WILC_CFG_PKT)
 					vmm_sz = ETH_CONFIG_PKT_HDR_OFFSET;
-				else if (tqe_q[ac]->type == WILC_NET_PKT)
+				else if (tx_cb->type == WILC_NET_PKT)
 					vmm_sz = ETH_ETHERNET_HDR_OFFSET;
 				else
 					vmm_sz = HOST_HDR_OFFSET;
@@ -787,7 +794,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 					break;
 				}
 				vmm_table[i] = vmm_sz / 4;
-				if (tqe_q[ac]->type == WILC_CFG_PKT)
+				if (tx_cb->type == WILC_CFG_PKT)
 					vmm_table[i] |= BIT(10);
 
 				cpu_to_le32s(&vmm_table[i]);
@@ -898,6 +905,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 
 		ac_pkt_num_to_chip[vmm_entries_ac[i]]++;
 		vif = tqe->vif;
+		tx_cb = WILC_SKB_TX_CB(tqe);
 		if (vmm_table[i] == 0)
 			break;
 
@@ -905,20 +913,20 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 		vmm_sz = FIELD_GET(WILC_VMM_BUFFER_SIZE, vmm_table[i]);
 		vmm_sz *= 4;
 
-		if (tqe->type == WILC_MGMT_PKT)
+		if (tx_cb->type == WILC_MGMT_PKT)
 			mgmt_ptk = 1;
 
-		header = (FIELD_PREP(WILC_VMM_HDR_TYPE, tqe->type) |
+		header = (FIELD_PREP(WILC_VMM_HDR_TYPE, tx_cb->type) |
 			  FIELD_PREP(WILC_VMM_HDR_MGMT_FIELD, mgmt_ptk) |
 			  FIELD_PREP(WILC_VMM_HDR_PKT_SIZE, tqe->buffer_size) |
 			  FIELD_PREP(WILC_VMM_HDR_BUFF_SIZE, vmm_sz));
 
 		cpu_to_le32s(&header);
 		memcpy(&txb[offset], &header, 4);
-		if (tqe->type == WILC_CFG_PKT) {
+		if (tx_cb->type == WILC_CFG_PKT) {
 			buffer_offset = ETH_CONFIG_PKT_HDR_OFFSET;
-		} else if (tqe->type == WILC_NET_PKT) {
-			int prio = tqe->q_num;
+		} else if (tx_cb->type == WILC_NET_PKT) {
+			int prio = tx_cb->q_num;
 
 			bssid = tqe->vif->bssid;
 			buffer_offset = ETH_ETHERNET_HDR_OFFSET;
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.h b/drivers/net/wireless/microchip/wilc1000/wlan.h
index 9b33262909e2f..295795a8060ac 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.h
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.h
@@ -333,6 +333,13 @@ struct txq_entry_t {
 	void (*tx_complete_func)(void *priv, int status);
 };
 
+#define wilc_skb_tx_cb	txq_entry_t
+
+static inline struct wilc_skb_tx_cb *WILC_SKB_TX_CB(struct txq_entry_t *tqe)
+{
+	return (struct wilc_skb_tx_cb *)tqe;
+}
+
 struct txq_fw_recv_queue_stat {
 	u8 acm;
 	u8 count;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 21/23] wilc1000: declare read-only ac_preserve_ratio as static and const
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (12 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 18/23] wilc1000: split huge tx handler into subfunctions David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 14/23] wilc1000: if there is no tx packet, don't increment packets-sent counter David Mosberger-Tang
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

Apart from being slightly more efficient, this makes the code easier
to follow.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 88a981b00bda2..debed2f159215 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -633,8 +633,8 @@ static int fill_vmm_table(const struct wilc *wilc,
 	int i;
 	u8 k, ac;
 	u32 sum;
-	u8 ac_preserve_ratio[NQUEUES] = {1, 1, 1, 1};
-	u8 *num_pkts_to_add;
+	static const u8 ac_preserve_ratio[NQUEUES] = {1, 1, 1, 1};
+	const u8 *num_pkts_to_add;
 	bool ac_exist = 0;
 	int vmm_sz = 0;
 	struct sk_buff *tqe_q[NQUEUES];
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 18/23] wilc1000: split huge tx handler into subfunctions
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (11 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 16/23] wilc1000: switch tx queue to normal sk_buff entries David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 21/23] wilc1000: declare read-only ac_preserve_ratio as static and const David Mosberger-Tang
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

This makes the code easier to read and less error prone.  There are no
functional changes in this patch.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 .../net/wireless/microchip/wilc1000/wlan.c    | 202 +++++++++++++-----
 1 file changed, 153 insertions(+), 49 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 286bbf9392165..b7c8ff95b646a 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -605,43 +605,40 @@ void host_sleep_notify(struct wilc *wilc)
 }
 EXPORT_SYMBOL_GPL(host_sleep_notify);
 
-int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
+/**
+ * Fill VMM table with packets waiting to be sent.  The packets are
+ * added based on access category (priority) but also balanced to
+ * provide fairness.  Since this function peeks at the packet queues,
+ * the txq_add_to_head_cs mutex must be acquired before calling this
+ * function.
+ *
+ * @wilc - Pointer to the wilc structure.
+ * @ac_desired_ratio: First-round limit on number of packets to add from the
+ *	respective queue.
+ * @vmm_table: Pointer to the VMM table to fill.
+ * @vmm_entries_ac: Pointer to the queue-number table to fill.
+ *	For each packet added to the VMM table, this will be filled in
+ *	with the queue-number (access-category) that the packet is coming
+ *	from.
+ *
+ * @return
+ *	The number of VMM entries filled in.  The table is 0-terminated
+ *	so the returned number is at most WILC_VMM_TBL_SIZE-1.
+ */
+static int fill_vmm_table(const struct wilc *wilc,
+			  u8 ac_desired_ratio[NQUEUES],
+			  u32 vmm_table[WILC_VMM_TBL_SIZE],
+			  u8 vmm_entries_ac[WILC_VMM_TBL_SIZE])
 {
-	int i, entries = 0;
+	int i;
 	u8 k, ac;
 	u32 sum;
-	u32 reg;
-	u8 ac_desired_ratio[NQUEUES] = {0, 0, 0, 0};
 	u8 ac_preserve_ratio[NQUEUES] = {1, 1, 1, 1};
 	u8 *num_pkts_to_add;
-	u8 vmm_entries_ac[WILC_VMM_TBL_SIZE];
-	u32 offset = 0;
 	bool max_size_over = 0, ac_exist = 0;
 	int vmm_sz = 0;
 	struct sk_buff *tqe_q[NQUEUES];
 	struct wilc_skb_tx_cb *tx_cb;
-	int ret = 0;
-	int counter;
-	int timeout;
-	u32 vmm_table[WILC_VMM_TBL_SIZE];
-	u8 ac_pkt_num_to_chip[NQUEUES] = {0, 0, 0, 0};
-	const struct wilc_hif_func *func;
-	int srcu_idx;
-	u8 *txb = wilc->tx_buffer;
-	struct wilc_vif *vif;
-
-	if (wilc->quit)
-		goto out_update_cnt;
-
-	if (ac_balance(wilc, ac_desired_ratio))
-		return -EINVAL;
-
-	mutex_lock(&wilc->txq_add_to_head_cs);
-
-	srcu_idx = srcu_read_lock(&wilc->srcu);
-	list_for_each_entry_rcu(vif, &wilc->vif_list, list)
-		wilc_wlan_txq_filter_dup_tcp_ack(vif->ndev);
-	srcu_read_unlock(&wilc->srcu, srcu_idx);
 
 	for (ac = 0; ac < NQUEUES; ac++)
 		tqe_q[ac] = skb_peek(&wilc->txq[ac]);
@@ -695,11 +692,28 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 		num_pkts_to_add = ac_preserve_ratio;
 	} while (!max_size_over && ac_exist);
 
-	if (i == 0)
-		goto out_unlock;
 	vmm_table[i] = 0x0;
+	return i;
+}
+
+/**
+ * Send the VMM table to the chip and get back the number of entries
+ * that the chip can accept.  The bus must have been acquired before
+ * calling this function.
+ *
+ * @wilc: Pointer to the wilc structure.
+ * @i: The number of entries in the VMM table.
+ * @vmm_table: The VMM table to send.
+ *
+ * @return
+ *	The number of VMM table entries the chip can accept.
+ */
+static int send_vmm_table(struct wilc *wilc, int i, const u32 *vmm_table)
+{
+	const struct wilc_hif_func *func;
+	int ret, counter, entries, timeout;
+	u32 reg;
 
-	acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
 	counter = 0;
 	func = wilc->hif_func;
 	do {
@@ -721,7 +735,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 	} while (!wilc->quit);
 
 	if (ret)
-		goto out_release_bus;
+		return ret;
 
 	timeout = 200;
 	do {
@@ -759,22 +773,36 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 				break;
 			reg &= ~BIT(0);
 			ret = func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg);
+		} else {
+			ret = entries;
 		}
 	} while (0);
+	return ret;
+}
 
-	if (ret)
-		goto out_release_bus;
-
-	if (entries == 0) {
-		/*
-		 * No VMM space available in firmware so retry to transmit
-		 * the packet from tx queue.
-		 */
-		ret = WILC_VMM_ENTRY_FULL_RETRY;
-		goto out_release_bus;
-	}
-
-	release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
+/**
+ * Copy a set of packets to the transmit buffer.  The
+ * txq_add_to_head_cs mutex must still be held when calling this
+ * function.
+ *
+ * @wilc - Pointer to the wilc structure.
+ * @entries: The number of packets to send from the VMM table.
+ * @vmm_table: The VMM table to send.
+ * @vmm_entries_ac: Table index i contains the number of the queue to
+ *	take the i-th packet from.
+ *
+ * @return
+ *	Negative number on error, 0 on success.
+ */
+static int copy_packets(struct wilc *wilc, int entries, u32 *vmm_table,
+			u8 *vmm_entries_ac)
+{
+	u8 ac_pkt_num_to_chip[NQUEUES] = {0, 0, 0, 0};
+	struct wilc_skb_tx_cb *tx_cb;
+	u8 *txb = wilc->tx_buffer;
+	struct wilc_vif *vif;
+	int i, vmm_sz;
+	u32 offset;
 
 	offset = 0;
 	i = 0;
@@ -829,16 +857,92 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 	} while (--entries);
 	for (i = 0; i < NQUEUES; i++)
 		wilc->fw[i].count += ac_pkt_num_to_chip[i];
+	return offset;
+}
 
-	acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
+/**
+ * Send the packets in the VMM table to the chip.  The bus must have
+ * been acquired.
+ *
+ * @wilc - Pointer to the wilc structure.
+ * @length: The length of the buffer containing the packets to be
+ *	sent to the chip.
+ *
+ * @return
+ *	Negative number on error, 0 on success.
+ */
+static int send_packets(struct wilc *wilc, int len)
+{
+	const struct wilc_hif_func *func = wilc->hif_func;
+	int ret;
+	u8 *txb = wilc->tx_buffer;
 
 	ret = func->hif_clear_int_ext(wilc, ENABLE_TX_VMM);
 	if (ret)
-		goto out_release_bus;
+		return ret;
+
+	ret = func->hif_block_tx_ext(wilc, 0, txb, len);
+	return ret;
+}
+
+int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
+{
+	int i, entries, len;
+	u8 ac;
+	u8 ac_desired_ratio[NQUEUES] = {0, 0, 0, 0};
+	u8 vmm_entries_ac[WILC_VMM_TBL_SIZE];
+	struct sk_buff *tqe_q[NQUEUES];
+	int ret = 0;
+	u32 vmm_table[WILC_VMM_TBL_SIZE];
+	int srcu_idx;
+	struct wilc_vif *vif;
+
+	if (wilc->quit)
+		goto out_update_cnt;
+
+	if (ac_balance(wilc, ac_desired_ratio))
+		return -EINVAL;
+
+	mutex_lock(&wilc->txq_add_to_head_cs);
+
+	srcu_idx = srcu_read_lock(&wilc->srcu);
+	list_for_each_entry_rcu(vif, &wilc->vif_list, list)
+		wilc_wlan_txq_filter_dup_tcp_ack(vif->ndev);
+	srcu_read_unlock(&wilc->srcu, srcu_idx);
+
+	for (ac = 0; ac < NQUEUES; ac++)
+		tqe_q[ac] = skb_peek(&wilc->txq[ac]);
+
+	i = fill_vmm_table(wilc, ac_desired_ratio, vmm_table, vmm_entries_ac);
+	if (i == 0)
+		goto out_unlock;
+
+	acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
+
+	ret = send_vmm_table(wilc, i, vmm_table);
+
+	release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
+
+	if (ret < 0)
+		goto out_unlock;
+
+	entries = ret;
+	if (entries == 0) {
+		/* No VMM space available in firmware.  Inform caller
+		 * to retry later.
+		 */
+		ret = WILC_VMM_ENTRY_FULL_RETRY;
+		goto out_unlock;
+	}
+
+	len = copy_packets(wilc, entries, vmm_table, vmm_entries_ac);
+	if (len <= 0)
+		goto out_unlock;
+
+	acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
 
-	ret = func->hif_block_tx_ext(wilc, 0, txb, offset);
+	ret = send_packets(wilc, len);
 
-out_release_bus:
 	release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
 
 out_unlock:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 14/23] wilc1000: if there is no tx packet, don't increment packets-sent counter
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (13 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 21/23] wilc1000: declare read-only ac_preserve_ratio as static and const David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 09/23] wilc1000: prepare wilc_wlan_tx_packet_done() for sk_buff changes David Mosberger-Tang
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

Granted, this case is mostly theoretical as the queue should never be
empty in this place, and hence tqe should never be NULL, but it's
still wrong to count a packet that doesn't exist.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 6484e4ab8e159..8e8f0e1de7c4c 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -893,10 +893,10 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 		u8 mgmt_ptk = 0;
 
 		tqe = wilc_wlan_txq_remove_from_head(wilc, vmm_entries_ac[i]);
-		ac_pkt_num_to_chip[vmm_entries_ac[i]]++;
 		if (!tqe)
 			break;
 
+		ac_pkt_num_to_chip[vmm_entries_ac[i]]++;
 		vif = tqe->vif;
 		if (vmm_table[i] == 0)
 			break;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 10/23] wilc1000: factor initialization of tx queue-specific packet fields
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (19 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 08/23] wilc1000: fix management packet type inconsistency David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 20/23] wilc1000: eliminate "max_size_over" variable in fill_vmm_table David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 15/23] wilc1000: Add struct wilc_skb_tx_cb as an alias of struct txq_entry_t David Mosberger-Tang
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

This ensures that the fields are initialized consistently for all
packets on the tx queues.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 .../net/wireless/microchip/wilc1000/wlan.c    | 45 ++++++++++---------
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index eeb9961adfa34..dd669f9ea88a8 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -12,8 +12,12 @@
 
 #define WAKE_UP_TRIAL_RETRY		10000
 
+#define NOT_TCP_ACK			(-1)
+
 static const u8 factors[NQUEUES] = {1, 1, 1, 1};
 
+static void tcp_process(struct net_device *, struct txq_entry_t *);
+
 static inline bool is_wilc1000(u32 id)
 {
 	return (id & (~WILC_CHIP_REV_FIELD)) == WILC_1000_BASE_ID;
@@ -60,13 +64,26 @@ wilc_wlan_txq_remove_from_head(struct wilc *wilc, u8 q_num)
 	return tqe;
 }
 
-static void wilc_wlan_txq_add_to_tail(struct net_device *dev, u8 q_num,
+static void init_txq_entry(struct txq_entry_t *tqe, struct wilc_vif *vif,
+			   u8 type, enum ip_pkt_priority q_num)
+{
+	tqe->vif = vif;
+	tqe->q_num = q_num;
+	tqe->type = type;
+	tqe->ack_idx = NOT_TCP_ACK;
+}
+
+static void wilc_wlan_txq_add_to_tail(struct net_device *dev, u8 type, u8 q_num,
 				      struct txq_entry_t *tqe)
 {
 	unsigned long flags;
 	struct wilc_vif *vif = netdev_priv(dev);
 	struct wilc *wilc = vif->wilc;
 
+	init_txq_entry(tqe, vif, type, q_num);
+	if (type == WILC_NET_PKT && vif->ack_filter.enabled)
+		tcp_process(dev, tqe);
+
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
 
 	list_add_tail(&tqe->list, &wilc->txq[q_num].txq_head.list);
@@ -78,12 +95,14 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, u8 q_num,
 	wake_up_interruptible(&wilc->txq_event);
 }
 
-static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, u8 q_num,
+static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, u8 type, u8 q_num,
 				      struct txq_entry_t *tqe)
 {
 	unsigned long flags;
 	struct wilc *wilc = vif->wilc;
 
+	init_txq_entry(tqe, vif, type, q_num);
+
 	mutex_lock(&wilc->txq_add_to_head_cs);
 
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
@@ -97,8 +116,6 @@ static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, u8 q_num,
 	wake_up_interruptible(&wilc->txq_event);
 }
 
-#define NOT_TCP_ACK			(-1)
-
 static inline void add_tcp_session(struct wilc_vif *vif, u32 src_prt,
 				   u32 dst_prt, u32 seq)
 {
@@ -281,16 +298,12 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer,
 		return 0;
 	}
 
-	tqe->type = WILC_CFG_PKT;
 	tqe->buffer = buffer;
 	tqe->buffer_size = buffer_size;
 	tqe->tx_complete_func = NULL;
 	tqe->priv = NULL;
-	tqe->q_num = AC_VO_Q;
-	tqe->ack_idx = NOT_TCP_ACK;
-	tqe->vif = vif;
 
-	wilc_wlan_txq_add_to_head(vif, AC_VO_Q, tqe);
+	wilc_wlan_txq_add_to_head(vif, WILC_CFG_PKT, AC_VO_Q, tqe);
 
 	return 1;
 }
@@ -452,15 +465,12 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev,
 		tx_complete_fn(tx_data, 0);
 		return 0;
 	}
-	tqe->type = WILC_NET_PKT;
 	tqe->buffer = buffer;
 	tqe->buffer_size = buffer_size;
 	tqe->tx_complete_func = tx_complete_fn;
 	tqe->priv = tx_data;
-	tqe->vif = vif;
 
 	q_num = ac_classify(wilc, tx_data->skb);
-	tqe->q_num = q_num;
 	if (ac_change(wilc, &q_num)) {
 		tx_complete_fn(tx_data, 0);
 		kfree(tqe);
@@ -468,10 +478,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev,
 	}
 
 	if (is_ac_q_limit(wilc, q_num)) {
-		tqe->ack_idx = NOT_TCP_ACK;
-		if (vif->ack_filter.enabled)
-			tcp_process(dev, tqe);
-		wilc_wlan_txq_add_to_tail(dev, q_num, tqe);
+		wilc_wlan_txq_add_to_tail(dev, WILC_NET_PKT, q_num, tqe);
 	} else {
 		tx_complete_fn(tx_data, 0);
 		kfree(tqe);
@@ -505,15 +512,11 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
 		tx_complete_fn(priv, 0);
 		return 0;
 	}
-	tqe->type = WILC_MGMT_PKT;
 	tqe->buffer = buffer;
 	tqe->buffer_size = buffer_size;
 	tqe->tx_complete_func = tx_complete_fn;
 	tqe->priv = priv;
-	tqe->q_num = AC_VO_Q;
-	tqe->ack_idx = NOT_TCP_ACK;
-	tqe->vif = vif;
-	wilc_wlan_txq_add_to_tail(dev, AC_VO_Q, tqe);
+	wilc_wlan_txq_add_to_tail(dev, WILC_MGMT_PKT, AC_VO_Q, tqe);
 	return 1;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 16/23] wilc1000: switch tx queue to normal sk_buff entries
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (10 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 22/23] wilc1000: minor syntax cleanup David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 18/23] wilc1000: split huge tx handler into subfunctions David Mosberger-Tang
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

Convert to the transmit path to use normal socket-buffer operations
rather than driver-specific structures and functions.

This ends up deleting a fair amount of code and otherwise mostly
consists of switching struct txq_entry_t to struct sk_buff.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 .../wireless/microchip/wilc1000/cfg80211.c    |  35 +--
 drivers/net/wireless/microchip/wilc1000/mon.c |  36 +--
 .../net/wireless/microchip/wilc1000/netdev.c  |  26 +-
 .../net/wireless/microchip/wilc1000/netdev.h  |   7 +-
 .../net/wireless/microchip/wilc1000/wlan.c    | 281 +++++++-----------
 .../net/wireless/microchip/wilc1000/wlan.h    |  50 +---
 6 files changed, 137 insertions(+), 298 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
index be387a8abb6af..d352b7dd03283 100644
--- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c
+++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
@@ -1038,14 +1038,6 @@ void wilc_wfi_p2p_rx(struct wilc_vif *vif, u8 *buff, u32 size)
 	cfg80211_rx_mgmt(&priv->wdev, freq, 0, buff, size, 0);
 }
 
-static void wilc_wfi_mgmt_tx_complete(void *priv, int status)
-{
-	struct wilc_p2p_mgmt_data *pv_data = priv;
-
-	kfree(pv_data->buff);
-	kfree(pv_data);
-}
-
 static void wilc_wfi_remain_on_channel_expired(void *data, u64 cookie)
 {
 	struct wilc_vif *vif = data;
@@ -1124,7 +1116,7 @@ static int mgmt_tx(struct wiphy *wiphy,
 	const u8 *buf = params->buf;
 	size_t len = params->len;
 	const struct ieee80211_mgmt *mgmt;
-	struct wilc_p2p_mgmt_data *mgmt_tx;
+	struct sk_buff *skb;
 	struct wilc_vif *vif = netdev_priv(wdev->netdev);
 	struct wilc_priv *priv = &vif->priv;
 	struct host_if_drv *wfi_drv = priv->hif_drv;
@@ -1141,20 +1133,11 @@ static int mgmt_tx(struct wiphy *wiphy,
 	if (!ieee80211_is_mgmt(mgmt->frame_control))
 		goto out;
 
-	mgmt_tx = kmalloc(sizeof(*mgmt_tx), GFP_KERNEL);
-	if (!mgmt_tx) {
-		ret = -ENOMEM;
-		goto out;
-	}
-
-	mgmt_tx->buff = kmemdup(buf, len, GFP_KERNEL);
-	if (!mgmt_tx->buff) {
-		ret = -ENOMEM;
-		kfree(mgmt_tx);
-		goto out;
-	}
+	skb = wilc_wlan_alloc_skb(vif, len);
+	if (!skb)
+		return -ENOMEM;
 
-	mgmt_tx->size = len;
+	skb_put_data(skb, buf, len);
 
 	if (ieee80211_is_probe_resp(mgmt->frame_control)) {
 		wilc_set_mac_chnl_num(vif, chan->hw_value);
@@ -1176,7 +1159,7 @@ static int mgmt_tx(struct wiphy *wiphy,
 		goto out_set_timeout;
 
 	vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_WFA, WLAN_OUI_TYPE_WFA_P2P,
-					    mgmt_tx->buff + ie_offset,
+					    skb->data + ie_offset,
 					    len - ie_offset);
 	if (!vendor_ie)
 		goto out_set_timeout;
@@ -1189,9 +1172,7 @@ static int mgmt_tx(struct wiphy *wiphy,
 
 out_txq_add_pkt:
 
-	wilc_wlan_txq_add_mgmt_pkt(wdev->netdev, mgmt_tx,
-				   mgmt_tx->buff, mgmt_tx->size,
-				   wilc_wfi_mgmt_tx_complete);
+	wilc_wlan_txq_add_mgmt_pkt(wdev->netdev, skb);
 
 out:
 
@@ -1732,7 +1713,7 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
 	wl->hif_func = ops;
 
 	for (i = 0; i < NQUEUES; i++)
-		INIT_LIST_HEAD(&wl->txq[i].txq_head.list);
+		skb_queue_head_init(&wl->txq[i]);
 
 	INIT_LIST_HEAD(&wl->rxq_head.list);
 	INIT_LIST_HEAD(&wl->vif_list);
diff --git a/drivers/net/wireless/microchip/wilc1000/mon.c b/drivers/net/wireless/microchip/wilc1000/mon.c
index 6bd63934c2d84..0b1c4f266cca5 100644
--- a/drivers/net/wireless/microchip/wilc1000/mon.c
+++ b/drivers/net/wireless/microchip/wilc1000/mon.c
@@ -95,45 +95,21 @@ void wilc_wfi_monitor_rx(struct net_device *mon_dev, u8 *buff, u32 size)
 	netif_rx(skb);
 }
 
-struct tx_complete_mon_data {
-	int size;
-	void *buff;
-};
-
-static void mgmt_tx_complete(void *priv, int status)
-{
-	struct tx_complete_mon_data *pv_data = priv;
-	/*
-	 * in case of fully hosting mode, the freeing will be done
-	 * in response to the cfg packet
-	 */
-	kfree(pv_data->buff);
-
-	kfree(pv_data);
-}
-
 static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)
 {
-	struct tx_complete_mon_data *mgmt_tx = NULL;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct sk_buff *skb;
 
 	if (!dev)
 		return -EFAULT;
 
 	netif_stop_queue(dev);
-	mgmt_tx = kmalloc(sizeof(*mgmt_tx), GFP_ATOMIC);
-	if (!mgmt_tx)
-		return -ENOMEM;
-
-	mgmt_tx->buff = kmemdup(buf, len, GFP_ATOMIC);
-	if (!mgmt_tx->buff) {
-		kfree(mgmt_tx);
+	skb = wilc_wlan_alloc_skb(vif, len);
+	if (!skb)
 		return -ENOMEM;
-	}
-
-	mgmt_tx->size = len;
+	skb_put_data(skb, buf, len);
 
-	wilc_wlan_txq_add_mgmt_pkt(dev, mgmt_tx, mgmt_tx->buff, mgmt_tx->size,
-				   mgmt_tx_complete);
+	wilc_wlan_txq_add_mgmt_pkt(dev, skb);
 
 	netif_wake_queue(dev);
 	return 0;
diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c
index 3b9f5d3e65998..a766687d6ef22 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.c
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.c
@@ -718,19 +718,10 @@ static void wilc_set_multicast_list(struct net_device *dev)
 		kfree(mc_list);
 }
 
-static void wilc_tx_complete(void *priv, int status)
-{
-	struct tx_complete_data *pv_data = priv;
-
-	dev_kfree_skb(pv_data->skb);
-	kfree(pv_data);
-}
-
 netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
 {
 	struct wilc_vif *vif = netdev_priv(ndev);
 	struct wilc *wilc = vif->wilc;
-	struct tx_complete_data *tx_data = NULL;
 	int queue_count;
 
 	if (skb->dev != ndev) {
@@ -738,22 +729,9 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
 		return NETDEV_TX_OK;
 	}
 
-	tx_data = kmalloc(sizeof(*tx_data), GFP_ATOMIC);
-	if (!tx_data) {
-		dev_kfree_skb(skb);
-		netif_wake_queue(ndev);
-		return NETDEV_TX_OK;
-	}
-
-	tx_data->buff = skb->data;
-	tx_data->size = skb->len;
-	tx_data->skb  = skb;
-
 	vif->netstats.tx_packets++;
-	vif->netstats.tx_bytes += tx_data->size;
-	queue_count = wilc_wlan_txq_add_net_pkt(ndev, tx_data,
-						tx_data->buff, tx_data->size,
-						wilc_tx_complete);
+	vif->netstats.tx_bytes += skb->len;
+	queue_count = wilc_wlan_txq_add_net_pkt(ndev, skb);
 
 	if (queue_count > FLOW_CONTROL_UPPER_THRESHOLD) {
 		int srcu_idx;
diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h
index d51095ac54730..6a135b4d7e3f0 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.h
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.h
@@ -163,7 +163,7 @@ struct ack_session_info {
 struct pending_acks {
 	u32 ack_num;
 	u32 session_index;
-	struct txq_entry_t  *txqe;
+	struct sk_buff *txqe;
 };
 
 struct tcp_ack_filter {
@@ -244,15 +244,14 @@ struct wilc {
 
 	/* lock to protect issue of wid command to firmware */
 	struct mutex cfg_cmd_lock;
-	struct wilc_cfg_frame cfg_frame;
-	u32 cfg_frame_offset;
+	struct sk_buff *cfg_skb;
 	u8 cfg_seq_no;
 
 	u8 *rx_buffer;
 	u32 rx_buffer_offset;
 	u8 *tx_buffer;
 
-	struct txq_handle txq[NQUEUES];
+	struct sk_buff_head txq[NQUEUES];
 	atomic_t txq_entries;
 	struct txq_fw_recv_queue_stat fw[NQUEUES];
 
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 5aa7bcf82054f..f895e4dd2e73f 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -16,7 +16,7 @@
 
 static const u8 factors[NQUEUES] = {1, 1, 1, 1};
 
-static void tcp_process(struct net_device *, struct txq_entry_t *);
+static void tcp_process(struct net_device *, struct sk_buff *);
 
 static inline bool is_wilc1000(u32 id)
 {
@@ -37,48 +37,19 @@ static inline void release_bus(struct wilc *wilc, enum bus_release release)
 	mutex_unlock(&wilc->hif_cs);
 }
 
-static void wilc_wlan_txq_remove(struct wilc *wilc, u8 q_num,
-				 struct txq_entry_t *tqe)
-{
-	list_del(&tqe->list);
-	atomic_dec(&wilc->txq_entries);
-	wilc->txq[q_num].count--;
-}
-
-static struct txq_entry_t *
-wilc_wlan_txq_remove_from_head(struct wilc *wilc, u8 q_num)
-{
-	struct txq_entry_t *tqe = NULL;
-	unsigned long flags;
-
-	spin_lock_irqsave(&wilc->txq_spinlock, flags);
-
-	if (!list_empty(&wilc->txq[q_num].txq_head.list)) {
-		tqe = list_first_entry(&wilc->txq[q_num].txq_head.list,
-				       struct txq_entry_t, list);
-		list_del(&tqe->list);
-		atomic_dec(&wilc->txq_entries);
-		wilc->txq[q_num].count--;
-	}
-	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
-	return tqe;
-}
-
-static void init_txq_entry(struct txq_entry_t *tqe, struct wilc_vif *vif,
+static void init_txq_entry(struct sk_buff *tqe, struct wilc_vif *vif,
 			   u8 type, enum ip_pkt_priority q_num)
 {
 	struct wilc_skb_tx_cb *tx_cb = WILC_SKB_TX_CB(tqe);
 
-	tqe->vif = vif;
 	tx_cb->type = type;
 	tx_cb->q_num = q_num;
 	tx_cb->ack_idx = NOT_TCP_ACK;
 }
 
 static void wilc_wlan_txq_add_to_tail(struct net_device *dev, u8 type, u8 q_num,
-				      struct txq_entry_t *tqe)
+				      struct sk_buff *tqe)
 {
-	unsigned long flags;
 	struct wilc_vif *vif = netdev_priv(dev);
 	struct wilc *wilc = vif->wilc;
 
@@ -86,34 +57,24 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, u8 type, u8 q_num,
 	if (type == WILC_NET_PKT && vif->ack_filter.enabled)
 		tcp_process(dev, tqe);
 
-	spin_lock_irqsave(&wilc->txq_spinlock, flags);
-
-	list_add_tail(&tqe->list, &wilc->txq[q_num].txq_head.list);
+	skb_queue_tail(&wilc->txq[q_num], tqe);
 	atomic_inc(&wilc->txq_entries);
-	wilc->txq[q_num].count++;
-
-	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 
 	wake_up_interruptible(&wilc->txq_event);
 }
 
 static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, u8 type, u8 q_num,
-				      struct txq_entry_t *tqe)
+				      struct sk_buff *tqe)
 {
-	unsigned long flags;
 	struct wilc *wilc = vif->wilc;
 
 	init_txq_entry(tqe, vif, type, q_num);
 
 	mutex_lock(&wilc->txq_add_to_head_cs);
 
-	spin_lock_irqsave(&wilc->txq_spinlock, flags);
-
-	list_add(&tqe->list, &wilc->txq[q_num].txq_head.list);
+	skb_queue_head(&wilc->txq[q_num], tqe);
 	atomic_inc(&wilc->txq_entries);
-	wilc->txq[q_num].count++;
 
-	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 	mutex_unlock(&wilc->txq_add_to_head_cs);
 	wake_up_interruptible(&wilc->txq_event);
 }
@@ -143,7 +104,7 @@ static inline void update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack)
 
 static inline void add_tcp_pending_ack(struct wilc_vif *vif, u32 ack,
 				       u32 session_index,
-				       struct txq_entry_t *txqe)
+				       struct sk_buff *txqe)
 {
 	struct wilc_skb_tx_cb *tx_cb = WILC_SKB_TX_CB(txqe);
 	struct tcp_ack_filter *f = &vif->ack_filter;
@@ -158,9 +119,9 @@ static inline void add_tcp_pending_ack(struct wilc_vif *vif, u32 ack,
 	}
 }
 
-static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
+static inline void tcp_process(struct net_device *dev, struct sk_buff *tqe)
 {
-	void *buffer = tqe->buffer;
+	void *buffer = tqe->data;
 	const struct ethhdr *eth_hdr_ptr = buffer;
 	int i;
 	unsigned long flags;
@@ -210,29 +171,30 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 }
 
-static void wilc_wlan_tx_packet_done(struct txq_entry_t *tqe, int status)
+static void wilc_wlan_tx_packet_done(struct sk_buff *tqe, int status)
 {
-	struct wilc_vif *vif = tqe->vif;
+	struct wilc_vif *vif = netdev_priv(tqe->dev);
 	struct wilc_skb_tx_cb *tx_cb = WILC_SKB_TX_CB(tqe);
 	int ack_idx = tx_cb->ack_idx;
 
-	tqe->status = status;
-	if (tqe->tx_complete_func)
-		tqe->tx_complete_func(tqe->priv, tqe->status);
 	if (ack_idx != NOT_TCP_ACK && ack_idx < MAX_PENDING_ACKS)
 		vif->ack_filter.pending_acks[ack_idx].txqe = NULL;
-	kfree(tqe);
+	if (status)
+		dev_consume_skb_any(tqe);
+	else
+		dev_kfree_skb_any(tqe);
 }
 
-static void wilc_wlan_txq_drop_net_pkt(struct txq_entry_t *tqe)
+static void wilc_wlan_txq_drop_net_pkt(struct sk_buff *tqe)
 {
-	struct wilc_vif *vif = tqe->vif;
+	struct wilc_vif *vif = netdev_priv(tqe->dev);
 	struct wilc *wilc = vif->wilc;
 	struct wilc_skb_tx_cb *tx_cb = WILC_SKB_TX_CB(tqe);
 
 	vif->ndev->stats.tx_dropped++;
 
-	wilc_wlan_txq_remove(wilc, tx_cb->q_num, tqe);
+	skb_unlink(tqe, &wilc->txq[tx_cb->q_num]);
+	atomic_dec(&wilc->txq_entries);
 	wilc_wlan_tx_packet_done(tqe, 1);
 }
 
@@ -261,7 +223,7 @@ static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 		bigger_ack_num = f->ack_session_info[index].bigger_ack_num;
 
 		if (f->pending_acks[i].ack_num < bigger_ack_num) {
-			struct txq_entry_t *tqe;
+			struct sk_buff *tqe;
 
 			tqe = f->pending_acks[i].txqe;
 			if (tqe)
@@ -284,30 +246,17 @@ void wilc_enable_tcp_ack_filter(struct wilc_vif *vif, bool value)
 	vif->ack_filter.enabled = value;
 }
 
-static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer,
-				     u32 buffer_size)
+static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, struct sk_buff *tqe)
 {
-	struct txq_entry_t *tqe;
 	struct wilc *wilc = vif->wilc;
 
 	netdev_dbg(vif->ndev, "Adding config packet ...\n");
 	if (wilc->quit) {
 		netdev_dbg(vif->ndev, "Return due to clear function\n");
-		complete(&wilc->cfg_event);
-		return 0;
-	}
-
-	tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC);
-	if (!tqe) {
-		complete(&wilc->cfg_event);
+		dev_kfree_skb_any(tqe);
 		return 0;
 	}
 
-	tqe->buffer = buffer;
-	tqe->buffer_size = buffer_size;
-	tqe->tx_complete_func = NULL;
-	tqe->priv = NULL;
-
 	wilc_wlan_txq_add_to_head(vif, WILC_CFG_PKT, AC_VO_Q, tqe);
 
 	return 1;
@@ -354,7 +303,7 @@ static bool is_ac_q_limit(struct wilc *wl, u8 q_num)
 	else
 		q_limit = (q->cnt[q_num] * FLOW_CONTROL_UPPER_THRESHOLD / q->sum) + 1;
 
-	if (wl->txq[q_num].count <= q_limit)
+	if (skb_queue_len(&wl->txq[q_num]) <= q_limit)
 		ret = true;
 
 	spin_unlock_irqrestore(&wl->txq_spinlock, flags);
@@ -442,12 +391,8 @@ static inline u8 ac_change(struct wilc *wilc, u8 *ac)
 	return 1;
 }
 
-int wilc_wlan_txq_add_net_pkt(struct net_device *dev,
-			      struct tx_complete_data *tx_data, u8 *buffer,
-			      u32 buffer_size,
-			      void (*tx_complete_fn)(void *, int))
+int wilc_wlan_txq_add_net_pkt(struct net_device *dev, struct sk_buff *tqe)
 {
-	struct txq_entry_t *tqe;
 	struct wilc_vif *vif = netdev_priv(dev);
 	struct wilc *wilc;
 	u8 q_num;
@@ -455,109 +400,50 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev,
 	wilc = vif->wilc;
 
 	if (wilc->quit) {
-		tx_complete_fn(tx_data, 0);
+		dev_kfree_skb_any(tqe);
 		return 0;
 	}
 
 	if (!wilc->initialized) {
-		tx_complete_fn(tx_data, 0);
+		dev_kfree_skb_any(tqe);
 		return 0;
 	}
 
-	tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC);
-
-	if (!tqe) {
-		tx_complete_fn(tx_data, 0);
-		return 0;
-	}
-	tqe->buffer = buffer;
-	tqe->buffer_size = buffer_size;
-	tqe->tx_complete_func = tx_complete_fn;
-	tqe->priv = tx_data;
-
-	q_num = ac_classify(wilc, tx_data->skb);
+	q_num = ac_classify(wilc, tqe);
 	if (ac_change(wilc, &q_num)) {
-		tx_complete_fn(tx_data, 0);
-		kfree(tqe);
+		dev_kfree_skb_any(tqe);
 		return 0;
 	}
 
 	if (is_ac_q_limit(wilc, q_num)) {
 		wilc_wlan_txq_add_to_tail(dev, WILC_NET_PKT, q_num, tqe);
 	} else {
-		tx_complete_fn(tx_data, 0);
-		kfree(tqe);
+		dev_kfree_skb(tqe);
 	}
 
 	return atomic_read(&wilc->txq_entries);
 }
 
-int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
-			       u32 buffer_size,
-			       void (*tx_complete_fn)(void *, int))
+int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, struct sk_buff *tqe)
 {
-	struct txq_entry_t *tqe;
 	struct wilc_vif *vif = netdev_priv(dev);
 	struct wilc *wilc;
 
 	wilc = vif->wilc;
 
 	if (wilc->quit) {
-		tx_complete_fn(priv, 0);
+		dev_kfree_skb_any(tqe);
 		return 0;
 	}
 
 	if (!wilc->initialized) {
-		tx_complete_fn(priv, 0);
+		dev_kfree_skb_any(tqe);
 		return 0;
 	}
-	tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC);
-
-	if (!tqe) {
-		tx_complete_fn(priv, 0);
-		return 0;
-	}
-	tqe->buffer = buffer;
-	tqe->buffer_size = buffer_size;
-	tqe->tx_complete_func = tx_complete_fn;
-	tqe->priv = priv;
 	wilc_wlan_txq_add_to_tail(dev, WILC_MGMT_PKT, AC_VO_Q, tqe);
 	return 1;
 }
 
-static struct txq_entry_t *wilc_wlan_txq_get_first(struct wilc *wilc, u8 q_num)
-{
-	struct txq_entry_t *tqe = NULL;
-	unsigned long flags;
-
-	spin_lock_irqsave(&wilc->txq_spinlock, flags);
-
-	if (!list_empty(&wilc->txq[q_num].txq_head.list))
-		tqe = list_first_entry(&wilc->txq[q_num].txq_head.list,
-				       struct txq_entry_t, list);
-
-	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
-
-	return tqe;
-}
-
-static struct txq_entry_t *wilc_wlan_txq_get_next(struct wilc *wilc,
-						  struct txq_entry_t *tqe,
-						  u8 q_num)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&wilc->txq_spinlock, flags);
-
-	if (!list_is_last(&tqe->list, &wilc->txq[q_num].txq_head.list))
-		tqe = list_next_entry(tqe, list);
-	else
-		tqe = NULL;
-	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
-
-	return tqe;
-}
-
 static void wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe)
 {
 	if (wilc->quit)
@@ -732,7 +618,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 	u32 offset = 0;
 	bool max_size_over = 0, ac_exist = 0;
 	int vmm_sz = 0;
-	struct txq_entry_t *tqe_q[NQUEUES];
+	struct sk_buff *tqe_q[NQUEUES];
 	struct wilc_skb_tx_cb *tx_cb;
 	int ret = 0;
 	int counter;
@@ -758,7 +644,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 	srcu_read_unlock(&wilc->srcu, srcu_idx);
 
 	for (ac = 0; ac < NQUEUES; ac++)
-		tqe_q[ac] = wilc_wlan_txq_get_first(wilc, ac);
+		tqe_q[ac] = skb_peek(&wilc->txq[ac]);
 
 	i = 0;
 	sum = 0;
@@ -786,7 +672,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 				else
 					vmm_sz = HOST_HDR_OFFSET;
 
-				vmm_sz += tqe_q[ac]->buffer_size;
+				vmm_sz += tqe_q[ac]->len;
 				vmm_sz = ALIGN(vmm_sz, 4);
 
 				if ((sum + vmm_sz) > WILC_TX_BUFF_SIZE) {
@@ -802,9 +688,8 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 
 				i++;
 				sum += vmm_sz;
-				tqe_q[ac] = wilc_wlan_txq_get_next(wilc,
-								   tqe_q[ac],
-								   ac);
+				tqe_q[ac] = skb_peek_next(tqe_q[ac],
+							  &wilc->txq[ac]);
 			}
 		}
 		num_pkts_to_add = ac_preserve_ratio;
@@ -894,17 +779,18 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 	offset = 0;
 	i = 0;
 	do {
-		struct txq_entry_t *tqe;
+		struct sk_buff *tqe;
 		u32 header, buffer_offset;
 		char *bssid;
 		u8 mgmt_ptk = 0;
 
-		tqe = wilc_wlan_txq_remove_from_head(wilc, vmm_entries_ac[i]);
+		tqe = skb_dequeue(&wilc->txq[vmm_entries_ac[i]]);
 		if (!tqe)
 			break;
 
+		atomic_dec(&wilc->txq_entries);
 		ac_pkt_num_to_chip[vmm_entries_ac[i]]++;
-		vif = tqe->vif;
+		vif = netdev_priv(tqe->dev);
 		tx_cb = WILC_SKB_TX_CB(tqe);
 		if (vmm_table[i] == 0)
 			break;
@@ -918,7 +804,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 
 		header = (FIELD_PREP(WILC_VMM_HDR_TYPE, tx_cb->type) |
 			  FIELD_PREP(WILC_VMM_HDR_MGMT_FIELD, mgmt_ptk) |
-			  FIELD_PREP(WILC_VMM_HDR_PKT_SIZE, tqe->buffer_size) |
+			  FIELD_PREP(WILC_VMM_HDR_PKT_SIZE, tqe->len) |
 			  FIELD_PREP(WILC_VMM_HDR_BUFF_SIZE, vmm_sz));
 
 		cpu_to_le32s(&header);
@@ -928,7 +814,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 		} else if (tx_cb->type == WILC_NET_PKT) {
 			int prio = tx_cb->q_num;
 
-			bssid = tqe->vif->bssid;
+			bssid = vif->bssid;
 			buffer_offset = ETH_ETHERNET_HDR_OFFSET;
 			memcpy(&txb[offset + 4], &prio, sizeof(prio));
 			memcpy(&txb[offset + 8], bssid, 6);
@@ -936,8 +822,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 			buffer_offset = HOST_HDR_OFFSET;
 		}
 
-		memcpy(&txb[offset + buffer_offset],
-		       tqe->buffer, tqe->buffer_size);
+		memcpy(&txb[offset + buffer_offset], tqe->data, tqe->len);
 		offset += vmm_sz;
 		i++;
 		wilc_wlan_tx_packet_done(tqe, 1);
@@ -1251,7 +1136,7 @@ int wilc_wlan_stop(struct wilc *wilc, struct wilc_vif *vif)
 
 void wilc_wlan_cleanup(struct net_device *dev)
 {
-	struct txq_entry_t *tqe;
+	struct sk_buff *tqe, *cfg_skb;
 	struct rxq_entry_t *rqe;
 	u8 ac;
 	struct wilc_vif *vif = netdev_priv(dev);
@@ -1259,9 +1144,15 @@ void wilc_wlan_cleanup(struct net_device *dev)
 
 	wilc->quit = 1;
 	for (ac = 0; ac < NQUEUES; ac++) {
-		while ((tqe = wilc_wlan_txq_remove_from_head(wilc, ac)))
+		while ((tqe = skb_dequeue(&wilc->txq[ac])))
 			wilc_wlan_tx_packet_done(tqe, 0);
 	}
+	atomic_set(&wilc->txq_entries, 0);
+	cfg_skb = wilc->cfg_skb;
+	if (cfg_skb) {
+		wilc->cfg_skb = NULL;
+		dev_kfree_skb_any(cfg_skb);
+	}
 
 	while ((rqe = wilc_wlan_rxq_remove(wilc)))
 		kfree(rqe);
@@ -1273,21 +1164,52 @@ void wilc_wlan_cleanup(struct net_device *dev)
 	wilc->hif_func->hif_deinit(NULL);
 }
 
+struct sk_buff *wilc_wlan_alloc_skb(struct wilc_vif *vif, size_t len)
+{
+	size_t size, headroom;
+	struct sk_buff *skb;
+
+	headroom = vif->ndev->needed_headroom;
+	size = headroom + len + vif->ndev->needed_tailroom;
+	skb = netdev_alloc_skb(vif->ndev, size);
+	if (!skb) {
+		netdev_err(vif->ndev, "Failed to alloc skb");
+		return NULL;
+	}
+	skb_reserve(skb, headroom);
+	return skb;
+}
+
+static struct sk_buff *alloc_cfg_skb(struct wilc_vif *vif)
+{
+	struct sk_buff *skb;
+
+	skb = wilc_wlan_alloc_skb(vif, (sizeof(struct wilc_cfg_cmd_hdr)
+					+ WILC_MAX_CFG_FRAME_SIZE));
+	if (!skb)
+		return NULL;
+	skb_reserve(skb, sizeof(struct wilc_cfg_cmd_hdr));
+	return skb;
+}
+
 static int wilc_wlan_cfg_commit(struct wilc_vif *vif, int type,
 				u32 drv_handler)
 {
 	struct wilc *wilc = vif->wilc;
-	struct wilc_cfg_frame *cfg = &wilc->cfg_frame;
-	int t_len = wilc->cfg_frame_offset + sizeof(struct wilc_cfg_cmd_hdr);
 	struct wilc_cfg_cmd_hdr *hdr;
+	struct sk_buff *cfg_skb = wilc->cfg_skb;
 
-	hdr = &cfg->hdr;
+	hdr = skb_push(cfg_skb, sizeof(*hdr));
 	hdr->cmd_type = (type == WILC_CFG_SET) ? 'W' : 'Q';
 	hdr->seq_no = wilc->cfg_seq_no;
-	hdr->total_len = cpu_to_le16(t_len);
+	hdr->total_len = cpu_to_le16(cfg_skb->len);
 	hdr->driver_handler = cpu_to_le32(drv_handler);
+	/* We are about to pass ownership of cfg_skb to the tx queue
+	 * (or it'll be destroyed, in case the queue is full):
+	 */
+	wilc->cfg_skb = NULL;
 
-	if (!wilc_wlan_txq_add_cfg_pkt(vif, (u8 *)&cfg->hdr, t_len))
+	if (!wilc_wlan_txq_add_cfg_pkt(vif, cfg_skb))
 		return -1;
 
 	return 0;
@@ -1302,24 +1224,32 @@ static int wilc_wlan_cfg_apply_wid(struct wilc_vif *vif, int start, u16 wid,
 				   u8 *buffer, u32 buffer_size, int commit,
 				   u32 drv_handler, bool set)
 {
-	u32 offset;
 	int ret_size;
 	struct wilc *wilc = vif->wilc;
 
 	mutex_lock(&wilc->cfg_cmd_lock);
 
-	if (start)
-		wilc->cfg_frame_offset = 0;
+	if (start) {
+		WARN_ON(wilc->cfg_skb);
+		wilc->cfg_skb = alloc_cfg_skb(vif);
+		if (!wilc->cfg_skb) {
+			netdev_dbg(vif->ndev, "Failed to alloc cfg_skb");
+			mutex_unlock(&wilc->cfg_cmd_lock);
+			return 0;
+		}
+	}
 
-	offset = wilc->cfg_frame_offset;
 	if (set)
-		ret_size = wilc_wlan_cfg_set_wid(wilc->cfg_frame.frame, offset,
+		ret_size = wilc_wlan_cfg_set_wid(wilc->cfg_skb->tail, 0,
 						 wid, buffer, buffer_size);
 	else
-		ret_size = wilc_wlan_cfg_get_wid(wilc->cfg_frame.frame, offset,
-						 wid);
-	offset += ret_size;
-	wilc->cfg_frame_offset = offset;
+		ret_size = wilc_wlan_cfg_get_wid(wilc->cfg_skb->tail, 0, wid);
+	if (ret_size == 0)
+		netdev_dbg(vif->ndev,
+			   "Failed to add WID 0x%x to %s cfg packet\n",
+			   wid, set ? "set" : "query");
+
+	skb_put(wilc->cfg_skb, ret_size);
 
 	if (!commit) {
 		mutex_unlock(&wilc->cfg_cmd_lock);
@@ -1339,7 +1269,6 @@ static int wilc_wlan_cfg_apply_wid(struct wilc_vif *vif, int start, u16 wid,
 		ret_size = 0;
 	}
 
-	wilc->cfg_frame_offset = 0;
 	wilc->cfg_seq_no = (wilc->cfg_seq_no + 1) % 256;
 	mutex_unlock(&wilc->cfg_cmd_lock);
 
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.h b/drivers/net/wireless/microchip/wilc1000/wlan.h
index 295795a8060ac..10618327133ce 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.h
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.h
@@ -320,24 +320,19 @@ enum ip_pkt_priority {
 	AC_BK_Q = 3
 };
 
-struct txq_entry_t {
-	struct list_head list;
-	int type;
-	u8 q_num;
-	int ack_idx;
-	u8 *buffer;
-	int buffer_size;
-	void *priv;
-	int status;
-	struct wilc_vif *vif;
-	void (*tx_complete_func)(void *priv, int status);
+/* When queueing a tx packet, this info is stored in the sk_buff's
+ * control buffer (cb).
+ */
+struct wilc_skb_tx_cb {
+	u8 type;			/* one of WILC_*_PKT */
+	enum ip_pkt_priority q_num;	/* AC queue this packet is on */
+	int ack_idx;			/* TCP ack index */
 };
 
-#define wilc_skb_tx_cb	txq_entry_t
-
-static inline struct wilc_skb_tx_cb *WILC_SKB_TX_CB(struct txq_entry_t *tqe)
+static inline struct wilc_skb_tx_cb *WILC_SKB_TX_CB(struct sk_buff *skb)
 {
-	return (struct wilc_skb_tx_cb *)tqe;
+	BUILD_BUG_ON(sizeof(struct wilc_skb_tx_cb) > sizeof(skb->cb));
+	return (struct wilc_skb_tx_cb *)&skb->cb[0];
 }
 
 struct txq_fw_recv_queue_stat {
@@ -345,11 +340,6 @@ struct txq_fw_recv_queue_stat {
 	u8 count;
 };
 
-struct txq_handle {
-	struct txq_entry_t txq_head;
-	u16 count;
-};
-
 struct rxq_entry_t {
 	struct list_head list;
 	u8 *buffer;
@@ -382,12 +372,6 @@ struct wilc_hif_func {
 
 #define WILC_MAX_CFG_FRAME_SIZE		1468
 
-struct tx_complete_data {
-	int size;
-	void *buff;
-	struct sk_buff *skb;
-};
-
 struct wilc_cfg_cmd_hdr {
 	u8 cmd_type;
 	u8 seq_no;
@@ -395,11 +379,6 @@ struct wilc_cfg_cmd_hdr {
 	__le32 driver_handler;
 };
 
-struct wilc_cfg_frame {
-	struct wilc_cfg_cmd_hdr hdr;
-	u8 frame[WILC_MAX_CFG_FRAME_SIZE];
-};
-
 struct wilc_cfg_rsp {
 	u8 type;
 	u8 seq_no;
@@ -411,19 +390,16 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer,
 				u32 buffer_size);
 int wilc_wlan_start(struct wilc *wilc);
 int wilc_wlan_stop(struct wilc *wilc, struct wilc_vif *vif);
-int wilc_wlan_txq_add_net_pkt(struct net_device *dev,
-			      struct tx_complete_data *tx_data, u8 *buffer,
-			      u32 buffer_size,
-			      void (*tx_complete_fn)(void *, int));
+int wilc_wlan_txq_add_net_pkt(struct net_device *dev, struct sk_buff *skb);
 int wilc_wlan_handle_txq(struct wilc *wl, u32 *txq_count);
 void wilc_handle_isr(struct wilc *wilc);
+struct sk_buff *wilc_wlan_alloc_skb(struct wilc_vif *vif, size_t len);
 void wilc_wlan_cleanup(struct net_device *dev);
 int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer,
 		      u32 buffer_size, int commit, u32 drv_handler);
 int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit,
 		      u32 drv_handler);
-int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
-			       u32 buffer_size, void (*func)(void *, int));
+int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, struct sk_buff *skb);
 void wilc_enable_tcp_ack_filter(struct wilc_vif *vif, bool value);
 int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc);
 netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 22/23] wilc1000: minor syntax cleanup
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (9 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 17/23] wilc1000: remove no longer used "vif" argument from init_txq_entry() David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 16/23] wilc1000: switch tx queue to normal sk_buff entries David Mosberger-Tang
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

Remove extraneous parentheses and braces.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index debed2f159215..4ec23b2b2da05 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -653,10 +653,9 @@ static int fill_vmm_table(const struct wilc *wilc,
 				continue;
 
 			ac_exist = 1;
-			for (k = 0; (k < num_pkts_to_add[ac]) && tqe_q[ac]; k++) {
-				if (i >= (WILC_VMM_TBL_SIZE - 1)) {
+			for (k = 0; k < num_pkts_to_add[ac] && tqe_q[ac]; k++) {
+				if (i >= WILC_VMM_TBL_SIZE - 1)
 					goto out;
-				}
 
 				tx_cb = WILC_SKB_TX_CB(tqe_q[ac]);
 				if (tx_cb->type == WILC_CFG_PKT)
@@ -669,9 +668,8 @@ static int fill_vmm_table(const struct wilc *wilc,
 				vmm_sz += tqe_q[ac]->len;
 				vmm_sz = ALIGN(vmm_sz, 4);
 
-				if ((sum + vmm_sz) > WILC_TX_BUFF_SIZE) {
+				if (sum + vmm_sz > WILC_TX_BUFF_SIZE)
 					goto out;
-				}
 				vmm_table[i] = vmm_sz / 4;
 				if (tx_cb->type == WILC_CFG_PKT)
 					vmm_table[i] |= BIT(10);
@@ -735,10 +733,8 @@ static int send_vmm_table(struct wilc *wilc, int i, const u32 *vmm_table)
 
 	timeout = 200;
 	do {
-		ret = func->hif_block_tx(wilc,
-					 WILC_VMM_TBL_RX_SHADOW_BASE,
-					 (u8 *)vmm_table,
-					 ((i + 1) * 4));
+		ret = func->hif_block_tx(wilc, WILC_VMM_TBL_RX_SHADOW_BASE,
+					 (u8 *)vmm_table, (i + 1) * 4);
 		if (ret)
 			break;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 19/23] wilc1000: don't tell the chip to go to sleep while copying tx packets
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (6 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 04/23] wilc1000: factor common code in wilc_wlan_cfg_set() and wilc_wlan_cfg_get() David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 11/23] wilc1000: convert tqx_entries from "int" to "atomic_t" David Mosberger-Tang
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

Putting the chip to sleep and waking it up again is relatively slow,
so there is no point to put the chip to sleep for the short time it
takes to copy a couple of packets.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 .../net/wireless/microchip/wilc1000/wlan.c    | 24 +++++++++----------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index b7c8ff95b646a..8652ec9f6d9c8 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -920,29 +920,27 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 	acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
 
 	ret = send_vmm_table(wilc, i, vmm_table);
+	if (ret <= 0) {
+		if (ret == 0)
+			/* No VMM space available in firmware.  Inform
+			 * caller to retry later.
+			 */
+			ret = WILC_VMM_ENTRY_FULL_RETRY;
+		goto out_release_bus;
+	}
 
-	release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
-
-	if (ret < 0)
-		goto out_unlock;
+	release_bus(wilc, WILC_BUS_RELEASE_ONLY);
 
 	entries = ret;
-	if (entries == 0) {
-		/* No VMM space available in firmware.  Inform caller
-		 * to retry later.
-		 */
-		ret = WILC_VMM_ENTRY_FULL_RETRY;
-		goto out_unlock;
-	}
-
 	len = copy_packets(wilc, entries, vmm_table, vmm_entries_ac);
 	if (len <= 0)
 		goto out_unlock;
 
-	acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
+	acquire_bus(wilc, WILC_BUS_ACQUIRE_ONLY);
 
 	ret = send_packets(wilc, len);
 
+out_release_bus:
 	release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
 
 out_unlock:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 23/23] wilc1000: introduce symbolic names for two tx-related control bits
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (15 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 09/23] wilc1000: prepare wilc_wlan_tx_packet_done() for sk_buff changes David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 13/23] wilc1000: sanitize config packet sequence number management a bit David Mosberger-Tang
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

I wish these registers were documented so I wouldn't have to guess at
their meanings and make up my own names.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 6 +++---
 drivers/net/wireless/microchip/wilc1000/wlan.h | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 4ec23b2b2da05..b7a792edea187 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -672,7 +672,7 @@ static int fill_vmm_table(const struct wilc *wilc,
 					goto out;
 				vmm_table[i] = vmm_sz / 4;
 				if (tx_cb->type == WILC_CFG_PKT)
-					vmm_table[i] |= BIT(10);
+					vmm_table[i] |= WILC_VMM_CFG_PKT;
 
 				cpu_to_le32s(&vmm_table[i]);
 				vmm_entries_ac[i] = ac;
@@ -715,7 +715,7 @@ static int send_vmm_table(struct wilc *wilc, int i, const u32 *vmm_table)
 		if (ret)
 			break;
 
-		if ((reg & 0x1) == 0) {
+		if ((reg & WILC_HOST_TX_CTRL_BUSY) == 0) {
 			ac_update_fw_ac_pkt_info(wilc, reg);
 			break;
 		}
@@ -763,7 +763,7 @@ static int send_vmm_table(struct wilc *wilc, int i, const u32 *vmm_table)
 			ret = func->hif_read_reg(wilc, WILC_HOST_TX_CTRL, &reg);
 			if (ret)
 				break;
-			reg &= ~BIT(0);
+			reg &= ~WILC_HOST_TX_CTRL_BUSY;
 			ret = func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg);
 		} else {
 			ret = entries;
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.h b/drivers/net/wireless/microchip/wilc1000/wlan.h
index 10618327133ce..f5d32ec93fdb9 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.h
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.h
@@ -224,6 +224,7 @@
 #define BE_AC_ACM_STAT_FIELD		BIT(8)
 #define BK_AC_COUNT_FIELD		GENMASK(7, 3)
 #define BK_AC_ACM_STAT_FIELD		BIT(1)
+#define WILC_HOST_TX_CTRL_BUSY		BIT(0)
 
 #define WILC_PKT_HDR_CONFIG_FIELD	BIT(31)
 #define WILC_PKT_HDR_OFFSET_FIELD	GENMASK(30, 22)
@@ -233,6 +234,7 @@
 #define WILC_INTERRUPT_DATA_SIZE	GENMASK(14, 0)
 
 #define WILC_VMM_BUFFER_SIZE		GENMASK(9, 0)
+#define WILC_VMM_CFG_PKT		BIT(10)
 
 #define WILC_VMM_HDR_TYPE		BIT(31)
 #define WILC_VMM_HDR_MGMT_FIELD		BIT(30)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 20/23] wilc1000: eliminate "max_size_over" variable in fill_vmm_table
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (20 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 10/23] wilc1000: factor initialization of tx queue-specific packet fields David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 15/23] wilc1000: Add struct wilc_skb_tx_cb as an alias of struct txq_entry_t David Mosberger-Tang
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

This makes the code tighter and easier to understand.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 8652ec9f6d9c8..88a981b00bda2 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -635,7 +635,7 @@ static int fill_vmm_table(const struct wilc *wilc,
 	u32 sum;
 	u8 ac_preserve_ratio[NQUEUES] = {1, 1, 1, 1};
 	u8 *num_pkts_to_add;
-	bool max_size_over = 0, ac_exist = 0;
+	bool ac_exist = 0;
 	int vmm_sz = 0;
 	struct sk_buff *tqe_q[NQUEUES];
 	struct wilc_skb_tx_cb *tx_cb;
@@ -645,20 +645,17 @@ static int fill_vmm_table(const struct wilc *wilc,
 
 	i = 0;
 	sum = 0;
-	max_size_over = 0;
 	num_pkts_to_add = ac_desired_ratio;
 	do {
 		ac_exist = 0;
-		for (ac = 0; (ac < NQUEUES) && (!max_size_over); ac++) {
+		for (ac = 0; ac < NQUEUES; ac++) {
 			if (!tqe_q[ac])
 				continue;
 
 			ac_exist = 1;
-			for (k = 0; (k < num_pkts_to_add[ac]) &&
-			     (!max_size_over) && tqe_q[ac]; k++) {
+			for (k = 0; (k < num_pkts_to_add[ac]) && tqe_q[ac]; k++) {
 				if (i >= (WILC_VMM_TBL_SIZE - 1)) {
-					max_size_over = 1;
-					break;
+					goto out;
 				}
 
 				tx_cb = WILC_SKB_TX_CB(tqe_q[ac]);
@@ -673,8 +670,7 @@ static int fill_vmm_table(const struct wilc *wilc,
 				vmm_sz = ALIGN(vmm_sz, 4);
 
 				if ((sum + vmm_sz) > WILC_TX_BUFF_SIZE) {
-					max_size_over = 1;
-					break;
+					goto out;
 				}
 				vmm_table[i] = vmm_sz / 4;
 				if (tx_cb->type == WILC_CFG_PKT)
@@ -690,8 +686,8 @@ static int fill_vmm_table(const struct wilc *wilc,
 			}
 		}
 		num_pkts_to_add = ac_preserve_ratio;
-	} while (!max_size_over && ac_exist);
-
+	} while (ac_exist);
+out:
 	vmm_table[i] = 0x0;
 	return i;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 17/23] wilc1000: remove no longer used "vif" argument from init_txq_entry()
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (8 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 11/23] wilc1000: convert tqx_entries from "int" to "atomic_t" David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 22/23] wilc1000: minor syntax cleanup David Mosberger-Tang
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

With the tx-path switched to sk_buffs, there is no longer any need for
the "vif" argument in init_txq_entry().

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index f895e4dd2e73f..286bbf9392165 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -37,7 +37,7 @@ static inline void release_bus(struct wilc *wilc, enum bus_release release)
 	mutex_unlock(&wilc->hif_cs);
 }
 
-static void init_txq_entry(struct sk_buff *tqe, struct wilc_vif *vif,
+static void init_txq_entry(struct sk_buff *tqe,
 			   u8 type, enum ip_pkt_priority q_num)
 {
 	struct wilc_skb_tx_cb *tx_cb = WILC_SKB_TX_CB(tqe);
@@ -53,7 +53,7 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, u8 type, u8 q_num,
 	struct wilc_vif *vif = netdev_priv(dev);
 	struct wilc *wilc = vif->wilc;
 
-	init_txq_entry(tqe, vif, type, q_num);
+	init_txq_entry(tqe, type, q_num);
 	if (type == WILC_NET_PKT && vif->ack_filter.enabled)
 		tcp_process(dev, tqe);
 
@@ -68,7 +68,7 @@ static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, u8 type, u8 q_num,
 {
 	struct wilc *wilc = vif->wilc;
 
-	init_txq_entry(tqe, vif, type, q_num);
+	init_txq_entry(tqe, type, q_num);
 
 	mutex_lock(&wilc->txq_add_to_head_cs);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 12/23] wilc1000: refactor wilc_wlan_cfg_commit() a bit
  2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
                   ` (17 preceding siblings ...)
  2021-12-18 23:54 ` [PATCH 13/23] wilc1000: sanitize config packet sequence number management a bit David Mosberger-Tang
@ 2021-12-18 23:54 ` David Mosberger-Tang
  2021-12-18 23:54 ` [PATCH 08/23] wilc1000: fix management packet type inconsistency David Mosberger-Tang
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: David Mosberger-Tang @ 2021-12-18 23:54 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

This cleanup makes the switch to sk_buff queues easier.  There is no
functional change.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 8435e1abdd515..8cd2ede8d2775 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -1271,15 +1271,13 @@ static int wilc_wlan_cfg_commit(struct wilc_vif *vif, int type,
 	struct wilc *wilc = vif->wilc;
 	struct wilc_cfg_frame *cfg = &wilc->cfg_frame;
 	int t_len = wilc->cfg_frame_offset + sizeof(struct wilc_cfg_cmd_hdr);
+	struct wilc_cfg_cmd_hdr *hdr;
 
-	if (type == WILC_CFG_SET)
-		cfg->hdr.cmd_type = 'W';
-	else
-		cfg->hdr.cmd_type = 'Q';
-
-	cfg->hdr.seq_no = wilc->cfg_seq_no % 256;
-	cfg->hdr.total_len = cpu_to_le16(t_len);
-	cfg->hdr.driver_handler = cpu_to_le32(drv_handler);
+	hdr = &cfg->hdr;
+	hdr->cmd_type = (type == WILC_CFG_SET) ? 'W' : 'Q';
+	hdr->seq_no = wilc->cfg_seq_no % 256;
+	hdr->total_len = cpu_to_le16(t_len);
+	hdr->driver_handler = cpu_to_le32(drv_handler);
 	wilc->cfg_seq_no = cfg->hdr.seq_no;
 
 	if (!wilc_wlan_txq_add_cfg_pkt(vif, (u8 *)&cfg->hdr, t_len))
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2021-12-18 23:55 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-18 23:54 [PATCH 00/23] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 02/23] wilc1000: switch txq_event from completion to waitqueue David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 03/23] wilc1000: move receive-queue stats from txq to wilc structure David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 01/23] wilc1000: don't hold txq_spinlock while initializing AC queue limits David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 05/23] wilc1000: add wilc_wlan_tx_packet_done() function David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 07/23] wilc1000: increment tx_dropped stat counter on tx packet drop David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 06/23] wilc1000: move tx packet drop code into its own function David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 04/23] wilc1000: factor common code in wilc_wlan_cfg_set() and wilc_wlan_cfg_get() David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 19/23] wilc1000: don't tell the chip to go to sleep while copying tx packets David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 11/23] wilc1000: convert tqx_entries from "int" to "atomic_t" David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 17/23] wilc1000: remove no longer used "vif" argument from init_txq_entry() David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 22/23] wilc1000: minor syntax cleanup David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 16/23] wilc1000: switch tx queue to normal sk_buff entries David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 18/23] wilc1000: split huge tx handler into subfunctions David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 21/23] wilc1000: declare read-only ac_preserve_ratio as static and const David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 14/23] wilc1000: if there is no tx packet, don't increment packets-sent counter David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 09/23] wilc1000: prepare wilc_wlan_tx_packet_done() for sk_buff changes David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 23/23] wilc1000: introduce symbolic names for two tx-related control bits David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 13/23] wilc1000: sanitize config packet sequence number management a bit David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 12/23] wilc1000: refactor wilc_wlan_cfg_commit() " David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 08/23] wilc1000: fix management packet type inconsistency David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 10/23] wilc1000: factor initialization of tx queue-specific packet fields David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 20/23] wilc1000: eliminate "max_size_over" variable in fill_vmm_table David Mosberger-Tang
2021-12-18 23:54 ` [PATCH 15/23] wilc1000: Add struct wilc_skb_tx_cb as an alias of struct txq_entry_t David Mosberger-Tang

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).