From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 15C0C42383; Tue, 10 Jan 2023 16:44:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90F1C40A8B; Tue, 10 Jan 2023 16:44:35 +0100 (CET) Received: from mail-vs1-f49.google.com (mail-vs1-f49.google.com [209.85.217.49]) by mails.dpdk.org (Postfix) with ESMTP id 76C0740687 for ; Tue, 10 Jan 2023 16:44:33 +0100 (CET) Received: by mail-vs1-f49.google.com with SMTP id n190so8777689vsc.11 for ; Tue, 10 Jan 2023 07:44:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=YJLwPAwWnUkJYFEke6sy9NLJszPQwJfqL1f2RhD7e8c=; b=GhrlohAeo0NmoROgeqzeODhLRyR2f37gUcZxUm299U8wXPu9bbWE0LebWtgEyvYTgf buKf0tB1QPFhpq1Et6TGd1KEBbYtFielBKKT5/RTnidnrUDra1x2BaO73ltckHzoHhP+ 1XxWb2jn491L8LEVlbP7yQf9oxvIzU6mGNYgGIpFoVte81VJQ4UY1kgM9nh7PVR6Hsda 3GLbp9wn4IvKCf8PNNo7q3Kl/GfqjFqIqz5kKFd7eiTMDlpvoNjqPN4DSDMd0YJNqDRI KkKOQn9Dz9tLJapZQM7l00tHyWF3qG3R8sg59HDFze/LiKi88xHGRH69i1MxZPym4+an LiXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YJLwPAwWnUkJYFEke6sy9NLJszPQwJfqL1f2RhD7e8c=; b=oqOBJ9wE9taPzRggM3pV0PpRs+KYN6VaL4M4h0r54qpnrg7xFFBbmLgPGgx1eN2xFR iKE8qJz46GVDvh5wyZYNB5df3H78stELUNXLDK0UHLGf+BhyfCYqS5SjCT8K+09ALgCX ooHoNS7HnMetD6iUnMBvHgFihoCVQT3fQhuBYunqPjeHmZX4Qak5vsWdyI7eJQC3wgWX 74opbNVaI6B70+MIIFhUjt5EehV1UTSIpRpsj8i0zDFJJYIz1UiKEBudQ2Xi3ddlSwTm yx4MPS7NCmK3tjV4rY0UoA3OPP21aHvn/oBdLVNODOmYZWH4gi1bbJqfVTSWumcwHZ4i RORg== X-Gm-Message-State: AFqh2ko/uIUA9mVgTa3IMhLN3e8SjIKnAwJJYLaEvki/RbBIHN/8ZUmS QKL7sOLq+zFjzFhwYGhwpjn/wyII2c94DLw/DVQBayHhBgtJpQ== X-Google-Smtp-Source: AMrXdXsl5kBgDef19cT2h0CNSjdASjiR33B7F8kkt3rIRmP+RXMW+0YR5KUr+emDY3kjQ6GAv7maDWS/sfLBx6Kn+FM= X-Received: by 2002:a05:6102:3e1a:b0:3d0:c091:87c8 with SMTP id j26-20020a0561023e1a00b003d0c09187c8mr735873vsv.31.1673365472683; Tue, 10 Jan 2023 07:44:32 -0800 (PST) MIME-Version: 1.0 References: <20221201040703.2977551-1-psatheesh@marvell.com> In-Reply-To: <20221201040703.2977551-1-psatheesh@marvell.com> From: Jerin Jacob Date: Tue, 10 Jan 2023 21:14:06 +0530 Message-ID: Subject: Re: [dpdk-dev] [PATCH] common/cnxk: mask LA ltype for second pass for cnxk To: psatheesh@marvell.com Cc: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , dev@dpdk.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Dec 1, 2022 at 9:37 AM wrote: > > From: Kiran Kumar K > > While installing flow rule, if user provide item type > as RTE_FLOW_ITEM_TYPE_ETH, it should be applied to both > first and second pass. Adding changes to mask the ltype > to match both. > > Signed-off-by: Kiran Kumar K > Reviewed-by: Satheesh Paul Updated the git commit as follows and applied to dpdk-next-net-mrvl/for-next-net. Thanks common/cnxk: mask LA layer type for second pass packet While installing flow rule, if user provide item type as RTE_FLOW_ITEM_TYPE_ETH, it should be applied to both first and second pass. Adding changes to mask the layer type to match both. Signed-off-by: Kiran Kumar K Reviewed-by: Satheesh Paul > --- > drivers/common/cnxk/roc_npc_mcam.c | 29 +++++++++++++++++++++++------ > drivers/common/cnxk/roc_npc_parse.c | 1 + > drivers/common/cnxk/roc_npc_priv.h | 1 + > 3 files changed, 25 insertions(+), 6 deletions(-) > > diff --git a/drivers/common/cnxk/roc_npc_mcam.c b/drivers/common/cnxk/roc_npc_mcam.c > index a725cabc57..526a6d1579 100644 > --- a/drivers/common/cnxk/roc_npc_mcam.c > +++ b/drivers/common/cnxk/roc_npc_mcam.c > @@ -551,6 +551,8 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow, > struct idev_cfg *idev; > uint16_t pf_func = 0; > uint16_t ctr = ~(0); > + uint32_t la_offset; > + uint64_t mask; > int rc, idx; > int entry; > > @@ -617,17 +619,32 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow, > flow->npc_action &= ~(GENMASK(19, 4)); > flow->npc_action |= (uint64_t)pf_func << 4; > > - npc_mcam_set_channel(flow, req, inl_dev->channel, > - inl_dev->chan_mask, false); > + npc_mcam_set_channel(flow, req, inl_dev->channel, inl_dev->chan_mask, > + false); > } else if (npc->is_sdp_link) { > - npc_mcam_set_channel(flow, req, npc->sdp_channel, > - npc->sdp_channel_mask, > + npc_mcam_set_channel(flow, req, npc->sdp_channel, npc->sdp_channel_mask, > pst->is_second_pass_rule); > } else { > - npc_mcam_set_channel(flow, req, npc->channel, > - (BIT_ULL(12) - 1), > + npc_mcam_set_channel(flow, req, npc->channel, (BIT_ULL(12) - 1), > pst->is_second_pass_rule); > } > + /* Always match both 1st pass and 2nd pass ltypes for all rules */ > + if (!pst->is_second_pass_rule && pst->has_eth_type) { > + la_offset = __builtin_popcount(npc->keyx_supp_nmask[flow->nix_intf] & > + ((1ULL << 9 /* LA offset */) - 1)); > + la_offset *= 4; > + > + mask = ~((0xfULL << la_offset)); > + /* Mask ltype ETHER (0x2) and CPT_HDR (0xa) */ > + req->entry_data.kw[0] &= mask; > + req->entry_data.kw_mask[0] &= mask; > + req->entry_data.kw[0] |= (0x2ULL << la_offset); > + req->entry_data.kw_mask[0] |= (0x7ULL << la_offset); > + flow->mcam_data[0] &= mask; > + flow->mcam_mask[0] &= mask; > + flow->mcam_data[0] |= (0x2ULL << la_offset); > + flow->mcam_mask[0] |= (0x7ULL << la_offset); > + } > } else { > uint16_t pf_func = (flow->npc_action >> 4) & 0xffff; > > diff --git a/drivers/common/cnxk/roc_npc_parse.c b/drivers/common/cnxk/roc_npc_parse.c > index ff00c746d6..947e1ec53d 100644 > --- a/drivers/common/cnxk/roc_npc_parse.c > +++ b/drivers/common/cnxk/roc_npc_parse.c > @@ -193,6 +193,7 @@ npc_parse_la(struct npc_parse_state *pst) > if (pst->pattern->type != ROC_NPC_ITEM_TYPE_ETH) > return 0; > > + pst->has_eth_type = true; > eth_item = pst->pattern->spec; > > lid = NPC_LID_LA; > diff --git a/drivers/common/cnxk/roc_npc_priv.h b/drivers/common/cnxk/roc_npc_priv.h > index 1a597280d1..09a727b13e 100644 > --- a/drivers/common/cnxk/roc_npc_priv.h > +++ b/drivers/common/cnxk/roc_npc_priv.h > @@ -196,6 +196,7 @@ struct npc_parse_state { > bool set_vlan_ltype_mask; > bool set_ipv6ext_ltype_mask; > bool is_second_pass_rule; > + bool has_eth_type; > }; > > enum npc_kpu_parser_flag { > -- > 2.35.3 >