[dpdk-dev] [PATCH] ethdev: check for invalid device name
Ali Alnubani
alialnu at mellanox.com
Thu Mar 14 08:23:31 CET 2019
Hi Stephen,
I see failures in performance tests caused by this patch:
http://mails.dpdk.org/archives/test-report/2019-March/076705.html
http://mails.dpdk.org/archives/test-report/2019-March/076704.html
After applying your patch, the devices will not be probed:
'''
Zero length Ethernet device name
net_mlx5: can not allocate rte ethdev
net_mlx5: probe of PCI device 0000:12:00.1 aborted after encountering an error: Cannot allocate memory
EAL: Requested device 0000:12:00.1 cannot be used
testpmd: No probed ethernet devices
'''
Testpmd command:
./x86_64-native-linuxapp-gcc/build/app/test-pmd/testpmd -c 0x3 -n 4 -w 12:00.0 -w 12:00.1 -- --txd=256 --rxd=256 -i
> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of Stephen Hemminger
> Sent: Monday, March 11, 2019 8:16 PM
> To: dev at dpdk.org
> Cc: Stephen Hemminger <stephen at networkplumber.org>
> Subject: [dpdk-dev] [PATCH] ethdev: check for invalid device name
>
> Do not allow creating a ethernet device with a name over the allowed
> maximum (or zero length). This is safer than silently truncating which is what
> happens now.
>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> Acked-by: Andrew Rybchenko <arybchenko at solarflare.com>
> ---
> v1 - previously sent as RFC
>
> lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index 85c1794968dd..0b81980ff71c 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -439,6 +439,16 @@ rte_eth_dev_allocate(const char *name)
> uint16_t port_id;
> struct rte_eth_dev *eth_dev = NULL;
>
> + if (*name) {
> + RTE_ETHDEV_LOG(ERR, "Zero length Ethernet device
> name\n");
> + return NULL;
> + }
> +
> + if (strnlen(name, RTE_ETH_NAME_MAX_LEN) >=
> RTE_ETH_NAME_MAX_LEN) {
> + RTE_ETHDEV_LOG(ERR, "Ethernet device name is too
> long\n");
> + return NULL;
> + }
> +
> rte_eth_dev_shared_data_prepare();
>
> /* Synchronize port creation between primary and secondary
> threads. */
> --
> 2.17.1
Regards,
Ali
More information about the dev
mailing list