From patchwork Mon Nov 20 05:51:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Ghosh X-Patchwork-Id: 166947 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1999007vqn; Sun, 19 Nov 2023 21:52:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHX+upG0zG+usVyA8Pr5lQxAWp/auU65Kzkm3ycPKse5N+f8fTrJoX9jcB66lhWh21dtgAr X-Received: by 2002:a05:6808:1888:b0:3b6:dd3c:5f78 with SMTP id bi8-20020a056808188800b003b6dd3c5f78mr7295958oib.44.1700459559856; Sun, 19 Nov 2023 21:52:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700459559; cv=none; d=google.com; s=arc-20160816; b=Mxs6NWRKyfFGHRmxk8Jclc61uSuDNuW513CmpeGkyROepFgmaiZj+cKYCDPNd3spM5 RwAa/v00yDVGvqe2ygtW+wDKtuNwXOiMvvYtTUWkpwkyadrCQMt1M0ephsn/YrsK/mpn 0Doubywfc+z1z9ShHt8Vc5VsxrfKjLww86R27+7Z5lsF91jtxqnHkrVu2rg5mk3zcFpY YtQ3x3E6yhj2/mOZg0V6VkF9kWU/9tmJbOQbGO7GqXr88aMZcaZzRICGu9b1tW+n0MLy TljxS2CSVozObDUjRcS2NA0KXw4rwWNqPr02A0sOAZFr7jgDLaQgYimdCVs0oAL0UYOu bvEQ== 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=S8dVyNkVOWEw+9SFPLtXKuGnffnZDVos0PuHKA1XzVc=; fh=LB7eT8vw2+vB8s433diJLOtRSPEOTPRz4ia3xZipBH0=; b=PHqFPTUh+ahRkXKPm4MXvJRjAsw8QsQ8lXE5XeV7XNGDC/HE7eJtwOX1cEeDi42zef Y1/98QVpQwG31aPD6JV1Qa7+8mt76VUPVuk23mt/IR0T5dmhkJP4ItHWlHXiRPj9IGXs 88//X/DvWZXmt9UPTfRjz7TeW5j7I/5Bo5GhTpLjUDdX3phVUGtZUr9b50VTLO/bulca rkJFZ6PqnyFIk6JDa/kARvp+wL24MLr2fPkEhMJJvgsQis83FVHvockX/aa+Tj2XUdg8 oQXW3tv0fkn5RATW1Qfw1h8uYyrJUP8E29bl+0Z70eG0dkfMLFBOo39HBbNAGbE8jF87 jBPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=ig2yUXIE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id z12-20020a63e10c000000b005bdbcff21f5si7472595pgh.501.2023.11.19.21.52.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 21:52:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=ig2yUXIE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 940958053C69; Sun, 19 Nov 2023 21:52:37 -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 S231920AbjKTFwD (ORCPT + 27 others); Mon, 20 Nov 2023 00:52:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbjKTFwC (ORCPT ); Mon, 20 Nov 2023 00:52:02 -0500 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94A27C5; Sun, 19 Nov 2023 21:51:59 -0800 (PST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AK2ixcu029495; Sun, 19 Nov 2023 21:51:47 -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=S8dVyNkVOWEw+9SFPLtXKuGnffnZDVos0PuHKA1XzVc=; b=ig2yUXIEbcBZOdRJcwPgLO2a8vU0j4qLNBfPi9MCyZ15Xgkv2tXITZ3S+AU5aSYuV8ce jPAwm14lSgb/EIbclkxHTVxE28rPblFAA7P2HbCWRXcluQWH2qKRznZQQ/6/2OfGWp/A Qkky5I3TNSrEXH0bxPE2MFAk0aHLOdoOkYNjhoE/hQQo6DW5FSpM4rKXUFLi/X788OVY c/MDBTscl/loNnpw2c+U0ps/ePIPrCLNDJFy+t8BxTQTl4ASsnr2t3w1GKY5ZLYcOaCr LdFWzMyd6N9MuhoOEI/8l9YvmqSFLSGwriGi7vovsDiEyItWyrmvyMKo2BhV6QnNxekZ 0A== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ueuguujya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 19 Nov 2023 21:51:47 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 19 Nov 2023 21:51:46 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sun, 19 Nov 2023 21:51:45 -0800 Received: from localhost.localdomain (unknown [10.28.36.166]) by maili.marvell.com (Postfix) with ESMTP id DF4BE3F7081; Sun, 19 Nov 2023 21:51:41 -0800 (PST) From: Suman Ghosh To: , , , , , , , , , , , , CC: Suman Ghosh Subject: [net PATCH] octeontx2-pf: Fix ntuple rule creation to direct packet to VF with higher Rx queue than its PF Date: Mon, 20 Nov 2023 11:21:38 +0530 Message-ID: <20231120055138.3602102-1-sumang@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-GUID: EHNlnzMSN3WlnvgNQPnBdJvH-4KyNsFc X-Proofpoint-ORIG-GUID: EHNlnzMSN3WlnvgNQPnBdJvH-4KyNsFc 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-20_03,2023-11-17_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]); Sun, 19 Nov 2023 21:52:37 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783061083223413847 X-GMAIL-MSGID: 1783061083223413847 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 --- .../marvell/octeontx2/nic/otx2_flows.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c index 4762dbea64a1..4200f2d387f6 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,9 +1101,26 @@ int otx2_add_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc) if (!(pfvf->flags & OTX2_FLAG_NTUPLE_SUPPORT)) return -ENOMEM; + /* 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) + goto bypass_queue_check; + if (ring >= pfvf->hw.rx_queues && fsp->ring_cookie != RX_CLS_FLOW_DISC) return -EINVAL; +bypass_queue_check: if (fsp->location >= otx2_get_maxflows(flow_cfg)) return -EINVAL; @@ -1182,6 +1200,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; }