[v9,3/3] net/cnxk: skip red drop for ingress policer

Message ID 20230215062532.1169860-3-rkudurumalla@marvell.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series [v9,1/3] ethdev: skip congestion management configuration |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Rakesh Kudurumalla Feb. 15, 2023, 6:25 a.m. UTC
  Dropping of packets is based on action configured
to meter.If both skip_red and drop actions are configured
then tail dropping in invoked else if only drop action is
configured then RED drop is invoked.This action is supported
only when RED is configured using rte_eth_cman_config_set()

Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
---
 doc/guides/nics/features/cnxk.ini      |  1 +
 doc/guides/nics/features/cnxk_vf.ini   |  1 +
 doc/guides/rel_notes/release_23_03.rst |  4 +++
 drivers/net/cnxk/cnxk_ethdev.h         |  1 +
 drivers/net/cnxk/cnxk_ethdev_mtr.c     | 50 ++++++++++++++++++++++++++
 5 files changed, 57 insertions(+)
  

Comments

Ferruh Yigit Feb. 15, 2023, 9:45 a.m. UTC | #1
On 2/15/2023 6:25 AM, Rakesh Kudurumalla wrote:
> Dropping of packets is based on action configured
> to meter.If both skip_red and drop actions are configured
> then tail dropping in invoked else if only drop action is
> configured then RED drop is invoked.This action is supported
> only when RED is configured using rte_eth_cman_config_set()
> 
> Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>

Ack from driver maintainers required to proceed.

> ---
>  doc/guides/nics/features/cnxk.ini      |  1 +
>  doc/guides/nics/features/cnxk_vf.ini   |  1 +
>  doc/guides/rel_notes/release_23_03.rst |  4 +++
>  drivers/net/cnxk/cnxk_ethdev.h         |  1 +
>  drivers/net/cnxk/cnxk_ethdev_mtr.c     | 50 ++++++++++++++++++++++++++
>  5 files changed, 57 insertions(+)
> 
> diff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini
> index f81628da77..7947c044bb 100644
> --- a/doc/guides/nics/features/cnxk.ini
> +++ b/doc/guides/nics/features/cnxk.ini
> @@ -94,4 +94,5 @@ queue                = Y
>  represented_port     = Y
>  rss                  = Y
>  security             = Y
> +skip_cman            = Y
>  vf                   = Y
> diff --git a/doc/guides/nics/features/cnxk_vf.ini b/doc/guides/nics/features/cnxk_vf.ini
> index c4ee32a9ad..873e1dcc0a 100644
> --- a/doc/guides/nics/features/cnxk_vf.ini
> +++ b/doc/guides/nics/features/cnxk_vf.ini
> @@ -83,4 +83,5 @@ pf                   = Y
>  queue                = Y
>  rss                  = Y
>  security             = Y
> +skip_cman            = Y
>  vf                   = Y
> diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst
> index 1dd10e26db..9f53ded5fb 100644
> --- a/doc/guides/rel_notes/release_23_03.rst
> +++ b/doc/guides/rel_notes/release_23_03.rst
> @@ -98,6 +98,10 @@ New Features
>      ``rte_event_dev_config::nb_single_link_event_port_queues`` parameter
>      required for eth_rx, eth_tx, crypto and timer eventdev adapters.
>  
> +* **Updated Marvell cnxk ethdev PMD.**
> +
> +  Added support to skip RED using new action
> +  ``RTE_FLOW_ACTION_TYPE_SKIP_CMAN``
>  

Can you please move this entry alphabetically ordered by vendor to the
block where has ethdev drivers, a little above in this section.


