From patchwork Mon Nov 23 23:29:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KY Srinivasan X-Patchwork-Id: 547769 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 197DD1402A2 for ; Tue, 24 Nov 2015 08:59:15 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754441AbbKWV4z (ORCPT ); Mon, 23 Nov 2015 16:56:55 -0500 Received: from p3plsmtps2ded04.prod.phx3.secureserver.net ([208.109.80.198]:36349 "EHLO p3plsmtps2ded04.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753842AbbKWV4v (ORCPT ); Mon, 23 Nov 2015 16:56:51 -0500 Received: from linuxonhyperv.com ([72.167.245.219]) by : HOSTING RELAY : with SMTP id 0z6Qa4ZgftPqa0z6QaVE3v; Mon, 23 Nov 2015 14:56:50 -0700 x-originating-ip: 72.167.245.219 Received: by linuxonhyperv.com (Postfix, from userid 507) id EE89819033B; Mon, 23 Nov 2015 15:29:07 -0800 (PST) From: "K. Y. Srinivasan" To: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com Cc: Vitaly Kuznetsov , "K. Y. Srinivasan" Subject: [PATCH net-next 10/10] hv_netvsc: remove locking in netvsc_send() Date: Mon, 23 Nov 2015 15:29:06 -0800 Message-Id: <1448321346-21357-10-git-send-email-kys@microsoft.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1448321346-21357-1-git-send-email-kys@microsoft.com> References: <1448321324-21318-1-git-send-email-kys@microsoft.com> <1448321346-21357-1-git-send-email-kys@microsoft.com> X-CMAE-Envelope: MS4wfMGSr9u0mh9/jLXJCJLZZ3NU53yqTnnbwcW3FCp/RmxZTyjimOR/vDGEc8C9176G06j1H4um1FQZtlBu+EO5RAc8m/t9mDcXyQR7lXDH1fG4XI+HT79F v8B5sZDWdWsngyqVWCIiBeYXdcrEnnXBV1DXlg24E7t6ZIO6gsEASYPtKpD0A5+9In8u8BnwYPekdUrPHAb0FT9/fIpUye3htOfpL47zZwwH9uNmMqL+X8rO LWqcZSypiOoORejxg0vxdP7N3I3dB+IHsuFkzDx9Ag5e3heFcy8LCctIkdk10s6VBLCxzQ1JnlMqu3XXe6BShNLwXjFidZmlaEbbOk4vzeYAJFdafdSr5xft CmUjA/C1O0Hyvn0lIZ2WHZIsdMVLf5aSocZwoZy2eYQiUZGYFDqKiGyLtlXFxcS1T473XIdALZ66d18Azdf22sn81EQllA== Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vitaly Kuznetsov Packet scheduler guarantees there won't be multiple senders for the same queue and as we use q_idx for multi_send_data the spinlock is redundant. Signed-off-by: Vitaly Kuznetsov Signed-off-by: K. Y. Srinivasan --- drivers/net/hyperv/hyperv_net.h | 1 - drivers/net/hyperv/netvsc.c | 8 -------- 2 files changed, 0 insertions(+), 9 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index a9d2bdc5..f5b2145 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -633,7 +633,6 @@ struct nvsp_message { #define RNDIS_PKT_ALIGN_DEFAULT 8 struct multi_send_data { - spinlock_t lock; /* protect struct multi_send_data */ struct hv_netvsc_packet *pkt; /* netvsc pkt pending */ u32 count; /* counter of batched packets */ }; diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 419b055..081f14f 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -38,7 +38,6 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device) { struct netvsc_device *net_device; struct net_device *ndev = hv_get_drvdata(device); - int i; net_device = kzalloc(sizeof(struct netvsc_device), GFP_KERNEL); if (!net_device) @@ -58,9 +57,6 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device) net_device->max_pkt = RNDIS_MAX_PKT_DEFAULT; net_device->pkt_align = RNDIS_PKT_ALIGN_DEFAULT; - for (i = 0; i < num_online_cpus(); i++) - spin_lock_init(&net_device->msd[i].lock); - hv_set_drvdata(device, net_device); return net_device; } @@ -850,7 +846,6 @@ int netvsc_send(struct hv_device *device, u16 q_idx = packet->q_idx; u32 pktlen = packet->total_data_buflen, msd_len = 0; unsigned int section_index = NETVSC_INVALID_INDEX; - unsigned long flag; struct multi_send_data *msdp; struct hv_netvsc_packet *msd_send = NULL, *cur_send = NULL; bool try_batch; @@ -867,7 +862,6 @@ int netvsc_send(struct hv_device *device, msdp = &net_device->msd[q_idx]; /* batch packets in send buffer if possible */ - spin_lock_irqsave(&msdp->lock, flag); if (msdp->pkt) msd_len = msdp->pkt->total_data_buflen; @@ -927,8 +921,6 @@ int netvsc_send(struct hv_device *device, cur_send = packet; } - spin_unlock_irqrestore(&msdp->lock, flag); - if (msd_send) { m_ret = netvsc_send_pkt(msd_send, net_device);