Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp63734pxb; Thu, 30 Sep 2021 00:52:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqjV8ENoJhfOqKpNQburFa080x8TSY2YLFFCEdxeuz6VxjMC/2btqJsAwURhlwtXA0Fk7Q X-Received: by 2002:a17:906:5010:: with SMTP id s16mr5127854ejj.245.1632988343417; Thu, 30 Sep 2021 00:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632988343; cv=none; d=google.com; s=arc-20160816; b=eM7V5w+S7jJ1+1nDbG2sOKd6LRLAcPsPI8nGabPfy9iAv2ZZkZOK5a6Zffl+i5pc5o 7iMjvLQgENT9WCK3yLdcKDI5MejbD8sTxNihnJc4dr5KFUOdm4A3bca6Og+8PUAVImsr p+qJiwNRFB6kCDl5cCuGVVm5EPQNg4Ty9fKmO9fgEIkba63BYqVjVgnL681/jlpHz4OF R4LPcuSxqO62QgXgMKzrnyl5oesqXCMf0+kwTUIOF66ceNodXX8Aw4DMCpe4QuWzE5Yl 0cFRrl/ZQXWyuyNqKuxr+ZBGGjqQHKH3D68cRWr4kRtpKbuFQCKaKgC8H2mbo3lR+SJB m2Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=gSoBnMkQTswY52nYz2iI/aODHbXeX528Qd+fXADuu5k=; b=ehagetGZnAu/HUmH5uml2cjaBhEh7xPYFk9fXn9QXJNIHHUkToK0DYsFseO1exttC4 Y4cM2yo9irFEJsWurkh1atsMoyIelkVXSOcBBUbVolY5EIG9zUJlpZYt7xlj58sF3d+e TJHH06j+1PVufk00h8li3YzI1VMz3iQHPS+1tLlIHwz0uxX5JS+qsRufv6D0TKp2/9NC e6NDH6NDUhQh3VOuCRf3hzMpC+FrN8TsI58KLYEIeLVKbgkwPBmMQdE/A06NYhppEZnJ HMnf54trv0VV/RzBSeSzUcfSS4/+Y7MFPQZA0tKJ2Ka/Vmr7g5K9Tg5W5OFtM1OTWyMt Jckg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nc14si4547181ejc.445.2021.09.30.00.51.57; Thu, 30 Sep 2021 00:52:23 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348906AbhI3HwJ (ORCPT + 99 others); Thu, 30 Sep 2021 03:52:09 -0400 Received: from inva021.nxp.com ([92.121.34.21]:37148 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348701AbhI3HwB (ORCPT ); Thu, 30 Sep 2021 03:52:01 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id E8E7A2017C0; Thu, 30 Sep 2021 09:50:17 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B02532017D6; Thu, 30 Sep 2021 09:50:17 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 04A03183AC89; Thu, 30 Sep 2021 15:50:14 +0800 (+08) From: Xiaoliang Yang To: davem@davemloft.net, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: allan.nielsen@microchip.com, joergen.andreasen@microchip.com, UNGLinuxDriver@microchip.com, vinicius.gomes@intel.com, michael.chan@broadcom.com, vishal@chelsio.com, saeedm@mellanox.com, jiri@mellanox.com, idosch@mellanox.com, alexandre.belloni@bootlin.com, kuba@kernel.org, xiaoliang.yang_1@nxp.com, po.liu@nxp.com, vladimir.oltean@nxp.com, leoyang.li@nxp.com, f.fainelli@gmail.com, andrew@lunn.ch, vivien.didelot@gmail.com, claudiu.manoil@nxp.com, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com, horatiu.vultur@microchip.com Subject: [PATCH v6 net-next 3/8] net: mscc: ocelot: set vcap IS2 chain to goto PSFP chain Date: Thu, 30 Sep 2021 15:59:43 +0800 Message-Id: <20210930075948.36981-4-xiaoliang.yang_1@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210930075948.36981-1-xiaoliang.yang_1@nxp.com> References: <20210930075948.36981-1-xiaoliang.yang_1@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some chips in the ocelot series such as VSC9959 support Per-Stream Filtering and Policing(PSFP), which is processing after VCAP blocks. We set this block on chain 30000 and set vcap IS2 chain to goto PSFP chain if hardware support. Signed-off-by: Xiaoliang Yang Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/mscc/ocelot_flower.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethernet/mscc/ocelot_flower.c index 8b843d3c9189..ce812194e44c 100644 --- a/drivers/net/ethernet/mscc/ocelot_flower.c +++ b/drivers/net/ethernet/mscc/ocelot_flower.c @@ -20,6 +20,9 @@ (1 * VCAP_BLOCK + (lookup) * VCAP_LOOKUP) #define VCAP_IS2_CHAIN(lookup, pag) \ (2 * VCAP_BLOCK + (lookup) * VCAP_LOOKUP + (pag)) +/* PSFP chain and block ID */ +#define PSFP_BLOCK_ID OCELOT_NUM_VCAP_BLOCKS +#define OCELOT_PSFP_CHAIN (3 * VCAP_BLOCK) static int ocelot_chain_to_block(int chain, bool ingress) { @@ -46,6 +49,9 @@ static int ocelot_chain_to_block(int chain, bool ingress) if (chain == VCAP_IS2_CHAIN(lookup, pag)) return VCAP_IS2; + if (chain == OCELOT_PSFP_CHAIN) + return PSFP_BLOCK_ID; + return -EOPNOTSUPP; } @@ -84,7 +90,8 @@ static bool ocelot_is_goto_target_valid(int goto_target, int chain, goto_target == VCAP_IS1_CHAIN(1) || goto_target == VCAP_IS1_CHAIN(2) || goto_target == VCAP_IS2_CHAIN(0, 0) || - goto_target == VCAP_IS2_CHAIN(1, 0)); + goto_target == VCAP_IS2_CHAIN(1, 0) || + goto_target == OCELOT_PSFP_CHAIN); if (chain == VCAP_IS1_CHAIN(0)) return (goto_target == VCAP_IS1_CHAIN(1)); @@ -111,7 +118,11 @@ static bool ocelot_is_goto_target_valid(int goto_target, int chain, if (chain == VCAP_IS2_CHAIN(0, pag)) return (goto_target == VCAP_IS2_CHAIN(1, pag)); - /* VCAP IS2 lookup 1 cannot jump anywhere */ + /* VCAP IS2 lookup 1 can goto to PSFP block if hardware support */ + for (pag = 0; pag < VCAP_IS2_NUM_PAG; pag++) + if (chain == VCAP_IS2_CHAIN(1, pag)) + return (goto_target == OCELOT_PSFP_CHAIN); + return false; } @@ -353,7 +364,7 @@ static int ocelot_flower_parse_action(struct ocelot *ocelot, int port, if (filter->goto_target == -1) { if ((filter->block_id == VCAP_IS2 && filter->lookup == 1) || - chain == 0) { + chain == 0 || filter->block_id == PSFP_BLOCK_ID) { allow_missing_goto_target = true; } else { NL_SET_ERR_MSG_MOD(extack, "Missing GOTO action"); -- 2.17.1