[dpdk-dev] [PATCH 2/7] mlx5: check if port is configured as Ethernet device
Adrien Mazarguil
adrien.mazarguil at 6wind.com
Mon Feb 22 19:18:38 CET 2016
From: Or Ami <ora at mellanox.com>
If the port link layer is not Ethernet, notify the user.
Signed-off-by: Or Ami <ora at mellanox.com>
---
doc/guides/rel_notes/release_16_04.rst | 5 +++++
drivers/net/mlx5/mlx5.c | 7 +++++++
2 files changed, 12 insertions(+)
diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index 09afff9..ab7c64d 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -146,6 +146,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.
+
Libraries
~~~~~~~~~
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 41dcbbf..ae2576f 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),
--
2.1.4
More information about the dev
mailing list