[dpdk-dev] [PATCH v1 02/21] app/testpmd: support flow RSS level parsing
Xueming Li
xuemingl at mellanox.com
Fri Mar 9 12:29:02 CET 2018
Support new flow RSS level parameter to select inner or outer RSS
fields. Example:
flow create 0 ingress pattern eth / ipv4 / udp dst is 4789 / vxlan /
end actions rss queues 1 2 end level 1 / end
Signed-off-by: Xueming Li <xuemingl at mellanox.com>
---
app/test-pmd/cmdline_flow.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index a5cf84f..921220d 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -169,6 +169,7 @@ enum index {
ACTION_RSS,
ACTION_RSS_QUEUES,
ACTION_RSS_QUEUE,
+ ACTION_RSS_LEVEL,
ACTION_PF,
ACTION_VF,
ACTION_VF_ORIGINAL,
@@ -190,7 +191,8 @@ enum index {
/** Storage size for struct rte_flow_action_rss including queues. */
#define ACTION_RSS_SIZE \
(offsetof(struct rte_flow_action_rss, queue) + \
- sizeof(*((struct rte_flow_action_rss *)0)->queue) * ACTION_RSS_NUM)
+ sizeof(*((struct rte_flow_action_rss *)0)->queue) * ACTION_RSS_NUM + \
+ sizeof(struct rte_eth_rss_conf))
/** Maximum number of subsequent tokens and arguments on the stack. */
#define CTX_STACK_SIZE 16
@@ -623,6 +625,7 @@ struct parse_action_priv {
static const enum index action_rss[] = {
ACTION_RSS_QUEUES,
+ ACTION_RSS_LEVEL,
ACTION_NEXT,
ZERO,
};
@@ -640,6 +643,12 @@ struct parse_action_priv {
ZERO,
};
+static struct arg rss_level_arg = {
+ .offset = ACTION_RSS_SIZE - sizeof(struct rte_eth_rss_conf) +
+ offsetof(struct rte_eth_rss_conf, rss_level),
+ .size = sizeof(((struct rte_eth_rss_conf *)0)->rss_level),
+};
+
static int parse_init(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
@@ -1589,6 +1598,13 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *,
.call = parse_vc_action_rss_queue,
.comp = comp_vc_action_rss_queue,
},
+ [ACTION_RSS_LEVEL] = {
+ .name = "level",
+ .help = "rss on tunnel level",
+ .next = NEXT(action_rss, NEXT_ENTRY(UNSIGNED)),
+ .args = ARGS(&rss_level_arg),
+ .call = parse_vc_conf,
+ },
[ACTION_PF] = {
.name = "pf",
.help = "redirect packets to physical device function",
@@ -1890,6 +1906,7 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *,
sizeof(double));
if ((uint8_t *)item + sizeof(*item) > data)
return -1;
+ memset(data, 0, data_size);
*item = (struct rte_flow_item){
.type = priv->type,
};
@@ -1907,14 +1924,20 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *,
sizeof(double));
if ((uint8_t *)action + sizeof(*action) > data)
return -1;
+ memset(data, 0, data_size);
*action = (struct rte_flow_action){
.type = priv->type,
};
+ if (ctx->curr == ACTION_RSS) {
+ struct rte_flow_action_rss *rss = (void *)data;
+
+ rss->rss_conf = RTE_PTR_ADD(rss, data_size -
+ sizeof(*rss->rss_conf));
+ }
++out->args.vc.actions_n;
ctx->object = action;
ctx->objmask = NULL;
}
- memset(data, 0, data_size);
out->args.vc.data = data;
ctx->objdata = data_size;
return len;
--
1.8.3.1
More information about the dev
mailing list