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 EB4EBA034C; Tue, 22 Feb 2022 20:36:22 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 48B1841145; Tue, 22 Feb 2022 20:35:54 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 18EC34117D for ; Tue, 22 Feb 2022 20:35:47 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 21MIlBmv020298 for ; Tue, 22 Feb 2022 11:35:47 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=otiBQF55ylzziDq1C0iLDbN1OCuLxNuZrj+bVMbUkY4=; b=NyrPCWTpEQ1+8MMiHqlNHPbYyhkf2+ipaDkEOyEFkBAY57m21taUxatwEoq48CyPGvDo XbSt2C3F+PW1M6mxUwhFQNHmaj5D+7Kn17Ys/QOOKMtMJA55gBdPHcF9Dd/6hcys8s7A 88PRrcsXmBPTWDjlsYc5QjAzDqAzw9jJix23QR6PuZUrV/xP4j2yeKDOlH1zmOQ7fcZ6 ESi/NIGyAUPyuh1/MhkNZ50mIxYiVIrCSdPs31qfKYNDnK2PvaUh8N3qYLDK4/j019kX i5A1taTNbA53yUdC0V11fBY8F2u7039cCXXnQ7juvNfsUG6CSDBip7Z7bW+b7BUglZza HA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ecwaxar2x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 22 Feb 2022 11:35:46 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 22 Feb 2022 11:35:45 -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.18 via Frontend Transport; Tue, 22 Feb 2022 11:35:45 -0800 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 2D92A3F707B; Tue, 22 Feb 2022 11:35:42 -0800 (PST) From: Nithin Dabilpuram To: , Nithin Dabilpuram , "Kiran Kumar K" , Sunil Kumar Kori , Satha Rao CC: Subject: [PATCH v2 10/21] net/cnxk: added Rx metadata negotiate operation Date: Wed, 23 Feb 2022 01:05:01 +0530 Message-ID: <20220222193512.19292-10-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20220222193512.19292-1-ndabilpuram@marvell.com> References: <20220207072932.22409-1-ndabilpuram@marvell.com> <20220222193512.19292-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: LkveyqCQRc_UOkwhnhRHc2m7omfpPplM X-Proofpoint-ORIG-GUID: LkveyqCQRc_UOkwhnhRHc2m7omfpPplM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-22_06,2022-02-21_02,2021-12-02_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 From: Satha Rao Added rx_metadata_negotiate api to enable mark update RX offload. Removed software logic to enable/disable mark update inside flow create/destroy APIs. Signed-off-by: Satha Rao --- drivers/net/cnxk/cn10k_ethdev.c | 26 ++++++++++++++++++++++++++ drivers/net/cnxk/cn10k_rte_flow.c | 20 ++------------------ drivers/net/cnxk/cn9k_ethdev.c | 25 +++++++++++++++++++++++++ drivers/net/cnxk/cn9k_rte_flow.c | 20 ++------------------ drivers/net/cnxk/cnxk_ethdev.h | 1 + 5 files changed, 56 insertions(+), 36 deletions(-) diff --git a/drivers/net/cnxk/cn10k_ethdev.c b/drivers/net/cnxk/cn10k_ethdev.c index 9bb08e1..6bf8275 100644 --- a/drivers/net/cnxk/cn10k_ethdev.c +++ b/drivers/net/cnxk/cn10k_ethdev.c @@ -39,6 +39,9 @@ nix_rx_offload_flags(struct rte_eth_dev *eth_dev) if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY) flags |= NIX_RX_OFFLOAD_SECURITY_F; + if (dev->rx_mark_update) + flags |= NIX_RX_OFFLOAD_MARK_UPDATE_F; + return flags; } @@ -448,6 +451,27 @@ cn10k_nix_dev_start(struct rte_eth_dev *eth_dev) return 0; } +static int +cn10k_nix_rx_metadata_negotiate(struct rte_eth_dev *eth_dev, uint64_t *features) +{ + struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); + + *features &= + (RTE_ETH_RX_METADATA_USER_FLAG | RTE_ETH_RX_METADATA_USER_MARK); + + if (*features) { + dev->rx_offload_flags |= NIX_RX_OFFLOAD_MARK_UPDATE_F; + dev->rx_mark_update = true; + } else { + dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_MARK_UPDATE_F; + dev->rx_mark_update = false; + } + + cn10k_eth_set_rx_function(eth_dev); + + return 0; +} + /* Update platform specific eth dev ops */ static void nix_eth_dev_ops_override(void) @@ -467,6 +491,8 @@ nix_eth_dev_ops_override(void) cnxk_eth_dev_ops.dev_ptypes_set = cn10k_nix_ptypes_set; cnxk_eth_dev_ops.timesync_enable = cn10k_nix_timesync_enable; cnxk_eth_dev_ops.timesync_disable = cn10k_nix_timesync_disable; + cnxk_eth_dev_ops.rx_metadata_negotiate = + cn10k_nix_rx_metadata_negotiate; } static void diff --git a/drivers/net/cnxk/cn10k_rte_flow.c b/drivers/net/cnxk/cn10k_rte_flow.c index aed187c..87d5c91 100644 --- a/drivers/net/cnxk/cn10k_rte_flow.c +++ b/drivers/net/cnxk/cn10k_rte_flow.c @@ -131,9 +131,9 @@ cn10k_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr, const struct rte_flow_action *action_rss = NULL; const struct rte_flow_action_meter *mtr = NULL; const struct rte_flow_action *act_q = NULL; - int mark_actions = 0, vtag_actions = 0; struct roc_npc *npc = &dev->npc; struct roc_npc_flow *flow; + int vtag_actions = 0; uint32_t req_act = 0; int i, rc; @@ -197,13 +197,6 @@ cn10k_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr, cn10k_mtr_connect(eth_dev, mtr->mtr_id); } - mark_actions = roc_npc_mark_actions_get(npc); - - if (mark_actions) { - dev->rx_offload_flags |= NIX_RX_OFFLOAD_MARK_UPDATE_F; - cn10k_eth_set_rx_function(eth_dev); - } - vtag_actions = roc_npc_vtag_actions_get(npc); if (vtag_actions) { @@ -220,20 +213,11 @@ cn10k_flow_destroy(struct rte_eth_dev *eth_dev, struct rte_flow *rte_flow, { struct roc_npc_flow *flow = (struct roc_npc_flow *)rte_flow; struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); - int mark_actions = 0, vtag_actions = 0; struct roc_npc *npc = &dev->npc; + int vtag_actions = 0; uint32_t mtr_id; int rc; - mark_actions = roc_npc_mark_actions_get(npc); - if (mark_actions) { - mark_actions = roc_npc_mark_actions_sub_return(npc, 1); - if (mark_actions == 0) { - dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_MARK_UPDATE_F; - cn10k_eth_set_rx_function(eth_dev); - } - } - vtag_actions = roc_npc_vtag_actions_get(npc); if (vtag_actions) { if (flow->nix_intf == ROC_NPC_INTF_RX) { diff --git a/drivers/net/cnxk/cn9k_ethdev.c b/drivers/net/cnxk/cn9k_ethdev.c index 01e3850..40215aa 100644 --- a/drivers/net/cnxk/cn9k_ethdev.c +++ b/drivers/net/cnxk/cn9k_ethdev.c @@ -39,6 +39,9 @@ nix_rx_offload_flags(struct rte_eth_dev *eth_dev) if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY) flags |= NIX_RX_OFFLOAD_SECURITY_F; + if (dev->rx_mark_update) + flags |= NIX_RX_OFFLOAD_MARK_UPDATE_F; + return flags; } @@ -447,6 +450,27 @@ cn9k_nix_dev_start(struct rte_eth_dev *eth_dev) return 0; } +static int +cn9k_nix_rx_metadata_negotiate(struct rte_eth_dev *eth_dev, uint64_t *features) +{ + struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); + + *features &= + (RTE_ETH_RX_METADATA_USER_FLAG | RTE_ETH_RX_METADATA_USER_MARK); + + if (*features) { + dev->rx_offload_flags |= NIX_RX_OFFLOAD_MARK_UPDATE_F; + dev->rx_mark_update = true; + } else { + dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_MARK_UPDATE_F; + dev->rx_mark_update = false; + } + + cn9k_eth_set_rx_function(eth_dev); + + return 0; +} + /* Update platform specific eth dev ops */ static void nix_eth_dev_ops_override(void) @@ -467,6 +491,7 @@ nix_eth_dev_ops_override(void) cnxk_eth_dev_ops.timesync_enable = cn9k_nix_timesync_enable; cnxk_eth_dev_ops.timesync_disable = cn9k_nix_timesync_disable; cnxk_eth_dev_ops.mtr_ops_get = NULL; + cnxk_eth_dev_ops.rx_metadata_negotiate = cn9k_nix_rx_metadata_negotiate; } static void diff --git a/drivers/net/cnxk/cn9k_rte_flow.c b/drivers/net/cnxk/cn9k_rte_flow.c index 6460672..fa9dd8d 100644 --- a/drivers/net/cnxk/cn9k_rte_flow.c +++ b/drivers/net/cnxk/cn9k_rte_flow.c @@ -13,21 +13,14 @@ cn9k_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr, struct rte_flow_error *error) { struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); - int mark_actions = 0, vtag_actions = 0; struct roc_npc *npc = &dev->npc; struct roc_npc_flow *flow; + int vtag_actions = 0; flow = cnxk_flow_create(eth_dev, attr, pattern, actions, error); if (!flow) return NULL; - mark_actions = roc_npc_mark_actions_get(npc); - - if (mark_actions) { - dev->rx_offload_flags |= NIX_RX_OFFLOAD_MARK_UPDATE_F; - cn9k_eth_set_rx_function(eth_dev); - } - vtag_actions = roc_npc_vtag_actions_get(npc); if (vtag_actions) { @@ -44,17 +37,8 @@ cn9k_flow_destroy(struct rte_eth_dev *eth_dev, struct rte_flow *rte_flow, { struct roc_npc_flow *flow = (struct roc_npc_flow *)rte_flow; struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); - int mark_actions = 0, vtag_actions = 0; struct roc_npc *npc = &dev->npc; - - mark_actions = roc_npc_mark_actions_get(npc); - if (mark_actions) { - mark_actions = roc_npc_mark_actions_sub_return(npc, 1); - if (mark_actions == 0) { - dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_MARK_UPDATE_F; - cn9k_eth_set_rx_function(eth_dev); - } - } + int vtag_actions = 0; vtag_actions = roc_npc_vtag_actions_get(npc); if (vtag_actions) { diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h index ad568c9..991969c 100644 --- a/drivers/net/cnxk/cnxk_ethdev.h +++ b/drivers/net/cnxk/cnxk_ethdev.h @@ -339,6 +339,7 @@ struct cnxk_eth_dev { uint8_t ptype_disable; bool scalar_ena; bool ptp_en; + bool rx_mark_update; /* Enable/Disable mark update to mbuf */ /* Pointer back to rte */ struct rte_eth_dev *eth_dev; -- 2.8.4