diff mbox series

[v2,26/50] wilc1000: reduce amount of time ack_filter_lock is held

Message ID 20211223011358.4031459-27-davidm@egauge.net
State New
Headers show
Series wilc1000: rework tx path to use sk_buffs throughout | expand

Commit Message

David Mosberger-Tang Dec. 23, 2021, 1:14 a.m. UTC
In tcp_process(), only hold the ack_filter_lock while accessing the
ack_filter state.

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

Patch

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 81180b2f9f4e1..5ea9129b36925 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -130,15 +130,13 @@  static inline void tcp_process(struct net_device *dev, struct sk_buff *tqe)
 	const struct tcphdr *tcp_hdr_ptr;
 	u32 ihl, total_length, data_offset;
 
-	mutex_lock(&vif->ack_filter_lock);
-
 	if (eth_hdr_ptr->h_proto != htons(ETH_P_IP))
-		goto out;
+		return;
 
 	ip_hdr_ptr = buffer + ETH_HLEN;
 
 	if (ip_hdr_ptr->protocol != IPPROTO_TCP)
-		goto out;
+		return;
 
 	ihl = ip_hdr_ptr->ihl << 2;
 	tcp_hdr_ptr = buffer + ETH_HLEN + ihl;
@@ -150,6 +148,9 @@  static inline void tcp_process(struct net_device *dev, struct sk_buff *tqe)
 
 		seq_no = ntohl(tcp_hdr_ptr->seq);
 		ack_no = ntohl(tcp_hdr_ptr->ack_seq);
+
+		mutex_lock(&vif->ack_filter_lock);
+
 		for (i = 0; i < f->tcp_session; i++) {
 			u32 j = f->ack_session_info[i].seq_num;
 
@@ -163,10 +164,9 @@  static inline void tcp_process(struct net_device *dev, struct sk_buff *tqe)
 			add_tcp_session(vif, 0, 0, seq_no);
 
 		add_tcp_pending_ack(vif, ack_no, i, tqe);
-	}
 
-out:
-	mutex_unlock(&vif->ack_filter_lock);
+		mutex_unlock(&vif->ack_filter_lock);
+	}
 }
 
 static void wilc_wlan_tx_packet_done(struct sk_buff *tqe, int status)