From patchwork Mon Nov 2 12:48:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 1392217 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CPt5h3g9hz9sVv; Mon, 2 Nov 2020 23:49:12 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kZZGh-0005vF-48; Mon, 02 Nov 2020 12:49:03 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kZZGf-0005up-Px for kernel-team@lists.ubuntu.com; Mon, 02 Nov 2020 12:49:01 +0000 Received: from mail-qk1-f200.google.com ([209.85.222.200]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kZZGf-00042P-FB for kernel-team@lists.ubuntu.com; Mon, 02 Nov 2020 12:49:01 +0000 Received: by mail-qk1-f200.google.com with SMTP id t70so8448366qka.11 for ; Mon, 02 Nov 2020 04:49:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x4QS7HRWjXPXcTjiXJuej/jwG8fQnZPe/Vd9L0yCw4s=; b=rxrUB41gaaaxm7hXf4rjjXDYRcXSd53fEhec8gYyNdKk2epB+JE5Wjllr7GySZkg9p uLZY6qeKc38H+IAi3ya9nN4WBzKz0IAL+udZ6rhFmoTcdc+39K8u44C5y3m7nHbVCnX0 V4rRQjq2XWtoqwzVlcg2+hda2u11kT+ObowwcowuxoVN/YeoHoQcUtVN3hfr/+d2mf22 vBCKcNWFWQc0COPbK/aNv/w0BdlWHXV3pwx7oItBaluKCh9ynv1N/ZY9Q771o1iLmzYy METgBB63zOPHVjX0iFTzLolsmvNGzB1T/DwqusmdVMjm08rlm7TtXh4KynGnFGT5nVgn VnPA== X-Gm-Message-State: AOAM5301W6mkeSO34Kf7q0cDQswcRfuyfh9FuW1XdU1LFo1ohtH3e9eo OiFzjESNTcPycZHhqIfcN7bAFJh8YZGnbv24Sw774/Z32EXU0X7xlIVKJSFdR3kP+9rtOBNeVgw 2298IKCoK84fxYOcj1mue+8eTRm/q8OvPV1pf11Z1JQ== X-Received: by 2002:ac8:1493:: with SMTP id l19mr13208320qtj.198.1604321339904; Mon, 02 Nov 2020 04:48:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9j1ZzuPfJxWlAZlRkSMuUourRaa5aX7pd+G0vll8uIvini3fWvR7SF32skptwhBtcjbGuxw== X-Received: by 2002:ac8:1493:: with SMTP id l19mr13208302qtj.198.1604321339689; Mon, 02 Nov 2020 04:48:59 -0800 (PST) Received: from localhost.localdomain (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id q7sm7666201qtd.49.2020.11.02.04.48.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 04:48:59 -0800 (PST) From: William Breathitt Gray To: kernel-team@lists.ubuntu.com Subject: [SRU][B:linux-azure-4.15][PATCH 01/40] hv_netvsc: pass netvsc_device to receive callback Date: Mon, 2 Nov 2020 07:48:17 -0500 Message-Id: <20201102124856.4659-2-william.gray@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201102124856.4659-1-william.gray@canonical.com> References: <20201102124856.4659-1-william.gray@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Stephen Hemminger BugLink: https://bugs.launchpad.net/bugs/1877654 The netvsc_receive_callback function was using RCU to find the appropriate underlying netvsc_device. Since calling function already had that pointer, this was unnecessary. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller (backported from commit 345ac08990b8365294f9756da806f357c239d758) [ vilhelmgray: context adjustments ] Signed-off-by: William Breathitt Gray --- drivers/net/hyperv/hyperv_net.h | 1 + drivers/net/hyperv/netvsc_drv.c | 13 ++----------- drivers/net/hyperv/rndis_filter.c | 3 ++- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 83e040359037..5d1c91500df0 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -202,6 +202,7 @@ int netvsc_send(struct net_device *net, void netvsc_linkstatus_callback(struct net_device *net, struct rndis_message *resp); int netvsc_recv_callback(struct net_device *net, + struct netvsc_device *nvdev, struct vmbus_channel *channel, void *data, u32 len, const struct ndis_tcp_ip_checksum_info *csum_info, diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 74e00120850c..3f1b3e6ae4aa 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -831,33 +831,25 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, * "wire" on the specified device. */ int netvsc_recv_callback(struct net_device *net, + struct netvsc_device *net_device, struct vmbus_channel *channel, void *data, u32 len, const struct ndis_tcp_ip_checksum_info *csum_info, const struct ndis_pkt_8021q_info *vlan) { struct net_device_context *net_device_ctx = netdev_priv(net); - struct netvsc_device *net_device; u16 q_idx = channel->offermsg.offer.sub_channel_index; - struct netvsc_channel *nvchan; + struct netvsc_channel *nvchan = &net_device->chan_table[q_idx]; struct sk_buff *skb; struct netvsc_stats *rx_stats; if (net->reg_state != NETREG_REGISTERED) return NVSP_STAT_FAIL; - rcu_read_lock(); - net_device = rcu_dereference(net_device_ctx->nvdev); - if (unlikely(!net_device)) - goto drop; - - nvchan = &net_device->chan_table[q_idx]; - /* Allocate a skb - TODO direct I/O to pages? */ skb = netvsc_alloc_recv_skb(net, &nvchan->napi, csum_info, vlan, data, len); if (unlikely(!skb)) { -drop: ++net->stats.rx_dropped; rcu_read_unlock(); return NVSP_STAT_FAIL; @@ -882,7 +874,6 @@ int netvsc_recv_callback(struct net_device *net, u64_stats_update_end(&rx_stats->syncp); napi_gro_receive(&nvchan->napi, skb); - rcu_read_unlock(); return NVSP_STAT_SUCCESS; } diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 29e8741e1891..4d2eceb3a694 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -397,7 +397,8 @@ static int rndis_filter_receive_data(struct net_device *ndev, */ data = (void *)((unsigned long)data + data_offset); csum_info = rndis_get_ppi(rndis_pkt, TCPIP_CHKSUM_PKTINFO); - return netvsc_recv_callback(ndev, channel, + + return netvsc_recv_callback(ndev, nvdev, channel, data, rndis_pkt->data_len, csum_info, vlan); }