Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp625843pxb; Thu, 12 Nov 2020 12:04:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgLGwqO+pF18Xj2BmeVurBveXRVdLqT5NoroOrocZqC3wZsGpFVftt1kJ4ObCD9uGvAaKI X-Received: by 2002:a50:e705:: with SMTP id a5mr1661466edn.29.1605211479319; Thu, 12 Nov 2020 12:04:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605211479; cv=none; d=google.com; s=arc-20160816; b=QpipEMdPELGuBeIeH0fnA3RDC9tJ2ltpFMagnMTBQnxbIhQM+R+NrpcoBKfGof9gkD YI13yQ1PWgjv1KiqdhxB/2iswbjl+mzRhwUXNGbmr/WkIM98fGvCQTdGFWGZV6I630n7 qOj6qKRP1xi+XAFlqUMgxaZJUamYgegYzm/bY5kYBlRtbh84LPfD8RGT1goX1IgXgElR fvusKVpombbaFYP5sffnS3qn9IGjTO+6R7u1BLG7fRUKQrS5gLe7kIDt4hMpgLhJlDz1 9mArqhiTfbEweaLSrYrgb1Rb1v31OiYJPhUo86izSGRICrbBsEW6g82DfYNGzhOcyY8X LZ9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AF4OkJVFDnImMNJP1h9DKgAEggI96n+VpJtZTsS6eSo=; b=uAqbXWDsZNA2k7+TeW6owP+/u/O2MAN1FJkEESYm4mAE4/o7PHRGy4G2vfIksD34HE n6Jq0bmAU+U0Pp4AFyK8xm1ocOui0KsXfEnRP5KNfDIfDqe1VA4/znn6LWisFiGTllhn Q1VN+AI18fbIgt7ns8eo9Y9FD9oOtSEBDO31n48WACxzWkmabkUTLOYuAzrWg5jXFg1V hax7mNlbWNblk9z1cXmuNnvYulXiVKtU3DBYNeElb09EgJP/dlIDBmBFY4fVyXOAfciq P4wguZbGilvYDR3CUhPNwDfgaWJ03vzuahK6UgrRJ9BnjmcGS7PreSk8oEuWvd/aLdSd bkbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="IW/asP/l"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t8si4751781edj.6.2020.11.12.12.04.15; Thu, 12 Nov 2020 12:04:39 -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=@gmail.com header.s=20161025 header.b="IW/asP/l"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727045AbgKLUCO (ORCPT + 99 others); Thu, 12 Nov 2020 15:02:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726868AbgKLUCN (ORCPT ); Thu, 12 Nov 2020 15:02:13 -0500 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45837C0613D1; Thu, 12 Nov 2020 12:02:13 -0800 (PST) Received: by mail-io1-xd43.google.com with SMTP id o11so7338521ioo.11; Thu, 12 Nov 2020 12:02:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AF4OkJVFDnImMNJP1h9DKgAEggI96n+VpJtZTsS6eSo=; b=IW/asP/lBn4FK8Sy11uUcIEtwsoqiHCCaGvjP5Erz54fDHscKlwvtbPiMtMUT4UyCH ekIQ7KQv9uphLHAyVgOI/xDQtBPRDMLFn3Jg8xqWYmXpQRBCK2jN4QM0hbzCqT5S5Jmj aA+NlpbGIrkNPIqBTfjd2bLtfuwq1Qzs9In3u4fiHf4xl5FNY/JTzxqV7+EINcwBx7qb vmQ9vDVQv7EVPe2vaXA+t08XySe3Zbkw15KnYvvciyAtAbhXJt9dNLfokbf4r7Ehrz+C s7rQMylghl1ISbYgSOmSfzH45OjlpujEF00nme8fcMce6dMRNgCOhv2rjaRhhlc1iC+a MM7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AF4OkJVFDnImMNJP1h9DKgAEggI96n+VpJtZTsS6eSo=; b=PxzUrPrD+TvKL+bIm2d293KWDyHl4iNNufcCf/LhoNQS5l7DStjdgF0QHBach0yMey fszShXDGO/p2gWMvSXYMGj6Q0yBtSzZF/vrYpOuG+62XC4UGF8aXt0fqmoREJo3QVLUe 5jGwOtXuSsbaTeVd1apniMNu0cuKqQZv9f/lm7uI3pzfW3TERCd08CM04suJiSWcjFKI z7aPBA8I8VKugcJNJJ6HP8MUGK6xvqIA0eM2oFXkeEaIFx/W9xO5KZqVjIMoKbJrhoeY y3+hXpfRIgv8Z6IkkCvtv2WGnQo77D85ozWyuJ6tX8E0Mf6q/WdvPXfdQjJyBrh4nsxV k5bw== X-Gm-Message-State: AOAM531SHuhd0heoMIbHwA9262nX2OLAwkd5B0dcqDVsILkxBACnvIrN C8ozx9j7v1C9p7yfbWI3/Tbnb1ASmjfgAqKJRwEsnXpM8a0= X-Received: by 2002:a6b:780b:: with SMTP id j11mr624752iom.5.1605211332457; Thu, 12 Nov 2020 12:02:12 -0800 (PST) MIME-Version: 1.0 References: <20201111071404.29620-1-naveenm@marvell.com> <20201111071404.29620-2-naveenm@marvell.com> In-Reply-To: <20201111071404.29620-2-naveenm@marvell.com> From: Alexander Duyck Date: Thu, 12 Nov 2020 12:02:01 -0800 Message-ID: Subject: Re: [PATCH v3 net-next 01/13] octeontx2-af: Modify default KEX profile to extract TX packet fields To: Naveen Mamindlapalli Cc: Netdev , LKML , Jakub Kicinski , David Miller , saeed@kernel.org, sgoutham@marvell.com, lcherian@marvell.com, gakula@marvell.com, jerinj@marvell.com, sbhatta@marvell.com, hkelam@marvell.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 11:22 PM Naveen Mamindlapalli wrote: > > From: Stanislaw Kardach > > The current default Key Extraction(KEX) profile can only use RX > packet fields while generating the MCAM search key. The profile > can't be used for matching TX packet fields. This patch modifies > the default KEX profile to add support for extracting TX packet > fields into MCAM search key. Enabled Tx KPU packet parsing by > configuring TX PKIND in tx_parse_cfg. > > Also modified the default KEX profile to extract VLAN TCI from > the LB_PTR and exact byte offset of VLAN header. The NPC KPU > parser was modified to point LB_PTR to the starting byte offset > of VLAN header which points to the tpid field. > > Signed-off-by: Stanislaw Kardach > Signed-off-by: Sunil Goutham > Signed-off-by: Naveen Mamindlapalli A bit more documentation would be useful. However other than that the code itself appears to make sense. Reviewed-by: Alexander Duyck > --- > .../ethernet/marvell/octeontx2/af/npc_profile.h | 71 ++++++++++++++++++++-- > .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 6 ++ > 2 files changed, 72 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h b/drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h > index 199448610e3e..c5b13385c81d 100644 > --- a/drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h > +++ b/drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h > @@ -13386,8 +13386,8 @@ static struct npc_mcam_kex npc_mkex_default = { > .kpu_version = NPC_KPU_PROFILE_VER, > .keyx_cfg = { > /* nibble: LA..LE (ltype only) + Channel */ > - [NIX_INTF_RX] = ((u64)NPC_MCAM_KEY_X2 << 32) | 0x49247, > - [NIX_INTF_TX] = ((u64)NPC_MCAM_KEY_X2 << 32) | ((1ULL << 19) - 1), > + [NIX_INTF_RX] = ((u64)NPC_MCAM_KEY_X2 << 32) | 0x249207, > + [NIX_INTF_TX] = ((u64)NPC_MCAM_KEY_X2 << 32) | 0x249200, > }, > .intf_lid_lt_ld = { > /* Default RX MCAM KEX profile */ // Any sort of explanation for what some of these magic numbers means might be useful. I'm left wondering if the lower 32b is a bitfield or a fixed value. I am guessing bit field based on the fact that it was originally being set using ((1ULL << X) - 1) however if there were macros defined for each bit explaining what each bit was that would be useful. > @@ -13405,12 +13405,14 @@ static struct npc_mcam_kex npc_mkex_default = { > /* Layer B: Single VLAN (CTAG) */ > /* CTAG VLAN[2..3] + Ethertype, 4 bytes, KW0[63:32] */ > [NPC_LT_LB_CTAG] = { > - KEX_LD_CFG(0x03, 0x0, 0x1, 0x0, 0x4), > + KEX_LD_CFG(0x03, 0x2, 0x1, 0x0, 0x4), > }, Similarly here some explanation for KEX_LD_CFG would be useful. From what I can tell it seems like this may be some sort of fix as you are adjusting the "hdr_ofs" field from 0 to 2. > /* Layer B: Stacked VLAN (STAG|QinQ) */ > [NPC_LT_LB_STAG_QINQ] = { > - /* CTAG VLAN[2..3] + Ethertype, 4 bytes, KW0[63:32] */ > - KEX_LD_CFG(0x03, 0x4, 0x1, 0x0, 0x4), > + /* Outer VLAN: 2 bytes, KW0[63:48] */ > + KEX_LD_CFG(0x01, 0x2, 0x1, 0x0, 0x6), > + /* Ethertype: 2 bytes, KW0[47:32] */ > + KEX_LD_CFG(0x01, 0x8, 0x1, 0x0, 0x4), Just to confirm, are you matching up the outer VLAN with the inner Ethertype here? It seems like an odd combination. I assume you need the inner ethertype in order to identify the L3 traffic? > }, > [NPC_LT_LB_FDSA] = { > /* SWITCH PORT: 1 byte, KW0[63:48] */ > @@ -13450,6 +13452,65 @@ static struct npc_mcam_kex npc_mkex_default = { > }, > }, > }, > + > + /* Default TX MCAM KEX profile */ > + [NIX_INTF_TX] = { > + [NPC_LID_LA] = { > + /* Layer A: Ethernet: */ > + [NPC_LT_LA_IH_NIX_ETHER] = { > + /* PF_FUNC: 2B , KW0 [47:32] */ > + KEX_LD_CFG(0x01, 0x0, 0x1, 0x0, 0x4), I'm assuming you have an 8B internal header that is being parsed? A comment explaining that this is parsing a preamble that is at the start of things might be useful. > + /* DMAC: 6 bytes, KW1[63:16] */ > + KEX_LD_CFG(0x05, 0x8, 0x1, 0x0, 0xa), > + }, > + }, > + [NPC_LID_LB] = { > + /* Layer B: Single VLAN (CTAG) */ > + [NPC_LT_LB_CTAG] = { > + /* CTAG VLAN[2..3] KW0[63:48] */ > + KEX_LD_CFG(0x01, 0x2, 0x1, 0x0, 0x6), > + /* CTAG VLAN[2..3] KW1[15:0] */ > + KEX_LD_CFG(0x01, 0x4, 0x1, 0x0, 0x8), > + }, > + /* Layer B: Stacked VLAN (STAG|QinQ) */ > + [NPC_LT_LB_STAG_QINQ] = { > + /* Outer VLAN: 2 bytes, KW0[63:48] */ > + KEX_LD_CFG(0x01, 0x2, 0x1, 0x0, 0x6), > + /* Outer VLAN: 2 Bytes, KW1[15:0] */ > + KEX_LD_CFG(0x01, 0x8, 0x1, 0x0, 0x8), > + }, > + }, > + [NPC_LID_LC] = { > + /* Layer C: IPv4 */ > + [NPC_LT_LC_IP] = { > + /* SIP+DIP: 8 bytes, KW2[63:0] */ > + KEX_LD_CFG(0x07, 0xc, 0x1, 0x0, 0x10), > + /* TOS: 1 byte, KW1[63:56] */ > + KEX_LD_CFG(0x0, 0x1, 0x1, 0x0, 0xf), > + }, > + /* Layer C: IPv6 */ > + [NPC_LT_LC_IP6] = { > + /* Everything up to SADDR: 8 bytes, KW2[63:0] */ > + KEX_LD_CFG(0x07, 0x0, 0x1, 0x0, 0x10), > + }, > + }, > + [NPC_LID_LD] = { > + /* Layer D:UDP */ > + [NPC_LT_LD_UDP] = { > + /* SPORT: 2 bytes, KW3[15:0] */ > + KEX_LD_CFG(0x1, 0x0, 0x1, 0x0, 0x18), > + /* DPORT: 2 bytes, KW3[31:16] */ > + KEX_LD_CFG(0x1, 0x2, 0x1, 0x0, 0x1a), I am curious why this is being done as two pieces instead of just one. From what I can tell you could just have a single rule that copies the 4 bytes for both ports in one shot and they would end up in the same place wouldn't they? > + }, > + /* Layer D:TCP */ > + [NPC_LT_LD_TCP] = { > + /* SPORT: 2 bytes, KW3[15:0] */ > + KEX_LD_CFG(0x1, 0x0, 0x1, 0x0, 0x18), > + /* DPORT: 2 bytes, KW3[31:16] */ > + KEX_LD_CFG(0x1, 0x2, 0x1, 0x0, 0x1a), > + }, > + }, > + }, > }, > }; > > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c > index 8bac1dd3a1c2..8c11abdbd9d1 100644 > --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c > +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c > @@ -57,6 +57,8 @@ enum nix_makr_fmt_indexes { > NIX_MARK_CFG_MAX, > }; > > +#define NIX_TX_PKIND 63ULL > + A comment explaining the magic number would be useful. From what I can tell this looks like a "just turn everything on" sort of config where you are enabling bit flags 0 - 5. > /* For now considering MC resources needed for broadcast > * pkt replication only. i.e 256 HWVFs + 12 PFs. > */ > @@ -1182,6 +1184,10 @@ int rvu_mbox_handler_nix_lf_alloc(struct rvu *rvu, > /* Config Rx pkt length, csum checks and apad enable / disable */ > rvu_write64(rvu, blkaddr, NIX_AF_LFX_RX_CFG(nixlf), req->rx_cfg); > > + /* Configure pkind for TX parse config, 63 from npc_profile */ > + cfg = NIX_TX_PKIND; > + rvu_write64(rvu, blkaddr, NIX_AF_LFX_TX_PARSE_CFG(nixlf), cfg); > + > intf = is_afvf(pcifunc) ? NIX_INTF_TYPE_LBK : NIX_INTF_TYPE_CGX; > err = nix_interface_init(rvu, pcifunc, intf, nixlf); > if (err) > -- > 2.16.5 >