From patchwork Tue Nov 21 16:56:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Ghosh X-Patchwork-Id: 167829 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp763487vqb; Tue, 21 Nov 2023 08:57:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IG46Yad5cdnVO5H7ZaZSSxTKd4cGCXn1FX3q2y9cvOafLJn6aIQRAe+aTnvUA21HutlHSgk X-Received: by 2002:a17:902:f68d:b0:1cf:6787:6ed9 with SMTP id l13-20020a170902f68d00b001cf67876ed9mr5053754plg.17.1700585829402; Tue, 21 Nov 2023 08:57:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700585829; cv=none; d=google.com; s=arc-20160816; b=mMljNPlOnu/NfopyCPO6Ez/X7rtxuGFTjBeeRV3HLN9bhQUUZ9xduEaG0RoM6Ph4Jq IML+dilkie91Sr/mr26LzgvYL1Ntr5Ab2oxhx2lNJiJTOeMQw8gdgonpXMxTnKCF8B9y Ljb67S4UrxRP2uezmtPEYmGSOAUWG0G2WWq19BJgsqFV1yCqC6GL9pfcos62Xlr3pGtw U9HxH2Yww/OIRiSLbSahQbeXvLj94ZNSCQtKXZGLYYbqWOLMqnhGu+ZXLcHoUxeHuVrB eCI8i1qxz7Nn7j2ukjQ8R9WS7Ota5BpFZTGh/2r6zYMCa/vrAfAs1AdM0yoF0pUyT7vd tTNg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=8etlXbF3LquEpSBVzWF1QWiK8n94DXI6bzbKmMyzZO8=; fh=hUbLtFg1vOwetDgf3vshS7p5Zngv9QT07S0/2ium41Y=; b=0Txmrz/xmOJbKVDYjTM94v00s1CQyb4DKp0Bj3A3BYYfj9sYzwAf7Def9971EJx8WJ Mvb93g8X/8MBVkgYURr+uv28H0lSbKyf1jAADXidV7rmBi1/S9vbKIyi3OvUwaEXewKV N96lCbm3m6fNMJ79ZJqhKc5K+FYf0Jv9sC0n6sH2v9/4cpm0FL2RI0IDhyA18DwaoJoc i4SH/PmMDQcTbdRcurBzG0cxD6yxWYAdgcpYLsU6OqbvXQdlxIr5TOWbXor9Hw5iNZkS cQKWsolZbwIbe7v/gV4y2BBzkNYMPhYex8mHyzyxO1WTvNzlnFk1M/UP5qDCn4xHWx/f Pdpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=BPBZdqwo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id t2-20020a170902bc4200b001cf641feed4si3695404plz.446.2023.11.21.08.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 08:57:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=BPBZdqwo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id F15C38027F52; Tue, 21 Nov 2023 08:57:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230399AbjKUQ5E (ORCPT + 99 others); Tue, 21 Nov 2023 11:57:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230340AbjKUQ5C (ORCPT ); Tue, 21 Nov 2023 11:57:02 -0500 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69F69191; Tue, 21 Nov 2023 08:56:57 -0800 (PST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ALG4vrG014135; Tue, 21 Nov 2023 08:56:48 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=8etlXbF3LquEpSBVzWF1QWiK8n94DXI6bzbKmMyzZO8=; b=BPBZdqwo51wIGkTYYLrEQxMN4lJT4TkCLrOjMVuGABHve/9J0MOKb+ayjOHAGMpktHFT rLUy2TFF/ZpAJuzqUgjiTkBtCwRWf2wWDpcvQaSIqJXxtTdNS0uKndy1zV9RKo41lukt M9rynanRWZ4JT3JoAXRgl/1uyHF26XYM4hOF7ey0Z1bLGw4YWz3mMUycGz+T0R55iZIk 3Du3yTsBOafx6d/p3Rl02dkVgkKE5Ol/kppyAsGMPeRIYJuh3Ceo77h9JI0uUU3kcdxS ptetRLe1JkDRLViIa7jvOhBChDsoSX8/de55s5kON7XYdXAP0xcl9jjP7KYIcLd5qxXT XA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3uewnw1qe7-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 21 Nov 2023 08:56:48 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 21 Nov 2023 08:56:31 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 21 Nov 2023 08:56:31 -0800 Received: from localhost.localdomain (unknown [10.28.36.166]) by maili.marvell.com (Postfix) with ESMTP id 655F93F7082; Tue, 21 Nov 2023 08:56:27 -0800 (PST) From: Suman Ghosh To: , , , , , , , , , , , , , CC: Suman Ghosh Subject: [net PATCH v2] octeontx2-pf: Fix ntuple rule creation to direct packet to VF with higher Rx queue than its PF Date: Tue, 21 Nov 2023 22:26:24 +0530 Message-ID: <20231121165624.3664182-1-sumang@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-GUID: bbFYwpA2hPiJ8KtBot0En0xNdVGK_eKx X-Proofpoint-ORIG-GUID: bbFYwpA2hPiJ8KtBot0En0xNdVGK_eKx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-21_10,2023-11-21_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 21 Nov 2023 08:57:03 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783061083223413847 X-GMAIL-MSGID: 1783193486662163934 It is possible to add a ntuple rule which would like to direct packet to a VF whose number of queues are greater/less than its PF's queue numbers. For example a PF can have 2 Rx queues but a VF created on that PF can have 8 Rx queues. As of today, ntuple rule will reject rule because it is checking the requested queue number against PF's number of Rx queues. As a part of this fix if the action of a ntuple rule is to move a packet to a VF's queue then the check is removed. Also, a debug information is printed to aware user that it is user's responsibility to cross check if the requested queue number on that VF is a valid one. Fixes: f0a1913f8a6f ("octeontx2-pf: Add support for ethtool ntuple filters") Signed-off-by: Suman Ghosh Reviewed-by: Wojciech Drewek Reviewed-by: Simon Horman --- v2 changes: - Removed 'goto' and added the new condition to existing if check. .../marvell/octeontx2/nic/otx2_flows.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c index 4762dbea64a1..97a71e9b8563 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c @@ -1088,6 +1088,7 @@ int otx2_add_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc) struct ethhdr *eth_hdr; bool new = false; int err = 0; + u64 vf_num; u32 ring; if (!flow_cfg->max_flows) { @@ -1100,7 +1101,21 @@ int otx2_add_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc) if (!(pfvf->flags & OTX2_FLAG_NTUPLE_SUPPORT)) return -ENOMEM; - if (ring >= pfvf->hw.rx_queues && fsp->ring_cookie != RX_CLS_FLOW_DISC) + /* Number of queues on a VF can be greater or less than + * the PF's queue. Hence no need to check for the + * queue count. Hence no need to check queue count if PF + * is installing for its VF. Below is the expected vf_num value + * based on the ethtool commands. + * + * e.g. + * 1. ethtool -U ... action -1 ==> vf_num:255 + * 2. ethtool -U ... action ==> vf_num:0 + * 3. ethtool -U ... vf queue ==> + * vf_num:vf_idx+1 + */ + vf_num = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie); + if (!is_otx2_vf(pfvf->pcifunc) && !vf_num && + ring >= pfvf->hw.rx_queues && fsp->ring_cookie != RX_CLS_FLOW_DISC) return -EINVAL; if (fsp->location >= otx2_get_maxflows(flow_cfg)) @@ -1182,6 +1197,9 @@ int otx2_add_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc) flow_cfg->nr_flows++; } + if (flow->is_vf) + netdev_info(pfvf->netdev, + "Make sure that VF's queue number is within its queue limit\n"); return 0; }