* [dpdk-dev] [PATCH] drivers: enable keep flow rule device capability for cnxk
@ 2022-01-25 4:19 psatheesh
2022-01-25 9:50 ` Ray Kinsella
2022-02-14 4:33 ` [dpdk-dev] [PATCH v2] " psatheesh
0 siblings, 2 replies; 5+ messages in thread
From: psatheesh @ 2022-01-25 4:19 UTC (permalink / raw)
To: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
Ray Kinsella
Cc: dev, Satheesh Paul
From: Kiran Kumar K <kirankumark@marvell.com>
Adding changes to enable keep flow rule device capability.
With this change, flow rules will be kept across device restart.
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Reviewed-by: Satheesh Paul <psatheesh@marvell.com>
---
drivers/common/cnxk/roc_npc.c | 8 ++++++++
drivers/common/cnxk/roc_npc.h | 2 ++
drivers/common/cnxk/roc_npc_mcam.c | 20 ++++++++++++++++++++
drivers/common/cnxk/roc_npc_priv.h | 1 +
drivers/common/cnxk/version.map | 1 +
drivers/net/cnxk/cnxk_ethdev.c | 15 +++++++++++++--
drivers/net/cnxk/cnxk_ethdev_ops.c | 4 ++--
drivers/net/cnxk/cnxk_rte_flow.c | 7 +++++++
8 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index e3961bfbc6..d470f53788 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -74,6 +74,14 @@ roc_npc_mcam_alloc_entries(struct roc_npc *roc_npc, int ref_entry,
priority, resp_count);
}
+int
+roc_npc_mcam_enable_all_entries(struct roc_npc *roc_npc, bool enable)
+{
+ struct npc *npc = roc_npc_to_npc_priv(roc_npc);
+
+ return npc_flow_enable_all_entries(npc, enable);
+}
+
int
roc_npc_mcam_alloc_entry(struct roc_npc *roc_npc, struct roc_npc_flow *mcam,
struct roc_npc_flow *ref_mcam, int prio,
diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h
index b836e264c6..f9e5028cab 100644
--- a/drivers/common/cnxk/roc_npc.h
+++ b/drivers/common/cnxk/roc_npc.h
@@ -309,6 +309,8 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
int __roc_api roc_npc_flow_destroy(struct roc_npc *roc_npc,
struct roc_npc_flow *flow);
int __roc_api roc_npc_mcam_free_entry(struct roc_npc *roc_npc, uint32_t entry);
+int __roc_api roc_npc_mcam_enable_all_entries(struct roc_npc *roc_npc,
+ bool enable);
int __roc_api roc_npc_mcam_alloc_entry(struct roc_npc *roc_npc,
struct roc_npc_flow *mcam,
struct roc_npc_flow *ref_mcam, int prio,
diff --git a/drivers/common/cnxk/roc_npc_mcam.c b/drivers/common/cnxk/roc_npc_mcam.c
index b251f643bc..30eceeb883 100644
--- a/drivers/common/cnxk/roc_npc_mcam.c
+++ b/drivers/common/cnxk/roc_npc_mcam.c
@@ -780,6 +780,26 @@ npc_program_mcam(struct npc *npc, struct npc_parse_state *pst, bool mcam_alloc)
return 0;
}
+int
+npc_flow_enable_all_entries(struct npc *npc, bool enable)
+{
+ struct npc_flow_list *list;
+ struct roc_npc_flow *flow;
+ int rc = 0, idx;
+
+ /* Free any MCAM counters and delete flow list */
+ for (idx = 0; idx < npc->flow_max_priority; idx++) {
+ list = &npc->flow_list[idx];
+ TAILQ_FOREACH(flow, list, next) {
+ flow->enable = enable;
+ rc = npc_mcam_write_entry(npc, flow);
+ if (rc)
+ return rc;
+ }
+ }
+ return rc;
+}
+
int
npc_flow_free_all_resources(struct npc *npc)
{
diff --git a/drivers/common/cnxk/roc_npc_priv.h b/drivers/common/cnxk/roc_npc_priv.h
index afd11add9a..23e8675253 100644
--- a/drivers/common/cnxk/roc_npc_priv.h
+++ b/drivers/common/cnxk/roc_npc_priv.h
@@ -413,6 +413,7 @@ int npc_mcam_alloc_entries(struct npc *npc, int ref_mcam, int *alloc_entry,
int npc_mcam_ena_dis_entry(struct npc *npc, struct roc_npc_flow *mcam,
bool enable);
int npc_mcam_write_entry(struct npc *npc, struct roc_npc_flow *mcam);
+int npc_flow_enable_all_entries(struct npc *npc, bool enable);
int npc_update_parse_state(struct npc_parse_state *pst,
struct npc_parse_item_info *info, int lid, int lt,
uint8_t flags);
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index 82b9fc1aea..39496d1906 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -311,6 +311,7 @@ INTERNAL {
roc_npc_mcam_alloc_entries;
roc_npc_mcam_alloc_entry;
roc_npc_mcam_clear_counter;
+ roc_npc_mcam_enable_all_entries;
roc_npc_mcam_ena_dis_entry;
roc_npc_mcam_free_all_resources;
roc_npc_mcam_free_counter;
diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index 53dfb5eae8..304272acab 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -1407,8 +1407,10 @@ cnxk_nix_dev_stop(struct rte_eth_dev *eth_dev)
int count, i, j, rc;
void *rxq;
- /* Disable switch hdr pkind */
- roc_nix_switch_hdr_set(&dev->nix, 0, 0, 0, 0);
+ /* Disable all the NPC entries */
+ rc = roc_npc_mcam_enable_all_entries(&dev->npc, 0);
+ if (rc)
+ return rc;
/* Stop link change events */
if (!roc_nix_is_vf_or_sdp(&dev->nix))
@@ -1483,6 +1485,12 @@ cnxk_nix_dev_start(struct rte_eth_dev *eth_dev)
return rc;
}
+ rc = roc_npc_mcam_enable_all_entries(&dev->npc, 1);
+ if (rc) {
+ plt_err("Failed to enable NPC entries %d", rc);
+ return rc;
+ }
+
cnxk_nix_toggle_flag_link_cfg(dev, true);
/* Start link change events */
@@ -1733,6 +1741,9 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool reset)
struct roc_nix *nix = &dev->nix;
int rc, i;
+ /* Disable switch hdr pkind */
+ roc_nix_switch_hdr_set(&dev->nix, 0, 0, 0, 0);
+
plt_free(eth_dev->security_ctx);
eth_dev->security_ctx = NULL;
diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c
index f20f201db2..1ae90092d6 100644
--- a/drivers/net/cnxk/cnxk_ethdev_ops.c
+++ b/drivers/net/cnxk/cnxk_ethdev_ops.c
@@ -67,8 +67,8 @@ cnxk_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo)
devinfo->speed_capa = dev->speed_capa;
devinfo->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
- RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
- devinfo->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP;
+ RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP |
+ RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP;
return 0;
}
diff --git a/drivers/net/cnxk/cnxk_rte_flow.c b/drivers/net/cnxk/cnxk_rte_flow.c
index b08d7c34fa..33bfa9b56c 100644
--- a/drivers/net/cnxk/cnxk_rte_flow.c
+++ b/drivers/net/cnxk/cnxk_rte_flow.c
@@ -315,6 +315,13 @@ cnxk_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
int errcode = 0;
int rc;
+ if (eth_dev->data->dev_started == 0) {
+ rte_flow_error_set(error, ENODEV,
+ RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+ "port not started");
+ return NULL;
+ }
+
rc = cnxk_map_flow_data(eth_dev, attr, pattern, actions, &in_attr,
in_pattern, in_actions,
&npc->flowkey_cfg_state);
--
2.25.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] drivers: enable keep flow rule device capability for cnxk
2022-01-25 4:19 [dpdk-dev] [PATCH] drivers: enable keep flow rule device capability for cnxk psatheesh
@ 2022-01-25 9:50 ` Ray Kinsella
2022-02-14 4:33 ` [dpdk-dev] [PATCH v2] " psatheesh
1 sibling, 0 replies; 5+ messages in thread
From: Ray Kinsella @ 2022-01-25 9:50 UTC (permalink / raw)
To: psatheesh
Cc: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao, dev
psatheesh@marvell.com writes:
> From: Kiran Kumar K <kirankumark@marvell.com>
>
> Adding changes to enable keep flow rule device capability.
> With this change, flow rules will be kept across device restart.
>
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> Reviewed-by: Satheesh Paul <psatheesh@marvell.com>
> ---
> drivers/common/cnxk/roc_npc.c | 8 ++++++++
> drivers/common/cnxk/roc_npc.h | 2 ++
> drivers/common/cnxk/roc_npc_mcam.c | 20 ++++++++++++++++++++
> drivers/common/cnxk/roc_npc_priv.h | 1 +
> drivers/common/cnxk/version.map | 1 +
> drivers/net/cnxk/cnxk_ethdev.c | 15 +++++++++++++--
> drivers/net/cnxk/cnxk_ethdev_ops.c | 4 ++--
> drivers/net/cnxk/cnxk_rte_flow.c | 7 +++++++
> 8 files changed, 54 insertions(+), 4 deletions(-)
>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v2] drivers: enable keep flow rule device capability for cnxk
2022-01-25 4:19 [dpdk-dev] [PATCH] drivers: enable keep flow rule device capability for cnxk psatheesh
2022-01-25 9:50 ` Ray Kinsella
@ 2022-02-14 4:33 ` psatheesh
2022-02-14 10:08 ` Ray Kinsella
1 sibling, 1 reply; 5+ messages in thread
From: psatheesh @ 2022-02-14 4:33 UTC (permalink / raw)
To: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
Ray Kinsella
Cc: dev, Satheesh Paul
From: Kiran Kumar K <kirankumark@marvell.com>
Adding changes to enable keep flow rule device capability.
With this change, flow rules will be kept across device restart.
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Reviewed-by: Satheesh Paul <psatheesh@marvell.com>
---
v2:
* Allow creating flow rule before device start.
drivers/common/cnxk/roc_npc.c | 8 ++++++++
drivers/common/cnxk/roc_npc.h | 2 ++
drivers/common/cnxk/roc_npc_mcam.c | 20 ++++++++++++++++++++
drivers/common/cnxk/roc_npc_priv.h | 1 +
drivers/common/cnxk/version.map | 1 +
drivers/net/cnxk/cnxk_ethdev.c | 15 +++++++++++++--
drivers/net/cnxk/cnxk_ethdev_ops.c | 4 ++--
7 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index e3961bfbc6..d470f53788 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -74,6 +74,14 @@ roc_npc_mcam_alloc_entries(struct roc_npc *roc_npc, int ref_entry,
priority, resp_count);
}
+int
+roc_npc_mcam_enable_all_entries(struct roc_npc *roc_npc, bool enable)
+{
+ struct npc *npc = roc_npc_to_npc_priv(roc_npc);
+
+ return npc_flow_enable_all_entries(npc, enable);
+}
+
int
roc_npc_mcam_alloc_entry(struct roc_npc *roc_npc, struct roc_npc_flow *mcam,
struct roc_npc_flow *ref_mcam, int prio,
diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h
index b836e264c6..f9e5028cab 100644
--- a/drivers/common/cnxk/roc_npc.h
+++ b/drivers/common/cnxk/roc_npc.h
@@ -309,6 +309,8 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
int __roc_api roc_npc_flow_destroy(struct roc_npc *roc_npc,
struct roc_npc_flow *flow);
int __roc_api roc_npc_mcam_free_entry(struct roc_npc *roc_npc, uint32_t entry);
+int __roc_api roc_npc_mcam_enable_all_entries(struct roc_npc *roc_npc,
+ bool enable);
int __roc_api roc_npc_mcam_alloc_entry(struct roc_npc *roc_npc,
struct roc_npc_flow *mcam,
struct roc_npc_flow *ref_mcam, int prio,
diff --git a/drivers/common/cnxk/roc_npc_mcam.c b/drivers/common/cnxk/roc_npc_mcam.c
index b251f643bc..30eceeb883 100644
--- a/drivers/common/cnxk/roc_npc_mcam.c
+++ b/drivers/common/cnxk/roc_npc_mcam.c
@@ -780,6 +780,26 @@ npc_program_mcam(struct npc *npc, struct npc_parse_state *pst, bool mcam_alloc)
return 0;
}
+int
+npc_flow_enable_all_entries(struct npc *npc, bool enable)
+{
+ struct npc_flow_list *list;
+ struct roc_npc_flow *flow;
+ int rc = 0, idx;
+
+ /* Free any MCAM counters and delete flow list */
+ for (idx = 0; idx < npc->flow_max_priority; idx++) {
+ list = &npc->flow_list[idx];
+ TAILQ_FOREACH(flow, list, next) {
+ flow->enable = enable;
+ rc = npc_mcam_write_entry(npc, flow);
+ if (rc)
+ return rc;
+ }
+ }
+ return rc;
+}
+
int
npc_flow_free_all_resources(struct npc *npc)
{
diff --git a/drivers/common/cnxk/roc_npc_priv.h b/drivers/common/cnxk/roc_npc_priv.h
index afd11add9a..23e8675253 100644
--- a/drivers/common/cnxk/roc_npc_priv.h
+++ b/drivers/common/cnxk/roc_npc_priv.h
@@ -413,6 +413,7 @@ int npc_mcam_alloc_entries(struct npc *npc, int ref_mcam, int *alloc_entry,
int npc_mcam_ena_dis_entry(struct npc *npc, struct roc_npc_flow *mcam,
bool enable);
int npc_mcam_write_entry(struct npc *npc, struct roc_npc_flow *mcam);
+int npc_flow_enable_all_entries(struct npc *npc, bool enable);
int npc_update_parse_state(struct npc_parse_state *pst,
struct npc_parse_item_info *info, int lid, int lt,
uint8_t flags);
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index ad1b5e8476..75a260f11e 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -312,6 +312,7 @@ INTERNAL {
roc_npc_mcam_alloc_entries;
roc_npc_mcam_alloc_entry;
roc_npc_mcam_clear_counter;
+ roc_npc_mcam_enable_all_entries;
roc_npc_mcam_ena_dis_entry;
roc_npc_mcam_free_all_resources;
roc_npc_mcam_free_counter;
diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index 53dfb5eae8..304272acab 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -1407,8 +1407,10 @@ cnxk_nix_dev_stop(struct rte_eth_dev *eth_dev)
int count, i, j, rc;
void *rxq;
- /* Disable switch hdr pkind */
- roc_nix_switch_hdr_set(&dev->nix, 0, 0, 0, 0);
+ /* Disable all the NPC entries */
+ rc = roc_npc_mcam_enable_all_entries(&dev->npc, 0);
+ if (rc)
+ return rc;
/* Stop link change events */
if (!roc_nix_is_vf_or_sdp(&dev->nix))
@@ -1483,6 +1485,12 @@ cnxk_nix_dev_start(struct rte_eth_dev *eth_dev)
return rc;
}
+ rc = roc_npc_mcam_enable_all_entries(&dev->npc, 1);
+ if (rc) {
+ plt_err("Failed to enable NPC entries %d", rc);
+ return rc;
+ }
+
cnxk_nix_toggle_flag_link_cfg(dev, true);
/* Start link change events */
@@ -1733,6 +1741,9 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool reset)
struct roc_nix *nix = &dev->nix;
int rc, i;
+ /* Disable switch hdr pkind */
+ roc_nix_switch_hdr_set(&dev->nix, 0, 0, 0, 0);
+
plt_free(eth_dev->security_ctx);
eth_dev->security_ctx = NULL;
diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c
index f20f201db2..1ae90092d6 100644
--- a/drivers/net/cnxk/cnxk_ethdev_ops.c
+++ b/drivers/net/cnxk/cnxk_ethdev_ops.c
@@ -67,8 +67,8 @@ cnxk_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo)
devinfo->speed_capa = dev->speed_capa;
devinfo->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
- RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
- devinfo->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP;
+ RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP |
+ RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP;
return 0;
}
--
2.25.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2] drivers: enable keep flow rule device capability for cnxk
2022-02-14 4:33 ` [dpdk-dev] [PATCH v2] " psatheesh
@ 2022-02-14 10:08 ` Ray Kinsella
2022-02-18 6:07 ` Jerin Jacob
0 siblings, 1 reply; 5+ messages in thread
From: Ray Kinsella @ 2022-02-14 10:08 UTC (permalink / raw)
To: psatheesh
Cc: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao, dev
psatheesh@marvell.com writes:
> From: Kiran Kumar K <kirankumark@marvell.com>
>
> Adding changes to enable keep flow rule device capability.
> With this change, flow rules will be kept across device restart.
>
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> Reviewed-by: Satheesh Paul <psatheesh@marvell.com>
> ---
> v2:
> * Allow creating flow rule before device start.
>
> drivers/common/cnxk/roc_npc.c | 8 ++++++++
> drivers/common/cnxk/roc_npc.h | 2 ++
> drivers/common/cnxk/roc_npc_mcam.c | 20 ++++++++++++++++++++
> drivers/common/cnxk/roc_npc_priv.h | 1 +
> drivers/common/cnxk/version.map | 1 +
> drivers/net/cnxk/cnxk_ethdev.c | 15 +++++++++++++--
> drivers/net/cnxk/cnxk_ethdev_ops.c | 4 ++--
> 7 files changed, 47 insertions(+), 4 deletions(-)
>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
--
Regards, Ray K
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2] drivers: enable keep flow rule device capability for cnxk
2022-02-14 10:08 ` Ray Kinsella
@ 2022-02-18 6:07 ` Jerin Jacob
0 siblings, 0 replies; 5+ messages in thread
From: Jerin Jacob @ 2022-02-18 6:07 UTC (permalink / raw)
To: Ray Kinsella, Ferruh Yigit
Cc: Satheesh Paul, Nithin Dabilpuram, Kiran Kumar K,
Sunil Kumar Kori, Satha Rao, dpdk-dev
On Mon, Feb 14, 2022 at 3:39 PM Ray Kinsella <mdr@ashroe.eu> wrote:
>
>
> psatheesh@marvell.com writes:
>
> > From: Kiran Kumar K <kirankumark@marvell.com>
> >
> > Adding changes to enable keep flow rule device capability.
> > With this change, flow rules will be kept across device restart.
> >
> > Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> > Reviewed-by: Satheesh Paul <psatheesh@marvell.com>
> > ---
> > v2:
> > * Allow creating flow rule before device start.
> >
> > drivers/common/cnxk/roc_npc.c | 8 ++++++++
> > drivers/common/cnxk/roc_npc.h | 2 ++
> > drivers/common/cnxk/roc_npc_mcam.c | 20 ++++++++++++++++++++
> > drivers/common/cnxk/roc_npc_priv.h | 1 +
> > drivers/common/cnxk/version.map | 1 +
> > drivers/net/cnxk/cnxk_ethdev.c | 15 +++++++++++++--
> > drivers/net/cnxk/cnxk_ethdev_ops.c | 4 ++--
> > 7 files changed, 47 insertions(+), 4 deletions(-)
> >
>
> Acked-by: Ray Kinsella <mdr@ashroe.eu>
Applied to dpdk-next-net-mrvl/for-next-net. Thanks
>
> --
> Regards, Ray K
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-18 6:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 4:19 [dpdk-dev] [PATCH] drivers: enable keep flow rule device capability for cnxk psatheesh
2022-01-25 9:50 ` Ray Kinsella
2022-02-14 4:33 ` [dpdk-dev] [PATCH v2] " psatheesh
2022-02-14 10:08 ` Ray Kinsella
2022-02-18 6:07 ` Jerin Jacob
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).