Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp436285imu; Wed, 19 Dec 2018 22:33:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vc0tyMHDs+MQEvY1QKJfxvi/xhiIQUIstfHy0jSzOsbYqoeJ0vjpiri12tC7CP08brvGkm X-Received: by 2002:a17:902:34a:: with SMTP id 68mr23592919pld.268.1545287635589; Wed, 19 Dec 2018 22:33:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545287635; cv=none; d=google.com; s=arc-20160816; b=qZR7V3b/Z3fCOmF58w0lPYvGZ94+CIA8KwNyZaESilp9v4grdMzakUN3pR2+Vl3af8 JLZbXOQtb8dFFLW97b6MMLdqDE+kwdC2YMpCRDINrUjzLQcoqJEmQkkUr3im53/StMZ8 yfZnh96mFy1mF+atWjS9xHWEP/VbLoj3IcjqLNHmbj1XaWqMqKR1QMgnAug/2BhZIg2v LIPCH2YKm6IhCQTKGo8aNd2ussbDy8blFwrhUKFBFjM7cuTEFWWJfQWFwjY0N45KtIAx GAjyWpZ0A9Z+aDE3OWjn5m1Q3WHqztpmFtP51RTMGkn1pzoCQ2jOUAgtVOr4apWhy9eC UTdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=9Dmj//k1cIsm/u23cTskzF9p90dA4Ud2Pu0ga/RGvWU=; b=StMePlPZq22O1DLV8kfVGQFLZ+LmFn69mhd38QXRcLJtk3v102CCqJ5l9Bja5UQdr0 SXpssr3fi0qPcsbYgg2B0ef0n1tXPWMNRXhAnXF3VJRBQBpbbfDJ80jgDUqH27f4B4uq id6Q/V5+/6PYyj2IJrzIv8oV4cS7jLmYcTCeRkQtKDirJBYUmBd7nT++WHAtMdURcd1f rKOMEtrIGEowfTlJ2bj4UYiGbBpatOCmSCR+0C946FEvolQ7/xVBl3CeTDbkkECiEOJI /texlCchhMJ2qxqB142gY34vBr9nAiC+b1e4QwLlr4BnjZBY63YGefOXxsIagVUvw3Gh H+4g== 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 b5si18320825pfg.121.2018.12.19.22.33.40; Wed, 19 Dec 2018 22:33:55 -0800 (PST) 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 S1730093AbeLTDQs (ORCPT + 99 others); Wed, 19 Dec 2018 22:16:48 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:16612 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729880AbeLTDQc (ORCPT ); Wed, 19 Dec 2018 22:16:32 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 31B0E4505C0D2; Thu, 20 Dec 2018 11:16:28 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.408.0; Thu, 20 Dec 2018 11:16:16 +0800 From: Peng Li To: CC: , , , , , Subject: [PATCH net-next 8/9] net: hns3: fix the descriptor index when get rss type Date: Thu, 20 Dec 2018 11:52:05 +0800 Message-ID: <1545277926-66432-9-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1545277926-66432-1-git-send-email-lipeng321@huawei.com> References: <1545277926-66432-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Driver gets rss information from the last descriptor of the packet. When driver handle the rss type, ring->next_to_clean indicates the first descriptor of next packet. This patch fix the descriptor index with "ring->next_to_clean - 1". Fixes: 232fc64b6e62 ("net: hns3: Add HW RSS hash information to RX skb") Signed-off-by: Peng Li --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 624b8a7..d3b9aaf 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2550,9 +2550,16 @@ static void hns3_set_gro_param(struct sk_buff *skb, u32 l234info, static void hns3_set_rx_skb_rss_type(struct hns3_enet_ring *ring, struct sk_buff *skb) { - struct hns3_desc *desc = &ring->desc[ring->next_to_clean]; struct hnae3_handle *handle = ring->tqp->handle; enum pkt_hash_types rss_type; + struct hns3_desc *desc; + int last_bd; + + /* When driver handle the rss type, ring->next_to_clean indicates the + * first descriptor of next packet, need -1 here. + */ + last_bd = (ring->next_to_clean - 1 + ring->desc_num) % ring->desc_num; + desc = &ring->desc[last_bd]; if (le32_to_cpu(desc->rx.rss_hash)) rss_type = handle->kinfo.rss_type; -- 1.9.1