Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2003443imm; Thu, 24 May 2018 04:21:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoPJeOJ5H4j/UIqBUCLRt4l0Pl1C1niBKheQVIHjTlLkKgQ8cnHVX4iJMkXKEryH/odY5zk X-Received: by 2002:a65:4d8e:: with SMTP id p14-v6mr5336589pgq.296.1527160864169; Thu, 24 May 2018 04:21:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527160864; cv=none; d=google.com; s=arc-20160816; b=VMliqCvFIEsP91iZayz7wOXcMOBUSP+dyn8EhFPPVg1drC5+bOBlXoj/k4EOq/Y9sk K2uSkF99W3qpLhkgkph2+FfO2+dFWEEDCS/XeAn7XUYw9zU51fGnRK4zvzkEzxeuJbyQ +I0qEmyYva8RhM2CExFHe/hdQe4uKrWhPzECwutWEogu01rKiX3ZulKaxL4w23ZOPuhN fANDRvIIFJ1n3oLD9toQ/nNnkoqvOAdtmNa/rccVgg4EyCSXaE9pmbTPviNVT5ddi/fL eg05GeGhDcCOfn01tTz5eZlUmQ0M+w1bS1XtwOcxWsq3J96+UulJE1LsIBm97VqwUMol UXRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Y44U+Q14dfEviy4SslSsuFN9DlInfCF3yImZVZn5jPg=; b=iCxkMH5cBXZtgpa9GQ3qnPH6QGg7DxKKFDPfbW9kXXOWRKP6AeouK8VO57nCDWOw5u 7pNBY06PKxEyN+yX15O8cHaNb8NbRJEAKxpUpykcmOkBI809EvVOyA7vdNDNa14u0xkc K+ilXZH4ra9yAHF/GzsZHmwveypHcn4alSXg4fQ1hH6efTD5QdrjZnHV709Ur6FN1U8R YgruA2IL1e6QPVoYFGiznvcAgQjAfvGi6UYCIWp3S54rOVzkB4V90wNRDw1TvFDUvXJc csuP3Er9jf3PwDDq60JiUo6VEZtOxA1QPRKRUy+u5hUAeZWC1p9hL13gGxg1XBPH7y03 6oPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xrk6gWqo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34-v6si21289593plz.66.2018.05.24.04.20.49; Thu, 24 May 2018 04:21:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xrk6gWqo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033121AbeEXLUJ (ORCPT + 99 others); Thu, 24 May 2018 07:20:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:53232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967913AbeEXJwl (ORCPT ); Thu, 24 May 2018 05:52:41 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D22B20847; Thu, 24 May 2018 09:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155560; bh=lLRt010PQeDpBHwFgOwwyYYbthL7X4DJ97+yNnALA8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xrk6gWqoOiopZBzZ6lAFaZhzOJGeuBhVthB8h3HxJ8/ab6gAistrBU0F1rHm2Eyxb fDhknFy1M01aq+OrrREchlW5JWbi9GqPksoqgzRJtnr/jfmUewsGeSn/r5FJG75CqI KvCcTMsO+KbqakLhwBrm4S7eexT1c1gl7gMfGKc8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mohammed Gamal , "David S. Miller" Subject: [PATCH 4.14 032/165] hv_netvsc: Split netvsc_revoke_buf() and netvsc_teardown_gpadl() Date: Thu, 24 May 2018 11:37:18 +0200 Message-Id: <20180524093623.275428805@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mohammed Gamal [ Commit 7992894c305eaf504d005529637ff8283d0a849d upstream. ] Split each of the functions into two for each of send/recv buffers. This will be needed in order to implement a fine-grained messaging sequence to the host so that we accommodate the requirements of different Windows versions Fixes: 0ef58b0a05c12 ("hv_netvsc: change GPAD teardown order on older versions") Signed-off-by: Mohammed Gamal Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/hyperv/netvsc.c | 46 ++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -105,11 +105,11 @@ static void free_netvsc_device_rcu(struc call_rcu(&nvdev->rcu, free_netvsc_device); } -static void netvsc_revoke_buf(struct hv_device *device, - struct netvsc_device *net_device) +static void netvsc_revoke_recv_buf(struct hv_device *device, + struct netvsc_device *net_device) { - struct nvsp_message *revoke_packet; struct net_device *ndev = hv_get_drvdata(device); + struct nvsp_message *revoke_packet; int ret; /* @@ -151,6 +151,14 @@ static void netvsc_revoke_buf(struct hv_ } net_device->recv_section_cnt = 0; } +} + +static void netvsc_revoke_send_buf(struct hv_device *device, + struct netvsc_device *net_device) +{ + struct net_device *ndev = hv_get_drvdata(device); + struct nvsp_message *revoke_packet; + int ret; /* Deal with the send buffer we may have setup. * If we got a send section size, it means we received a @@ -194,8 +202,8 @@ static void netvsc_revoke_buf(struct hv_ } } -static void netvsc_teardown_gpadl(struct hv_device *device, - struct netvsc_device *net_device) +static void netvsc_teardown_recv_gpadl(struct hv_device *device, + struct netvsc_device *net_device) { struct net_device *ndev = hv_get_drvdata(device); int ret; @@ -214,6 +222,13 @@ static void netvsc_teardown_gpadl(struct } net_device->recv_buf_gpadl_handle = 0; } +} + +static void netvsc_teardown_send_gpadl(struct hv_device *device, + struct netvsc_device *net_device) +{ + struct net_device *ndev = hv_get_drvdata(device); + int ret; if (net_device->send_buf_gpadl_handle) { ret = vmbus_teardown_gpadl(device->channel, @@ -423,8 +438,10 @@ static int netvsc_init_buf(struct hv_dev goto exit; cleanup: - netvsc_revoke_buf(device, net_device); - netvsc_teardown_gpadl(device, net_device); + netvsc_revoke_recv_buf(device, net_device); + netvsc_revoke_send_buf(device, net_device); + netvsc_teardown_recv_gpadl(device, net_device); + netvsc_teardown_send_gpadl(device, net_device); exit: return ret; @@ -554,7 +571,8 @@ void netvsc_device_remove(struct hv_devi = rtnl_dereference(net_device_ctx->nvdev); int i; - netvsc_revoke_buf(device, net_device); + netvsc_revoke_recv_buf(device, net_device); + netvsc_revoke_send_buf(device, net_device); RCU_INIT_POINTER(net_device_ctx->nvdev, NULL); @@ -569,14 +587,18 @@ void netvsc_device_remove(struct hv_devi netdev_dbg(ndev, "net device safe to remove\n"); /* older versions require that buffer be revoked before close */ - if (vmbus_proto_version < VERSION_WIN10) - netvsc_teardown_gpadl(device, net_device); + if (vmbus_proto_version < VERSION_WIN10) { + netvsc_teardown_recv_gpadl(device, net_device); + netvsc_teardown_send_gpadl(device, net_device); + } /* Now, we can close the channel safely */ vmbus_close(device->channel); - if (vmbus_proto_version >= VERSION_WIN10) - netvsc_teardown_gpadl(device, net_device); + if (vmbus_proto_version >= VERSION_WIN10) { + netvsc_teardown_recv_gpadl(device, net_device); + netvsc_teardown_send_gpadl(device, net_device); + } /* Release all resources */ free_netvsc_device_rcu(net_device);