mlx5: check port is configured as ethernet device
authorOr Ami <ora@mellanox.com>
Thu, 3 Mar 2016 14:27:35 +0000 (15:27 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 16 Mar 2016 17:52:17 +0000 (18:52 +0100)
If the port link layer is not Ethernet, notify the user.

Signed-off-by: Or Ami <ora@mellanox.com>
doc/guides/rel_notes/release_16_04.rst
drivers/net/mlx5/mlx5.c

index 41207c1..0f6fd4c 100644 (file)
@@ -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,
index 41dcbbf..ae2576f 100644 (file)
@@ -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),