Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp20269pxb; Fri, 15 Jan 2021 04:53:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxatYDufEOgQvQgOzn3g1/1KvdStg0t9iwJlUaNNR4Iy3M0dX5ZW3e9OdFOsv4mqVIxfc00 X-Received: by 2002:a17:906:3b16:: with SMTP id g22mr4290351ejf.504.1610715186171; Fri, 15 Jan 2021 04:53:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715186; cv=none; d=google.com; s=arc-20160816; b=VZLVPbrV50st7YO7iJc/sPxslfEhexJYEWhGqFJ6/d/k7l9mOzX5MUokSEbhyn6WfU 3L+xvAjO+rB7PpyKLrN4UAIdUAfo4EF/OR8mEYPui8tcvLlcyxKyJRHbxqUycrGKQmn1 cJPUKiEUz/QcicA+ScuziC+omLjCqHWEBfdMSdQyxMoIgCKmCL4NLnrj6Hq6HjCrboMZ j1QF2jknjdG0TkhHNsRqhOV5EnJGAFZkp8lOJ4bBZKi6Wyn89a6xZ25V87xWLHsFazBg z4IxJxYmmml1jiLpzJa7PHthaUQ9fhp7kMA6jogwEmffCO/We+uFenBCVBkrRz+2NA4r lg/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N+TBpzVjrBou6w3RiT73/YUT5kNHD4mZkaiAaUX9nBQ=; b=RlhRbtiR0WE+EWrt2GJZhnW97krVxECZup0lIESm5/kngkEQtqB++qQkZFPbhEBAPU Sf1TiQPrXH4wfevVhum0umZ8/ZqIwmB/JTNb+80jy+qoX3fEF0GDgvymK2piVrTVDTWi x7OGBiN3jj6EvpyGpmVL638SHNlm4gLDN1BI6Kp7mIiAYT8bKj84dInIzMUcB3RIxn+X nOFzFe5D+0UiPjaeyU+X4ve+IMKC7tn7ZOJ/WU1guVcve22H+ymjBIrj+m4BN6NkZwzr rYTR+y19So3ceAh9aH0L0IvvvvqlvQbyb2Ho8guPO/WvXd802qIo7ZMmkQ0sCl3HtWXJ 24yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T1LpNwTb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn9si1236938edb.68.2021.01.15.04.52.42; Fri, 15 Jan 2021 04:53:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T1LpNwTb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733127AbhAOMt4 (ORCPT + 99 others); Fri, 15 Jan 2021 07:49:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:42934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbhAOMgW (ORCPT ); Fri, 15 Jan 2021 07:36:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id AF7DB221FA; Fri, 15 Jan 2021 12:36:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714167; bh=oYzQ0GpoPLA19Tqk2PUHYgiPOs3BgEpNVATYi51TYgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T1LpNwTb+i7SyO7egMRhRpMxlwnrGI57Q37HnzlMOAJmQ5gHXEXsGtWUWNhrKyH9B nLiRzrUPvsEF8QXKum9VwyyajrqGZld6CoajVd1d+fEFV6g8r2nprUq7J7acSS8BSK AU4l+vEAG3MQEE+i3iTsGM1pfMpwR42nBc5Ict5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , Huazhong Tan , "David S. Miller" Subject: [PATCH 5.10 014/103] net: hns3: fix incorrect handling of sctp6 rss tuple Date: Fri, 15 Jan 2021 13:27:07 +0100 Message-Id: <20210115122006.735771290@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115122006.047132306@linuxfoundation.org> References: <20210115122006.047132306@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen [ Upstream commit ab6e32d2913a594bc8f822ce4a75c400190b2ecc ] For DEVICE_VERSION_V2, the hardware only supports src-ip, dst-ip and verification-tag for rss tuple set of sctp6 packet. For DEVICE_VERSION_V3, the hardware supports src-port and dst-port as well. Currently, when user queries the sctp6 rss tuples info, some unsupported information will be showed on V2. So add a check for hardware version when initializing and queries sctp6 rss tuple to fix this issue. Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Jian Shen Signed-off-by: Huazhong Tan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 ++++-- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 2 ++ drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 9 ++++++--- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h | 2 ++ 4 files changed, 14 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -4484,8 +4484,8 @@ static int hclge_set_rss_tuple(struct hn req->ipv4_sctp_en = tuple_sets; break; case SCTP_V6_FLOW: - if ((nfc->data & RXH_L4_B_0_1) || - (nfc->data & RXH_L4_B_2_3)) + if (hdev->ae_dev->dev_version <= HNAE3_DEVICE_VERSION_V2 && + (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3))) return -EINVAL; req->ipv6_sctp_en = tuple_sets; @@ -4665,6 +4665,8 @@ static void hclge_rss_init_cfg(struct hc vport[i].rss_tuple_sets.ipv6_udp_en = HCLGE_RSS_INPUT_TUPLE_OTHER; vport[i].rss_tuple_sets.ipv6_sctp_en = + hdev->ae_dev->dev_version <= HNAE3_DEVICE_VERSION_V2 ? + HCLGE_RSS_INPUT_TUPLE_SCTP_NO_PORT : HCLGE_RSS_INPUT_TUPLE_SCTP; vport[i].rss_tuple_sets.ipv6_fragment_en = HCLGE_RSS_INPUT_TUPLE_OTHER; --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h @@ -105,6 +105,8 @@ #define HCLGE_D_IP_BIT BIT(2) #define HCLGE_S_IP_BIT BIT(3) #define HCLGE_V_TAG_BIT BIT(4) +#define HCLGE_RSS_INPUT_TUPLE_SCTP_NO_PORT \ + (HCLGE_D_IP_BIT | HCLGE_S_IP_BIT | HCLGE_V_TAG_BIT) #define HCLGE_RSS_TC_SIZE_0 1 #define HCLGE_RSS_TC_SIZE_1 2 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -901,8 +901,8 @@ static int hclgevf_set_rss_tuple(struct req->ipv4_sctp_en = tuple_sets; break; case SCTP_V6_FLOW: - if ((nfc->data & RXH_L4_B_0_1) || - (nfc->data & RXH_L4_B_2_3)) + if (hdev->ae_dev->dev_version <= HNAE3_DEVICE_VERSION_V2 && + (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3))) return -EINVAL; req->ipv6_sctp_en = tuple_sets; @@ -2481,7 +2481,10 @@ static void hclgevf_rss_init_cfg(struct tuple_sets->ipv4_fragment_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; tuple_sets->ipv6_tcp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; tuple_sets->ipv6_udp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; - tuple_sets->ipv6_sctp_en = HCLGEVF_RSS_INPUT_TUPLE_SCTP; + tuple_sets->ipv6_sctp_en = + hdev->ae_dev->dev_version <= HNAE3_DEVICE_VERSION_V2 ? + HCLGEVF_RSS_INPUT_TUPLE_SCTP_NO_PORT : + HCLGEVF_RSS_INPUT_TUPLE_SCTP; tuple_sets->ipv6_fragment_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; } --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h @@ -122,6 +122,8 @@ #define HCLGEVF_D_IP_BIT BIT(2) #define HCLGEVF_S_IP_BIT BIT(3) #define HCLGEVF_V_TAG_BIT BIT(4) +#define HCLGEVF_RSS_INPUT_TUPLE_SCTP_NO_PORT \ + (HCLGEVF_D_IP_BIT | HCLGEVF_S_IP_BIT | HCLGEVF_V_TAG_BIT) #define HCLGEVF_STATS_TIMER_INTERVAL 36U