[dpdk-stable] [PATCH v3 08/12] service: remove redundant code
Van Haaren, Harry
harry.van.haaren at intel.com
Fri Apr 3 13:58:01 CEST 2020
> From: Phil Yang <phil.yang at arm.com>
> Sent: Tuesday, March 17, 2020 1:18 AM
> To: thomas at monjalon.net; Van Haaren, Harry <harry.van.haaren at intel.com>;
> Ananyev, Konstantin <konstantin.ananyev at intel.com>;
> stephen at networkplumber.org; maxime.coquelin at redhat.com; dev at dpdk.org
> Cc: david.marchand at redhat.com; jerinj at marvell.com; hemant.agrawal at nxp.com;
> Honnappa.Nagarahalli at arm.com; gavin.hu at arm.com; ruifeng.wang at arm.com;
> joyce.kong at arm.com; nd at arm.com; Stable at 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: Stable at dpdk.org
>
> Signed-off-by: Phil Yang <phil.yang at arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli at 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
More information about the stable
mailing list