If the port link layer is not Ethernet, notify the user.
Signed-off-by: Or Ami <ora@mellanox.com>
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,
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),