From nobody Wed Dec 17 19:22:30 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87734800; Fri, 10 Oct 2025 00:04:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760054651; cv=none; b=X3F1PLFdiimcmDjEIuC832AXpgrQjXAFoh18EVd3ivDWDziV23/OTaOpB921lXP87ZEIssGxGdc2WcN8HjJV4rpdimYa3LQPcAPmks3qcP5w0JLSnVMuBUcMoKD82KBG17iq9U35fNJG0AGOzwUdcs5mvQAEJNlZAxQN63k2tPk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760054651; c=relaxed/simple; bh=GYcVpB/Rbd568LAIkFMQTYH7d1GIjnK4TTH3LzlrsF4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uRYYcJcpeS2oMzFjKogiaB6ZeQ2scuQnrPePAe4uLXd2oadAD6ZRT6Yj7EDweMmShFXXMZQcwaqApa5A/YgJkwlIGzfgNkk+zy5xCyF4JL3cIXYL1e5LvkxB6SRHdJipI20JudEKKU4QfAcPXb4KU65CD4owCoixw30SiCc3Mw0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=i1CFJj0O; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="i1CFJj0O" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760054650; x=1791590650; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=GYcVpB/Rbd568LAIkFMQTYH7d1GIjnK4TTH3LzlrsF4=; b=i1CFJj0O9Hj0/Z5eO+HudocaTzsZZ0PADUloouexW/6hGZHO5/Sbqz/p jffpT7jKYF05pLmuv5emdynmEeE1Tpomnkr6BnF9J7MUDyO986ZuTdfxc w4FZPKKi72DaWnVaU/C9NdsFdmpgJmKDMx5vU7uupXojUrX1nmAxvM3Bb hfR4gMRDXrzLtnQrTuGJyEHOQwnGKpOrG/tUPx/KFb04KD4GHZBCcct33 C8ZaMhq0n4X2Jc31/bMKeQPT2Nla60PehiEbV5UzqaPfeivvFBzGXvE87 4ak1S9kYcz9dzGDw2YfwHKc43VrteUyX3OTjA5O6IW27natAWaPtzToeW A==; X-CSE-ConnectionGUID: yovrYQhQRn2J8afcjFyauA== X-CSE-MsgGUID: 4gb6tarXTw+VeWC8gnXbng== X-IronPort-AV: E=McAfee;i="6800,10657,11577"; a="62316071" X-IronPort-AV: E=Sophos;i="6.19,217,1754982000"; d="scan'208";a="62316071" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2025 17:04:09 -0700 X-CSE-ConnectionGUID: lDoAXJc7T/ulA9mlgjL0Tg== X-CSE-MsgGUID: KS72NxPUTZSyHGORJanoOg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,217,1754982000"; d="scan'208";a="180858268" Received: from orcnseosdtjek.jf.intel.com (HELO [10.166.28.70]) ([10.166.28.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2025 17:04:09 -0700 From: Jacob Keller Date: Thu, 09 Oct 2025 17:03:46 -0700 Subject: [PATCH net v3 1/6] idpf: cleanup remaining SKBs in PTP flows Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251009-jk-iwl-net-2025-10-01-v3-1-ef32a425b92a@intel.com> References: <20251009-jk-iwl-net-2025-10-01-v3-0-ef32a425b92a@intel.com> In-Reply-To: <20251009-jk-iwl-net-2025-10-01-v3-0-ef32a425b92a@intel.com> To: Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Emil Tantilov , Alexander Lobakin , Willem de Bruijn , Sridhar Samudrala , Phani Burra , Piotr Kwapulinski , Simon Horman , Radoslaw Tyl , Jedrzej Jagielski Cc: Konstantin Ilichev , Milena Olech , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jacob Keller , Aleksandr Loktionov , Samuel Salin X-Mailer: b4 0.15-dev-89294 X-Developer-Signature: v=1; a=openpgp-sha256; l=2249; i=jacob.e.keller@intel.com; h=from:subject:message-id; bh=KTppvEjkGt0QXsvzcoJg6JlbsKXXXHH7KYc15giG5cE=; b=owGbwMvMwCWWNS3WLp9f4wXjabUkhowXvmXSORNj9yvtYv5zNsckObuNI8a1/cIxnhWftgWdY NJ9e/ptRykLgxgXg6yYIouCQ8jK68YTwrTeOMvBzGFlAhnCwMUpABNxU2L4p1ZZ8Ob1vMnvN21W /LBpm0W86r2yN4ULV/+SnBDt/97hwl5Ghmcrpk9ZWzqHx48jtmkOZ8qJ6plbi1nvpph94TuZ9kz /NDMA X-Developer-Key: i=jacob.e.keller@intel.com; a=openpgp; fpr=204054A9D73390562AEC431E6A965D3E6F0F28E8 From: Milena Olech When the driver requests Tx timestamp value, one of the first steps is to clone SKB using skb_get. It increases the reference counter for that SKB to prevent unexpected freeing by another component. However, there may be a case where the index is requested, SKB is assigned and never consumed by PTP flows - for example due to reset during running PTP apps. Add a check in release timestamping function to verify if the SKB assigned to Tx timestamp latch was freed, and release remaining SKBs. Fixes: 4901e83a94ef ("idpf: add Tx timestamp capabilities negotiation") Signed-off-by: Milena Olech Signed-off-by: Anton Nadezhdin Reviewed-by: Aleksandr Loktionov Tested-by: Samuel Salin Signed-off-by: Jacob Keller --- drivers/net/ethernet/intel/idpf/idpf_ptp.c | 3 +++ drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/net/ethernet/intel/idpf/idpf_ptp.c b/drivers/net/ether= net/intel/idpf/idpf_ptp.c index 142823af1f9e..3e1052d070cf 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_ptp.c +++ b/drivers/net/ethernet/intel/idpf/idpf_ptp.c @@ -863,6 +863,9 @@ static void idpf_ptp_release_vport_tstamp(struct idpf_v= port *vport) u64_stats_inc(&vport->tstamp_stats.flushed); =20 list_del(&ptp_tx_tstamp->list_member); + if (ptp_tx_tstamp->skb) + consume_skb(ptp_tx_tstamp->skb); + kfree(ptp_tx_tstamp); } u64_stats_update_end(&vport->tstamp_stats.stats_sync); diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c b/drivers/= net/ethernet/intel/idpf/idpf_virtchnl_ptp.c index 8a2e0f8c5e36..61cedb6f2854 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c @@ -517,6 +517,7 @@ idpf_ptp_get_tstamp_value(struct idpf_vport *vport, shhwtstamps.hwtstamp =3D ns_to_ktime(tstamp); skb_tstamp_tx(ptp_tx_tstamp->skb, &shhwtstamps); consume_skb(ptp_tx_tstamp->skb); + ptp_tx_tstamp->skb =3D NULL; =20 list_add(&ptp_tx_tstamp->list_member, &tx_tstamp_caps->latches_free); --=20 2.51.0.rc1.197.g6d975e95c9d7 From nobody Wed Dec 17 19:22:30 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B18F134BA24; Fri, 10 Oct 2025 00:04:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760054654; cv=none; b=JhlInUsk8JSI6l6JPU48S853oSpSl2QWjtEgDTjpWnpmLe/ljFrZHtmH7UQEVHm/zA0sjDsYqq05oIefG/dwwwCpeXdQ899hNtkO3nNrBWj73tJFiyQumYnbD3O6ZCG6ywzjrWx0QGHfCTcXRMBBrstBYci1w7Jc1s/Hv29TDH0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760054654; c=relaxed/simple; bh=5Tr8aaEfST++XTnJZ+/WJ9wbOB3+Va5EmnEF0PMJm/s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=d8H8deBAlwZVoWDnM3LeQfWzizyZJrQ6PEeO/cAE4ObbnEjStt/EI3RSSjhvoN4dpZBZ8fw4OE82ns9STYFnpTT/ok05LUDacSkphwaDwW4f1PGaXtf1fj5akoRGhfPa0H68Gkg0Azuvr6Razbx9LG98rGzpXSeEv+woRvjmQLU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=i/Iy/c0X; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="i/Iy/c0X" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760054652; x=1791590652; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=5Tr8aaEfST++XTnJZ+/WJ9wbOB3+Va5EmnEF0PMJm/s=; b=i/Iy/c0XQAeKC3VZegaQ5kyOTz2gKye7+g5DBvEBTZz+fD4Tvg1OcIoE LRctQxx5T1LFhYsiiJZg6cX5quUzCorqdyAj9hr2NdGt+vUB8tRssyzQL Uyg+lM5ADfTdImMhL2OZgEcq8CswrE3jkM8ZQhxcZpnDXNbVfXgo4jJ6R aUMT3nQQiFRn83YLFQiNspuNEmrilaqtCJvntKK0iiUwNOzDWQudBN3me az0VrLdhzYel2NCfRol8Ec4hpsU1leDue0/LHHRYdSpxH31Y725kkeoVr 61AxreW1b21b61HFm8LGD5DLgUtyy1AQDHCaE40wUsBfmraQjjfZTiVLC Q==; X-CSE-ConnectionGUID: NjHVu5ctTA6y7anlhXxSMQ== X-CSE-MsgGUID: NKjCiGxmSx2Ymc6z+NhnQg== X-IronPort-AV: E=McAfee;i="6800,10657,11577"; a="62316077" X-IronPort-AV: E=Sophos;i="6.19,217,1754982000"; d="scan'208";a="62316077" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2025 17:04:09 -0700 X-CSE-ConnectionGUID: IbRwUlrTRISVXeRQrbF+AQ== X-CSE-MsgGUID: Jkq6rybpR3qFIKcdIn/g3w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,217,1754982000"; d="scan'208";a="180858272" Received: from orcnseosdtjek.jf.intel.com (HELO [10.166.28.70]) ([10.166.28.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2025 17:04:09 -0700 From: Jacob Keller Date: Thu, 09 Oct 2025 17:03:47 -0700 Subject: [PATCH net v3 2/6] ixgbevf: fix getting link speed data for E610 devices Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251009-jk-iwl-net-2025-10-01-v3-2-ef32a425b92a@intel.com> References: <20251009-jk-iwl-net-2025-10-01-v3-0-ef32a425b92a@intel.com> In-Reply-To: <20251009-jk-iwl-net-2025-10-01-v3-0-ef32a425b92a@intel.com> To: Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Emil Tantilov , Alexander Lobakin , Willem de Bruijn , Sridhar Samudrala , Phani Burra , Piotr Kwapulinski , Simon Horman , Radoslaw Tyl , Jedrzej Jagielski Cc: Konstantin Ilichev , Milena Olech , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jacob Keller , Aleksandr Loktionov , stable@vger.kernel.org, Rafal Romanowski X-Mailer: b4 0.15-dev-89294 X-Developer-Signature: v=1; a=openpgp-sha256; l=10342; i=jacob.e.keller@intel.com; h=from:subject:message-id; bh=0gDafKMo5QWGyYkGwUnZJAglRZV0MGwTmXbBQH/2bMQ=; b=owGbwMvMwCWWNS3WLp9f4wXjabUkhowXvuVd+kpVC/5Mratncvd22946/UVbxwq9RoGjolvMy y84yip0lLIwiHExyIopsig4hKy8bjwhTOuNsxzMHFYmkCEMXJwCMJHviQz/M9dOLDrYb7uH03jl cuX/M00S+VoS99yq0p7sM7X9yHkZfYb/Dvckwxjez3odp3FjyY4Dn6YcqT/mJjkptOJkbJSxtFo EMwA= X-Developer-Key: i=jacob.e.keller@intel.com; a=openpgp; fpr=204054A9D73390562AEC431E6A965D3E6F0F28E8 From: Jedrzej Jagielski E610 adapters no longer use the VFLINKS register to read PF's link speed and linkup state. As a result VF driver cannot get actual link state and it incorrectly reports 10G which is the default option. It leads to a situation where even 1G adapters print 10G as actual link speed. The same happens when PF driver set speed different than 10G. Add new mailbox operation to let the VF driver request a PF driver to provide actual link data. Update the mailbox api to v1.6. Incorporate both ways of getting link status within the legacy ixgbe_check_mac_link_vf() function. Fixes: 4c44b450c69b ("ixgbevf: Add support for Intel(R) E610 device") Co-developed-by: Andrzej Wilczynski Signed-off-by: Andrzej Wilczynski Reviewed-by: Przemek Kitszel Reviewed-by: Aleksandr Loktionov Cc: stable@vger.kernel.org Signed-off-by: Jedrzej Jagielski Tested-by: Rafal Romanowski Signed-off-by: Jacob Keller --- drivers/net/ethernet/intel/ixgbevf/defines.h | 1 + drivers/net/ethernet/intel/ixgbevf/mbx.h | 4 + drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 6 +- drivers/net/ethernet/intel/ixgbevf/vf.c | 137 +++++++++++++++++-= ---- 4 files changed, 116 insertions(+), 32 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbevf/defines.h b/drivers/net/eth= ernet/intel/ixgbevf/defines.h index a9bc96f6399d..e177d1d58696 100644 --- a/drivers/net/ethernet/intel/ixgbevf/defines.h +++ b/drivers/net/ethernet/intel/ixgbevf/defines.h @@ -28,6 +28,7 @@ =20 /* Link speed */ typedef u32 ixgbe_link_speed; +#define IXGBE_LINK_SPEED_UNKNOWN 0 #define IXGBE_LINK_SPEED_1GB_FULL 0x0020 #define IXGBE_LINK_SPEED_10GB_FULL 0x0080 #define IXGBE_LINK_SPEED_100_FULL 0x0008 diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.h b/drivers/net/etherne= t/intel/ixgbevf/mbx.h index 835bbcc5cc8e..c1494fd1f67b 100644 --- a/drivers/net/ethernet/intel/ixgbevf/mbx.h +++ b/drivers/net/ethernet/intel/ixgbevf/mbx.h @@ -66,6 +66,7 @@ enum ixgbe_pfvf_api_rev { ixgbe_mbox_api_13, /* API version 1.3, linux/freebsd VF driver */ ixgbe_mbox_api_14, /* API version 1.4, linux/freebsd VF driver */ ixgbe_mbox_api_15, /* API version 1.5, linux/freebsd VF driver */ + ixgbe_mbox_api_16, /* API version 1.6, linux/freebsd VF driver */ /* This value should always be last */ ixgbe_mbox_api_unknown, /* indicates that API version is not known */ }; @@ -102,6 +103,9 @@ enum ixgbe_pfvf_api_rev { =20 #define IXGBE_VF_GET_LINK_STATE 0x10 /* get vf link state */ =20 +/* mailbox API, version 1.6 VF requests */ +#define IXGBE_VF_GET_PF_LINK_STATE 0x11 /* request PF to send link info */ + /* length of permanent address message returned from PF */ #define IXGBE_VF_PERMADDR_MSG_LEN 4 /* word in permanent address message with the current multicast type */ diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/ne= t/ethernet/intel/ixgbevf/ixgbevf_main.c index 28e25641b167..92671638b428 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -2275,6 +2275,7 @@ static void ixgbevf_negotiate_api(struct ixgbevf_adap= ter *adapter) { struct ixgbe_hw *hw =3D &adapter->hw; static const int api[] =3D { + ixgbe_mbox_api_16, ixgbe_mbox_api_15, ixgbe_mbox_api_14, ixgbe_mbox_api_13, @@ -2294,7 +2295,8 @@ static void ixgbevf_negotiate_api(struct ixgbevf_adap= ter *adapter) idx++; } =20 - if (hw->api_version >=3D ixgbe_mbox_api_15) { + /* Following is not supported by API 1.6, it is specific for 1.5 */ + if (hw->api_version =3D=3D ixgbe_mbox_api_15) { hw->mbx.ops.init_params(hw); memcpy(&hw->mbx.ops, &ixgbevf_mbx_ops, sizeof(struct ixgbe_mbx_operations)); @@ -2651,6 +2653,7 @@ static void ixgbevf_set_num_queues(struct ixgbevf_ada= pter *adapter) case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: case ixgbe_mbox_api_15: + case ixgbe_mbox_api_16: if (adapter->xdp_prog && hw->mac.max_tx_queues =3D=3D rss) rss =3D rss > 3 ? 2 : 1; @@ -4645,6 +4648,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const = struct pci_device_id *ent) case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: case ixgbe_mbox_api_15: + case ixgbe_mbox_api_16: netdev->max_mtu =3D IXGBE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN); break; diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet= /intel/ixgbevf/vf.c index dcaef34b88b6..f05246fb5a74 100644 --- a/drivers/net/ethernet/intel/ixgbevf/vf.c +++ b/drivers/net/ethernet/intel/ixgbevf/vf.c @@ -313,6 +313,7 @@ int ixgbevf_get_reta_locked(struct ixgbe_hw *hw, u32 *r= eta, int num_rx_queues) * is not supported for this device type. */ switch (hw->api_version) { + case ixgbe_mbox_api_16: case ixgbe_mbox_api_15: case ixgbe_mbox_api_14: case ixgbe_mbox_api_13: @@ -382,6 +383,7 @@ int ixgbevf_get_rss_key_locked(struct ixgbe_hw *hw, u8 = *rss_key) * or if the operation is not supported for this device type. */ switch (hw->api_version) { + case ixgbe_mbox_api_16: case ixgbe_mbox_api_15: case ixgbe_mbox_api_14: case ixgbe_mbox_api_13: @@ -552,6 +554,7 @@ static s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *h= w, int xcast_mode) case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: case ixgbe_mbox_api_15: + case ixgbe_mbox_api_16: break; default: return -EOPNOTSUPP; @@ -624,6 +627,48 @@ static s32 ixgbevf_hv_get_link_state_vf(struct ixgbe_h= w *hw, bool *link_state) return -EOPNOTSUPP; } =20 +/** + * ixgbevf_get_pf_link_state - Get PF's link status + * @hw: pointer to the HW structure + * @speed: link speed + * @link_up: indicate if link is up/down + * + * Ask PF to provide link_up state and speed of the link. + * + * Return: IXGBE_ERR_MBX in the case of mailbox error, + * -EOPNOTSUPP if the op is not supported or 0 on success. + */ +static int ixgbevf_get_pf_link_state(struct ixgbe_hw *hw, ixgbe_link_speed= *speed, + bool *link_up) +{ + u32 msgbuf[3] =3D {}; + int err; + + switch (hw->api_version) { + case ixgbe_mbox_api_16: + break; + default: + return -EOPNOTSUPP; + } + + msgbuf[0] =3D IXGBE_VF_GET_PF_LINK_STATE; + + err =3D ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, + ARRAY_SIZE(msgbuf)); + if (err || (msgbuf[0] & IXGBE_VT_MSGTYPE_FAILURE)) { + err =3D IXGBE_ERR_MBX; + *speed =3D IXGBE_LINK_SPEED_UNKNOWN; + /* No need to set @link_up to false as it will be done by + * ixgbe_check_mac_link_vf(). + */ + } else { + *speed =3D msgbuf[1]; + *link_up =3D msgbuf[2]; + } + + return err; +} + /** * ixgbevf_set_vfta_vf - Set/Unset VLAN filter table address * @hw: pointer to the HW structure @@ -658,6 +703,58 @@ static s32 ixgbevf_set_vfta_vf(struct ixgbe_hw *hw, u3= 2 vlan, u32 vind, return err; } =20 +/** + * ixgbe_read_vflinks - Read VFLINKS register + * @hw: pointer to the HW structure + * @speed: link speed + * @link_up: indicate if link is up/down + * + * Get linkup status and link speed from the VFLINKS register. + */ +static void ixgbe_read_vflinks(struct ixgbe_hw *hw, ixgbe_link_speed *spee= d, + bool *link_up) +{ + u32 vflinks =3D IXGBE_READ_REG(hw, IXGBE_VFLINKS); + + /* if link status is down no point in checking to see if PF is up */ + if (!(vflinks & IXGBE_LINKS_UP)) { + *link_up =3D false; + return; + } + + /* for SFP+ modules and DA cables on 82599 it can take up to 500usecs + * before the link status is correct + */ + if (hw->mac.type =3D=3D ixgbe_mac_82599_vf) { + for (int i =3D 0; i < 5; i++) { + udelay(100); + vflinks =3D IXGBE_READ_REG(hw, IXGBE_VFLINKS); + + if (!(vflinks & IXGBE_LINKS_UP)) { + *link_up =3D false; + return; + } + } + } + + /* We reached this point so there's link */ + *link_up =3D true; + + switch (vflinks & IXGBE_LINKS_SPEED_82599) { + case IXGBE_LINKS_SPEED_10G_82599: + *speed =3D IXGBE_LINK_SPEED_10GB_FULL; + break; + case IXGBE_LINKS_SPEED_1G_82599: + *speed =3D IXGBE_LINK_SPEED_1GB_FULL; + break; + case IXGBE_LINKS_SPEED_100_82599: + *speed =3D IXGBE_LINK_SPEED_100_FULL; + break; + default: + *speed =3D IXGBE_LINK_SPEED_UNKNOWN; + } +} + /** * ixgbevf_hv_set_vfta_vf - * Hyper-V variant - just a stub. * @hw: unused @@ -705,7 +802,6 @@ static s32 ixgbevf_check_mac_link_vf(struct ixgbe_hw *h= w, struct ixgbe_mbx_info *mbx =3D &hw->mbx; struct ixgbe_mac_info *mac =3D &hw->mac; s32 ret_val =3D 0; - u32 links_reg; u32 in_msg =3D 0; =20 /* If we were hit with a reset drop the link */ @@ -715,36 +811,14 @@ static s32 ixgbevf_check_mac_link_vf(struct ixgbe_hw = *hw, if (!mac->get_link_status) goto out; =20 - /* if link status is down no point in checking to see if pf is up */ - links_reg =3D IXGBE_READ_REG(hw, IXGBE_VFLINKS); - if (!(links_reg & IXGBE_LINKS_UP)) - goto out; - - /* for SFP+ modules and DA cables on 82599 it can take up to 500usecs - * before the link status is correct - */ - if (mac->type =3D=3D ixgbe_mac_82599_vf) { - int i; - - for (i =3D 0; i < 5; i++) { - udelay(100); - links_reg =3D IXGBE_READ_REG(hw, IXGBE_VFLINKS); - - if (!(links_reg & IXGBE_LINKS_UP)) - goto out; - } - } - - switch (links_reg & IXGBE_LINKS_SPEED_82599) { - case IXGBE_LINKS_SPEED_10G_82599: - *speed =3D IXGBE_LINK_SPEED_10GB_FULL; - break; - case IXGBE_LINKS_SPEED_1G_82599: - *speed =3D IXGBE_LINK_SPEED_1GB_FULL; - break; - case IXGBE_LINKS_SPEED_100_82599: - *speed =3D IXGBE_LINK_SPEED_100_FULL; - break; + if (hw->mac.type =3D=3D ixgbe_mac_e610_vf) { + ret_val =3D ixgbevf_get_pf_link_state(hw, speed, link_up); + if (ret_val) + goto out; + } else { + ixgbe_read_vflinks(hw, speed, link_up); + if (*link_up =3D=3D false) + goto out; } =20 /* if the read failed it could just be a mailbox collision, best wait @@ -951,6 +1025,7 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned i= nt *num_tcs, case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: case ixgbe_mbox_api_15: + case ixgbe_mbox_api_16: break; default: return 0; --=20 2.51.0.rc1.197.g6d975e95c9d7 From nobody Wed Dec 17 19:22:30 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF7F686347; Fri, 10 Oct 2025 00:04:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760054655; cv=none; b=XSuujzGbqNZ+XvMIi64ePN4saqfmJQ69Flm9+gIsKeV7NaNu6vQ27WI9VXAm/EldBfu/fiX4lOhAulFhda+cj716MKL2/sM3t+mBgU2wfmHY2/+x3uvybMMVHMn7H3rQ+y68tnUanQFEcedHmpAX1+Yv7cMHmdapPsYIuiRl4nQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760054655; c=relaxed/simple; bh=+V5lrywCj3i8hHmaCLmJst2BSMbLJiNvxdIn69lTYRc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=piyL8vjCuMhqE+sJtV+Z2sldgEqNX1kxyLImPYvcO/XthU/N/5os10JSgEmtUN9mj6Qjh1+Et5+il83NxMERvbOF3YK6bbo5PriuyeaZYN+Uj4e/umGa2OnOY/1ekmGAgvIOzNROrwbWk6aoZfmyU4d1fDDtWu08u4posoe+Jg4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hClJU5iM; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hClJU5iM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760054654; x=1791590654; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=+V5lrywCj3i8hHmaCLmJst2BSMbLJiNvxdIn69lTYRc=; b=hClJU5iMvnmDdL87JJPS0imJN8e3nbbCzsmiMFQ3tTWyfbMzIe5iFmz+ x+dkXp8LPcpOWZC7sK8mkUCD2woHtgSUhJ6B079BdA57radX5KbIUsgdQ C3JexP6E47ui8SDZ7gYEZijbjvGSgQ41o08CEh1IqCIO9odDFt2oBMUzb +h531+oRus6X5V7ZcVZIYbkL0bwfUFEwbD4/zCAUK6LERzByU9xUhOJ9h 4qw1lPoPuFvEPVBYWKULrcxIv/u58XWG9R2xm4kG8dK54+u5mAqit1a7z ACXLuu4JXEOd6oTPZl76ctj+G1bLksO54yYqHU7w3n0zMPFaQX0lKzOXo w==; X-CSE-ConnectionGUID: ffKL9uqoS3OhcFE/xMFGtA== X-CSE-MsgGUID: ODB15Y73Qku8fcJDmL6ipA== X-IronPort-AV: E=McAfee;i="6800,10657,11577"; a="62316088" X-IronPort-AV: E=Sophos;i="6.19,217,1754982000"; d="scan'208";a="62316088" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2025 17:04:09 -0700 X-CSE-ConnectionGUID: /SnLVndsSwSTGSaz+zf/fQ== X-CSE-MsgGUID: hXN7t4AOQiO/aepIlnz05w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,217,1754982000"; d="scan'208";a="180858275" Received: from orcnseosdtjek.jf.intel.com (HELO [10.166.28.70]) ([10.166.28.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2025 17:04:09 -0700 From: Jacob Keller Date: Thu, 09 Oct 2025 17:03:48 -0700 Subject: [PATCH net v3 3/6] ixgbe: handle IXGBE_VF_GET_PF_LINK_STATE mailbox operation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251009-jk-iwl-net-2025-10-01-v3-3-ef32a425b92a@intel.com> References: <20251009-jk-iwl-net-2025-10-01-v3-0-ef32a425b92a@intel.com> In-Reply-To: <20251009-jk-iwl-net-2025-10-01-v3-0-ef32a425b92a@intel.com> To: Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Emil Tantilov , Alexander Lobakin , Willem de Bruijn , Sridhar Samudrala , Phani Burra , Piotr Kwapulinski , Simon Horman , Radoslaw Tyl , Jedrzej Jagielski Cc: Konstantin Ilichev , Milena Olech , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jacob Keller , Aleksandr Loktionov , Rafal Romanowski X-Mailer: b4 0.15-dev-89294 X-Developer-Signature: v=1; a=openpgp-sha256; l=5618; i=jacob.e.keller@intel.com; h=from:subject:message-id; bh=WveGSDHApHh1gyC1vDVAz7ivD6vjeZ/2lXnfVNk+0nM=; b=owGbwMvMwCWWNS3WLp9f4wXjabUkhowXvuXuaqcL9TO3S6R5c9U1b2+53f7zdq/0K9GH9j/cV /FlVGh0lLIwiHExyIopsig4hKy8bjwhTOuNsxzMHFYmkCEMXJwCMJHUPob/VXIWO7PFllXMPX9l muP0e5ar1un/se+5F230YVtRxMZtzYwMEzWzilt3nTXeMIGBMcymmrVS85RZoJjoX/4fcR0OC9f xAAA= X-Developer-Key: i=jacob.e.keller@intel.com; a=openpgp; fpr=204054A9D73390562AEC431E6A965D3E6F0F28E8 From: Jedrzej Jagielski Update supported API version and provide handler for IXGBE_VF_GET_PF_LINK_STATE cmd. Simply put stored values of link speed and link_up from adapter context. Reviewed-by: Przemek Kitszel Reviewed-by: Aleksandr Loktionov Signed-off-by: Jedrzej Jagielski Link: https://lore.kernel.org/stable/20250828095227.1857066-3-jedrzej.jagie= lski%40intel.com Tested-by: Rafal Romanowski Signed-off-by: Jacob Keller --- drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h | 5 +++ drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 42 ++++++++++++++++++++++= ++++ 2 files changed, 47 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h b/drivers/net/eth= ernet/intel/ixgbe/ixgbe_mbx.h index 4af149b63a39..f7256a339c99 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h @@ -50,6 +50,8 @@ enum ixgbe_pfvf_api_rev { ixgbe_mbox_api_12, /* API version 1.2, linux/freebsd VF driver */ ixgbe_mbox_api_13, /* API version 1.3, linux/freebsd VF driver */ ixgbe_mbox_api_14, /* API version 1.4, linux/freebsd VF driver */ + ixgbe_mbox_api_15, /* API version 1.5, linux/freebsd VF driver */ + ixgbe_mbox_api_16, /* API version 1.6, linux/freebsd VF driver */ /* This value should always be last */ ixgbe_mbox_api_unknown, /* indicates that API version is not known */ }; @@ -86,6 +88,9 @@ enum ixgbe_pfvf_api_rev { =20 #define IXGBE_VF_GET_LINK_STATE 0x10 /* get vf link state */ =20 +/* mailbox API, version 1.6 VF requests */ +#define IXGBE_VF_GET_PF_LINK_STATE 0x11 /* request PF to send link info */ + /* length of permanent address message returned from PF */ #define IXGBE_VF_PERMADDR_MSG_LEN 4 /* word in permanent address message with the current multicast type */ diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/e= thernet/intel/ixgbe/ixgbe_sriov.c index 32ac1e020d91..b09271d61a4e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -510,6 +510,7 @@ static int ixgbe_set_vf_lpe(struct ixgbe_adapter *adapt= er, u32 max_frame, u32 vf case ixgbe_mbox_api_12: case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: + case ixgbe_mbox_api_16: /* Version 1.1 supports jumbo frames on VFs if PF has * jumbo frames enabled which means legacy VFs are * disabled @@ -1046,6 +1047,7 @@ static int ixgbe_negotiate_vf_api(struct ixgbe_adapte= r *adapter, case ixgbe_mbox_api_12: case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: + case ixgbe_mbox_api_16: adapter->vfinfo[vf].vf_api =3D api; return 0; default: @@ -1072,6 +1074,7 @@ static int ixgbe_get_vf_queues(struct ixgbe_adapter *= adapter, case ixgbe_mbox_api_12: case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: + case ixgbe_mbox_api_16: break; default: return -1; @@ -1112,6 +1115,7 @@ static int ixgbe_get_vf_reta(struct ixgbe_adapter *ad= apter, u32 *msgbuf, u32 vf) =20 /* verify the PF is supporting the correct API */ switch (adapter->vfinfo[vf].vf_api) { + case ixgbe_mbox_api_16: case ixgbe_mbox_api_14: case ixgbe_mbox_api_13: case ixgbe_mbox_api_12: @@ -1145,6 +1149,7 @@ static int ixgbe_get_vf_rss_key(struct ixgbe_adapter = *adapter, =20 /* verify the PF is supporting the correct API */ switch (adapter->vfinfo[vf].vf_api) { + case ixgbe_mbox_api_16: case ixgbe_mbox_api_14: case ixgbe_mbox_api_13: case ixgbe_mbox_api_12: @@ -1174,6 +1179,7 @@ static int ixgbe_update_vf_xcast_mode(struct ixgbe_ad= apter *adapter, fallthrough; case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: + case ixgbe_mbox_api_16: break; default: return -EOPNOTSUPP; @@ -1244,6 +1250,7 @@ static int ixgbe_get_vf_link_state(struct ixgbe_adapt= er *adapter, case ixgbe_mbox_api_12: case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: + case ixgbe_mbox_api_16: break; default: return -EOPNOTSUPP; @@ -1254,6 +1261,38 @@ static int ixgbe_get_vf_link_state(struct ixgbe_adap= ter *adapter, return 0; } =20 +/** + * ixgbe_send_vf_link_status - send link status data to VF + * @adapter: pointer to adapter struct + * @msgbuf: pointer to message buffers + * @vf: VF identifier + * + * Reply for IXGBE_VF_GET_PF_LINK_STATE mbox command sending link status d= ata. + * + * Return: 0 on success or -EOPNOTSUPP when operation is not supported. + */ +static int ixgbe_send_vf_link_status(struct ixgbe_adapter *adapter, + u32 *msgbuf, u32 vf) +{ + struct ixgbe_hw *hw =3D &adapter->hw; + + switch (adapter->vfinfo[vf].vf_api) { + case ixgbe_mbox_api_16: + if (hw->mac.type !=3D ixgbe_mac_e610) + return -EOPNOTSUPP; + break; + default: + return -EOPNOTSUPP; + } + /* Simply provide stored values as watchdog & link status events take + * care of its freshness. + */ + msgbuf[1] =3D adapter->link_speed; + msgbuf[2] =3D adapter->link_up; + + return 0; +} + static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) { u32 mbx_size =3D IXGBE_VFMAILBOX_SIZE; @@ -1328,6 +1367,9 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter= *adapter, u32 vf) case IXGBE_VF_IPSEC_DEL: retval =3D ixgbe_ipsec_vf_del_sa(adapter, msgbuf, vf); break; + case IXGBE_VF_GET_PF_LINK_STATE: + retval =3D ixgbe_send_vf_link_status(adapter, msgbuf, vf); + break; default: e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]); retval =3D -EIO; --=20 2.51.0.rc1.197.g6d975e95c9d7 From nobody Wed Dec 17 19:22:30 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EA081547F2; Fri, 10 Oct 2025 00:04:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760054656; cv=none; b=EGFTelulFnXIHQPY77t7DzQn+FG6bRt/Yk4U4WX8X5lDQCDB83OVts3Tz17DynnN8vxVwIyaJj6uWCAzCrrsgXVLoVD+vi3l/lvCLjLU/ia/EC7ExSdh314eTf9+8kjZzDhiGm+ZQrmvLuShhuOGzACJzK+loI2cHl6weMaS+jM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760054656; c=relaxed/simple; bh=GJMrjEcsZnm+4A1earTDzo1+f/eVV90GXue0FW/CVko=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nHGc6/kec/a0ThXY3QUkfW8Bwh7RczoJFZd9XUK7mj6F2kqplRHVBoSA+Q8Kqm7vbTmvxavhaNDxXwRVdCVJ2kAbv6A1QXzjfT4hQFNNjEsL102KYR/Dk4dw8JTVn9zBaomSBwhCwI3z/F+9EBwM6HESuKXMpEpvuC9soA25Muo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=NaHdpzfx; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NaHdpzfx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760054655; x=1791590655; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=GJMrjEcsZnm+4A1earTDzo1+f/eVV90GXue0FW/CVko=; b=NaHdpzfxsgqVgRkW92M6C+G7SdeINyg7oMEftdac2A15HhusvyPUpAxv G3lPrTSFPb8hUy8qCew4wiaxaj1UBmvNe/fPVvvhfgjdHk4+McZQHP/tU pd+GLqbzM5hkdSCgtX+1jzhKdxrOPSIR5PZn//5QYW4KQ0jsk9/sLgXK1 4K7XdHjEAM2vUaD41sYFzg9RCGOjUWHq398/Tn53M3zvbB01pDYhKZy4P NxTvXmnoRvsnK5OoeixJ2I6bzqlC4pJckCuVSZPrQ0AZTfUO/9Eo4IkZR obf4maHFWuv6N4gOKB9d9PTMURs3mwm2+nqj3/Xb6kTDXC2KlmyayKwoO A==; X-CSE-ConnectionGUID: /AZFRy1lQladpDsXYLIlQw== X-CSE-MsgGUID: fC0voUeoQWeT1zSyehtPyQ== X-IronPort-AV: E=McAfee;i="6800,10657,11577"; a="62316089" X-IronPort-AV: E=Sophos;i="6.19,217,1754982000"; d="scan'208";a="62316089" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2025 17:04:09 -0700 X-CSE-ConnectionGUID: xitU3fU0SmekpQh72WCQ2w== X-CSE-MsgGUID: iHC2zFvwTaSMKPgGOO2oyA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,217,1754982000"; d="scan'208";a="180858277" Received: from orcnseosdtjek.jf.intel.com (HELO [10.166.28.70]) ([10.166.28.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2025 17:04:09 -0700 From: Jacob Keller Date: Thu, 09 Oct 2025 17:03:49 -0700 Subject: [PATCH net v3 4/6] ixgbevf: fix mailbox API compatibility by negotiating supported features Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251009-jk-iwl-net-2025-10-01-v3-4-ef32a425b92a@intel.com> References: <20251009-jk-iwl-net-2025-10-01-v3-0-ef32a425b92a@intel.com> In-Reply-To: <20251009-jk-iwl-net-2025-10-01-v3-0-ef32a425b92a@intel.com> To: Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Emil Tantilov , Alexander Lobakin , Willem de Bruijn , Sridhar Samudrala , Phani Burra , Piotr Kwapulinski , Simon Horman , Radoslaw Tyl , Jedrzej Jagielski Cc: Konstantin Ilichev , Milena Olech , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jacob Keller , Aleksandr Loktionov , stable@vger.kernel.org, Rafal Romanowski X-Mailer: b4 0.15-dev-89294 X-Developer-Signature: v=1; a=openpgp-sha256; l=12961; i=jacob.e.keller@intel.com; h=from:subject:message-id; bh=FOHZYctobMXLMCihiXUYZlPGi8uqnrgJ1tbuyH6sdNg=; b=owGbwMvMwCWWNS3WLp9f4wXjabUkhowXvuUz1ZXCHZc/X3vkUk56n4RosRHjlK19nlr72mcuS PzNu2BSRykLgxgXg6yYIouCQ8jK68YTwrTeOMvBzGFlAhnCwMUpABPRecnw32++seMO3tNbjx37 pTQn6L3HZouDHpK8tyO/VahzbOyayc7IcD7cu6ile/71S68X1n29U2jdreJjnfNYx79/O0fzdld BJgA= X-Developer-Key: i=jacob.e.keller@intel.com; a=openpgp; fpr=204054A9D73390562AEC431E6A965D3E6F0F28E8 From: Jedrzej Jagielski There was backward compatibility in the terms of mailbox API. Various drivers from various OSes supporting 10G adapters from Intel portfolio could easily negotiate mailbox API. This convention has been broken since introducing API 1.4. Commit 0062e7cc955e ("ixgbevf: add VF IPsec offload code") added support for IPSec which is specific only for the kernel ixgbe driver. None of the rest of the Intel 10G PF/VF drivers supports it. And actually lack of support was not included in the IPSec implementation - there were no such code paths. No possibility to negotiate support for the feature was introduced along with introduction of the feature itself. Commit 339f28964147 ("ixgbevf: Add support for new mailbox communication between PF and VF") increasing API version to 1.5 did the same - it introduced code supported specifically by the PF ESX driver. It altered API version for the VF driver in the same time not touching the version defined for the PF ixgbe driver. It led to additional discrepancies, as the code provided within API 1.6 cannot be supported for Linux ixgbe driver as it causes crashes. The issue was noticed some time ago and mitigated by Jake within the commit d0725312adf5 ("ixgbevf: stop attempting IPSEC offload on Mailbox API 1.5"). As a result we have regression for IPsec support and after increasing API to version 1.6 ixgbevf driver stopped to support ESX MBX. To fix this mess add new mailbox op asking PF driver about supported features. Basing on a response determine whether to set support for IPSec and ESX-specific enhanced mailbox. New mailbox op, for compatibility purposes, must be added within new API revision, as API version of OOT PF & VF drivers is already increased to 1.6 and doesn't incorporate features negotiate op. Features negotiation mechanism gives possibility to be extended with new features when needed in the future. Reported-by: Jacob Keller Closes: https://lore.kernel.org/intel-wired-lan/20241101-jk-ixgbevf-mailbox= -v1-5-fixes-v1-0-f556dc9a66ed@intel.com/ Fixes: 0062e7cc955e ("ixgbevf: add VF IPsec offload code") Fixes: 339f28964147 ("ixgbevf: Add support for new mailbox communication be= tween PF and VF") Reviewed-by: Jacob Keller Reviewed-by: Przemek Kitszel Reviewed-by: Aleksandr Loktionov Cc: stable@vger.kernel.org Signed-off-by: Jedrzej Jagielski Tested-by: Rafal Romanowski Signed-off-by: Jacob Keller --- drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 7 ++++ drivers/net/ethernet/intel/ixgbevf/mbx.h | 4 ++ drivers/net/ethernet/intel/ixgbevf/vf.h | 1 + drivers/net/ethernet/intel/ixgbevf/ipsec.c | 10 +++++ drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 32 +++++++++++++++- drivers/net/ethernet/intel/ixgbevf/vf.c | 45 +++++++++++++++++++= +++- 6 files changed, 96 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/eth= ernet/intel/ixgbevf/ixgbevf.h index 3a379e6a3a2a..039187607e98 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h @@ -363,6 +363,13 @@ struct ixgbevf_adapter { struct ixgbe_hw hw; u16 msg_enable; =20 + u32 pf_features; +#define IXGBEVF_PF_SUP_IPSEC BIT(0) +#define IXGBEVF_PF_SUP_ESX_MBX BIT(1) + +#define IXGBEVF_SUPPORTED_FEATURES (IXGBEVF_PF_SUP_IPSEC | \ + IXGBEVF_PF_SUP_ESX_MBX) + struct ixgbevf_hw_stats stats; =20 unsigned long state; diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.h b/drivers/net/etherne= t/intel/ixgbevf/mbx.h index c1494fd1f67b..a8ed23ee66aa 100644 --- a/drivers/net/ethernet/intel/ixgbevf/mbx.h +++ b/drivers/net/ethernet/intel/ixgbevf/mbx.h @@ -67,6 +67,7 @@ enum ixgbe_pfvf_api_rev { ixgbe_mbox_api_14, /* API version 1.4, linux/freebsd VF driver */ ixgbe_mbox_api_15, /* API version 1.5, linux/freebsd VF driver */ ixgbe_mbox_api_16, /* API version 1.6, linux/freebsd VF driver */ + ixgbe_mbox_api_17, /* API version 1.7, linux/freebsd VF driver */ /* This value should always be last */ ixgbe_mbox_api_unknown, /* indicates that API version is not known */ }; @@ -106,6 +107,9 @@ enum ixgbe_pfvf_api_rev { /* mailbox API, version 1.6 VF requests */ #define IXGBE_VF_GET_PF_LINK_STATE 0x11 /* request PF to send link info */ =20 +/* mailbox API, version 1.7 VF requests */ +#define IXGBE_VF_FEATURES_NEGOTIATE 0x12 /* get features supported by PF*/ + /* length of permanent address message returned from PF */ #define IXGBE_VF_PERMADDR_MSG_LEN 4 /* word in permanent address message with the current multicast type */ diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet= /intel/ixgbevf/vf.h index 2d791bc26ae4..4f19b8900c29 100644 --- a/drivers/net/ethernet/intel/ixgbevf/vf.h +++ b/drivers/net/ethernet/intel/ixgbevf/vf.h @@ -26,6 +26,7 @@ struct ixgbe_mac_operations { s32 (*stop_adapter)(struct ixgbe_hw *); s32 (*get_bus_info)(struct ixgbe_hw *); s32 (*negotiate_api_version)(struct ixgbe_hw *hw, int api); + int (*negotiate_features)(struct ixgbe_hw *hw, u32 *pf_features); =20 /* Link */ s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool, bool); diff --git a/drivers/net/ethernet/intel/ixgbevf/ipsec.c b/drivers/net/ether= net/intel/ixgbevf/ipsec.c index 65580b9cb06f..fce35924ff8b 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ipsec.c +++ b/drivers/net/ethernet/intel/ixgbevf/ipsec.c @@ -273,6 +273,9 @@ static int ixgbevf_ipsec_add_sa(struct net_device *dev, adapter =3D netdev_priv(dev); ipsec =3D adapter->ipsec; =20 + if (!(adapter->pf_features & IXGBEVF_PF_SUP_IPSEC)) + return -EOPNOTSUPP; + if (xs->id.proto !=3D IPPROTO_ESP && xs->id.proto !=3D IPPROTO_AH) { NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol for IPsec offload"); return -EINVAL; @@ -405,6 +408,9 @@ static void ixgbevf_ipsec_del_sa(struct net_device *dev, adapter =3D netdev_priv(dev); ipsec =3D adapter->ipsec; =20 + if (!(adapter->pf_features & IXGBEVF_PF_SUP_IPSEC)) + return; + if (xs->xso.dir =3D=3D XFRM_DEV_OFFLOAD_IN) { sa_idx =3D xs->xso.offload_handle - IXGBE_IPSEC_BASE_RX_INDEX; =20 @@ -612,6 +618,10 @@ void ixgbevf_init_ipsec_offload(struct ixgbevf_adapter= *adapter) size_t size; =20 switch (adapter->hw.api_version) { + case ixgbe_mbox_api_17: + if (!(adapter->pf_features & IXGBEVF_PF_SUP_IPSEC)) + return; + break; case ixgbe_mbox_api_14: break; default: diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/ne= t/ethernet/intel/ixgbevf/ixgbevf_main.c index 92671638b428..d5ce20f47def 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -2271,10 +2271,35 @@ static void ixgbevf_init_last_counter_stats(struct = ixgbevf_adapter *adapter) adapter->stats.base_vfmprc =3D adapter->stats.last_vfmprc; } =20 +/** + * ixgbevf_set_features - Set features supported by PF + * @adapter: pointer to the adapter struct + * + * Negotiate with PF supported features and then set pf_features according= ly. + */ +static void ixgbevf_set_features(struct ixgbevf_adapter *adapter) +{ + u32 *pf_features =3D &adapter->pf_features; + struct ixgbe_hw *hw =3D &adapter->hw; + int err; + + err =3D hw->mac.ops.negotiate_features(hw, pf_features); + if (err && err !=3D -EOPNOTSUPP) + netdev_dbg(adapter->netdev, + "PF feature negotiation failed.\n"); + + /* Address also pre API 1.7 cases */ + if (hw->api_version =3D=3D ixgbe_mbox_api_14) + *pf_features |=3D IXGBEVF_PF_SUP_IPSEC; + else if (hw->api_version =3D=3D ixgbe_mbox_api_15) + *pf_features |=3D IXGBEVF_PF_SUP_ESX_MBX; +} + static void ixgbevf_negotiate_api(struct ixgbevf_adapter *adapter) { struct ixgbe_hw *hw =3D &adapter->hw; static const int api[] =3D { + ixgbe_mbox_api_17, ixgbe_mbox_api_16, ixgbe_mbox_api_15, ixgbe_mbox_api_14, @@ -2295,8 +2320,9 @@ static void ixgbevf_negotiate_api(struct ixgbevf_adap= ter *adapter) idx++; } =20 - /* Following is not supported by API 1.6, it is specific for 1.5 */ - if (hw->api_version =3D=3D ixgbe_mbox_api_15) { + ixgbevf_set_features(adapter); + + if (adapter->pf_features & IXGBEVF_PF_SUP_ESX_MBX) { hw->mbx.ops.init_params(hw); memcpy(&hw->mbx.ops, &ixgbevf_mbx_ops, sizeof(struct ixgbe_mbx_operations)); @@ -2654,6 +2680,7 @@ static void ixgbevf_set_num_queues(struct ixgbevf_ada= pter *adapter) case ixgbe_mbox_api_14: case ixgbe_mbox_api_15: case ixgbe_mbox_api_16: + case ixgbe_mbox_api_17: if (adapter->xdp_prog && hw->mac.max_tx_queues =3D=3D rss) rss =3D rss > 3 ? 2 : 1; @@ -4649,6 +4676,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const = struct pci_device_id *ent) case ixgbe_mbox_api_14: case ixgbe_mbox_api_15: case ixgbe_mbox_api_16: + case ixgbe_mbox_api_17: netdev->max_mtu =3D IXGBE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN); break; diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet= /intel/ixgbevf/vf.c index f05246fb5a74..74d320879513 100644 --- a/drivers/net/ethernet/intel/ixgbevf/vf.c +++ b/drivers/net/ethernet/intel/ixgbevf/vf.c @@ -313,6 +313,7 @@ int ixgbevf_get_reta_locked(struct ixgbe_hw *hw, u32 *r= eta, int num_rx_queues) * is not supported for this device type. */ switch (hw->api_version) { + case ixgbe_mbox_api_17: case ixgbe_mbox_api_16: case ixgbe_mbox_api_15: case ixgbe_mbox_api_14: @@ -383,6 +384,7 @@ int ixgbevf_get_rss_key_locked(struct ixgbe_hw *hw, u8 = *rss_key) * or if the operation is not supported for this device type. */ switch (hw->api_version) { + case ixgbe_mbox_api_17: case ixgbe_mbox_api_16: case ixgbe_mbox_api_15: case ixgbe_mbox_api_14: @@ -555,6 +557,7 @@ static s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *h= w, int xcast_mode) case ixgbe_mbox_api_14: case ixgbe_mbox_api_15: case ixgbe_mbox_api_16: + case ixgbe_mbox_api_17: break; default: return -EOPNOTSUPP; @@ -646,6 +649,7 @@ static int ixgbevf_get_pf_link_state(struct ixgbe_hw *h= w, ixgbe_link_speed *spee =20 switch (hw->api_version) { case ixgbe_mbox_api_16: + case ixgbe_mbox_api_17: break; default: return -EOPNOTSUPP; @@ -669,6 +673,42 @@ static int ixgbevf_get_pf_link_state(struct ixgbe_hw *= hw, ixgbe_link_speed *spee return err; } =20 +/** + * ixgbevf_negotiate_features_vf - negotiate supported features with PF dr= iver + * @hw: pointer to the HW structure + * @pf_features: bitmask of features supported by PF + * + * Return: IXGBE_ERR_MBX in the case of mailbox error, + * -EOPNOTSUPP if the op is not supported or 0 on success. + */ +static int ixgbevf_negotiate_features_vf(struct ixgbe_hw *hw, u32 *pf_feat= ures) +{ + u32 msgbuf[2] =3D {}; + int err; + + switch (hw->api_version) { + case ixgbe_mbox_api_17: + break; + default: + return -EOPNOTSUPP; + } + + msgbuf[0] =3D IXGBE_VF_FEATURES_NEGOTIATE; + msgbuf[1] =3D IXGBEVF_SUPPORTED_FEATURES; + + err =3D ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, + ARRAY_SIZE(msgbuf)); + + if (err || (msgbuf[0] & IXGBE_VT_MSGTYPE_FAILURE)) { + err =3D IXGBE_ERR_MBX; + *pf_features =3D 0x0; + } else { + *pf_features =3D msgbuf[1]; + } + + return err; +} + /** * ixgbevf_set_vfta_vf - Set/Unset VLAN filter table address * @hw: pointer to the HW structure @@ -799,6 +839,7 @@ static s32 ixgbevf_check_mac_link_vf(struct ixgbe_hw *h= w, bool *link_up, bool autoneg_wait_to_complete) { + struct ixgbevf_adapter *adapter =3D hw->back; struct ixgbe_mbx_info *mbx =3D &hw->mbx; struct ixgbe_mac_info *mac =3D &hw->mac; s32 ret_val =3D 0; @@ -825,7 +866,7 @@ static s32 ixgbevf_check_mac_link_vf(struct ixgbe_hw *h= w, * until we are called again and don't report an error */ if (mbx->ops.read(hw, &in_msg, 1)) { - if (hw->api_version >=3D ixgbe_mbox_api_15) + if (adapter->pf_features & IXGBEVF_PF_SUP_ESX_MBX) mac->get_link_status =3D false; goto out; } @@ -1026,6 +1067,7 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned = int *num_tcs, case ixgbe_mbox_api_14: case ixgbe_mbox_api_15: case ixgbe_mbox_api_16: + case ixgbe_mbox_api_17: break; default: return 0; @@ -1080,6 +1122,7 @@ static const struct ixgbe_mac_operations ixgbevf_mac_= ops =3D { .setup_link =3D ixgbevf_setup_mac_link_vf, .check_link =3D ixgbevf_check_mac_link_vf, .negotiate_api_version =3D ixgbevf_negotiate_api_version_vf, + .negotiate_features =3D ixgbevf_negotiate_features_vf, .set_rar =3D ixgbevf_set_rar_vf, .update_mc_addr_list =3D ixgbevf_update_mc_addr_list_vf, .update_xcast_mode =3D ixgbevf_update_xcast_mode, --=20 2.51.0.rc1.197.g6d975e95c9d7 From nobody Wed Dec 17 19:22:30 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98EE118A6CF; Fri, 10 Oct 2025 00:04:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760054657; cv=none; b=JLXFs4N3n21Jk7auL3MIg+vTZng8+fUt+wUFgDWZMYrCXRhp1O1FV2o9D6Rb8FfDtelyYm6V8hn6MSrM8FbkFZdOHvT6mBu/EripWWuqB7zt4sBE6g2mMPszWCsKap2IFDQsnee8EZI34fMZEOoV13brG+c1R+ymV/GOBXetShY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760054657; c=relaxed/simple; bh=eduPU7wWCs8zAVaitAd4sKGnjYvi8D+VzudXvzq2Sqo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bcRr3RFKpbKA5xL0p3ISmh/vwUDm+mjifo3GKQvn1+dEDpRMtu2nBvpF6yYp7Pvr7Sa/Mx++GgoJ2aSNbVgvXrAyMBFBx4vKKpL3BuHfzGKlOqpJB7tBLitkw2qDXeaEbpAQygMPUDnZBg1eMWME28eeQVBYy4XoZn/yL91VRQs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=IX4fFBUp; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IX4fFBUp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760054655; x=1791590655; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=eduPU7wWCs8zAVaitAd4sKGnjYvi8D+VzudXvzq2Sqo=; b=IX4fFBUp3CGYMpTiR/LE2mGcrf6cUJxUg921N3DOfBALnea1nEbBYEej iH4DlZEZCivagMwKFh+EUa+t7GAVacp2ib6AIxGCnP57xq9vL5ZaFG24k JrK8nlAs4nb1FpGPe4/0bjluUCOdOY1bmHVV4U3Tptk5GqtqfqJ8urAdB B42/1EmnS9KxE/IicLCMUA2CLpCDGK7cFpZo15k74XQzhyWlxmYi88c2a lZrc8Unrm+AT7aL8ybJXHzYiBRdtDmmUH25Hg8Lz2iOggXB8adVQfmV0U yGdvxbEoPM+8ziQq1exbltMyK0Wy1nUsNelGxCQY6GEhMIsLOAp9PPyrx Q==; X-CSE-ConnectionGUID: Q9O0+MNRR/yb1b0FPacUWA== X-CSE-MsgGUID: pgF3mu4MTbK9P3w/k7/Skw== X-IronPort-AV: E=McAfee;i="6800,10657,11577"; a="62316100" X-IronPort-AV: E=Sophos;i="6.19,217,1754982000"; d="scan'208";a="62316100" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2025 17:04:10 -0700 X-CSE-ConnectionGUID: uzG1v20hTvCOAyvQrxYmGQ== X-CSE-MsgGUID: wt7zEQV7RXyd69AHFuoAVg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,217,1754982000"; d="scan'208";a="180858281" Received: from orcnseosdtjek.jf.intel.com (HELO [10.166.28.70]) ([10.166.28.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2025 17:04:09 -0700 From: Jacob Keller Date: Thu, 09 Oct 2025 17:03:50 -0700 Subject: [PATCH net v3 5/6] ixgbe: handle IXGBE_VF_FEATURES_NEGOTIATE mbox cmd Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251009-jk-iwl-net-2025-10-01-v3-5-ef32a425b92a@intel.com> References: <20251009-jk-iwl-net-2025-10-01-v3-0-ef32a425b92a@intel.com> In-Reply-To: <20251009-jk-iwl-net-2025-10-01-v3-0-ef32a425b92a@intel.com> To: Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Emil Tantilov , Alexander Lobakin , Willem de Bruijn , Sridhar Samudrala , Phani Burra , Piotr Kwapulinski , Simon Horman , Radoslaw Tyl , Jedrzej Jagielski Cc: Konstantin Ilichev , Milena Olech , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jacob Keller , Aleksandr Loktionov , Rafal Romanowski X-Mailer: b4 0.15-dev-89294 X-Developer-Signature: v=1; a=openpgp-sha256; l=5967; i=jacob.e.keller@intel.com; h=from:subject:message-id; bh=PdICJJfpUzWF+GQ6nT06zC3A3sdlZO5ik1Z2bGsX5dg=; b=owGbwMvMwCWWNS3WLp9f4wXjabUkhowXvuVzbu+tWcIymemXascSlq7vH5WUnse+yzVfvSZBv cfp7zTLjlIWBjEuBlkxRRYFh5CV140nhGm9cZaDmcPKBDKEgYtTACbCIczwP3izBdueuTc86+Zr nXS/3NTDcrW6yMKhf6ows6acZUi5KCPDDb7WyYb2sqmHrLKTJA35HwTOnM30vq3a9ctChre17CL sAA== X-Developer-Key: i=jacob.e.keller@intel.com; a=openpgp; fpr=204054A9D73390562AEC431E6A965D3E6F0F28E8 From: Jedrzej Jagielski Send to VF information about features supported by the PF driver. Increase API version to 1.7. Reviewed-by: Przemek Kitszel Reviewed-by: Aleksandr Loktionov Signed-off-by: Jedrzej Jagielski Tested-by: Rafal Romanowski Signed-off-by: Jacob Keller --- drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h | 10 +++++++ drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 37 ++++++++++++++++++++++= ++++ 2 files changed, 47 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h b/drivers/net/eth= ernet/intel/ixgbe/ixgbe_mbx.h index f7256a339c99..0334ed4b8fa3 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h @@ -52,6 +52,7 @@ enum ixgbe_pfvf_api_rev { ixgbe_mbox_api_14, /* API version 1.4, linux/freebsd VF driver */ ixgbe_mbox_api_15, /* API version 1.5, linux/freebsd VF driver */ ixgbe_mbox_api_16, /* API version 1.6, linux/freebsd VF driver */ + ixgbe_mbox_api_17, /* API version 1.7, linux/freebsd VF driver */ /* This value should always be last */ ixgbe_mbox_api_unknown, /* indicates that API version is not known */ }; @@ -91,6 +92,9 @@ enum ixgbe_pfvf_api_rev { /* mailbox API, version 1.6 VF requests */ #define IXGBE_VF_GET_PF_LINK_STATE 0x11 /* request PF to send link info */ =20 +/* mailbox API, version 1.7 VF requests */ +#define IXGBE_VF_FEATURES_NEGOTIATE 0x12 /* get features supported by PF */ + /* length of permanent address message returned from PF */ #define IXGBE_VF_PERMADDR_MSG_LEN 4 /* word in permanent address message with the current multicast type */ @@ -101,6 +105,12 @@ enum ixgbe_pfvf_api_rev { #define IXGBE_VF_MBX_INIT_TIMEOUT 2000 /* number of retries on mailbox */ #define IXGBE_VF_MBX_INIT_DELAY 500 /* microseconds between retries */ =20 +/* features negotiated between PF/VF */ +#define IXGBEVF_PF_SUP_IPSEC BIT(0) +#define IXGBEVF_PF_SUP_ESX_MBX BIT(1) + +#define IXGBE_SUPPORTED_FEATURES IXGBEVF_PF_SUP_IPSEC + struct ixgbe_hw; =20 int ixgbe_read_mbx(struct ixgbe_hw *, u32 *, u16, u16); diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/e= thernet/intel/ixgbe/ixgbe_sriov.c index b09271d61a4e..ee133d6749b3 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -511,6 +511,7 @@ static int ixgbe_set_vf_lpe(struct ixgbe_adapter *adapt= er, u32 max_frame, u32 vf case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: case ixgbe_mbox_api_16: + case ixgbe_mbox_api_17: /* Version 1.1 supports jumbo frames on VFs if PF has * jumbo frames enabled which means legacy VFs are * disabled @@ -1048,6 +1049,7 @@ static int ixgbe_negotiate_vf_api(struct ixgbe_adapte= r *adapter, case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: case ixgbe_mbox_api_16: + case ixgbe_mbox_api_17: adapter->vfinfo[vf].vf_api =3D api; return 0; default: @@ -1075,6 +1077,7 @@ static int ixgbe_get_vf_queues(struct ixgbe_adapter *= adapter, case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: case ixgbe_mbox_api_16: + case ixgbe_mbox_api_17: break; default: return -1; @@ -1115,6 +1118,7 @@ static int ixgbe_get_vf_reta(struct ixgbe_adapter *ad= apter, u32 *msgbuf, u32 vf) =20 /* verify the PF is supporting the correct API */ switch (adapter->vfinfo[vf].vf_api) { + case ixgbe_mbox_api_17: case ixgbe_mbox_api_16: case ixgbe_mbox_api_14: case ixgbe_mbox_api_13: @@ -1149,6 +1153,7 @@ static int ixgbe_get_vf_rss_key(struct ixgbe_adapter = *adapter, =20 /* verify the PF is supporting the correct API */ switch (adapter->vfinfo[vf].vf_api) { + case ixgbe_mbox_api_17: case ixgbe_mbox_api_16: case ixgbe_mbox_api_14: case ixgbe_mbox_api_13: @@ -1180,6 +1185,7 @@ static int ixgbe_update_vf_xcast_mode(struct ixgbe_ad= apter *adapter, case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: case ixgbe_mbox_api_16: + case ixgbe_mbox_api_17: break; default: return -EOPNOTSUPP; @@ -1251,6 +1257,7 @@ static int ixgbe_get_vf_link_state(struct ixgbe_adapt= er *adapter, case ixgbe_mbox_api_13: case ixgbe_mbox_api_14: case ixgbe_mbox_api_16: + case ixgbe_mbox_api_17: break; default: return -EOPNOTSUPP; @@ -1278,6 +1285,7 @@ static int ixgbe_send_vf_link_status(struct ixgbe_ada= pter *adapter, =20 switch (adapter->vfinfo[vf].vf_api) { case ixgbe_mbox_api_16: + case ixgbe_mbox_api_17: if (hw->mac.type !=3D ixgbe_mac_e610) return -EOPNOTSUPP; break; @@ -1293,6 +1301,32 @@ static int ixgbe_send_vf_link_status(struct ixgbe_ad= apter *adapter, return 0; } =20 +/** + * ixgbe_negotiate_vf_features - negotiate supported features with VF dri= ver + * @adapter: pointer to adapter struct + * @msgbuf: pointer to message buffers + * @vf: VF identifier + * + * Return: 0 on success or -EOPNOTSUPP when operation is not supported. + */ +static int ixgbe_negotiate_vf_features(struct ixgbe_adapter *adapter, + u32 *msgbuf, u32 vf) +{ + u32 features =3D msgbuf[1]; + + switch (adapter->vfinfo[vf].vf_api) { + case ixgbe_mbox_api_17: + break; + default: + return -EOPNOTSUPP; + } + + features &=3D IXGBE_SUPPORTED_FEATURES; + msgbuf[1] =3D features; + + return 0; +} + static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) { u32 mbx_size =3D IXGBE_VFMAILBOX_SIZE; @@ -1370,6 +1404,9 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter= *adapter, u32 vf) case IXGBE_VF_GET_PF_LINK_STATE: retval =3D ixgbe_send_vf_link_status(adapter, msgbuf, vf); break; + case IXGBE_VF_FEATURES_NEGOTIATE: + retval =3D ixgbe_negotiate_vf_features(adapter, msgbuf, vf); + break; default: e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]); retval =3D -EIO; --=20 2.51.0.rc1.197.g6d975e95c9d7 From nobody Wed Dec 17 19:22:30 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FB561B4F2C; Fri, 10 Oct 2025 00:04:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760054657; cv=none; b=fbrHUho+zsb84gW5sLsU2+ccDe4mVt3xKB88X1suXsPT9GNEWxmOTuCf/wNYUdLPLCFKOYOFKrRazg2g19YlB+rgaIKK2RbGOxsD0Dkvb77ikEyNfXzOcCOZYc9tsIV+rIh74nnOYtbGAdfmJZDE7dUq39/0IQ9sHbO9HBkitpY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760054657; c=relaxed/simple; bh=K/RaOnVi05JVkqqhHTGCjiBc/V2HGVq76P40JXdtSTg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p0mqlLJ1eB+h8ynsFxsOKzaaFQ+DxUhUaYyM8g4lKc6daHyNtWbEbPMDY0Kz4edD5Du0X3jxFooYwWDXlnATH4RYb6JvAwfXaTBlEe8RqK/FIabCmI/b0ctbiK3tdsEffocwf5QCVLWmYsFqvmYSkNDEoRmATj3RLK1KSqj3K1o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AjLadrK5; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AjLadrK5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760054656; x=1791590656; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=K/RaOnVi05JVkqqhHTGCjiBc/V2HGVq76P40JXdtSTg=; b=AjLadrK5rxBv0LgziNlw/skZCByt8FM55Gg8f8bjzdmAe4JMzHLqgtJo XumNvMRBTN9wKGtkhEdE8DmR/lFIKbIVu2+wlixMiJJEYpIl02pbscro5 5kqHtrJA+OLOOrTxPNNbLura2WHW5uDqi8gqHutWTI3iMl5z/MlTiaXDl emefK0g1AxhM+p5F3BYPAREfYIap6Ir6iPtj+U9OHnc9PuGUvaZZ1gL/b JKnLeLujL1mD+KY/fTSxFC4UWiLssLkwa94HPeR2t9bgS78ENp7GSwUY1 cqHxWrg8HUvYOk6LuhypoNt22h0tFEm/LJAXEb4mocGiIzre/p4nM6qaW w==; X-CSE-ConnectionGUID: uKCR4ouBT82a8oDvXgcFwA== X-CSE-MsgGUID: avS6vPAnT0a70YOlsbrUag== X-IronPort-AV: E=McAfee;i="6800,10657,11577"; a="62316108" X-IronPort-AV: E=Sophos;i="6.19,217,1754982000"; d="scan'208";a="62316108" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2025 17:04:10 -0700 X-CSE-ConnectionGUID: a7aExJGCSCOeWEfAn8bhsQ== X-CSE-MsgGUID: 8obgRRF7T5OwlPUMC2IsmQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,217,1754982000"; d="scan'208";a="180858283" Received: from orcnseosdtjek.jf.intel.com (HELO [10.166.28.70]) ([10.166.28.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2025 17:04:09 -0700 From: Jacob Keller Date: Thu, 09 Oct 2025 17:03:51 -0700 Subject: [PATCH net v3 6/6] ixgbe: fix too early devlink_free() in ixgbe_remove() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251009-jk-iwl-net-2025-10-01-v3-6-ef32a425b92a@intel.com> References: <20251009-jk-iwl-net-2025-10-01-v3-0-ef32a425b92a@intel.com> In-Reply-To: <20251009-jk-iwl-net-2025-10-01-v3-0-ef32a425b92a@intel.com> To: Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Emil Tantilov , Alexander Lobakin , Willem de Bruijn , Sridhar Samudrala , Phani Burra , Piotr Kwapulinski , Simon Horman , Radoslaw Tyl , Jedrzej Jagielski Cc: Konstantin Ilichev , Milena Olech , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jacob Keller , Koichiro Den , Rinitha S , Aleksandr Loktionov , Paul Menzel X-Mailer: b4 0.15-dev-89294 X-Developer-Signature: v=1; a=openpgp-sha256; l=2595; i=jacob.e.keller@intel.com; h=from:subject:message-id; bh=jhRfq8T2cyWOmChhBNbcupsEiMKPHxR5Fk20EtnVGug=; b=owGbwMvMwCWWNS3WLp9f4wXjabUkhowXvhVz9L3/bfm68h5L8ps6rdKd39crh6/eyvJd49a8a 8cefP26oqOUhUGMi0FWTJFFwSFk5XXjCWFab5zlYOawMoEMYeDiFICJfPzC8Fckj0Uo/9OM9e0s 7xxmzpC/78A9P02K6Zntrx/qSjd0ZM8xMtyqzaq1+SVzgaN+96Em2e5pS96al+lwC/pPuMbq/33 Ob3YA X-Developer-Key: i=jacob.e.keller@intel.com; a=openpgp; fpr=204054A9D73390562AEC431E6A965D3E6F0F28E8 From: Koichiro Den Since ixgbe_adapter is embedded in devlink, calling devlink_free() prematurely in the ixgbe_remove() path can lead to UAF. Move devlink_free() to the end. KASAN report: BUG: KASAN: use-after-free in ixgbe_reset_interrupt_capability+0x140/0x180= [ixgbe] Read of size 8 at addr ffff0000adf813e0 by task bash/2095 CPU: 1 UID: 0 PID: 2095 Comm: bash Tainted: G S 6.17.0-rc2-tnguy.net-queu= e+ #1 PREEMPT(full) [...] Call trace: show_stack+0x30/0x90 (C) dump_stack_lvl+0x9c/0xd0 print_address_description.constprop.0+0x90/0x310 print_report+0x104/0x1f0 kasan_report+0x88/0x180 __asan_report_load8_noabort+0x20/0x30 ixgbe_reset_interrupt_capability+0x140/0x180 [ixgbe] ixgbe_clear_interrupt_scheme+0xf8/0x130 [ixgbe] ixgbe_remove+0x2d0/0x8c0 [ixgbe] pci_device_remove+0xa0/0x220 device_remove+0xb8/0x170 device_release_driver_internal+0x318/0x490 device_driver_detach+0x40/0x68 unbind_store+0xec/0x118 drv_attr_store+0x64/0xb8 sysfs_kf_write+0xcc/0x138 kernfs_fop_write_iter+0x294/0x440 new_sync_write+0x1fc/0x588 vfs_write+0x480/0x6a0 ksys_write+0xf0/0x1e0 __arm64_sys_write+0x70/0xc0 invoke_syscall.constprop.0+0xcc/0x280 el0_svc_common.constprop.0+0xa8/0x248 do_el0_svc+0x44/0x68 el0_svc+0x54/0x160 el0t_64_sync_handler+0xa0/0xe8 el0t_64_sync+0x1b0/0x1b8 Fixes: a0285236ab93 ("ixgbe: add initial devlink support") Signed-off-by: Koichiro Den Tested-by: Rinitha S Reviewed-by: Jedrzej Jagielski Reviewed-by: Aleksandr Loktionov Reviewed-by: Paul Menzel Signed-off-by: Jacob Keller --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/et= hernet/intel/ixgbe/ixgbe_main.c index 90d4e57b1c93..ca1ccc630001 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -12101,7 +12101,6 @@ static void ixgbe_remove(struct pci_dev *pdev) =20 devl_port_unregister(&adapter->devlink_port); devl_unlock(adapter->devlink); - devlink_free(adapter->devlink); =20 ixgbe_stop_ipsec_offload(adapter); ixgbe_clear_interrupt_scheme(adapter); @@ -12137,6 +12136,8 @@ static void ixgbe_remove(struct pci_dev *pdev) =20 if (disable_dev) pci_disable_device(pdev); + + devlink_free(adapter->devlink); } =20 /** --=20 2.51.0.rc1.197.g6d975e95c9d7