>  Removed Items
>  -------------
> diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h
> index f0eab4244c..ba35873124 100644
> --- a/drivers/net/cnxk/cnxk_ethdev.h
> +++ b/drivers/net/cnxk/cnxk_ethdev.h
> @@ -168,6 +168,7 @@ struct policy_actions {
>  		uint16_t queue;
>  		uint32_t mtr_id;
>  		struct action_rss *rss_desc;
> +		bool skip_red;
>  	};
>  };
>  
> diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c
> index dcfa4223d5..27a6e4ef3d 100644
> --- a/drivers/net/cnxk/cnxk_ethdev_mtr.c
> +++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c
> @@ -358,6 +358,9 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev,
>  				if (action->type == RTE_FLOW_ACTION_TYPE_VOID)
>  					supported[i] = true;
>  
> +				if (action->type == RTE_FLOW_ACTION_TYPE_SKIP_CMAN)
> +					supported[i] = true;
> +
>  				if (!supported[i])
>  					return update_mtr_err(i, error, true);
>  			}
> @@ -397,6 +400,10 @@ cnxk_fill_policy_actions(struct cnxk_mtr_policy_node *fmp,
>  					fmp->actions[i].action_fate =
>  						action->type;
>  				}
> +
> +				if (action->type ==
> +					RTE_FLOW_ACTION_TYPE_SKIP_CMAN)
> +					fmp->actions[i].skip_red = true;
>  			}
>  		}
>  	}
> @@ -1306,6 +1313,45 @@ nix_mtr_config_map(struct cnxk_meter_node *mtr, struct roc_nix_bpf_cfg *cfg)
>  		cfg->action[ROC_NIX_BPF_COLOR_RED] = ROC_NIX_BPF_ACTION_DROP;
>  }
>  
> +static void
> +nix_mtr_config_red(struct cnxk_meter_node *mtr, struct roc_nix_rq *rq,
> +		   struct roc_nix_bpf_cfg *cfg)
> +{
> +	struct cnxk_mtr_policy_node *policy = mtr->policy;
> +
> +	if ((rq->red_pass && rq->red_pass >= rq->red_drop) ||
> +	   (rq->spb_red_pass && rq->spb_red_pass >= rq->spb_red_drop)	||
> +	   (rq->xqe_red_pass && rq->xqe_red_pass >= rq->xqe_red_drop)) {
> +		if (policy->actions[RTE_COLOR_GREEN].action_fate ==
> +			RTE_FLOW_ACTION_TYPE_DROP) {
> +			if (policy->actions[RTE_COLOR_GREEN].skip_red)
> +				cfg->action[ROC_NIX_BPF_COLOR_GREEN] =
> +						ROC_NIX_BPF_ACTION_DROP;
> +			else
> +				cfg->action[ROC_NIX_BPF_COLOR_GREEN] =
> +						ROC_NIX_BPF_ACTION_RED;
> +		}
> +		if (policy->actions[RTE_COLOR_YELLOW].action_fate ==
> +			RTE_FLOW_ACTION_TYPE_DROP) {
> +			if (policy->actions[RTE_COLOR_YELLOW].skip_red)
> +				cfg->action[ROC_NIX_BPF_COLOR_YELLOW] =
> +						ROC_NIX_BPF_ACTION_DROP;
> +			else
> +				cfg->action[ROC_NIX_BPF_COLOR_YELLOW] =
> +						ROC_NIX_BPF_ACTION_RED;
> +		}
> +		if (policy->actions[RTE_COLOR_RED].action_fate ==
> +			RTE_FLOW_ACTION_TYPE_DROP) {
> +			if (policy->actions[RTE_COLOR_RED].skip_red)
> +				cfg->action[ROC_NIX_BPF_COLOR_RED] =
> +						ROC_NIX_BPF_ACTION_DROP;
> +			else
> +				cfg->action[ROC_NIX_BPF_COLOR_RED] =
> +						ROC_NIX_BPF_ACTION_RED;
> +		}
> +	}
> +}
> +
>  static void
>  nix_precolor_table_map(struct cnxk_meter_node *mtr,
>  		       struct roc_nix_bpf_precolor *tbl,
> @@ -1483,6 +1529,10 @@ nix_mtr_configure(struct rte_eth_dev *eth_dev, uint32_t id)
>  			if (!mtr[i]->is_used) {
>  				memset(&cfg, 0, sizeof(struct roc_nix_bpf_cfg));
>  				nix_mtr_config_map(mtr[i], &cfg);
> +				for (j = 0; j < mtr[i]->rq_num; j++) {
> +					rq = &dev->rqs[mtr[i]->rq_id[j]];
> +					nix_mtr_config_red(mtr[i], rq, &cfg);
> +				}
>  				rc = roc_nix_bpf_config(nix, mtr[i]->bpf_id,
>  							lvl_map[mtr[i]->level],
>  							&cfg);
  
Nithin Dabilpuram Feb. 15, 2023, 10 a.m. UTC | #2
Acked-by:  Nithin Dabilpuram<ndabilpuram@marvell.com>

> -----Original Message-----
> From: Rakesh Kudurumalla <rkudurumalla@marvell.com>
> Sent: Wednesday, February 15, 2023 11:56 AM
> To: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar Kokkilagadda
> <kirankumark@marvell.com>; Sunil Kumar Kori <skori@marvell.com>; Satha Koteswara Rao
> Kottidi <skoteshwar@marvell.com>
> Cc: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; dev@dpdk.org; Rakesh Kudurumalla
> <rkudurumalla@marvell.com>
> Subject: [PATCH v9 3/3] net/cnxk: skip red drop for ingress policer
> 
> Dropping of packets is based on action configured
> to meter.If both skip_red and drop actions are configured
> then tail dropping in invoked else if only drop action is
> configured then RED drop is invoked.This action is supported
> only when RED is configured using rte_eth_cman_config_set()
> 
> Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
> ---
>  doc/guides/nics/features/cnxk.ini      |  1 +
>  doc/guides/nics/features/cnxk_vf.ini   |  1 +
>  doc/guides/rel_notes/release_23_03.rst |  4 +++
>  drivers/net/cnxk/cnxk_ethdev.h         |  1 +
>  drivers/net/cnxk/cnxk_ethdev_mtr.c     | 50 ++++++++++++++++++++++++++
>  5 files changed, 57 insertions(+)
> 
> diff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini
> index f81628da77..7947c044bb 100644
> --- a/doc/guides/nics/features/cnxk.ini
> +++ b/doc/guides/nics/features/cnxk.ini
> @@ -94,4 +94,5 @@ queue                = Y
>  represented_port     = Y
>  rss                  = Y
>  security             = Y
> +skip_cman            = Y
>  vf                   = Y
> diff --git a/doc/guides/nics/features/cnxk_vf.ini b/doc/guides/nics/features/cnxk_vf.ini
> index c4ee32a9ad..873e1dcc0a 100644
> --- a/doc/guides/nics/features/cnxk_vf.ini
> +++ b/doc/guides/nics/features/cnxk_vf.ini
> @@ -83,4 +83,5 @@ pf                   = Y
>  queue                = Y
>  rss                  = Y
>  security             = Y
> +skip_cman            = Y
>  vf                   = Y
> diff --git a/doc/guides/rel_notes/release_23_03.rst
> b/doc/guides/rel_notes/release_23_03.rst
> index 1dd10e26db..9f53ded5fb 100644
> --- a/doc/guides/rel_notes/release_23_03.rst
> +++ b/doc/guides/rel_notes/release_23_03.rst
> @@ -98,6 +98,10 @@ New Features
>      ``rte_event_dev_config::nb_single_link_event_port_queues`` parameter
>      required for eth_rx, eth_tx, crypto and timer eventdev adapters.
> 
> +* **Updated Marvell cnxk ethdev PMD.**
> +
> +  Added support to skip RED using new action
> +  ``RTE_FLOW_ACTION_TYPE_SKIP_CMAN``
> 
>  Removed Items
>  -------------
> diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h
> index f0eab4244c..ba35873124 100644
> --- a/drivers/net/cnxk/cnxk_ethdev.h
> +++ b/drivers/net/cnxk/cnxk_ethdev.h
> @@ -168,6 +168,7 @@ struct policy_actions {
>  		uint16_t queue;
>  		uint32_t mtr_id;
>  		struct action_rss *rss_desc;
> +		bool skip_red;
>  	};
>  };
> 
> diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c
> index dcfa4223d5..27a6e4ef3d 100644
> --- a/drivers/net/cnxk/cnxk_ethdev_mtr.c
> +++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c
> @@ -358,6 +358,9 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev,
>  				if (action->type == RTE_FLOW_ACTION_TYPE_VOID)
>  					supported[i] = true;
> 
> +				if (action->type == RTE_FLOW_ACTION_TYPE_SKIP_CMAN)
> +					supported[i] = true;
> +
>  				if (!supported[i])
>  					return update_mtr_err(i, error, true);
>  			}
> @@ -397,6 +400,10 @@ cnxk_fill_policy_actions(struct cnxk_mtr_policy_node *fmp,
>  					fmp->actions[i].action_fate =
>  						action->type;
>  				}
> +
> +				if (action->type ==
> +					RTE_FLOW_ACTION_TYPE_SKIP_CMAN)
> +					fmp->actions[i].skip_red = true;
>  			}
>  		}
>  	}
> @@ -1306,6 +1313,45 @@ nix_mtr_config_map(struct cnxk_meter_node *mtr, struct
> roc_nix_bpf_cfg *cfg)
>  		cfg->action[ROC_NIX_BPF_COLOR_RED] = ROC_NIX_BPF_ACTION_DROP;
>  }
> 
> +static void
> +nix_mtr_config_red(struct cnxk_meter_node *mtr, struct roc_nix_rq *rq,
> +		   struct roc_nix_bpf_cfg *cfg)
> +{
> +	struct cnxk_mtr_policy_node *policy = mtr->policy;
> +
> +	if ((rq->red_pass && rq->red_pass >= rq->red_drop) ||
> +	   (rq->spb_red_pass && rq->spb_red_pass >= rq->spb_red_drop)	||
> +	   (rq->xqe_red_pass && rq->xqe_red_pass >= rq->xqe_red_drop)) {
> +		if (policy->actions[RTE_COLOR_GREEN].action_fate ==
> +			RTE_FLOW_ACTION_TYPE_DROP) {
> +			if (policy->actions[RTE_COLOR_GREEN].skip_red)
> +				cfg->action[ROC_NIX_BPF_COLOR_GREEN] =
> +						ROC_NIX_BPF_ACTION_DROP;
> +			else
> +				cfg->action[ROC_NIX_BPF_COLOR_GREEN] =
> +						ROC_NIX_BPF_ACTION_RED;
> +		}
> +		if (policy->actions[RTE_COLOR_YELLOW].action_fate ==
> +			RTE_FLOW_ACTION_TYPE_DROP) {
> +			if (policy->actions[RTE_COLOR_YELLOW].skip_red)
> +				cfg->action[ROC_NIX_BPF_COLOR_YELLOW] =
> +						ROC_NIX_BPF_ACTION_DROP;
> +			else
> +				cfg->action[ROC_NIX_BPF_COLOR_YELLOW] =
> +						ROC_NIX_BPF_ACTION_RED;
> +		}
> +		if (policy->actions[RTE_COLOR_RED].action_fate ==
> +			RTE_FLOW_ACTION_TYPE_DROP) {
> +			if (policy->actions[RTE_COLOR_RED].skip_red)
> +				cfg->action[ROC_NIX_BPF_COLOR_RED] =
> +						ROC_NIX_BPF_ACTION_DROP;
> +			else
> +				cfg->action[ROC_NIX_BPF_COLOR_RED] =
> +						ROC_NIX_BPF_ACTION_RED;
> +		}
> +	}
> +}
> +
>  static void
>  nix_precolor_table_map(struct cnxk_meter_node *mtr,
>  		       struct roc_nix_bpf_precolor *tbl,
> @@ -1483,6 +1529,10 @@ nix_mtr_configure(struct rte_eth_dev *eth_dev, uint32_t id)
>  			if (!mtr[i]->is_used) {
>  				memset(&cfg, 0, sizeof(struct roc_nix_bpf_cfg));
>  				nix_mtr_config_map(mtr[i], &cfg);
> +				for (j = 0; j < mtr[i]->rq_num; j++) {
> +					rq = &dev->rqs[mtr[i]->rq_id[j]];
> +					nix_mtr_config_red(mtr[i], rq, &cfg);
> +				}
>  				rc = roc_nix_bpf_config(nix, mtr[i]->bpf_id,
>  							lvl_map[mtr[i]->level],
>  							&cfg);
> --
> 2.25.1
  

Patch

diff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini
index f81628da77..7947c044bb 100644
--- a/doc/guides/nics/features/cnxk.ini
+++ b/doc/guides/nics/features/cnxk.ini
@@ -94,4 +94,5 @@  queue                = Y
 represented_port     = Y
 rss                  = Y
 security             = Y
+skip_cman            = Y
 vf                   = Y
diff --git a/doc/guides/nics/features/cnxk_vf.ini b/doc/guides/nics/features/cnxk_vf.ini
index c4ee32a9ad..873e1dcc0a 100644
--- a/doc/guides/nics/features/cnxk_vf.ini
+++ b/doc/guides/nics/features/cnxk_vf.ini
@@ -83,4 +83,5 @@  pf                   = Y
 queue                = Y
 rss                  = Y
 security             = Y
+skip_cman            = Y
 vf                   = Y
diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst
index 1dd10e26db..9f53ded5fb 100644
--- a/doc/guides/rel_notes/release_23_03.rst
+++ b/doc/guides/rel_notes/release_23_03.rst
@@ -98,6 +98,10 @@  New Features
     ``rte_event_dev_config::nb_single_link_event_port_queues`` parameter
     required for eth_rx, eth_tx, crypto and timer eventdev adapters.
 
+* **Updated Marvell cnxk ethdev PMD.**
+
+  Added support to skip RED using new action
+  ``RTE_FLOW_ACTION_TYPE_SKIP_CMAN``
 
 Removed Items
 -------------
diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h
index f0eab4244c..ba35873124 100644
--- a/drivers/net/cnxk/cnxk_ethdev.h
+++ b/drivers/net/cnxk/cnxk_ethdev.h
@@ -168,6 +168,7 @@  struct policy_actions {
 		uint16_t queue;
 		uint32_t mtr_id;
 		struct action_rss *rss_desc;
+		bool skip_red;
 	};
 };
 
diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c
index dcfa4223d5..27a6e4ef3d 100644
--- a/drivers/net/cnxk/cnxk_ethdev_mtr.c
+++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c
@@ -358,6 +358,9 @@  cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev,
 				if (action->type == RTE_FLOW_ACTION_TYPE_VOID)
 					supported[i] = true;
 
+				if (action->type == RTE_FLOW_ACTION_TYPE_SKIP_CMAN)
+					supported[i] = true;
+
 				if (!supported[i])
 					return update_mtr_err(i, error, true);
 			}
