[dpdk-dev] crypto/scheduler: fix build
Checks
Commit Message
Fixes 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode")
drivers/crypto/scheduler/scheduler_multicore.c: In function 'scheduler_stop':
drivers/crypto/scheduler/scheduler_multicore.c:286:2: error: 'for' loop
initial declarations are only allowed in C99 or C11 mode
for (uint16_t i = 0; i < sched_ctx->nb_wc; i++)
^
compilation terminated due to -Wfatal-errors.
mk/internal/rte.compile-pre.mk:138: recipe for target 'scheduler_multicore.o'
failed
make[4]: *** [scheduler_multicore.o] Error 1
make[4]: *** Waiting for unfinished jobs....
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/crypto/scheduler/scheduler_multicore.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Comments
09/07/2017 11:44, Jan Blunck:
> Fixes 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode")
>
> drivers/crypto/scheduler/scheduler_multicore.c: In function 'scheduler_stop':
> drivers/crypto/scheduler/scheduler_multicore.c:286:2: error: 'for' loop
> initial declarations are only allowed in C99 or C11 mode
> for (uint16_t i = 0; i < sched_ctx->nb_wc; i++)
> ^
I wonder why I have not spotted it.
What is your compiler? which version?
On Sun, Jul 9, 2017 at 6:38 AM, Thomas Monjalon <thomas@monjalon.net> wrote:
> 09/07/2017 11:44, Jan Blunck:
>> Fixes 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode")
>>
>> drivers/crypto/scheduler/scheduler_multicore.c: In function 'scheduler_stop':
>> drivers/crypto/scheduler/scheduler_multicore.c:286:2: error: 'for' loop
>> initial declarations are only allowed in C99 or C11 mode
>> for (uint16_t i = 0; i < sched_ctx->nb_wc; i++)
>> ^
>
> I wonder why I have not spotted it.
> What is your compiler? which version?
This is with Debian Jessie:
gcc version 4.9.2 (Debian 4.9.2-10)
09/07/2017 12:43, Jan Blunck:
> On Sun, Jul 9, 2017 at 6:38 AM, Thomas Monjalon <thomas@monjalon.net> wrote:
> > 09/07/2017 11:44, Jan Blunck:
> >> Fixes 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode")
> >>
> >> drivers/crypto/scheduler/scheduler_multicore.c: In function 'scheduler_stop':
> >> drivers/crypto/scheduler/scheduler_multicore.c:286:2: error: 'for' loop
> >> initial declarations are only allowed in C99 or C11 mode
> >> for (uint16_t i = 0; i < sched_ctx->nb_wc; i++)
> >> ^
> >
> > I wonder why I have not spotted it.
> > What is your compiler? which version?
>
> This is with Debian Jessie:
>
> gcc version 4.9.2 (Debian 4.9.2-10)
OK, so I could update the title to "fix build with old gcc" ?
And add in the log that it has been seen with gcc 4.9.2.
Do you agree?
PS: I am testing with gcc 7.1.
09/07/2017 11:44, Jan Blunck:
> Fixes 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode")
>
> drivers/crypto/scheduler/scheduler_multicore.c: In function 'scheduler_stop':
> drivers/crypto/scheduler/scheduler_multicore.c:286:2: error: 'for' loop
> initial declarations are only allowed in C99 or C11 mode
> for (uint16_t i = 0; i < sched_ctx->nb_wc; i++)
> ^
> compilation terminated due to -Wfatal-errors.
> mk/internal/rte.compile-pre.mk:138: recipe for target 'scheduler_multicore.o'
> failed
> make[4]: *** [scheduler_multicore.o] Error 1
> make[4]: *** Waiting for unfinished jobs....
>
> Signed-off-by: Jan Blunck <jblunck@infradead.org>
Applied, thanks
@@ -280,10 +280,11 @@ scheduler_stop(struct rte_cryptodev *dev)
{
struct scheduler_ctx *sched_ctx = dev->data->dev_private;
struct mc_scheduler_ctx *mc_ctx = sched_ctx->private_ctx;
+ uint16_t i;
mc_ctx->stop_signal = 1;
- for (uint16_t i = 0; i < sched_ctx->nb_wc; i++)
+ for (i = 0; i < sched_ctx->nb_wc; i++)
rte_eal_wait_lcore(sched_ctx->wc_pool[i]);
return 0;
@@ -316,6 +317,7 @@ scheduler_create_private_ctx(struct rte_cryptodev *dev)
{
struct scheduler_ctx *sched_ctx = dev->data->dev_private;
struct mc_scheduler_ctx *mc_ctx;
+ uint16_t i;
if (sched_ctx->private_ctx)
rte_free(sched_ctx->private_ctx);
@@ -328,7 +330,7 @@ scheduler_create_private_ctx(struct rte_cryptodev *dev)
}
mc_ctx->num_workers = sched_ctx->nb_wc;
- for (uint16_t i = 0; i < sched_ctx->nb_wc; i++) {
+ for (i = 0; i < sched_ctx->nb_wc; i++) {
char r_name[16];
snprintf(r_name, sizeof(r_name), MC_SCHED_ENQ_RING_NAME_PREFIX "%u", i);