From: Or Ami Date: Thu, 3 Mar 2016 14:27:35 +0000 (+0100) Subject: mlx5: check port is configured as ethernet device X-Git-Tag: spdx-start~7302 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1371f4df16bc;p=dpdk.git mlx5: check port is configured as ethernet device If the port link layer is not Ethernet, notify the user. Signed-off-by: Or Ami --- diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 41207c18de..0f6fd4cdb7 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -278,6 +278,11 @@ Drivers A crash could occur when failing to allocate private device context. +* **mlx5: Added port type check.** + + Done to prevent port initialization on non-Ethernet link layers and + to report an error. + * **aesni_mb: Fixed wrong return value when creating a device.** cryptodev_aesni_mb_init() was returning the device id of the device created, diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 41dcbbf697..ae2576f655 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -348,6 +348,13 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) ERROR("port query failed: %s", strerror(err)); goto port_error; } + + if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) { + ERROR("port %d is not configured in Ethernet mode", + port); + goto port_error; + } + if (port_attr.state != IBV_PORT_ACTIVE) DEBUG("port %d is not active: \"%s\" (%d)", port, ibv_port_state_str(port_attr.state),