lkml.org 
[lkml]   [2021]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 05/50] wilc1000: add wilc_wlan_tx_packet_done() function
Date
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 97624f758cbe4..7b7ee6ee9f849 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
\
 
 \ /
  Last update: 2021-12-23 02:16    [W:0.131 / U:1.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site