[PATCH net 7/9] hv_netvsc: don't need full irqsave for request_lock

Stephen Hemminger stephen at networkplumber.org
Thu Mar 1 18:27:54 UTC 2018


Since the driver incoming handling is done with NAPI.
This path is run in softirq (not hardirq) therefore don't
need to do full local irq save/restore.

Signed-off-by: Stephen Hemminger <sthemmin at microsoft.com>
---
 drivers/net/hyperv/rndis_filter.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 1cba767c6453..3ce11361634f 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -92,7 +92,6 @@ static struct rndis_request *get_rndis_request(struct rndis_device *dev,
 	struct rndis_request *request;
 	struct rndis_message *rndis_msg;
 	struct rndis_set_request *set;
-	unsigned long flags;
 
 	request = kzalloc(sizeof(struct rndis_request), GFP_KERNEL);
 	if (!request)
@@ -115,9 +114,9 @@ static struct rndis_request *get_rndis_request(struct rndis_device *dev,
 	set->req_id = atomic_inc_return(&dev->new_req_id);
 
 	/* Add to the request list */
-	spin_lock_irqsave(&dev->request_lock, flags);
+	spin_lock_bh(&dev->request_lock);
 	list_add_tail(&request->list_ent, &dev->req_list);
-	spin_unlock_irqrestore(&dev->request_lock, flags);
+	spin_unlock_bh(&dev->request_lock);
 
 	return request;
 }
@@ -125,11 +124,9 @@ static struct rndis_request *get_rndis_request(struct rndis_device *dev,
 static void put_rndis_request(struct rndis_device *dev,
 			    struct rndis_request *req)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&dev->request_lock, flags);
+	spin_lock_bh(&dev->request_lock);
 	list_del(&req->list_ent);
-	spin_unlock_irqrestore(&dev->request_lock, flags);
+	spin_unlock_bh(&dev->request_lock);
 
 	kfree(req);
 }
@@ -269,10 +266,9 @@ static void rndis_filter_receive_response(struct rndis_device *dev,
 {
 	struct rndis_request *request = NULL;
 	bool found = false;
-	unsigned long flags;
 	struct net_device *ndev = dev->ndev;
 
-	spin_lock_irqsave(&dev->request_lock, flags);
+	spin_lock_bh(&dev->request_lock);
 	list_for_each_entry(request, &dev->req_list, list_ent) {
 		/*
 		 * All request/response message contains RequestId as the 1st
@@ -284,7 +280,7 @@ static void rndis_filter_receive_response(struct rndis_device *dev,
 			break;
 		}
 	}
-	spin_unlock_irqrestore(&dev->request_lock, flags);
+	spin_unlock_bh(&dev->request_lock);
 
 	if (found) {
 		if (resp->msg_len <=
-- 
2.16.1



More information about the devel mailing list