[PATCH v5] net: add thread-safe crc api
Stephen Hemminger
stephen at networkplumber.org
Mon Feb 10 20:57:27 CET 2025
On Fri, 7 Feb 2025 18:24:43 +0000
Arkadiusz Kusztal <arkadiuszx.kusztal at intel.com> wrote:
> +static struct
> +{
> + rte_net_crc_handler f[RTE_NET_CRC_REQS];
> +} handlers_dpdk26[RTE_NET_CRC_AVX512 + 1];
> +
Should have { after the struct
+void rte_net_crc_free(struct rte_net_crc *crc)
+{
+ rte_free(crc);
+}
Add rte_net_crc_free to the coccinelle script that checks for null free.
Also add function attributes please.
> diff --git a/lib/net/rte_net_crc.h b/lib/net/rte_net_crc.h
> index 72d3e10ff6..ffac8c2f1f 100644
> --- a/lib/net/rte_net_crc.h
> +++ b/lib/net/rte_net_crc.h
> @@ -1,5 +1,5 @@
> /* SPDX-License-Identifier: BSD-3-Clause
> - * Copyright(c) 2017-2020 Intel Corporation
> + * Copyright(c) 2017-2025 Intel Corporation
> */
Not sure what DPDK policy is around copyright date updates.
The Linux kernel has said no to this (excess churn).
> +struct rte_net_crc *rte_net_crc_set_alg_v26(enum rte_net_crc_alg alg,
> + enum rte_net_crc_type type)
Since this now an allocator should add function attributes __rte_malloc
and __rte_dealloc(rte_crc_free, 1).
> +{
> + uint16_t max_simd_bitwidth;
> + struct rte_net_crc *crc;
> +
> + crc = rte_zmalloc(NULL, sizeof(struct rte_net_crc), 0);
> + if (crc == NULL)
> + return NULL;
Are you using rte_malloc here because it can be shared between primary/secondary?
Otherwise regular malloc has more checks.
More information about the dev
mailing list