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 26/50] wilc1000: reduce amount of time ack_filter_lock is held
Date
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 --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
\
 
 \ /
  Last update: 2021-12-23 02:16    [W:0.238 / U:0.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site