Search Linux Wireless

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In tcp_process(), only hold the ack_filter_lock while accessing the
ack_filter state.

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

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




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux