[5/5] net/iavf: add support for FDIR mark action
Checks
Commit Message
This patch enables mark action support and takes mark only case
into consideration.
Signed-off-by: Simei Su <simei.su@intel.com>
---
drivers/net/iavf/iavf.h | 1 +
drivers/net/iavf/iavf_fdir.c | 46 +++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 46 insertions(+), 1 deletion(-)
Comments
> -----Original Message-----
> From: Su, Simei <simei.su@intel.com>
> Sent: Wednesday, March 18, 2020 1:42 PM
> To: Ye, Xiaolong <xiaolong.ye@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Cao, Yahui <yahui.cao@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Su, Simei <simei.su@intel.com>
> Subject: [PATCH 5/5] net/iavf: add support for FDIR mark action
>
> This patch enables mark action support and takes mark only case into
> consideration.
>
> Signed-off-by: Simei Su <simei.su@intel.com>
> ---
> drivers/net/iavf/iavf.h | 1 +
> drivers/net/iavf/iavf_fdir.c | 46
> +++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 46 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index
> 62a3eb8..178d481 100644
> --- a/drivers/net/iavf/iavf.h
> +++ b/drivers/net/iavf/iavf.h
> @@ -103,6 +103,7 @@ struct iavf_fdir_conf {
> struct virtchnl_fdir_fltr input;
> uint64_t input_set;
> uint32_t flow_id;
> + uint32_t mark_flag;
> };
>
> struct iavf_fdir_info {
> diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c index
> 8d49c28..a03bc09 100644
> --- a/drivers/net/iavf/iavf_fdir.c
> +++ b/drivers/net/iavf/iavf_fdir.c
> @@ -18,6 +18,7 @@
> #include "iavf.h"
> #include "iavf_generic_flow.h"
> #include "virtchnl.h"
> +#include "iavf_rxtx.h"
>
> #define IAVF_FDIR_MAX_QREGION_SIZE 128
>
> @@ -171,6 +172,9 @@
> goto free_entry;
> }
>
> + if (filter->mark_flag == 1)
> + iavf_fdir_rx_proc_enable(ad, 1);
> +
> rte_memcpy(rule, filter, sizeof(*rule));
> flow->rule = rule;
>
> @@ -199,6 +203,9 @@
> return -rte_errno;
> }
>
> + if (filter->mark_flag == 1)
> + iavf_fdir_rx_proc_enable(ad, 0);
> +
> flow->rule = NULL;
> rte_free(filter);
>
> @@ -297,7 +304,9 @@
> struct iavf_fdir_conf *filter)
> {
> const struct rte_flow_action_queue *act_q;
> + const struct rte_flow_action_mark *mark_spec = NULL;
> uint32_t dest_num = 0;
> + uint32_t mark_num = 0;
> int ret;
>
> int number = 0;
> @@ -367,6 +376,20 @@
> filter->input.rule_cfg.action_set.count = ++number;
> break;
>
> + case RTE_FLOW_ACTION_TYPE_MARK:
> + mark_num++;
> +
> + filter->mark_flag = 1;
> + mark_spec = actions->conf;
> + filter_action = &filter->input.rule_cfg.
> + action_set.actions[number];
> +
> + filter_action->type = VIRTCHNL_FDIR_ACT_MARK;
> + filter_action->mark_id = mark_spec->id;
> +
> + filter->input.rule_cfg.action_set.count = ++number;
> + break;
> +
> default:
> rte_flow_error_set(error, EINVAL,
> RTE_FLOW_ERROR_TYPE_ACTION,
> actions, @@ -375,13 +398,34 @@
> }
> }
>
> - if (dest_num == 0 || dest_num >= 2) {
> + if (dest_num >= 2) {
> rte_flow_error_set(error, EINVAL,
> RTE_FLOW_ERROR_TYPE_ACTION, actions,
> "Unsupported action combination");
> return -rte_errno;
> }
>
> + if (mark_num >= 2) {
> + rte_flow_error_set(error, EINVAL,
> + RTE_FLOW_ERROR_TYPE_ACTION, actions,
> + "Too many mark actions");
> + return -rte_errno;
> + }
> +
> + if (dest_num + mark_num == 0) {
> + rte_flow_error_set(error, EINVAL,
> + RTE_FLOW_ERROR_TYPE_ACTION, actions,
> + "Emtpy action");
> + return -rte_errno;
> + }
> +
> + /* Mark only is equal to mark + passthru. */
> + if (dest_num == 0) {
> + filter_action = &filter->input.rule_cfg.
> + action_set.actions[number];
> + filter_action->type = VIRTCHNL_FDIR_ACT_PASSTHRU;
[Cao, Yahui]
Miss "filter->input.rule_cfg.action_set.count = ++number;" here
> + }
> +
> return 0;
> }
>
> --
> 1.8.3.1
Hi, Yahui
> -----Original Message-----
> From: Cao, Yahui <yahui.cao@intel.com>
> Sent: Tuesday, March 31, 2020 1:21 PM
> To: Su, Simei <simei.su@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>;
> Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Wu, Jingjing <jingjing.wu@intel.com>
> Subject: RE: [PATCH 5/5] net/iavf: add support for FDIR mark action
>
>
>
> > -----Original Message-----
> > From: Su, Simei <simei.su@intel.com>
> > Sent: Wednesday, March 18, 2020 1:42 PM
> > To: Ye, Xiaolong <xiaolong.ye@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Cao, Yahui <yahui.cao@intel.com>; Wu, Jingjing
> > <jingjing.wu@intel.com>; Su, Simei <simei.su@intel.com>
> > Subject: [PATCH 5/5] net/iavf: add support for FDIR mark action
> >
> > This patch enables mark action support and takes mark only case into
> > consideration.
> >
> > Signed-off-by: Simei Su <simei.su@intel.com>
> > ---
> > drivers/net/iavf/iavf.h | 1 +
> > drivers/net/iavf/iavf_fdir.c | 46
> > +++++++++++++++++++++++++++++++++++++++++++-
> > 2 files changed, 46 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index
> > 62a3eb8..178d481 100644
> > --- a/drivers/net/iavf/iavf.h
> > +++ b/drivers/net/iavf/iavf.h
> > @@ -103,6 +103,7 @@ struct iavf_fdir_conf { struct virtchnl_fdir_fltr
> > input; uint64_t input_set; uint32_t flow_id;
> > +uint32_t mark_flag;
> > };
> >
> > struct iavf_fdir_info {
> > diff --git a/drivers/net/iavf/iavf_fdir.c
> > b/drivers/net/iavf/iavf_fdir.c index
> > 8d49c28..a03bc09 100644
> > --- a/drivers/net/iavf/iavf_fdir.c
> > +++ b/drivers/net/iavf/iavf_fdir.c
> > @@ -18,6 +18,7 @@
> > #include "iavf.h"
> > #include "iavf_generic_flow.h"
> > #include "virtchnl.h"
> > +#include "iavf_rxtx.h"
> >
> > #define IAVF_FDIR_MAX_QREGION_SIZE 128
> >
> > @@ -171,6 +172,9 @@
> > goto free_entry;
> > }
> >
> > +if (filter->mark_flag == 1)
> > +iavf_fdir_rx_proc_enable(ad, 1);
> > +
> > rte_memcpy(rule, filter, sizeof(*rule)); flow->rule = rule;
> >
> > @@ -199,6 +203,9 @@
> > return -rte_errno;
> > }
> >
> > +if (filter->mark_flag == 1)
> > +iavf_fdir_rx_proc_enable(ad, 0);
> > +
> > flow->rule = NULL;
> > rte_free(filter);
> >
> > @@ -297,7 +304,9 @@
> > struct iavf_fdir_conf *filter)
> > {
> > const struct rte_flow_action_queue *act_q;
> > +const struct rte_flow_action_mark *mark_spec = NULL;
> > uint32_t dest_num = 0;
> > +uint32_t mark_num = 0;
> > int ret;
> >
> > int number = 0;
> > @@ -367,6 +376,20 @@
> > filter->input.rule_cfg.action_set.count = ++number; break;
> >
> > +case RTE_FLOW_ACTION_TYPE_MARK:
> > +mark_num++;
> > +
> > +filter->mark_flag = 1;
> > +mark_spec = actions->conf;
> > +filter_action = &filter->input.rule_cfg.
> > +action_set.actions[number];
> > +
> > +filter_action->type = VIRTCHNL_FDIR_ACT_MARK; filter_action->mark_id
> > += mark_spec->id;
> > +
> > +filter->input.rule_cfg.action_set.count = ++number;
> > +break;
> > +
> > default:
> > rte_flow_error_set(error, EINVAL,
> > RTE_FLOW_ERROR_TYPE_ACTION,
> > actions, @@ -375,13 +398,34 @@
> > }
> > }
> >
> > -if (dest_num == 0 || dest_num >= 2) {
> > +if (dest_num >= 2) {
> > rte_flow_error_set(error, EINVAL,
> > RTE_FLOW_ERROR_TYPE_ACTION, actions,
> > "Unsupported action combination");
> > return -rte_errno;
> > }
> >
> > +if (mark_num >= 2) {
> > +rte_flow_error_set(error, EINVAL,
> > +RTE_FLOW_ERROR_TYPE_ACTION, actions,
> > +"Too many mark actions");
> > +return -rte_errno;
> > +}
> > +
> > +if (dest_num + mark_num == 0) {
> > +rte_flow_error_set(error, EINVAL,
> > +RTE_FLOW_ERROR_TYPE_ACTION, actions,
> > +"Emtpy action");
> > +return -rte_errno;
> > +}
> > +
> > +/* Mark only is equal to mark + passthru. */ if (dest_num == 0) {
> > +filter_action = &filter->input.rule_cfg.
> > +action_set.actions[number];
> > +filter_action->type = VIRTCHNL_FDIR_ACT_PASSTHRU;
> [Cao, Yahui]
> Miss "filter->input.rule_cfg.action_set.count = ++number;" here
Yes, I have found this issue and already added in my following patch, will be included in the next version. Thanks!
Br
Simei
>
> > +}
> > +
> > return 0;
> > }
> >
> > --
> > 1.8.3.1
>
@@ -103,6 +103,7 @@ struct iavf_fdir_conf {
struct virtchnl_fdir_fltr input;
uint64_t input_set;
uint32_t flow_id;
+ uint32_t mark_flag;
};
struct iavf_fdir_info {
@@ -18,6 +18,7 @@
#include "iavf.h"
#include "iavf_generic_flow.h"
#include "virtchnl.h"
+#include "iavf_rxtx.h"
#define IAVF_FDIR_MAX_QREGION_SIZE 128
@@ -171,6 +172,9 @@
goto free_entry;
}
+ if (filter->mark_flag == 1)
+ iavf_fdir_rx_proc_enable(ad, 1);
+
rte_memcpy(rule, filter, sizeof(*rule));
flow->rule = rule;
@@ -199,6 +203,9 @@
return -rte_errno;
}
+ if (filter->mark_flag == 1)
+ iavf_fdir_rx_proc_enable(ad, 0);
+
flow->rule = NULL;
rte_free(filter);
@@ -297,7 +304,9 @@
struct iavf_fdir_conf *filter)
{
const struct rte_flow_action_queue *act_q;
+ const struct rte_flow_action_mark *mark_spec = NULL;
uint32_t dest_num = 0;
+ uint32_t mark_num = 0;
int ret;
int number = 0;
@@ -367,6 +376,20 @@
filter->input.rule_cfg.action_set.count = ++number;
break;
+ case RTE_FLOW_ACTION_TYPE_MARK:
+ mark_num++;
+
+ filter->mark_flag = 1;
+ mark_spec = actions->conf;
+ filter_action = &filter->input.rule_cfg.
+ action_set.actions[number];
+
+ filter_action->type = VIRTCHNL_FDIR_ACT_MARK;
+ filter_action->mark_id = mark_spec->id;
+
+ filter->input.rule_cfg.action_set.count = ++number;
+ break;
+
default:
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION, actions,
@@ -375,13 +398,34 @@
}
}
- if (dest_num == 0 || dest_num >= 2) {
+ if (dest_num >= 2) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION, actions,
"Unsupported action combination");
return -rte_errno;
}
+ if (mark_num >= 2) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION, actions,
+ "Too many mark actions");
+ return -rte_errno;
+ }
+
+ if (dest_num + mark_num == 0) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION, actions,
+ "Emtpy action");
+ return -rte_errno;
+ }
+
+ /* Mark only is equal to mark + passthru. */
+ if (dest_num == 0) {
+ filter_action = &filter->input.rule_cfg.
+ action_set.actions[number];
+ filter_action->type = VIRTCHNL_FDIR_ACT_PASSTHRU;
+ }
+
return 0;
}