Re: [dpdk-dev] [PATCH 12/22] app/testpmd: add rte_flow item spec handler
Hi Beilei, On Fri, Dec 16, 2016 at 12:22:52PM +, Xing, Beilei wrote: > Thanks Adrien. > > I have two questions: > 1. when I set " / vlan tci fix 10" with testpmd, I find the mask of tci is > 0x. > Actually tci includes PRI, CFI, and Vlan_id which holds 12 bits, so is > it possible > to set the mask to 0xFFF? > Our driver will check the mask only covers vlan_id instead of the whole > tci. Right, I'll work on a method to do that. TCI remains 16 bit either way so the current approach remains accurate, although not convenient because a 10 bit mask must be specified manually. This change won't be included in v2 though. > 2. When we test destroy function, we find the pointer provided to PMD is NULL > instead of the pointer PMD returned to RTE during creating flow. Could you > please have double check? Thanks. There is indeed a bug [1]. It is fixed in v2. Thanks. [1] http://dpdk.org/ml/archives/dev/2016-November/050435.html -- Adrien Mazarguil 6WIND
Re: [dpdk-dev] [PATCH 12/22] app/testpmd: add rte_flow item spec handler
Thanks Adrien. I have two questions: 1. when I set " / vlan tci fix 10" with testpmd, I find the mask of tci is 0x. Actually tci includes PRI, CFI, and Vlan_id which holds 12 bits, so is it possible to set the mask to 0xFFF? Our driver will check the mask only covers vlan_id instead of the whole tci. 2. When we test destroy function, we find the pointer provided to PMD is NULL instead of the pointer PMD returned to RTE during creating flow. Could you please have double check? Thanks. Best Regards Beilei > -Original Message- > From: Adrien Mazarguil [mailto:adrien.mazarg...@6wind.com] > Sent: Friday, December 16, 2016 5:18 PM > To: Pei, Yulong > Cc: dev@dpdk.org; Thomas Monjalon ; De > Lara Guarch, Pablo ; Olivier Matz > ; Xing, Beilei > Subject: Re: [dpdk-dev] [PATCH 12/22] app/testpmd: add rte_flow item spec > handler > > Hi Yulong, > > On Fri, Dec 16, 2016 at 03:01:15AM +, Pei, Yulong wrote: > > Hi Adrien, > > > > I try to setup the following rule, but it seems that after set 'spec' > > param, > can not set 'mask' param, is it an issue here or am I wrong to use it ? > > > > testpmd> flow create 0 ingress pattern eth dst spec 00:00:00:00:09:00 > > dst [TOKEN]: destination MAC > > src [TOKEN]: source MAC > > type [TOKEN]: EtherType > > / [TOKEN]: specify next pattern item > > You need to re-specify dst with "mask" instead of "spec". You can specify it > as many times you like to update each structure in turn, e.g.: > > testpmd> flow create 0 ingress pattern eth dst spec 00:00:00:00:09:00 dst > mask 00:00:00:00:ff:ff > > If you want to specify both spec and mask at once assuming you want it full, > these commands yield the same result: > > testpmd> flow create 0 ingress pattern eth dst fix 00:00:00:00:09:00 > testpmd> > flow create 0 ingress pattern eth dst spec 00:00:00:00:09:00 dst mask > ff:ff:ff:ff:ff:ff testpmd> flow create 0 ingress pattern eth dst spec > 00:00:00:00:09:00 dst prefix 48 > > You are even allowed to change your mind: > > testpmd> flow create 0 ingress pattern eth dst fix 00:00:2a:2a:2a:2a dst fix > 00:00:00:00:09:00 > > All these will be properly documented in the v2 patchset. Note, this version > will replace the "fix" keyword with "is" ("fix" made no sense according to > feedback). > > -- > Adrien Mazarguil > 6WIND
Re: [dpdk-dev] [PATCH 12/22] app/testpmd: add rte_flow item spec handler
Hi Yulong, On Fri, Dec 16, 2016 at 03:01:15AM +, Pei, Yulong wrote: > Hi Adrien, > > I try to setup the following rule, but it seems that after set 'spec' param, > can not set 'mask' param, is it an issue here or am I wrong to use it ? > > testpmd> flow create 0 ingress pattern eth dst spec 00:00:00:00:09:00 > dst [TOKEN]: destination MAC > src [TOKEN]: source MAC > type [TOKEN]: EtherType > / [TOKEN]: specify next pattern item You need to re-specify dst with "mask" instead of "spec". You can specify it as many times you like to update each structure in turn, e.g.: testpmd> flow create 0 ingress pattern eth dst spec 00:00:00:00:09:00 dst mask 00:00:00:00:ff:ff If you want to specify both spec and mask at once assuming you want it full, these commands yield the same result: testpmd> flow create 0 ingress pattern eth dst fix 00:00:00:00:09:00 testpmd> flow create 0 ingress pattern eth dst spec 00:00:00:00:09:00 dst mask ff:ff:ff:ff:ff:ff testpmd> flow create 0 ingress pattern eth dst spec 00:00:00:00:09:00 dst prefix 48 You are even allowed to change your mind: testpmd> flow create 0 ingress pattern eth dst fix 00:00:2a:2a:2a:2a dst fix 00:00:00:00:09:00 All these will be properly documented in the v2 patchset. Note, this version will replace the "fix" keyword with "is" ("fix" made no sense according to feedback). -- Adrien Mazarguil 6WIND
Re: [dpdk-dev] [PATCH 12/22] app/testpmd: add rte_flow item spec handler
Hi Adrien, I try to setup the following rule, but it seems that after set 'spec' param, can not set 'mask' param, is it an issue here or am I wrong to use it ? testpmd> flow create 0 ingress pattern eth dst spec 00:00:00:00:09:00 dst [TOKEN]: destination MAC src [TOKEN]: source MAC type [TOKEN]: EtherType / [TOKEN]: specify next pattern item Best Regards Yulong Pei -Original Message- From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Adrien Mazarguil Sent: Thursday, November 17, 2016 12:24 AM To: dev@dpdk.org Cc: Thomas Monjalon ; De Lara Guarch, Pablo ; Olivier Matz Subject: [dpdk-dev] [PATCH 12/22] app/testpmd: add rte_flow item spec handler Add parser code to fully set individual fields of pattern item specification structures, using the following operators: - fix: sets field and applies full bit-mask for perfect matching. - spec: sets field without modifying its bit-mask. - last: sets upper value of the spec => last range. - mask: sets bit-mask affecting both spec and last from arbitrary value. Signed-off-by: Adrien Mazarguil --- app/test-pmd/cmdline_flow.c | 110 +++ 1 file changed, 110 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index e70e8e2..790b4b8 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -89,6 +89,10 @@ enum index { /* Validate/create pattern. */ PATTERN, + ITEM_PARAM_FIX, + ITEM_PARAM_SPEC, + ITEM_PARAM_LAST, + ITEM_PARAM_MASK, ITEM_NEXT, ITEM_END, ITEM_VOID, @@ -121,6 +125,7 @@ struct context { uint16_t port; /**< Current port ID (for completions). */ uint32_t objdata; /**< Object-specific data. */ void *object; /**< Address of current object for relative offsets. */ + void *objmask; /**< Object a full mask must be written to. */ }; /** Token argument. */ @@ -267,6 +272,14 @@ static const enum index next_list_attr[] = { 0, }; +static const enum index item_param[] = { + ITEM_PARAM_FIX, + ITEM_PARAM_SPEC, + ITEM_PARAM_LAST, + ITEM_PARAM_MASK, + 0, +}; + static const enum index next_item[] = { ITEM_END, ITEM_VOID, @@ -287,6 +300,8 @@ static int parse_init(struct context *, const struct token *, static int parse_vc(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); +static int parse_vc_spec(struct context *, const struct token *, +const char *, unsigned int, void *, unsigned int); static int parse_destroy(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -492,6 +507,26 @@ static const struct token token_list[] = { .next = NEXT(next_item), .call = parse_vc, }, + [ITEM_PARAM_FIX] = { + .name = "fix", + .help = "match value perfectly (with full bit-mask)", + .call = parse_vc_spec, + }, + [ITEM_PARAM_SPEC] = { + .name = "spec", + .help = "match value according to configured bit-mask", + .call = parse_vc_spec, + }, + [ITEM_PARAM_LAST] = { + .name = "last", + .help = "specify upper bound to establish a range", + .call = parse_vc_spec, + }, + [ITEM_PARAM_MASK] = { + .name = "mask", + .help = "specify bit-mask with relevant bits set to one", + .call = parse_vc_spec, + }, [ITEM_NEXT] = { .name = "/", .help = "specify next pattern item", @@ -605,6 +640,7 @@ parse_init(struct context *ctx, const struct token *token, memset((uint8_t *)out + sizeof(*out), 0x22, size - sizeof(*out)); ctx->objdata = 0; ctx->object = out; + ctx->objmask = NULL; return len; } @@ -632,11 +668,13 @@ parse_vc(struct context *ctx, const struct token *token, out->command = ctx->curr; ctx->objdata = 0; ctx->object = out; + ctx->objmask = NULL; out->args.vc.data = (uint8_t *)out + size; return len; } ctx->objdata = 0; ctx->object = &out->args.vc.attr; + ctx->objmask = NULL; switch (ctx->curr) { case GROUP: case PRIORITY: @@ -652,6 +690,7 @@ parse_vc(struct context *ctx, const struct token *token, (void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1), sizeof(double)); ctx->object = out->args.vc.pattern
[dpdk-dev] [PATCH 12/22] app/testpmd: add rte_flow item spec handler
Add parser code to fully set individual fields of pattern item specification structures, using the following operators: - fix: sets field and applies full bit-mask for perfect matching. - spec: sets field without modifying its bit-mask. - last: sets upper value of the spec => last range. - mask: sets bit-mask affecting both spec and last from arbitrary value. Signed-off-by: Adrien Mazarguil --- app/test-pmd/cmdline_flow.c | 110 +++ 1 file changed, 110 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index e70e8e2..790b4b8 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -89,6 +89,10 @@ enum index { /* Validate/create pattern. */ PATTERN, + ITEM_PARAM_FIX, + ITEM_PARAM_SPEC, + ITEM_PARAM_LAST, + ITEM_PARAM_MASK, ITEM_NEXT, ITEM_END, ITEM_VOID, @@ -121,6 +125,7 @@ struct context { uint16_t port; /**< Current port ID (for completions). */ uint32_t objdata; /**< Object-specific data. */ void *object; /**< Address of current object for relative offsets. */ + void *objmask; /**< Object a full mask must be written to. */ }; /** Token argument. */ @@ -267,6 +272,14 @@ static const enum index next_list_attr[] = { 0, }; +static const enum index item_param[] = { + ITEM_PARAM_FIX, + ITEM_PARAM_SPEC, + ITEM_PARAM_LAST, + ITEM_PARAM_MASK, + 0, +}; + static const enum index next_item[] = { ITEM_END, ITEM_VOID, @@ -287,6 +300,8 @@ static int parse_init(struct context *, const struct token *, static int parse_vc(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); +static int parse_vc_spec(struct context *, const struct token *, +const char *, unsigned int, void *, unsigned int); static int parse_destroy(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -492,6 +507,26 @@ static const struct token token_list[] = { .next = NEXT(next_item), .call = parse_vc, }, + [ITEM_PARAM_FIX] = { + .name = "fix", + .help = "match value perfectly (with full bit-mask)", + .call = parse_vc_spec, + }, + [ITEM_PARAM_SPEC] = { + .name = "spec", + .help = "match value according to configured bit-mask", + .call = parse_vc_spec, + }, + [ITEM_PARAM_LAST] = { + .name = "last", + .help = "specify upper bound to establish a range", + .call = parse_vc_spec, + }, + [ITEM_PARAM_MASK] = { + .name = "mask", + .help = "specify bit-mask with relevant bits set to one", + .call = parse_vc_spec, + }, [ITEM_NEXT] = { .name = "/", .help = "specify next pattern item", @@ -605,6 +640,7 @@ parse_init(struct context *ctx, const struct token *token, memset((uint8_t *)out + sizeof(*out), 0x22, size - sizeof(*out)); ctx->objdata = 0; ctx->object = out; + ctx->objmask = NULL; return len; } @@ -632,11 +668,13 @@ parse_vc(struct context *ctx, const struct token *token, out->command = ctx->curr; ctx->objdata = 0; ctx->object = out; + ctx->objmask = NULL; out->args.vc.data = (uint8_t *)out + size; return len; } ctx->objdata = 0; ctx->object = &out->args.vc.attr; + ctx->objmask = NULL; switch (ctx->curr) { case GROUP: case PRIORITY: @@ -652,6 +690,7 @@ parse_vc(struct context *ctx, const struct token *token, (void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1), sizeof(double)); ctx->object = out->args.vc.pattern; + ctx->objmask = NULL; return len; case ACTIONS: out->args.vc.actions = @@ -660,6 +699,7 @@ parse_vc(struct context *ctx, const struct token *token, out->args.vc.pattern_n), sizeof(double)); ctx->object = out->args.vc.actions; + ctx->objmask = NULL; return len; default: if (!token->priv) @@ -682,6 +722,7 @@ parse_vc(struct context *ctx, const struct token *token, }; ++out->args.vc.pattern_n; ctx->object = item; + ctx->objmask = NULL; } else { const struct parse_action_priv *priv = token->priv; struct rte_flow_action *action = @@ -698,6 +739,7 @@ par