Message ID | 1459780977-12430-1-git-send-email-bill.fischofer@linaro.org |
---|---|
State | New |
Headers | show |
On 04/04/16 17:42, Bill Fischofer wrote: > Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2138 by adding an > explicit rc check for odp_pktio_capability(). > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > platform/linux-generic/odp_packet_io.c | 24 ++++++++++++++++++------ > 1 file changed, 18 insertions(+), 6 deletions(-) > > diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c > index 9192be2..b0f3423 100644 > --- a/platform/linux-generic/odp_packet_io.c > +++ b/platform/linux-generic/odp_packet_io.c > @@ -1027,6 +1027,7 @@ int odp_pktin_queue_config(odp_pktio_t pktio, > odp_pktio_capability_t capa; > unsigned num_queues; > unsigned i; > + int rc; > odp_queue_t queue; > odp_pktin_queue_param_t default_param; > > @@ -1059,10 +1060,15 @@ int odp_pktin_queue_config(odp_pktio_t pktio, > return -1; > } > > - odp_pktio_capability(pktio, &capa); > + rc = odp_pktio_capability(pktio, &capa); > > - if (num_queues > capa.max_input_queues) { > - ODP_DBG("pktio %s: too many input queues\n", entry->s.name); > + if (rc != 0 || num_queues > capa.max_input_queues) { > + if (rc != 0) > + ODP_DBG("pktio %s: unable to read capabilities\n", > + entry->s.name); > + else > + ODP_DBG("pktio %s: too many input queues\n", > + entry->s.name); > return -1; it's that match simple to read?: rc = odp_pktio_capability(pktio, &capa); if (rc) { ODP_DBG("pktio %s: unable to read capabilities\n", entry->s.name); return -1; } if (num_queues > capa.max_input_queues) { ODP_DBG("pktio %s: unable to read capabilities\n", + entry->s.name); return -1; } > } > > @@ -1135,6 +1141,7 @@ int odp_pktout_queue_config(odp_pktio_t pktio, > odp_pktio_capability_t capa; > unsigned num_queues; > unsigned i; > + int rc; > odp_pktout_queue_param_t default_param; > > if (param == NULL) { > @@ -1172,10 +1179,15 @@ int odp_pktout_queue_config(odp_pktio_t pktio, > return -1; > } > > - odp_pktio_capability(pktio, &capa); > + rc = odp_pktio_capability(pktio, &capa); > > - if (num_queues > capa.max_output_queues) { > - ODP_DBG("pktio %s: too many output queues\n", entry->s.name); > + if (rc != 0 || num_queues > capa.max_output_queues) { > + if (rc != 0) > + ODP_DBG("pktio %s: unable to read capabilities\n", > + entry->s.name); > + else > + ODP_DBG("pktio %s: too many output queues\n", > + entry->s.name); > return -1; > } >
OK, v5 sent with that suggested change. On Mon, Apr 4, 2016 at 10:26 AM, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > On 04/04/16 17:42, Bill Fischofer wrote: > >> Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2138 by adding an >> explicit rc check for odp_pktio_capability(). >> >> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> >> --- >> platform/linux-generic/odp_packet_io.c | 24 ++++++++++++++++++------ >> 1 file changed, 18 insertions(+), 6 deletions(-) >> >> diff --git a/platform/linux-generic/odp_packet_io.c >> b/platform/linux-generic/odp_packet_io.c >> index 9192be2..b0f3423 100644 >> --- a/platform/linux-generic/odp_packet_io.c >> +++ b/platform/linux-generic/odp_packet_io.c >> @@ -1027,6 +1027,7 @@ int odp_pktin_queue_config(odp_pktio_t pktio, >> odp_pktio_capability_t capa; >> unsigned num_queues; >> unsigned i; >> + int rc; >> odp_queue_t queue; >> odp_pktin_queue_param_t default_param; >> @@ -1059,10 +1060,15 @@ int odp_pktin_queue_config(odp_pktio_t pktio, >> return -1; >> } >> - odp_pktio_capability(pktio, &capa); >> + rc = odp_pktio_capability(pktio, &capa); >> - if (num_queues > capa.max_input_queues) { >> - ODP_DBG("pktio %s: too many input queues\n", entry-> >> s.name); >> + if (rc != 0 || num_queues > capa.max_input_queues) { >> + if (rc != 0) >> + ODP_DBG("pktio %s: unable to read capabilities\n", >> + entry->s.name); >> + else >> + ODP_DBG("pktio %s: too many input queues\n", >> + entry->s.name); >> return -1; >> > > it's that match simple to read?: > > rc = odp_pktio_capability(pktio, &capa); > if (rc) { > ODP_DBG("pktio %s: unable to read capabilities\n", > entry->s.name); > return -1; > } > > if (num_queues > capa.max_input_queues) { > ODP_DBG("pktio %s: unable to read capabilities\n", + entry->s.name > ); > return -1; > } > > } >> @@ -1135,6 +1141,7 @@ int odp_pktout_queue_config(odp_pktio_t pktio, >> odp_pktio_capability_t capa; >> unsigned num_queues; >> unsigned i; >> + int rc; >> odp_pktout_queue_param_t default_param; >> if (param == NULL) { >> @@ -1172,10 +1179,15 @@ int odp_pktout_queue_config(odp_pktio_t pktio, >> return -1; >> } >> - odp_pktio_capability(pktio, &capa); >> + rc = odp_pktio_capability(pktio, &capa); >> - if (num_queues > capa.max_output_queues) { >> - ODP_DBG("pktio %s: too many output queues\n", entry-> >> s.name); >> + if (rc != 0 || num_queues > capa.max_output_queues) { >> + if (rc != 0) >> + ODP_DBG("pktio %s: unable to read capabilities\n", >> + entry->s.name); >> + else >> + ODP_DBG("pktio %s: too many output queues\n", >> + entry->s.name); >> return -1; >> } >> >> > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp >
ping. v5 needs review. On Mon, Apr 4, 2016 at 11:14 AM, Bill Fischofer <bill.fischofer@linaro.org> wrote: > OK, v5 sent with that suggested change. > > On Mon, Apr 4, 2016 at 10:26 AM, Maxim Uvarov <maxim.uvarov@linaro.org> > wrote: > >> On 04/04/16 17:42, Bill Fischofer wrote: >> >>> Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2138 by adding an >>> explicit rc check for odp_pktio_capability(). >>> >>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> >>> --- >>> platform/linux-generic/odp_packet_io.c | 24 ++++++++++++++++++------ >>> 1 file changed, 18 insertions(+), 6 deletions(-) >>> >>> diff --git a/platform/linux-generic/odp_packet_io.c >>> b/platform/linux-generic/odp_packet_io.c >>> index 9192be2..b0f3423 100644 >>> --- a/platform/linux-generic/odp_packet_io.c >>> +++ b/platform/linux-generic/odp_packet_io.c >>> @@ -1027,6 +1027,7 @@ int odp_pktin_queue_config(odp_pktio_t pktio, >>> odp_pktio_capability_t capa; >>> unsigned num_queues; >>> unsigned i; >>> + int rc; >>> odp_queue_t queue; >>> odp_pktin_queue_param_t default_param; >>> @@ -1059,10 +1060,15 @@ int odp_pktin_queue_config(odp_pktio_t pktio, >>> return -1; >>> } >>> - odp_pktio_capability(pktio, &capa); >>> + rc = odp_pktio_capability(pktio, &capa); >>> - if (num_queues > capa.max_input_queues) { >>> - ODP_DBG("pktio %s: too many input queues\n", entry-> >>> s.name); >>> + if (rc != 0 || num_queues > capa.max_input_queues) { >>> + if (rc != 0) >>> + ODP_DBG("pktio %s: unable to read >>> capabilities\n", >>> + entry->s.name); >>> + else >>> + ODP_DBG("pktio %s: too many input queues\n", >>> + entry->s.name); >>> return -1; >>> >> >> it's that match simple to read?: >> >> rc = odp_pktio_capability(pktio, &capa); >> if (rc) { >> ODP_DBG("pktio %s: unable to read capabilities\n", >> entry->s.name); >> return -1; >> } >> >> if (num_queues > capa.max_input_queues) { >> ODP_DBG("pktio %s: unable to read capabilities\n", + entry-> >> s.name); >> return -1; >> } >> >> } >>> @@ -1135,6 +1141,7 @@ int odp_pktout_queue_config(odp_pktio_t pktio, >>> odp_pktio_capability_t capa; >>> unsigned num_queues; >>> unsigned i; >>> + int rc; >>> odp_pktout_queue_param_t default_param; >>> if (param == NULL) { >>> @@ -1172,10 +1179,15 @@ int odp_pktout_queue_config(odp_pktio_t pktio, >>> return -1; >>> } >>> - odp_pktio_capability(pktio, &capa); >>> + rc = odp_pktio_capability(pktio, &capa); >>> - if (num_queues > capa.max_output_queues) { >>> - ODP_DBG("pktio %s: too many output queues\n", entry-> >>> s.name); >>> + if (rc != 0 || num_queues > capa.max_output_queues) { >>> + if (rc != 0) >>> + ODP_DBG("pktio %s: unable to read >>> capabilities\n", >>> + entry->s.name); >>> + else >>> + ODP_DBG("pktio %s: too many output queues\n", >>> + entry->s.name); >>> return -1; >>> } >>> >>> >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> https://lists.linaro.org/mailman/listinfo/lng-odp >> > >
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 9192be2..b0f3423 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -1027,6 +1027,7 @@ int odp_pktin_queue_config(odp_pktio_t pktio, odp_pktio_capability_t capa; unsigned num_queues; unsigned i; + int rc; odp_queue_t queue; odp_pktin_queue_param_t default_param; @@ -1059,10 +1060,15 @@ int odp_pktin_queue_config(odp_pktio_t pktio, return -1; } - odp_pktio_capability(pktio, &capa); + rc = odp_pktio_capability(pktio, &capa); - if (num_queues > capa.max_input_queues) { - ODP_DBG("pktio %s: too many input queues\n", entry->s.name); + if (rc != 0 || num_queues > capa.max_input_queues) { + if (rc != 0) + ODP_DBG("pktio %s: unable to read capabilities\n", + entry->s.name); + else + ODP_DBG("pktio %s: too many input queues\n", + entry->s.name); return -1; } @@ -1135,6 +1141,7 @@ int odp_pktout_queue_config(odp_pktio_t pktio, odp_pktio_capability_t capa; unsigned num_queues; unsigned i; + int rc; odp_pktout_queue_param_t default_param; if (param == NULL) { @@ -1172,10 +1179,15 @@ int odp_pktout_queue_config(odp_pktio_t pktio, return -1; } - odp_pktio_capability(pktio, &capa); + rc = odp_pktio_capability(pktio, &capa); - if (num_queues > capa.max_output_queues) { - ODP_DBG("pktio %s: too many output queues\n", entry->s.name); + if (rc != 0 || num_queues > capa.max_output_queues) { + if (rc != 0) + ODP_DBG("pktio %s: unable to read capabilities\n", + entry->s.name); + else + ODP_DBG("pktio %s: too many output queues\n", + entry->s.name); return -1; }
Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2138 by adding an explicit rc check for odp_pktio_capability(). Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> --- platform/linux-generic/odp_packet_io.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)