[dpdk-dev] [PATCH v1 03/48] net/mlx4: check max number of ports dynamically
Legacy, Allain
Allain.Legacy at windriver.com
Tue Aug 1 19:35:30 CEST 2017
> -----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?
> @@ -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;
Regards,
Allain
More information about the dev
mailing list