[PATCH 4/8] net/nfb: add device argument "port" to limit used ports
Stephen Hemminger
stephen at networkplumber.org
Fri Jan 16 18:36:02 CET 2026
On Thu, 15 Jan 2026 16:16:52 +0100
spinler at cesnet.cz wrote:
>
> +static int fill_port_mask(const char *key __rte_unused, const char *value, void *opaque)
> +{
> + int ret = 0;
> + char *end = NULL;
> + uint64_t *port_mask = opaque;
> + int port;
> +
> + port = strtol(value, &end, 16);
> + if ((value[0] == '\0') || (end == NULL) || (*end != '\0'))
> + ret = -1;
> +
> + if (ret != 0 || port >= 64 || port < 0)
> + return -1;
> +
> + *port_mask |= (1ull << port);
> + return 0;
> +}
Do you really want to allow negative values, why not use strtoul()
Also, if there is a limit of 64 this should be a #define or config constant
More information about the dev
mailing list