Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2753030imj; Mon, 11 Feb 2019 07:59:47 -0800 (PST) X-Google-Smtp-Source: AHgI3IYUFl8Rp+MZZ3ZdoSt6IpgCTo5PLd6nNdroNFYVUjpIo9Oy8JLVy0QB7k6+cKhQ/S7J9AWo X-Received: by 2002:a17:902:6bc3:: with SMTP id m3mr26178927plt.24.1549900787419; Mon, 11 Feb 2019 07:59:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900787; cv=none; d=google.com; s=arc-20160816; b=UJ2rXFL2IoYTATtA7wLhdaon4BgqSFsi42EE9Dgg6fL7YReDWL4d4oOddFHib0ZIUw 01KreijkA+KzZ0f8UhnqzetxguwvoIDqZiBfnZksQs0FiJFn7YsYd077rYls3twlkxI6 r5gkc4gGzw4gZYYYb4+XzlydG3rjsu/WPYyjf6GXP1TECQb87RjwYjWcjUIUpwUJA5Fn uZvQJ9T2jw2uI2MxfMD6HIYEAEx877pjAZqu5DQg+OiEBqOHEniqSeEw9RJraP3VWM3w MVIMkjJKWTNk+fg2J9Oi5F75TeQiTv9l358MFfA+Q31wy7DQhVDDaAZyR697DrRksrMp SXQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yqx95GXOOW2XuhypLL830heNV3lBuykRwq5QQbEPEjE=; b=bBgqYQEbyy69N2bsNCYAHE9n0808JDDyO0FoM26RC279Gm1LVWM2/eR2QRBAlYICFc vynxJ9y9mbUvtB3aWrOjlA0joXBSTA1eAy3txX9Vv0ZGcob0Kf1aC2pHIFJXux82LfRL njp7U2c09FDSGgVSf2InrnDWDm+eqoVf75HnFD0CFkWdObFOppc62RvelFBeVg8OZ4iL fifhdclbSNf+bc3RPkjf+AxvVdfxjz2KWOSFrdwilv/MGfSwxAuL2nrnFR1Xd6bNn6uQ lcWHV8ngmnRBX60fS0rOfW1bLh4Q+/CjOimjPSP8yRNtuFCi6+Rgx6ThNnwWZw4u1Hcq dy5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FNebl4Uy; 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 f13si9460159pgv.164.2019.02.11.07.59.31; Mon, 11 Feb 2019 07:59:47 -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; dkim=pass header.i=@kernel.org header.s=default header.b=FNebl4Uy; 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 S1730533AbfBKOcu (ORCPT + 99 others); Mon, 11 Feb 2019 09:32:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:40336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730522AbfBKOct (ORCPT ); Mon, 11 Feb 2019 09:32:49 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 EFCEB20844; Mon, 11 Feb 2019 14:32:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895568; bh=dPemYv0rjZQuY5DXmr2RSjreztvPnxszXmtgiXSCzlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FNebl4Uy6G7/qGmuaNgvqily/hepp1ETe/W9eYdiqc5caGqatzSG1iFNd+VoijzSE ZGcDyMG1f7MlCvsTRfVaP6v551EoC2rp+11lQpHkBmElJJD0jKpVz5GDtHfav6NtGP 8UMu+I6t/INWbbLQ/D6aK4FaELJXRz+5Bh6E14HE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Li , "David S. Miller" , Sasha Levin Subject: [PATCH 4.20 219/352] net: hns3: fix the descriptor index when get rss type Date: Mon, 11 Feb 2019 15:17:26 +0100 Message-Id: <20190211141901.154302125@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 31a16f99e02c2e0b40a5fb05d66f5e56721027e2 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 beb5dbd5e98d..d424d5bc0507 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2332,9 +2332,16 @@ static bool hns3_parse_vlan_tag(struct hns3_enet_ring *ring, 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; -- 2.19.1