Re: [PATCH 4/8] net/nfb: add device argument "port" to limit used ports

Martin Spinler
2026-01-20T15:16:47Z

On Fri, 2026-01-16 at 09:36 -0800, Stephen Hemminger wrote:
> On Thu, 15 Jan 2026 16:16:52 +0100
> spinler@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

Good point, thanks.
Also will use the RTE_BIT64 for port_mask.