[PATCH 4/5] Introduce frames with unlimited lifetime in tx buffer.

Max Filippov jcmvbkbc at gmail.com
Fri Jan 9 17:16:52 EET 2009


Introduce frames with unlimited lifetime in tx buffer.

Signed-off-by: Max Filippov <jcmvbkbc at gmail.com>
---
 stlc45xx.c |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/stlc45xx.c b/stlc45xx.c
index f2d9d0a..1105b8a 100644
--- a/stlc45xx.c
+++ b/stlc45xx.c
@@ -936,21 +936,28 @@ static int stlc45xx_upload_firmware(struct stlc45xx *stlc)
 }
 
 /* caller must hold tx_lock */
-static void stlc45xx_check_txsent(struct stlc45xx *stlc)
+static int stlc45xx_check_txsent(struct stlc45xx *stlc)
 {
+	int n_mortal = 0;
 	struct txbuffer *entry, *n;
 
 	list_for_each_entry_safe(entry, n, &stlc->tx_sent, tx_list) {
-		if (time_after(jiffies, entry->lifetime)) {
-			if (net_ratelimit())
-				stlc45xx_warning("frame 0x%x lifetime exceeded",
-						 entry->start);
-			list_del(&entry->tx_list);
-			skb_pull(entry->skb, entry->header_len);
-			ieee80211_tx_status(stlc->hw, entry->skb);
-			stlc45xx_txbuffer_free(stlc, entry);
+		if (entry->lifetime) {
+			if (time_after(jiffies, entry->lifetime)) {
+				if (net_ratelimit())
+					stlc45xx_warning("frame 0x%x lifetime exceeded",
+							 entry->start);
+				list_del(&entry->tx_list);
+				if (entry->status_needed) {
+					skb_pull(entry->skb, entry->header_len);
+					ieee80211_tx_status(stlc->hw, entry->skb);
+				}
+				stlc45xx_txbuffer_free(stlc, entry);
+			} else
+				++n_mortal;
 		}
 	}
+	return n_mortal;
 }
 
 static void stlc45xx_power_off(struct stlc45xx *stlc)
@@ -1189,10 +1196,9 @@ static int stlc45xx_rx_txack(struct stlc45xx *stlc, struct sk_buff *skb)
 
 	list_del(&entry->tx_list);
 
-	stlc45xx_check_txsent(stlc);
-	if (list_empty(&stlc->tx_sent))
-		/* there are no pending frames, we can stop the tx timeout
-		 * timer */
+	if (0 == stlc45xx_check_txsent(stlc))
+		/* there are no pending frames with limited lifetime,
+		 * we can stop the tx timeout timer */
 		cancel_delayed_work(&stlc->work_tx_timeout);
 
 	spin_lock_bh(&stlc->tx_lock);
-- 
1.5.4.3


More information about the stlc45xx-devel mailing list