aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlava Shwartsman <slavash@nvidia.com>2026-06-10 16:43:08 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-06-17 18:23:15 +0000
commit17cf7760a98a87c33d0415e2d2e1d4b24dd69e4d (patch)
tree560a9b185ac04f08b56ae96c3cbc0a7cd24b5e79
parent49b78368c5ed9cf41dedfc1c02a597fd49468537 (diff)
mlx5en: guard against empty eth_proto_oper mask
eth_proto_oper is used to derive the active media mode, but an empty mask leaves no valid bit for ilog2() to consume. Treat this as an invalid carrier update, reset the active media state, and report the unexpected PTYS value. Reviewed by: kib Tested by: Wafa Hamzah <wafah@nvidia.com> MFC after: 1 week Sponsored by: NVIDIA Networking
-rw-r--r--sys/dev/mlx5/mlx5_en/mlx5_en_main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
index 35450776e54e..6d8e1ba41709 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -445,9 +445,16 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet);
eth_proto_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext,
eth_proto_oper);
+ if (eth_proto_oper == 0) {
+ priv->media_active_last = IFM_ETHER;
+ if_setbaudrate(priv->ifp, 1);
+ mlx5_en_err(priv->ifp, "eth_proto_oper is 0\n");
+ return;
+ }
connector_type = MLX5_GET(ptys_reg, out, connector_type);
if (connector_type >= MLX5E_CONNECTOR_TYPE_NUMBER)
connector_type = MLX5E_PORT_UNKNOWN;
+
i = ilog2(eth_proto_oper);
if (ext) {