[dpdk-dev] [PATCH v1 03/48] net/mlx4: check max number of ports dynamically
Adrien Mazarguil
adrien.mazarguil at 6wind.com
Wed Aug 2 09:52:23 CEST 2017
On Tue, Aug 01, 2017 at 05:35:30PM +0000, Legacy, Allain wrote:
> > -----Original Message-----
> > From: Adrien Mazarguil [mailto:adrien.mazarguil at 6wind.com]
> > Sent: Tuesday, August 01, 2017 12:54 PM
> <...>
> > @@ -5946,12 +5949,11 @@ mlx4_arg_parse(const char *key, const char *val,
> > void *out)
> > return -errno;
> > }
> > if (strcmp(MLX4_PMD_PORT_KVARG, key) == 0) {
> > - if (tmp >= MLX4_PMD_MAX_PHYS_PORTS) {
> > - ERROR("invalid port index %lu (max: %u)",
> > - tmp, MLX4_PMD_MAX_PHYS_PORTS - 1);
> > + if (!(conf->ports.present & (1 << tmp))) {
> > + ERROR("invalid port index %lu", tmp);
>
> The original error included the max value. Wouldn't it be useful to report this to the
> user to help them understand their mistake?
Makes sense, I'll add it back.
> > @@ -6085,16 +6092,16 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv,
> > struct rte_pci_device *pci_dev)
> > }
> > INFO("%u port(s) detected", device_attr.phys_port_cnt);
> >
> > + for (i = 0; i < device_attr.phys_port_cnt; ++i)
> > + conf.ports.present |= 1 << i;
>
> The loop could be avoided with:
>
> conf.ports.present = (1 << device_attr.phys_port_cnt) - 1;
I will also make that change in the next iteration, thanks.
--
Adrien Mazarguil
6WIND
More information about the dev
mailing list