summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatan Azrad <matan@mellanox.com>2017-07-24 16:47:32 +0300
committerYuanhan Liu <yliu@fridaylinux.org>2017-08-29 14:50:29 +0800
commit56679bc38b9c9d0a95527a6ee4710044bcb89ced (patch)
tree55bb3f069bd2fd23d2177b773322049d73bb2909
parentca611e549fd72dbd1a2aa8c8e556d93364844705 (diff)
downloaddpdk-stable-56679bc38b9c9d0a95527a6ee4710044bcb89ced.zip
dpdk-stable-56679bc38b9c9d0a95527a6ee4710044bcb89ced.tar.gz
dpdk-stable-56679bc38b9c9d0a95527a6ee4710044bcb89ced.tar.xz
app/testpmd: fix flow rule copy functions
[ upstream commit 79bf388493b5c4be104c6c17fd98aa293dafa42d ] The corrupted code checks only RAW flow item type special case for returning its size but doesn't deal with any other flow item type and returns 0 for all the others. This bug leaves the flow descriptor empty for non RAW types. The fix takes the correct size to any regular types from appropriate array. The same issue, with a similar fix, is in flow action size method which deals only with RSS special type. Fixes: 938a184a1870 ("app/testpmd: implement basic support for flow API") Signed-off-by: Matan Azrad <matan@mellanox.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
-rw-r--r--app/test-pmd/config.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 83a8f52..1c20661 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -979,8 +979,10 @@ static void
flow_item_spec_size(const struct rte_flow_item *item,
size_t *size, size_t *pad)
{
- if (!item->spec)
+ if (!item->spec) {
+ *size = 0;
goto empty;
+ }
switch (item->type) {
union {
const struct rte_flow_item_raw *raw;
@@ -992,10 +994,10 @@ flow_item_spec_size(const struct rte_flow_item *item,
spec.raw->length * sizeof(*spec.raw->pattern);
break;
default:
-empty:
- *size = 0;
+ *size = flow_item[item->type].size;
break;
}
+empty:
*pad = RTE_ALIGN_CEIL(*size, sizeof(double)) - *size;
}
@@ -1030,8 +1032,10 @@ static void
flow_action_conf_size(const struct rte_flow_action *action,
size_t *size, size_t *pad)
{
- if (!action->conf)
+ if (!action->conf) {
+ *size = 0;
goto empty;
+ }
switch (action->type) {
union {
const struct rte_flow_action_rss *rss;
@@ -1043,10 +1047,10 @@ flow_action_conf_size(const struct rte_flow_action *action,
conf.rss->num * sizeof(*conf.rss->queue);
break;
default:
-empty:
- *size = 0;
+ *size = flow_action[action->type].size;
break;
}
+empty:
*pad = RTE_ALIGN_CEIL(*size, sizeof(double)) - *size;
}