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 E9F3345BB3; Wed, 23 Oct 2024 17:02:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 662A442E59; Wed, 23 Oct 2024 17:02:13 +0200 (CEST) Received: from mx0a-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id B972442E00 for ; Wed, 23 Oct 2024 17:02:11 +0200 (CEST) Received: from pps.filterd (m0431384.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49NASSqm001774 for ; Wed, 23 Oct 2024 08:02:11 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=X 1Yi98y1/rw/MobDVWLQj4jp/onvSm86XMdhLGjTJcE=; b=lMZhZkHkAiXYNwaMX wzK9kKsdSM0gdijprv2Bi6kVs+wewkQeLwUDT/+0q963xCAZLctrDE0+TkPk+mIw 8PpwTunVK0PhIuhhjQvY4rCFYWEAusbvQAWiCFkFxltb7ji/L1iP2zozSQqht92V tagTJD+47EB/YDwjJDYbjMXIr+BVPsTXNxa7YX44I3BoCebbKPyTfkEmppK0pBYA eCwA7S6YpsLBqAjGjtwcdbdjHDKu+XAN6qoIHE+tTInW0qeyzqMSUHy0u/ddCnBj jUd34ltkPrmnyAxrWARQbFNR6Mon7OBQoJxee+Q0CCEF4OsVmLsgqrTRNMDEyHV2 vu3zg== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 42eydy8mnj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 23 Oct 2024 08:02:10 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 23 Oct 2024 08:02:09 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 23 Oct 2024 08:02:09 -0700 Received: from localhost.localdomain (unknown [10.29.52.211]) by maili.marvell.com (Postfix) with ESMTP id ECD1E3F7069; Wed, 23 Oct 2024 08:02:06 -0700 (PDT) From: Harman Kalra To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra CC: Subject: [PATCH 7/8] common/cnxk: update representee RSS rule via PF Date: Wed, 23 Oct 2024 20:31:41 +0530 Message-ID: <20241023150143.113877-7-hkalra@marvell.com> X-Mailer: git-send-email 2.46.0.469.g4590f2e941 In-Reply-To: <20241023150143.113877-1-hkalra@marvell.com> References: <20241023150143.113877-1-hkalra@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: J8e0U15nJLHGfayfUODy42eEiLpiHMBy X-Proofpoint-ORIG-GUID: J8e0U15nJLHGfayfUODy42eEiLpiHMBy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.687,Hydra:6.0.235,FMLib:17.0.607.475 definitions=2020-10-13_15,2020-10-13_02,2020-04-07_01 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 Adding support to update representee's RSS rule via PF ports. Before updating the rule strict validation to check if requested representee is part of PF port. Signed-off-by: Harman Kalra --- drivers/common/cnxk/roc_eswitch.c | 11 ++++++++ drivers/common/cnxk/roc_eswitch.h | 3 ++ drivers/common/cnxk/roc_nix_priv.h | 8 ++++++ drivers/common/cnxk/roc_nix_rss.c | 45 ++++++++++++++++++++++-------- drivers/common/cnxk/roc_npc.c | 23 ++++++++------- drivers/common/cnxk/roc_npc.h | 1 + drivers/common/cnxk/roc_npc_priv.h | 3 +- drivers/common/cnxk/version.map | 1 + 8 files changed, 72 insertions(+), 23 deletions(-) diff --git a/drivers/common/cnxk/roc_eswitch.c b/drivers/common/cnxk/roc_eswitch.c index c67b4090a5..6cae459065 100644 --- a/drivers/common/cnxk/roc_eswitch.c +++ b/drivers/common/cnxk/roc_eswitch.c @@ -387,3 +387,14 @@ roc_eswitch_nix_repte_stats(struct roc_nix *roc_nix, uint16_t pf_func, struct ro mbox_put(mbox); return rc; } + +int +roc_eswitch_is_repte_pfs_vf(uint16_t rep_pffunc, uint16_t pf_pffunc) +{ + uint16_t rep_pf = dev_get_pf(rep_pffunc); + + if (roc_model_is_cn20k()) + return ((rep_pf << RVU_PFVF_PF_SHIFT_CN20K) == pf_pffunc); + else + return ((rep_pf << RVU_PFVF_PF_SHIFT) == pf_pffunc); +} diff --git a/drivers/common/cnxk/roc_eswitch.h b/drivers/common/cnxk/roc_eswitch.h index 45400ae77a..5e4ba5d72a 100644 --- a/drivers/common/cnxk/roc_eswitch.h +++ b/drivers/common/cnxk/roc_eswitch.h @@ -43,6 +43,9 @@ struct roc_eswitch_repte_notify_msg { typedef int (*process_repte_notify_t)(void *roc_nix, struct roc_eswitch_repte_notify_msg *notify_msg); +/* Generic */ +int __roc_api roc_eswitch_is_repte_pfs_vf(uint16_t rep_pffunc, uint16_t pf_pffunc); + /* NPC */ int __roc_api roc_eswitch_npc_mcam_rx_rule(struct roc_npc *roc_npc, struct roc_npc_flow *flow, uint16_t pcifunc, uint16_t vlan_tci, diff --git a/drivers/common/cnxk/roc_nix_priv.h b/drivers/common/cnxk/roc_nix_priv.h index 3fd6fcbe9f..eb64608885 100644 --- a/drivers/common/cnxk/roc_nix_priv.h +++ b/drivers/common/cnxk/roc_nix_priv.h @@ -488,4 +488,12 @@ int nix_tel_node_add_rq(struct roc_nix_rq *rq); int nix_tel_node_add_cq(struct roc_nix_cq *cq); int nix_tel_node_add_sq(struct roc_nix_sq *sq); +/* + * RSS + */ +int nix_rss_reta_pffunc_set(struct roc_nix *roc_nix, uint8_t group, + uint16_t reta[ROC_NIX_RSS_RETA_MAX], uint16_t pf_func); +int nix_rss_flowkey_pffunc_set(struct roc_nix *roc_nix, uint8_t *alg_idx, uint32_t flowkey, + uint8_t group, int mcam_index, uint16_t pf_func); + #endif /* _ROC_NIX_PRIV_H_ */ diff --git a/drivers/common/cnxk/roc_nix_rss.c b/drivers/common/cnxk/roc_nix_rss.c index fd1472e9b9..ac5df654ff 100644 --- a/drivers/common/cnxk/roc_nix_rss.c +++ b/drivers/common/cnxk/roc_nix_rss.c @@ -116,7 +116,7 @@ nix_cn9k_rss_reta_set(struct nix *nix, uint8_t group, static int nix_cn10k_rss_reta_set(struct nix *nix, uint8_t group, uint16_t reta[ROC_NIX_RSS_RETA_MAX], - uint8_t lock_rx_ctx) + uint8_t lock_rx_ctx, uint16_t pf_func) { struct mbox *mbox = mbox_get((&nix->dev)->mbox); struct nix_cn10k_aq_enq_req *req; @@ -138,6 +138,9 @@ nix_cn10k_rss_reta_set(struct nix *nix, uint8_t group, uint16_t reta[ROC_NIX_RSS goto exit; } } + if (pf_func) + req->hdr.pcifunc = pf_func; + req->rss.rq = reta[idx]; /* Fill AQ info */ req->qidx = (group * nix->reta_sz) + idx; @@ -161,6 +164,8 @@ nix_cn10k_rss_reta_set(struct nix *nix, uint8_t group, uint16_t reta[ROC_NIX_RSS goto exit; } } + if (pf_func) + req->hdr.pcifunc = pf_func; req->rss.rq = reta[idx]; /* Fill AQ info */ req->qidx = (group * nix->reta_sz) + idx; @@ -180,7 +185,7 @@ nix_cn10k_rss_reta_set(struct nix *nix, uint8_t group, uint16_t reta[ROC_NIX_RSS static int nix_rss_reta_set(struct nix *nix, uint8_t group, uint16_t reta[ROC_NIX_RSS_RETA_MAX], - uint8_t lock_rx_ctx) + uint8_t lock_rx_ctx, uint16_t pf_func) { struct mbox *mbox = mbox_get((&nix->dev)->mbox); struct nix_cn20k_aq_enq_req *req; @@ -225,6 +230,8 @@ nix_rss_reta_set(struct nix *nix, uint8_t group, uint16_t reta[ROC_NIX_RSS_RETA_ goto exit; } } + if (pf_func) + req->hdr.pcifunc = pf_func; req->rss.rq = reta[idx]; /* Fill AQ info */ req->qidx = (group * nix->reta_sz) + idx; @@ -243,8 +250,8 @@ nix_rss_reta_set(struct nix *nix, uint8_t group, uint16_t reta[ROC_NIX_RSS_RETA_ } int -roc_nix_rss_reta_set(struct roc_nix *roc_nix, uint8_t group, - uint16_t reta[ROC_NIX_RSS_RETA_MAX]) +nix_rss_reta_pffunc_set(struct roc_nix *roc_nix, uint8_t group, uint16_t reta[ROC_NIX_RSS_RETA_MAX], + uint16_t pf_func) { struct nix *nix = roc_nix_to_nix_priv(roc_nix); int rc; @@ -253,12 +260,11 @@ roc_nix_rss_reta_set(struct roc_nix *roc_nix, uint8_t group, return NIX_ERR_PARAM; if (roc_model_is_cn9k()) - rc = nix_cn9k_rss_reta_set(nix, group, reta, - roc_nix->lock_rx_ctx); + rc = nix_cn9k_rss_reta_set(nix, group, reta, roc_nix->lock_rx_ctx); else if (roc_model_is_cn10k()) - rc = nix_cn10k_rss_reta_set(nix, group, reta, roc_nix->lock_rx_ctx); + rc = nix_cn10k_rss_reta_set(nix, group, reta, roc_nix->lock_rx_ctx, pf_func); else - rc = nix_rss_reta_set(nix, group, reta, roc_nix->lock_rx_ctx); + rc = nix_rss_reta_set(nix, group, reta, roc_nix->lock_rx_ctx, pf_func); if (rc) return rc; @@ -267,8 +273,13 @@ roc_nix_rss_reta_set(struct roc_nix *roc_nix, uint8_t group, } int -roc_nix_rss_reta_get(struct roc_nix *roc_nix, uint8_t group, - uint16_t reta[ROC_NIX_RSS_RETA_MAX]) +roc_nix_rss_reta_set(struct roc_nix *roc_nix, uint8_t group, uint16_t reta[ROC_NIX_RSS_RETA_MAX]) +{ + return nix_rss_reta_pffunc_set(roc_nix, group, reta, 0); +} + +int +roc_nix_rss_reta_get(struct roc_nix *roc_nix, uint8_t group, uint16_t reta[ROC_NIX_RSS_RETA_MAX]) { struct nix *nix = roc_nix_to_nix_priv(roc_nix); @@ -280,8 +291,8 @@ roc_nix_rss_reta_get(struct roc_nix *roc_nix, uint8_t group, } int -roc_nix_rss_flowkey_set(struct roc_nix *roc_nix, uint8_t *alg_idx, - uint32_t flowkey, uint8_t group, int mcam_index) +nix_rss_flowkey_pffunc_set(struct roc_nix *roc_nix, uint8_t *alg_idx, uint32_t flowkey, + uint8_t group, int mcam_index, uint16_t pf_func) { struct nix *nix = roc_nix_to_nix_priv(roc_nix); struct nix_rss_flowkey_cfg_rsp *rss_rsp; @@ -297,6 +308,9 @@ roc_nix_rss_flowkey_set(struct roc_nix *roc_nix, uint8_t *alg_idx, cfg = mbox_alloc_msg_nix_rss_flowkey_cfg(mbox); if (cfg == NULL) goto exit; + if (pf_func) + cfg->hdr.pcifunc = pf_func; + cfg->flowkey_cfg = flowkey; cfg->mcam_index = mcam_index; /* -1 indicates default group */ cfg->group = group; /* 0 is default group */ @@ -311,6 +325,13 @@ roc_nix_rss_flowkey_set(struct roc_nix *roc_nix, uint8_t *alg_idx, return rc; } +int +roc_nix_rss_flowkey_set(struct roc_nix *roc_nix, uint8_t *alg_idx, uint32_t flowkey, uint8_t group, + int mcam_index) +{ + return nix_rss_flowkey_pffunc_set(roc_nix, alg_idx, flowkey, group, mcam_index, 0); +} + int roc_nix_rss_default_setup(struct roc_nix *roc_nix, uint32_t flowkey) { diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c index 2b3c90683c..53f278c764 100644 --- a/drivers/common/cnxk/roc_npc.c +++ b/drivers/common/cnxk/roc_npc.c @@ -1053,9 +1053,9 @@ npc_rss_free_grp_get(struct npc *npc, uint32_t *pos) } int -npc_rss_action_configure(struct roc_npc *roc_npc, - const struct roc_npc_action_rss *rss, uint8_t *alg_idx, - uint32_t *rss_grp, uint32_t mcam_id) +npc_rss_action_configure(struct roc_npc *roc_npc, const struct roc_npc_action_rss *rss, + uint8_t *alg_idx, uint32_t *rss_grp, uint32_t mcam_id, + uint16_t rss_repte_pf_func) { struct npc *npc = roc_npc_to_npc_priv(roc_npc); struct roc_nix *roc_nix = roc_npc->roc_nix; @@ -1098,7 +1098,7 @@ npc_rss_action_configure(struct roc_npc *roc_npc, if (rc < 0 || rss_grp_idx == 0) return -ENOSPC; - for (i = 0; i < rss->queue_num; i++) { + for (i = 0; (i < rss->queue_num) && !rss_repte_pf_func; i++) { if (rss->queue[i] >= nix->nb_rx_queues) { plt_err("queue id > max number of queues"); return -EINVAL; @@ -1126,10 +1126,9 @@ npc_rss_action_configure(struct roc_npc *roc_npc, rem = nix->reta_sz % rss->queue_num; if (rem) - memcpy(&reta[i * rss->queue_num], rss->queue, - rem * sizeof(uint16_t)); + memcpy(&reta[i * rss->queue_num], rss->queue, rem * sizeof(uint16_t)); - rc = roc_nix_rss_reta_set(roc_nix, *rss_grp, reta); + rc = nix_rss_reta_pffunc_set(roc_nix, *rss_grp, reta, rss_repte_pf_func); if (rc) { plt_err("Failed to init rss table rc = %d", rc); return rc; @@ -1137,8 +1136,8 @@ npc_rss_action_configure(struct roc_npc *roc_npc, flowkey_cfg = roc_npc->flowkey_cfg_state; - rc = roc_nix_rss_flowkey_set(roc_nix, &flowkey_algx, flowkey_cfg, - *rss_grp, mcam_id); + rc = nix_rss_flowkey_pffunc_set(roc_nix, &flowkey_algx, flowkey_cfg, *rss_grp, mcam_id, + rss_repte_pf_func); if (rc) { plt_err("Failed to set rss hash function rc = %d", rc); return rc; @@ -1170,7 +1169,8 @@ npc_rss_action_program(struct roc_npc *roc_npc, for (; actions->type != ROC_NPC_ACTION_TYPE_END; actions++) { if (actions->type == ROC_NPC_ACTION_TYPE_RSS) { rss = (const struct roc_npc_action_rss *)actions->conf; - rc = npc_rss_action_configure(npc, rss, &alg_idx, &rss_grp, flow->mcam_id); + rc = npc_rss_action_configure(npc, rss, &alg_idx, &rss_grp, flow->mcam_id, + actions->rss_repte_pf_func); if (rc) return rc; @@ -1678,6 +1678,7 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr, goto set_rss_failed; } roc_npc->rep_npc = NULL; + roc_npc->rep_act_pf_func = 0; if (flow->has_age_action) npc_age_flow_list_entry_add(roc_npc, flow); @@ -1700,6 +1701,7 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr, set_rss_failed: roc_npc->rep_npc = NULL; + roc_npc->rep_act_pf_func = 0; if (flow->use_pre_alloc == 0) { rc = roc_npc_mcam_free_entry(roc_npc, flow->mcam_id); if (rc != 0) { @@ -1712,6 +1714,7 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr, } err_exit: roc_npc->rep_npc = NULL; + roc_npc->rep_act_pf_func = 0; plt_free(flow); return NULL; } diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h index 72aada84a1..bf8c65aa9c 100644 --- a/drivers/common/cnxk/roc_npc.h +++ b/drivers/common/cnxk/roc_npc.h @@ -203,6 +203,7 @@ enum roc_npc_action_type { struct roc_npc_action { enum roc_npc_action_type type; /**< Action type. */ const void *conf; /**< Pointer to action configuration object. */ + uint16_t rss_repte_pf_func; /**< Per flow tmp var for rss representee pffunc */ }; struct roc_npc_action_sample { diff --git a/drivers/common/cnxk/roc_npc_priv.h b/drivers/common/cnxk/roc_npc_priv.h index 069c625911..e08a34d146 100644 --- a/drivers/common/cnxk/roc_npc_priv.h +++ b/drivers/common/cnxk/roc_npc_priv.h @@ -484,7 +484,8 @@ int npc_process_ipv6_field_hash(const struct roc_npc_flow_item_ipv6 *ipv6_spec, const struct roc_npc_flow_item_ipv6 *ipv6_mask, struct npc_parse_state *pst, uint8_t type); int npc_rss_action_configure(struct roc_npc *roc_npc, const struct roc_npc_action_rss *rss, - uint8_t *alg_idx, uint32_t *rss_grp, uint32_t mcam_id); + uint8_t *alg_idx, uint32_t *rss_grp, uint32_t mcam_id, + uint16_t rss_repte_pf_func); int npc_rss_action_program(struct roc_npc *roc_npc, const struct roc_npc_action actions[], struct roc_npc_flow *flow); int npc_rss_group_free(struct npc *npc, struct roc_npc_flow *flow); diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 877333b80c..935be3584c 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -90,6 +90,7 @@ INTERNAL { roc_dpi_enable; roc_dpi_wait_queue_idle; roc_error_msg_get; + roc_eswitch_is_repte_pfs_vf; roc_eswitch_nix_process_repte_notify_cb_register; roc_eswitch_nix_process_repte_notify_cb_unregister; roc_eswitch_nix_repte_stats; -- 2.46.0.469.g4590f2e941