[dpdk-dev] [PATCH v2 1/6] eal/interrupts: implement get set APIs
David Marchand
david.marchand at redhat.com
Thu Oct 14 09:31:17 CEST 2021
On Tue, Oct 5, 2021 at 2:17 PM Harman Kalra <hkalra at marvell.com> wrote:
> +struct rte_intr_handle *rte_intr_instance_alloc(uint32_t flags)
> +{
> + struct rte_intr_handle *intr_handle;
> + bool mem_allocator;
Regardless of the currently defined flags, we want to have an ABI
ready for future changes, so if there is a "flags" input parameter, it
must be checked against valid values.
You can build a RTE_INTR_ALLOC_KNOWN_FLAGS define that contains all
valid flags either in a private header or only in this .c file if no
other unit needs it.
Next, in this function:
if ((flags & ~RTE_INTR_ALLOC_KNOWN_FLAGS) != 0) {
rte_errno = EINVAL;
return NULL;
}
A check in unit tests is then a good thing to add so that developpers
adding new flag get a CI failure.
This is not a blocker as this API is still experimental, but please
let's do this from the start.
> +
> + mem_allocator = (flags & RTE_INTR_ALLOC_DPDK_ALLOCATOR) != 0;
> + if (mem_allocator)
> + intr_handle = rte_zmalloc(NULL, sizeof(struct rte_intr_handle),
> + 0);
> + else
> + intr_handle = calloc(1, sizeof(struct rte_intr_handle));
--
David Marchand
More information about the dev
mailing list