Received: by 10.213.65.68 with SMTP id h4csp963246imn; Thu, 22 Mar 2018 12:15:30 -0700 (PDT) X-Google-Smtp-Source: AG47ELsZcXoB33408jZi5etIheAqwxuTzOJ9HUeWVfu6Tg8DxKhxsGp0ULvKN59Gij31wdu/9xfR X-Received: by 2002:a17:902:1e3:: with SMTP id b90-v6mr4875141plb.155.1521746130227; Thu, 22 Mar 2018 12:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521746130; cv=none; d=google.com; s=arc-20160816; b=GyyyXnvYKFv4aXekRPNL78oG3UrQgNhQMnfdCCOxGkJ+rPsjspawpL6FujxAZzT3yW RA1xIQgsRuEH9ZFCmDZhA0AQNKbgybV7oUjw8Ocqj7roRDJYMVay4W2hs2wdSoaIqxhP cZBsBiftWxit9vvHnoxtDBOy21m0q+UGDZhWcpTiE8aRiM8c4DRcoNYV+yWEW6ZSgDn9 XabIQA2gRkGVo8xbINRiBZ0RmDSa7rGJov7emifOd57X7IMnVMNi7Z7nWSzKxIk0ohzO X1x/CCk7XdTq/r8koBJK8ismt+3E0MoIwGatrT2le6yuGChmjOusdz0vxE4H0Tg+NSmq IbRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=n0WvhSAEsY61xXl42MPuImavlhFZuFvRpN5IuKU5jAU=; b=zvl1OLsLDF+BLpCJQ9CsMB6Wpr4FhMJUt3hfcp2yoMrvhr0Sdo0rE7lAQSAoo3s8SP cxktiTNDR4t9IMtMAX7YzW6ymhA+cCDshgG8HODYOeJ5EvIhL01LDVN7DGLECxbqAWIf AckjDapUBraPDK7oYWSqTveF8yazQbK7hoi5pRoqaMH/ldhijI6g/nC1c1X2cxeALHtO biZxh5ibJorC5MwHwAwO+qlSTGZvBx++oZG+ZNbohg6r+gUdFJPXJqhxSyRgbj8J+HWh ex4KS9E85msx/MtocaXhaYeohthZFy5zmW8T5f/1XuaotZNqQR8N766y5pwQCM4xX3tD oeXw== ARC-Authentication-Results: i=1; mx.google.com; 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 e93-v6si6690488plk.159.2018.03.22.12.15.15; Thu, 22 Mar 2018 12:15:30 -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; 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 S1752050AbeCVTNz (ORCPT + 99 others); Thu, 22 Mar 2018 15:13:55 -0400 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:35506 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751985AbeCVTNw (ORCPT ); Thu, 22 Mar 2018 15:13:52 -0400 X-Greylist: delayed 675 seconds by postgrey-1.27 at vger.kernel.org; Thu, 22 Mar 2018 15:13:47 EDT Received: from linuxonhyperv2.linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id z5SyeJoURZVTdz5Syer8Ad; Thu, 22 Mar 2018 12:01:36 -0700 x-originating-ip: 107.180.71.197 Received: from haiyangz by linuxonhyperv2.linuxonhyperv.com with local (Exim 4.89_1) (envelope-from ) id 1ez5Sy-0006g0-EW; Thu, 22 Mar 2018 12:01:36 -0700 From: Haiyang Zhang To: davem@davemloft.net, netdev@vger.kernel.org Cc: haiyangz@microsoft.com, kys@microsoft.com, sthemmin@microsoft.com, olaf@aepfle.de, vkuznets@redhat.com, devel@linuxdriverproject.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next,1/2] hv_netvsc: Fix the return status in RX path Date: Thu, 22 Mar 2018 12:01:13 -0700 Message-Id: <20180322190114.25596-2-haiyangz@linuxonhyperv.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180322190114.25596-1-haiyangz@linuxonhyperv.com> References: <20180322190114.25596-1-haiyangz@linuxonhyperv.com> Reply-To: haiyangz@microsoft.com X-CMAE-Envelope: MS4wfJxrdB/sZuO5WJD5gIkqVBMrkATf51xAXKNrLFPBpjDvv3lxJrV4fJAb0A7eGbO+BGgfQNP1az1qWuG9pxE4W/0s3B1YXjwDML5hxXBUlU6ReiR7l7V/ 8mGlJqbN8XLK+pYKFxOLAM7CJpjZVxMLr5snQ6f0JKbPew6Ki139BJF+4qpnIN9Qn3Jrb7TAAOGmH3Rd12FTNHR12Y7+SvR2uqREkIr7uLEH0A5RFzZQ9UXG 8Av5QQkJ87Rxtn+y+F60IHZR3AAynEcToxtm9VFuRL3V6XGy88xqlLSkeJFhAx38XREizWahNvIfUvzEYEx723abvxBZaRtuHi+qpZWgyQNN2RqTL3zYC523 2r+hVG6O6bnpz+xszdxlXUJMfUxsh1kxrvfAG5OpWNaKNdQNPQSxSjZDc6TqPy7t9chZ/Vxvo/d1tYWUXOt4lQrWII5wwQlOQlBmh9LbefwR1d8QJYbq5ALi Q9MkwBuu1ymNrcayKMJYSrCYnOipkA8d+0yLzg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Haiyang Zhang As defined in hyperv_net.h, the NVSP_STAT_SUCCESS is one not zero. Some functions returns 0 when it actually means NVSP_STAT_SUCCESS. This patch fixes them. In netvsc_receive(), it puts the last RNDIS packet's receive status for all packets in a vmxferpage which may contain multiple RNDIS packets. This patch puts NVSP_STAT_FAIL in the receive completion if one of the packets in a vmxferpage fails. Signed-off-by: Haiyang Zhang --- drivers/net/hyperv/netvsc.c | 8 ++++++-- drivers/net/hyperv/netvsc_drv.c | 2 +- drivers/net/hyperv/rndis_filter.c | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index aa95e81af6e5..1ddb2c39b6e4 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -1098,12 +1098,16 @@ static int netvsc_receive(struct net_device *ndev, void *data = recv_buf + vmxferpage_packet->ranges[i].byte_offset; u32 buflen = vmxferpage_packet->ranges[i].byte_count; + int ret; trace_rndis_recv(ndev, q_idx, data); /* Pass it to the upper layer */ - status = rndis_filter_receive(ndev, net_device, - channel, data, buflen); + ret = rndis_filter_receive(ndev, net_device, + channel, data, buflen); + + if (unlikely(ret != NVSP_STAT_SUCCESS)) + status = NVSP_STAT_FAIL; } enq_receive_complete(ndev, net_device, q_idx, diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index cdb78eefab67..33607995be62 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -818,7 +818,7 @@ int netvsc_recv_callback(struct net_device *net, u64_stats_update_end(&rx_stats->syncp); napi_gro_receive(&nvchan->napi, skb); - return 0; + return NVSP_STAT_SUCCESS; } static void netvsc_get_drvinfo(struct net_device *net, diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 2dc00f714482..591fb8080f11 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -443,10 +443,10 @@ int rndis_filter_receive(struct net_device *ndev, "unhandled rndis message (type %u len %u)\n", rndis_msg->ndis_msg_type, rndis_msg->msg_len); - break; + return NVSP_STAT_FAIL; } - return 0; + return NVSP_STAT_SUCCESS; } static int rndis_filter_query_device(struct rndis_device *dev, -- 2.15.1