From: Ferruh Yigit <ferruh.yigit@intel.com>
To: "Zhang,Alvin" <alvinx.zhang@intel.com>
Cc: dev@dpdk.org, stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix RSS key
Date: Tue, 19 Jan 2021 19:14:40 +0000 [thread overview]
Message-ID: <fdee4be8-3ff6-c2f7-793b-4b6e5c394d0d@intel.com> (raw)
In-Reply-To: <20210118085937.12072-1-alvinx.zhang@intel.com>
On 1/18/2021 8:59 AM, Zhang,Alvin wrote:
> From: Alvin Zhang <alvinx.zhang@intel.com>
>
> Since the patch '1848b117' has set the value of key in 'struct
> rte_flow_action_rss' to NULL, the PMD cannot get the RSS key now.
>
> This patch sets offset and size of the key pointer as the first
> parameter of the token 'key' and copies the start address of the
> 'HEX' data to the location specified by the first parameter of
> the token.
>
Can you please put the rte_flow command that enables reproducing this defect, it
may help in the future?
> Fixes: 1848b117cca1 ("app/testpmd: fix RSS key for flow API RSS rule")
> Cc: stable@dpdk.org
>
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> ---
> app/test-pmd/cmdline_flow.c | 24 +++++++++++++-----------
> 1 file changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 585cab9..6eb46d3 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -3403,7 +3403,10 @@ static int comp_set_sample_index(struct context *, const struct token *,
> .name = "key",
> .help = "RSS hash key",
> .next = NEXT(action_rss, NEXT_ENTRY(HEX)),
> - .args = ARGS(ARGS_ENTRY_ARB(0, 0),
> + .args = ARGS(ARGS_ENTRY_ARB
> + (offsetof(struct action_rss_data, conf) +
> + offsetof(struct rte_flow_action_rss, key),
> + sizeof(((struct rte_flow_action_rss *)0)->key)),
+1, it is required to write the address, and I confirm this enables getting
'key' value to the PMD.
> ARGS_ENTRY_ARB
> (offsetof(struct action_rss_data, conf) +
> offsetof(struct rte_flow_action_rss, key_len),
> @@ -6495,19 +6498,18 @@ static int comp_set_sample_index(struct context *, const struct token *,
> if (ctx->objmask)
> memset((uint8_t *)ctx->objmask + arg_data->offset,
> 0xff, hexlen);
> +
> /* Save address if requested. */
> if (arg_addr->size) {
> - memcpy((uint8_t *)ctx->object + arg_addr->offset,
> - (void *[]){
> - (uint8_t *)ctx->object + arg_data->offset
> - },
> - arg_addr->size);
> + if (arg_addr->size < sizeof(void *))
> + goto error;
Above two lines seems only actual change in this function, others are
refactoring the assignment.
1) why this check required, I think we can ignore it.
2) What do you think to remove the refactoring to reduce the change to the
actual fix?
> +
> + *(void **)((uint8_t *)ctx->object + arg_addr->offset) =
> + (uint8_t *)ctx->object + arg_data->offset;
> +
> if (ctx->objmask)
> - memcpy((uint8_t *)ctx->objmask + arg_addr->offset,
> - (void *[]){
> - (uint8_t *)ctx->objmask + arg_data->offset
> - },
> - arg_addr->size);
> + *(void **)((uint8_t *)ctx->objmask + arg_addr->offset) =
> + (uint8_t *)ctx->objmask + arg_data->offset;
> }
> return len;
> error:
>
next prev parent reply other threads:[~2021-01-19 19:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 8:59 Zhang,Alvin
2021-01-19 19:14 ` Ferruh Yigit [this message]
2021-01-21 9:35 ` Zhang, AlvinX
2021-01-21 9:41 ` [dpdk-dev] [PATCH v2] " Zhang,Alvin
2021-01-22 5:43 ` Zhou, JunX W
2021-01-22 14:58 ` Ferruh Yigit
-- strict thread matches above, loose matches on Subject: below --
2020-12-30 5:29 [dpdk-dev] [PATCH] " Zhang,Alvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fdee4be8-3ff6-c2f7-793b-4b6e5c394d0d@intel.com \
--to=ferruh.yigit@intel.com \
--cc=alvinx.zhang@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).