@@ -397,6 +400,10 @@  cnxk_fill_policy_actions(struct cnxk_mtr_policy_node *fmp,
 					fmp->actions[i].action_fate =
 						action->type;
 				}
+
+				if (action->type ==
+					RTE_FLOW_ACTION_TYPE_SKIP_CMAN)
+					fmp->actions[i].skip_red = true;
 			}
 		}
 	}
@@ -1306,6 +1313,45 @@  nix_mtr_config_map(struct cnxk_meter_node *mtr, struct roc_nix_bpf_cfg *cfg)
 		cfg->action[ROC_NIX_BPF_COLOR_RED] = ROC_NIX_BPF_ACTION_DROP;
 }
 
+static void
+nix_mtr_config_red(struct cnxk_meter_node *mtr, struct roc_nix_rq *rq,
+		   struct roc_nix_bpf_cfg *cfg)
+{
+	struct cnxk_mtr_policy_node *policy = mtr->policy;
+
+	if ((rq->red_pass && rq->red_pass >= rq->red_drop) ||
+	   (rq->spb_red_pass && rq->spb_red_pass >= rq->spb_red_drop)	||
+	   (rq->xqe_red_pass && rq->xqe_red_pass >= rq->xqe_red_drop)) {
+		if (policy->actions[RTE_COLOR_GREEN].action_fate ==
+			RTE_FLOW_ACTION_TYPE_DROP) {
+			if (policy->actions[RTE_COLOR_GREEN].skip_red)
+				cfg->action[ROC_NIX_BPF_COLOR_GREEN] =
+						ROC_NIX_BPF_ACTION_DROP;
+			else
+				cfg->action[ROC_NIX_BPF_COLOR_GREEN] =
+						ROC_NIX_BPF_ACTION_RED;
+		}
+		if (policy->actions[RTE_COLOR_YELLOW].action_fate ==
+			RTE_FLOW_ACTION_TYPE_DROP) {
+			if (policy->actions[RTE_COLOR_YELLOW].skip_red)
+				cfg->action[ROC_NIX_BPF_COLOR_YELLOW] =
+						ROC_NIX_BPF_ACTION_DROP;
+			else
+				cfg->action[ROC_NIX_BPF_COLOR_YELLOW] =
+						ROC_NIX_BPF_ACTION_RED;
+		}
+		if (policy->actions[RTE_COLOR_RED].action_fate ==
+			RTE_FLOW_ACTION_TYPE_DROP) {
+			if (policy->actions[RTE_COLOR_RED].skip_red)
+				cfg->action[ROC_NIX_BPF_COLOR_RED] =
+						ROC_NIX_BPF_ACTION_DROP;
+			else
+				cfg->action[ROC_NIX_BPF_COLOR_RED] =
+						ROC_NIX_BPF_ACTION_RED;
+		}
+	}
+}
+
 static void
 nix_precolor_table_map(struct cnxk_meter_node *mtr,
 		       struct roc_nix_bpf_precolor *tbl,
@@ -1483,6 +1529,10 @@  nix_mtr_configure(struct rte_eth_dev *eth_dev, uint32_t id)
 			if (!mtr[i]->is_used) {
 				memset(&cfg, 0, sizeof(struct roc_nix_bpf_cfg));
 				nix_mtr_config_map(mtr[i], &cfg);
+				for (j = 0; j < mtr[i]->rq_num; j++) {
+					rq = &dev->rqs[mtr[i]->rq_id[j]];
+					nix_mtr_config_red(mtr[i], rq, &cfg);
+				}
 				rc = roc_nix_bpf_config(nix, mtr[i]->bpf_id,
 							lvl_map[mtr[i]->level],
 							&cfg);