> From: Phil Yang <phil.y...@arm.com>
> Sent: Tuesday, March 17, 2020 1:18 AM
> To: tho...@monjalon.net; Van Haaren, Harry <harry.van.haa...@intel.com>;
> Ananyev, Konstantin <konstantin.anan...@intel.com>;
> step...@networkplumber.org; maxime.coque...@redhat.com; dev@dpdk.org
> Cc: david.march...@redhat.com; jer...@marvell.com; hemant.agra...@nxp.com;
> honnappa.nagaraha...@arm.com; gavin...@arm.com; ruifeng.w...@arm.com;
> joyce.k...@arm.com; n...@arm.com; sta...@dpdk.org
> Subject: [PATCH v3 08/12] service: remove redundant code
> 
> The service id validation is verified in the calling function, remove
> the redundant code inside the service_update function.
> 
> Fixes: 21698354c832 ("service: introduce service cores concept")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Phil Yang <phil.y...@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagaraha...@arm.com>


Same comment as patch 7/12, is this really a "Fix"? This functionality
is not "broken" in  the current code? And is there value in porting
to stable? I'd see this as unnecessary churn.

As before, it is a valid cleanup (thanks), and I'd like to take it for
new DPDK releases.

Happy to Ack without Fixes or Cc Stable, if that's acceptable to you?



> ---
>  lib/librte_eal/common/rte_service.c | 31 ++++++++++++-------------------
>  1 file changed, 12 insertions(+), 19 deletions(-)
> 
> diff --git a/lib/librte_eal/common/rte_service.c
> b/lib/librte_eal/common/rte_service.c
> index 2117726..557b5a9 100644
> --- a/lib/librte_eal/common/rte_service.c
> +++ b/lib/librte_eal/common/rte_service.c
> @@ -552,21 +552,10 @@ rte_service_start_with_defaults(void)
>  }
> 
>  static int32_t
> -service_update(struct rte_service_spec *service, uint32_t lcore,
> +service_update(uint32_t sid, uint32_t lcore,
>               uint32_t *set, uint32_t *enabled)
>  {
> -     uint32_t i;
> -     int32_t sid = -1;
> -
> -     for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) {
> -             if ((struct rte_service_spec *)&rte_services[i] == service &&
> -                             service_valid(i)) {
> -                     sid = i;
> -                     break;
> -             }
> -     }
> -
> -     if (sid == -1 || lcore >= RTE_MAX_LCORE)
> +     if (lcore >= RTE_MAX_LCORE)
>               return -EINVAL;
> 
>       if (!lcore_states[lcore].is_service_core)
> @@ -598,19 +587,23 @@ service_update(struct rte_service_spec *service,
> uint32_t lcore,
>  int32_t
>  rte_service_map_lcore_set(uint32_t id, uint32_t lcore, uint32_t enabled)
>  {
> -     struct rte_service_spec_impl *s;
> -     SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
> +     /* validate ID, or return error value */
> +     if (id >= RTE_SERVICE_NUM_MAX || !service_valid(id))
> +             return -EINVAL;
> +
>       uint32_t on = enabled > 0;
> -     return service_update(&s->spec, lcore, &on, 0);
> +     return service_update(id, lcore, &on, 0);
>  }
> 
>  int32_t
>  rte_service_map_lcore_get(uint32_t id, uint32_t lcore)
>  {
> -     struct rte_service_spec_impl *s;
> -     SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
> +     /* validate ID, or return error value */
> +     if (id >= RTE_SERVICE_NUM_MAX || !service_valid(id))
> +             return -EINVAL;
> +
>       uint32_t enabled;
> -     int ret = service_update(&s->spec, lcore, 0, &enabled);
> +     int ret = service_update(id, lcore, 0, &enabled);
>       if (ret == 0)
>               return enabled;
>       return ret;
> --
> 2.7.4

Reply via email to