From patchwork Tue Dec 3 21:55:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13893009 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 9AA6B20A5C2 for ; Tue, 3 Dec 2024 21:55:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262932; cv=none; b=Xb0og/dvrSOYeoEP/ThUtdGA3G2l2WYV7SVqIuVywdrPK3TjYDzN7aMVkvzU3Y7f+wFrLkYeGSZujuXay5k5bYkf9ARGLQ6Nk+2JBc0Q5RJjSo/25yVVL7rJMZZeT8jCWQVKReFe+iTtsfubh0SkE28hcDkOQ2udCFtjtwzrAvA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262932; c=relaxed/simple; bh=PvvJzR4B5qMPuIDfMD4TNsJDp2Tw1/PM/ZMFomPXBPI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AswSF8KltHPZQlEnh9allp6JHh8GWkXpvuMaI0cJSxylng0LgRJStB4A3qX//Ml6gHCQ1HjZbOHU5Yh0nIPJD0hm3sgnqoz4fvII2QK4noLW5NX71v2Adf6SUID95064nUxYp15KEJRAa8a78zdMy7W9RiIbIF+++CunMXTCBWc= 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=cTS+jLCy; arc=none smtp.client-ip=192.198.163.16 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="cTS+jLCy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733262931; x=1764798931; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PvvJzR4B5qMPuIDfMD4TNsJDp2Tw1/PM/ZMFomPXBPI=; b=cTS+jLCyKq1hAfpiYkk7tmrWgLRBS5h6QtGwJuMFPbGp4p+LZgUanbcc J+evXMP6eaNR2eem7wQ8M6efDGRrz/u2Q2XEdWIdQ3wx1GnXqQWFKIV3x w/dnNX/c1tN1wxMz7P2ZB7KfxLWNuOUkI7HN3GcvTlSqf7rXrIoAzmrvO /9VzNv/pcAEPMxr37JtcGSsA6dkHUaO0r0zrcMxHLb06oMp6bn1Y+1CAn /5wYNdwvxM7Q1TlKz6Htw0S52fY35bj4lgV2K416PTp8RuJL2XYqpzB0K aM9lZduOXfy6FVge0ktMn2UIWpmkaKVQ03Fw5H1xBSlBrRdKJQqudouzk Q==; X-CSE-ConnectionGUID: YZBBa6u7R0uUpJvUpzVTXw== X-CSE-MsgGUID: T7SoxdoqQOCmbihWIMSNiw== X-IronPort-AV: E=McAfee;i="6700,10204,11275"; a="21087111" X-IronPort-AV: E=Sophos;i="6.12,206,1728975600"; d="scan'208";a="21087111" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2024 13:55:29 -0800 X-CSE-ConnectionGUID: DrMLAZQCRryuPQbUPn8QCg== X-CSE-MsgGUID: pYkXzYxCTKm5wzdTK9+IFw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="98578867" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa003.jf.intel.com with ESMTP; 03 Dec 2024 13:55:29 -0800 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, andrew+netdev@lunn.ch, netdev@vger.kernel.org Cc: Arkadiusz Kubalewski , anthony.l.nguyen@intel.com, richardcochran@gmail.com, horms@kernel.org, Aleksandr Loktionov , Pucha Himasekhar Reddy Subject: [PATCH net 1/9] ice: fix PHY Clock Recovery availability check Date: Tue, 3 Dec 2024 13:55:10 -0800 Message-ID: <20241203215521.1646668-2-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.46.0.522.gc50d79eeffbf In-Reply-To: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> References: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Arkadiusz Kubalewski To check if PHY Clock Recovery mechanic is available for a device, there is a need to verify if given PHY is available within the netlist, but the netlist node type used for the search is wrong, also the search context shall be specified. Modify the search function to allow specifying the context in the search. Use the PHY node type instead of CLOCK CONTROLLER type, also use proper search context which for PHY search is PORT, as defined in E810 Datasheet [1] ('3.3.8.2.4 Node Part Number and Node Options (0x0003)' and 'Table 3-105. Program Topology Device NVM Admin Command'). [1] https://cdrdv2.intel.com/v1/dl/getContent/613875?explicitVersion=true Fixes: 91e43ca0090b ("ice: fix linking when CONFIG_PTP_1588_CLOCK=n") Reviewed-by: Aleksandr Loktionov Signed-off-by: Arkadiusz Kubalewski Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/ice/ice_common.c | 25 ++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index b22e71dc59d4..496d86cbd13f 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c @@ -542,7 +542,8 @@ ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd, /** * ice_find_netlist_node * @hw: pointer to the hw struct - * @node_type_ctx: type of netlist node to look for + * @node_type: type of netlist node to look for + * @ctx: context of the search * @node_part_number: node part number to look for * @node_handle: output parameter if node found - optional * @@ -552,10 +553,12 @@ ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd, * valid if the function returns zero, and should be ignored on any non-zero * return value. * - * Returns: 0 if the node is found, -ENOENT if no handle was found, and - * a negative error code on failure to access the AQ. + * Return: + * * 0 if the node is found, + * * -ENOENT if no handle was found, + * * negative error code on failure to access the AQ. */ -static int ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, +static int ice_find_netlist_node(struct ice_hw *hw, u8 node_type, u8 ctx, u8 node_part_number, u16 *node_handle) { u8 idx; @@ -566,8 +569,8 @@ static int ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, int status; cmd.addr.topo_params.node_type_ctx = - FIELD_PREP(ICE_AQC_LINK_TOPO_NODE_TYPE_M, - node_type_ctx); + FIELD_PREP(ICE_AQC_LINK_TOPO_NODE_TYPE_M, node_type) | + FIELD_PREP(ICE_AQC_LINK_TOPO_NODE_CTX_M, ctx); cmd.addr.topo_params.index = idx; status = ice_aq_get_netlist_node(hw, &cmd, @@ -2747,9 +2750,11 @@ bool ice_is_pf_c827(struct ice_hw *hw) */ bool ice_is_phy_rclk_in_netlist(struct ice_hw *hw) { - if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL, + if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_PHY, + ICE_AQC_LINK_TOPO_NODE_CTX_PORT, ICE_AQC_GET_LINK_TOPO_NODE_NR_C827, NULL) && - ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL, + ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_PHY, + ICE_AQC_LINK_TOPO_NODE_CTX_PORT, ICE_AQC_GET_LINK_TOPO_NODE_NR_E822_PHY, NULL)) return false; @@ -2765,6 +2770,7 @@ bool ice_is_phy_rclk_in_netlist(struct ice_hw *hw) bool ice_is_clock_mux_in_netlist(struct ice_hw *hw) { if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_MUX, + ICE_AQC_LINK_TOPO_NODE_CTX_GLOBAL, ICE_AQC_GET_LINK_TOPO_NODE_NR_GEN_CLK_MUX, NULL)) return false; @@ -2785,12 +2791,14 @@ bool ice_is_clock_mux_in_netlist(struct ice_hw *hw) bool ice_is_cgu_in_netlist(struct ice_hw *hw) { if (!ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL, + ICE_AQC_LINK_TOPO_NODE_CTX_GLOBAL, ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032, NULL)) { hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032; return true; } else if (!ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL, + ICE_AQC_LINK_TOPO_NODE_CTX_GLOBAL, ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384, NULL)) { hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384; @@ -2809,6 +2817,7 @@ bool ice_is_cgu_in_netlist(struct ice_hw *hw) bool ice_is_gps_in_netlist(struct ice_hw *hw) { if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_GPS, + ICE_AQC_LINK_TOPO_NODE_CTX_GLOBAL, ICE_AQC_GET_LINK_TOPO_NODE_NR_GEN_GPS, NULL)) return false; From patchwork Tue Dec 3 21:55:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13893010 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 E111A20B7EB for ; Tue, 3 Dec 2024 21:55:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262933; cv=none; b=k9MDqWOqomqijE86n2+30HfAPyHZCwJnUf8C6CIc7F6Q1I5SYbjRLwSk5zfsU/elrFVfGdkvw+s7RixmAM6WqxBsBI8X5J3TvRopL48eUDRVLqOcf7zktgaegYOu/BNgRianZDkhOXO7I4hNc49KMOk6LZTesWoAC4josH4NLrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262933; c=relaxed/simple; bh=7afLJoL/wekRZ8yibQSLBhUoTJnjgypHM9R2JNcGk/k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nLfERRlng1niPGzgV9tTks3sDlxG0W3e2VW+UA9sXZkCzAKN7DPzl7TF7dy0eZfuFt6nxfPWMz9+lp4tKSCloysnX+vAWzTkpIxnz0NfHjI/UlTAa3Rdatp/3Q9Tf5cHpZKyYpdpGJyRQwN3E+9TvDei207IKP9XJEoMXkPjk/I= 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=Fr8ObVte; arc=none smtp.client-ip=192.198.163.16 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="Fr8ObVte" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733262932; x=1764798932; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7afLJoL/wekRZ8yibQSLBhUoTJnjgypHM9R2JNcGk/k=; b=Fr8ObVtePszy/krijgS4XxZz9MOz6V64WNNkNBKGPHBjlhh5yZj9K/4O t/WByTLSYGBZNerHFihCL86lSGzex6dtc4EZ8o/0pfh8kQW1U2+HbMeuZ 8wQ4hflCfdy8Q/d4EAEXuZTD8sPftQQy+N64TQz5hDz1JzVdT/Ecym1ON BTEloRx47/hX5XMjPNNrdKKmPjHPoF2esWatcFfkSJGEsddfzxry74Y1L AlKqeiY76uZWxvb6hdp9bD94vopfnkgVeIzAcWtUDKJQWmodYHwyyxoKc H1ai3TV4PedzIXgrrmg5LpWCImhXhJvnMitLFr5a9+ury3tRcVcJkm/pH g==; X-CSE-ConnectionGUID: sULRgppCSISziE5ycn83MA== X-CSE-MsgGUID: 2Ek+BpOFR+OECYOF17x0UQ== X-IronPort-AV: E=McAfee;i="6700,10204,11275"; a="21087117" X-IronPort-AV: E=Sophos;i="6.12,206,1728975600"; d="scan'208";a="21087117" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2024 13:55:29 -0800 X-CSE-ConnectionGUID: oV0Sro9WRDCFoCT2dTOZQA== X-CSE-MsgGUID: I5+Txj/QQoOkyaRjj6cLWA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="98578870" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa003.jf.intel.com with ESMTP; 03 Dec 2024 13:55:29 -0800 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, andrew+netdev@lunn.ch, netdev@vger.kernel.org Cc: Przemyslaw Korba , anthony.l.nguyen@intel.com, richardcochran@gmail.com, Przemek Kitszel , Simon Horman , Pucha Himasekhar Reddy Subject: [PATCH net 2/9] ice: fix PHY timestamp extraction for ETH56G Date: Tue, 3 Dec 2024 13:55:11 -0800 Message-ID: <20241203215521.1646668-3-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.46.0.522.gc50d79eeffbf In-Reply-To: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> References: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Przemyslaw Korba Fix incorrect PHY timestamp extraction for ETH56G. It's better to use FIELD_PREP() than manual shift. Fixes: 7cab44f1c35f ("ice: Introduce ETH56G PHY model for E825C products") Reviewed-by: Przemek Kitszel Reviewed-by: Simon Horman Signed-off-by: Przemyslaw Korba Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 3 ++- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c index dfd49732bd5b..518893f23372 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c @@ -1518,7 +1518,8 @@ static int ice_read_ptp_tstamp_eth56g(struct ice_hw *hw, u8 port, u8 idx, * lower 8 bits in the low register, and the upper 32 bits in the high * register. */ - *tstamp = ((u64)hi) << TS_PHY_HIGH_S | ((u64)lo & TS_PHY_LOW_M); + *tstamp = FIELD_PREP(TS_PHY_HIGH_M, hi) | + FIELD_PREP(TS_PHY_LOW_M, lo); return 0; } diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h index 47af7c5c79b8..1cee0f1bba2d 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h @@ -682,9 +682,8 @@ static inline bool ice_is_dual(struct ice_hw *hw) #define TS_HIGH_M 0xFF #define TS_HIGH_S 32 -#define TS_PHY_LOW_M 0xFF -#define TS_PHY_HIGH_M 0xFFFFFFFF -#define TS_PHY_HIGH_S 8 +#define TS_PHY_LOW_M GENMASK(7, 0) +#define TS_PHY_HIGH_M GENMASK_ULL(39, 8) #define BYTES_PER_IDX_ADDR_L_U 8 #define BYTES_PER_IDX_ADDR_L 4 From patchwork Tue Dec 3 21:55:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13893011 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 86E1820B800 for ; Tue, 3 Dec 2024 21:55:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262934; cv=none; b=TfP4Q+Mv9T+TzI5eFl4I1uxNMKAa93HpH5XD3TlpnXQmU1r6RLCRWRPdDHJOVvMni/rzL/Q7D/Jb/RzXqT93mJ3jgyk4f+TkIsxHyxEWgJ74xL00aGvofkDbLAQYpnuLKa3OBvn5llhgk2FdEppcb/qF08ADWaD2W3DtdPbyGp4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262934; c=relaxed/simple; bh=xdGs9E5UYETH31RftHS1Y8AXWeuC9cJIca5yksIYcho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pMDQdhZ6YdWxC+5KHTmqLygBPhtWpkqZEiZ1lDgM+QvNG8itkW3Gp2tSxB8BKs2JoPJO3Gl9tA5F3selYPj9aMiF9cZu14CUMNS82dugmNQtyG1h52F3Uk6VA/8VZNX4TpvIzRl6N9q39QGcALI/xLG8vX6jN/68kqqhrwf20ik= 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=BJOa44ls; arc=none smtp.client-ip=192.198.163.16 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="BJOa44ls" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733262932; x=1764798932; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xdGs9E5UYETH31RftHS1Y8AXWeuC9cJIca5yksIYcho=; b=BJOa44lsD97+8r+bOcvEbdvjFWdJU3BmVHABuaRLV4XFx3mBd6aGdlcZ cYuVBdRMLkxkZsRfj3/kdbuyBFEm8SlcrL+0m77/E0/uMJERBwhkknB/W a815TS+HiZ53bIYMw/9dRvTXr1cC1VfgxxHFyAjSpeNoFRkrmhHKSzMQf 7PPUtQGqJOZ4bhehWEJc1NTO6tf/uQbDueqndGMQV4PXkXa1GR74YXjRm xvlyMOlFsbpYLCPVK8RxGgjsDPYN6ricbQIfT7Wf8ycNs5B6jXW9Xe5y/ /0Z6U0ov0x53PsaDN1H9XE6oxJSgk0InPlTG8goTbxzclLtN4030rtiB5 g==; X-CSE-ConnectionGUID: R9sa7JrRQHOglwDI//1FdQ== X-CSE-MsgGUID: 2pZcYGe2QzumkFeNsUC3tw== X-IronPort-AV: E=McAfee;i="6700,10204,11275"; a="21087125" X-IronPort-AV: E=Sophos;i="6.12,206,1728975600"; d="scan'208";a="21087125" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2024 13:55:29 -0800 X-CSE-ConnectionGUID: qoHe6ofnRRG/kp15KlDQOg== X-CSE-MsgGUID: OzpN/qYySlS1c0wg7PEiyA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="98578873" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa003.jf.intel.com with ESMTP; 03 Dec 2024 13:55:29 -0800 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, andrew+netdev@lunn.ch, netdev@vger.kernel.org Cc: Wojciech Drewek , anthony.l.nguyen@intel.com, jiri@resnulli.us, Przemek Kitszel , Michal Swiatkowski , Simon Horman , Sujai Buvaneswaran Subject: [PATCH net 3/9] ice: Fix NULL pointer dereference in switchdev Date: Tue, 3 Dec 2024 13:55:12 -0800 Message-ID: <20241203215521.1646668-4-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.46.0.522.gc50d79eeffbf In-Reply-To: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> References: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Wojciech Drewek Commit 608a5c05c39b ("virtchnl: support queue rate limit and quanta size configuration") introduced new virtchnl ops: - get_qos_caps - cfg_q_bw - cfg_q_quanta New ops were added to ice_virtchnl_dflt_ops, in commit 015307754a19 ("ice: Support VF queue rate limit and quanta size configuration"), but not to the ice_virtchnl_repr_ops. Because of that, if we get one of those messages in switchdev mode we end up with NULL pointer dereference: [ 1199.794701] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 1199.794804] Workqueue: ice ice_service_task [ice] [ 1199.794878] RIP: 0010:0x0 [ 1199.795027] Call Trace: [ 1199.795033] [ 1199.795039] ? __die+0x20/0x70 [ 1199.795051] ? page_fault_oops+0x140/0x520 [ 1199.795064] ? exc_page_fault+0x7e/0x270 [ 1199.795074] ? asm_exc_page_fault+0x22/0x30 [ 1199.795086] ice_vc_process_vf_msg+0x6e5/0xd30 [ice] [ 1199.795165] __ice_clean_ctrlq+0x734/0x9d0 [ice] [ 1199.795207] ice_service_task+0xccf/0x12b0 [ice] [ 1199.795248] process_one_work+0x21a/0x620 [ 1199.795260] worker_thread+0x18d/0x330 [ 1199.795269] ? __pfx_worker_thread+0x10/0x10 [ 1199.795279] kthread+0xec/0x120 [ 1199.795288] ? __pfx_kthread+0x10/0x10 [ 1199.795296] ret_from_fork+0x2d/0x50 [ 1199.795305] ? __pfx_kthread+0x10/0x10 [ 1199.795312] ret_from_fork_asm+0x1a/0x30 [ 1199.795323] Fixes: 015307754a19 ("ice: Support VF queue rate limit and quanta size configuration") Reviewed-by: Przemek Kitszel Reviewed-by: Michal Swiatkowski Signed-off-by: Wojciech Drewek Reviewed-by: Simon Horman Tested-by: Sujai Buvaneswaran Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/ice/ice_virtchnl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl.c b/drivers/net/ethernet/intel/ice/ice_virtchnl.c index f445e33b2028..ff4ad788d96a 100644 --- a/drivers/net/ethernet/intel/ice/ice_virtchnl.c +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl.c @@ -4128,6 +4128,9 @@ static const struct ice_virtchnl_ops ice_virtchnl_dflt_ops = { .get_qos_caps = ice_vc_get_qos_caps, .cfg_q_bw = ice_vc_cfg_q_bw, .cfg_q_quanta = ice_vc_cfg_q_quanta, + /* If you add a new op here please make sure to add it to + * ice_virtchnl_repr_ops as well. + */ }; /** @@ -4258,6 +4261,9 @@ static const struct ice_virtchnl_ops ice_virtchnl_repr_ops = { .dis_vlan_stripping_v2_msg = ice_vc_dis_vlan_stripping_v2_msg, .ena_vlan_insertion_v2_msg = ice_vc_ena_vlan_insertion_v2_msg, .dis_vlan_insertion_v2_msg = ice_vc_dis_vlan_insertion_v2_msg, + .get_qos_caps = ice_vc_get_qos_caps, + .cfg_q_bw = ice_vc_cfg_q_bw, + .cfg_q_quanta = ice_vc_cfg_q_quanta, }; /** From patchwork Tue Dec 3 21:55:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13893012 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 B772520B809 for ; Tue, 3 Dec 2024 21:55:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262934; cv=none; b=bKbIjuJLXEzImLX4WR9rN8FAXJYzTwZEKAwoj/PT+ozki/f7M/sTkmh7CRLYimYM8qsbWGgsJfouineBk0CAuOob9K5+VVE4THkuer5N6XM4pOUPyI4qR071Os6DmVtZLRfANT5zPKws0/2f7JKyzlxEGcMFpsT8W1zL3RNra+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262934; c=relaxed/simple; bh=GOwloZZiQDXi74olsCPHhrNLamregpnqg/ecAoF3+gg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jsr5U85ibT6NtrcgduUpYKKiu4kaUOSThHYsIzZcNZRSN/0SqMAKtVuRnHGXGE/Uy/D0i4jYG1dk1/VYJSG1c94+YGj9tBBPw5aHhGqT2j/RtYCpIfVTm6Zi7l0eRXci6+4g0md82FxjGIjia2q1D5D62cFyuELuAZKwP27RIwI= 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=S7rsvM6e; arc=none smtp.client-ip=192.198.163.16 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="S7rsvM6e" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733262933; x=1764798933; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GOwloZZiQDXi74olsCPHhrNLamregpnqg/ecAoF3+gg=; b=S7rsvM6eYGjRhnycUe1qAs8f+WebVx5qYMVDnkgyhOx0sGJ82A7KvHt7 c5eRVZq9YwuPVHE1lS9xosm8Fp2bcQlUs5oczbWEudtmJ7vTQbPYqbNoI QAU/Msx9+2g6xwDRf4+zK6gydgv5BbzmXUSagOF8cvgbuYpCdIWJj/Nys ppeBC9Dq2+cPlS0Sl/2QK9dZREMWw+TIPJJdFnTJrC/xiN5yaVHPMvxVV MbYQiSN1HO0vfGhYiYgVXUhNTrL6IYhI+vhAy/NUS7BTkYTHhmcrW+0YZ 82fSnDgqKOfV9BDCE9PSL1Gu0DON6lSW58dXLpCatW3OOH0TFKODce0Mq Q==; X-CSE-ConnectionGUID: XleZtI6NQOS8ZzeynV0oEQ== X-CSE-MsgGUID: HwsggqpYS3GEw/DiMJtjjQ== X-IronPort-AV: E=McAfee;i="6700,10204,11275"; a="21087132" X-IronPort-AV: E=Sophos;i="6.12,206,1728975600"; d="scan'208";a="21087132" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2024 13:55:29 -0800 X-CSE-ConnectionGUID: IUQTCRLcT2aqNusFC38LfQ== X-CSE-MsgGUID: k21yMxrkQUu5Y4BGCBhpvQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="98578877" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa003.jf.intel.com with ESMTP; 03 Dec 2024 13:55:29 -0800 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, andrew+netdev@lunn.ch, netdev@vger.kernel.org Cc: Marcin Szycik , anthony.l.nguyen@intel.com, jiri@resnulli.us, Michal Swiatkowski , Priya Singh Subject: [PATCH net 4/9] ice: Fix VLAN pruning in switchdev mode Date: Tue, 3 Dec 2024 13:55:13 -0800 Message-ID: <20241203215521.1646668-5-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.46.0.522.gc50d79eeffbf In-Reply-To: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> References: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Marcin Szycik In switchdev mode the uplink VSI should receive all unmatched packets, including VLANs. Therefore, VLAN pruning should be disabled if uplink is in switchdev mode. It is already being done in ice_eswitch_setup_env(), however the addition of ice_up() in commit 44ba608db509 ("ice: do switchdev slow-path Rx using PF VSI") caused VLAN pruning to be re-enabled after disabling it. Add a check to ice_set_vlan_filtering_features() to ensure VLAN filtering will not be enabled if uplink is in switchdev mode. Note that ice_is_eswitch_mode_switchdev() is being used instead of ice_is_switchdev_running(), as the latter would only return true after the whole switchdev setup completes. Fixes: 44ba608db509 ("ice: do switchdev slow-path Rx using PF VSI") Reviewed-by: Michal Swiatkowski Signed-off-by: Marcin Szycik Tested-by: Priya Singh Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/ice/ice_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 1eaa4428fd24..187856d4c79a 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -6408,10 +6408,12 @@ ice_set_vlan_filtering_features(struct ice_vsi *vsi, netdev_features_t features) int err = 0; /* support Single VLAN Mode (SVM) and Double VLAN Mode (DVM) by checking - * if either bit is set + * if either bit is set. In switchdev mode Rx filtering should never be + * enabled. */ - if (features & - (NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER)) + if ((features & + (NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER)) && + !ice_is_eswitch_mode_switchdev(vsi->back)) err = vlan_ops->ena_rx_filtering(vsi); else err = vlan_ops->dis_rx_filtering(vsi); From patchwork Tue Dec 3 21:55:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13893013 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 B0EF520C00C for ; Tue, 3 Dec 2024 21:55:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262935; cv=none; b=izcPsdHjZPeVvmDGBbxDtyWnai2LpwbMPokuXIHmWyMr+eub5JGXApuCHU1qQlvdEnQ9Fc9U+CJ1bf6msfvcyllhxhhooRQC1lXrUsn++cUxr5oxIBp4HcrToDxtAIpkM0h0zBO2srR2qXdJB5VG77f9eXbO5kfIPoKFPUjN2ac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262935; c=relaxed/simple; bh=dPHC9U2lY7m13ipDqNZOcYlAVURCmXYHvnQ/N2yAnG0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mtT5X1JeM0j16x0ck9Shqf4dLEcUm/8tZgLGXRxlK3bdO5kI1Tt3b6LjvY9y3Yg5CEtgUCoOszxezcLIqt4pvH/cRvDlU6F7cJVGOAXflgBKC8foBNGtKzFbErHsrIJOJj1BNdkbe0rDoHIXT0tuTJRxCthvLho8zJSrEzC1Ohc= 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=LCtEzLAM; arc=none smtp.client-ip=192.198.163.16 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="LCtEzLAM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733262934; x=1764798934; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dPHC9U2lY7m13ipDqNZOcYlAVURCmXYHvnQ/N2yAnG0=; b=LCtEzLAMF+uNWWLTZ8Qk9qtppc8K30DaoLlbC4Thr9574qnfYraAYuJy odjmng+/wNjXxp7tsJO2TQrT+5qx+LX8gjJpeMJyEgN6McLVbuAsYXE9U Wa4QFadsF7MaJfHNwTxCBR+Vmircllz1qIhVzhymWRyjfDA8X4Pfa3oiK b1uWB0avN4xj4Qt3xyzJVdMxY8O/Ou24O6euuyQ7qljG61al4OB3GGtOa T/WQSOJZEAFAqWTx4gqO+EcZeJsmlKe97iExzLnQEGY8gwtotsb8VlDfu gaT+2bYhx87A0Wb2R70Bzn34N+xs0RzbbtHLsL8l7f950IN4yVTpSJosb A==; X-CSE-ConnectionGUID: FIsujvIGROCVyDdd3qr72A== X-CSE-MsgGUID: ltATwvhdTXehcG/2gIrCoA== X-IronPort-AV: E=McAfee;i="6700,10204,11275"; a="21087139" X-IronPort-AV: E=Sophos;i="6.12,206,1728975600"; d="scan'208";a="21087139" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2024 13:55:29 -0800 X-CSE-ConnectionGUID: pymBQdPcTDuxX95Ynoj4sg== X-CSE-MsgGUID: YUgLnjSsToyLJx9L1Lk8Rg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="98578880" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa003.jf.intel.com with ESMTP; 03 Dec 2024 13:55:29 -0800 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, andrew+netdev@lunn.ch, netdev@vger.kernel.org Cc: Joshua Hay , anthony.l.nguyen@intel.com, Alexander Lobakin , Madhu chittim , Simon Horman , Krishneil Singh Subject: [PATCH net 5/9] idpf: set completion tag for "empty" bufs associated with a packet Date: Tue, 3 Dec 2024 13:55:14 -0800 Message-ID: <20241203215521.1646668-6-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.46.0.522.gc50d79eeffbf In-Reply-To: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> References: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Joshua Hay Commit d9028db618a6 ("idpf: convert to libeth Tx buffer completion") inadvertently removed code that was necessary for the tx buffer cleaning routine to iterate over all buffers associated with a packet. When a frag is too large for a single data descriptor, it will be split across multiple data descriptors. This means the frag will span multiple buffers in the buffer ring in order to keep the descriptor and buffer ring indexes aligned. The buffer entries in the ring are technically empty and no cleaning actions need to be performed. These empty buffers can precede other frags associated with the same packet. I.e. a single packet on the buffer ring can look like: buf[0]=skb0.frag0 buf[1]=skb0.frag1 buf[2]=empty buf[3]=skb0.frag2 The cleaning routine iterates through these buffers based on a matching completion tag. If the completion tag is not set for buf2, the loop will end prematurely. Frag2 will be left uncleaned and next_to_clean will be left pointing to the end of packet, which will break the cleaning logic for subsequent cleans. This consequently leads to tx timeouts. Assign the empty bufs the same completion tag for the packet to ensure the cleaning routine iterates over all of the buffers associated with the packet. Fixes: d9028db618a6 ("idpf: convert to libeth Tx buffer completion") Signed-off-by: Joshua Hay Acked-by: Alexander Lobakin Reviewed-by: Madhu chittim Reviewed-by: Simon Horman Tested-by: Krishneil Singh Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c index da2a5becf62f..34f4118c7bc0 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c @@ -2448,6 +2448,7 @@ static void idpf_tx_splitq_map(struct idpf_tx_queue *tx_q, * rest of the packet. */ tx_buf->type = LIBETH_SQE_EMPTY; + idpf_tx_buf_compl_tag(tx_buf) = params->compl_tag; /* Adjust the DMA offset and the remaining size of the * fragment. On the first iteration of this loop, From patchwork Tue Dec 3 21:55:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13893014 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 5C9AC20C02E for ; Tue, 3 Dec 2024 21:55:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262936; cv=none; b=nWycGm/SajY0X7cAKcUWh+Vc0+h083GMVWM7RIQWtBlSsj1ae4A84Ux70CSIBsLMzOncWuuImsXfVLvZm9JqIqd8vPggN/4tmAHJVFMlqeI0Ohl2AqhXFXgQKHCIlQKINDlrK1LARPV+Fb9GGUw9GbFnD8trPGeJAxH55OG0Dz0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262936; c=relaxed/simple; bh=UdyR4PJHi6VBm3/+paaOfmCEmQoUhDZEbunWfeGFRTs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HkrJaiaKlAcEn0AFyOISOV0hTQOFm4lislGur8utkgAmQmI6HrFHcjrDqB9Q4H1Wifw1gt8Pg0C2400xUv/+M0xDNTXFbBKDrIQTFV7jNPuJ6qCOcFXe7EhGnXPqqJW758GnLGEjun1uhARalFF+v6Hf4ZMVzyqapEHOt1qw7UQ= 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=VYusZe2d; arc=none smtp.client-ip=192.198.163.16 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="VYusZe2d" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733262934; x=1764798934; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UdyR4PJHi6VBm3/+paaOfmCEmQoUhDZEbunWfeGFRTs=; b=VYusZe2dtqM2URnVpDruA4OhMQZWa+L6BG6bC9AFHwX7zA9tNcWvtEvV SRqYEPJHhSXIuymjhtd14XQ+0fV1hPQzZR/uupSanfYbHrHErUIsdTV0L pwwhSyuPijQah1YKKwuG7k51wpQ6TCKKWBl3SXjUL9bLMgy4tD6O/xRyf yKIlh4QEFZ0uiUZFMgGrX9BByE/VZ1LYyPLZ16WM2PCO+BRAnoZQwuxeC oqmC9W7FfP0P10vUGSxtjF8kaAavIkKKpNNUDjw/xCA5byU+pf+iiu3zY Ih3XU0DuwlVua9FtJC1IAEHKN+LgyFUCJRXltXUVQ5Rwo7Z5qiwqSP+cU g==; X-CSE-ConnectionGUID: kSgq4VIUR56xUOipY0aI/g== X-CSE-MsgGUID: jLbTMKDZQouQDq0s74ygAw== X-IronPort-AV: E=McAfee;i="6700,10204,11275"; a="21087145" X-IronPort-AV: E=Sophos;i="6.12,206,1728975600"; d="scan'208";a="21087145" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2024 13:55:29 -0800 X-CSE-ConnectionGUID: DInEKKwfT8eXWToVYLm+qA== X-CSE-MsgGUID: Smo4HCfzReS6lt6JccP+Og== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="98578885" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa003.jf.intel.com with ESMTP; 03 Dec 2024 13:55:29 -0800 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, andrew+netdev@lunn.ch, netdev@vger.kernel.org Cc: Jacob Keller , anthony.l.nguyen@intel.com, Przemek Kitszel , Rafal Romanowski Subject: [PATCH net 6/9] ixgbevf: stop attempting IPSEC offload on Mailbox API 1.5 Date: Tue, 3 Dec 2024 13:55:15 -0800 Message-ID: <20241203215521.1646668-7-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.46.0.522.gc50d79eeffbf In-Reply-To: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> References: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jacob Keller Commit 339f28964147 ("ixgbevf: Add support for new mailbox communication between PF and VF") added support for v1.5 of the PF to VF mailbox communication API. This commit mistakenly enabled IPSEC offload for API v1.5. No implementation of the v1.5 API has support for IPSEC offload. This offload is only supported by the Linux PF as mailbox API v1.4. In fact, the v1.5 API is not implemented in any Linux PF. Attempting to enable IPSEC offload on a PF which supports v1.5 API will not work. Only the Linux upstream ixgbe and ixgbevf support IPSEC offload, and only as part of the v1.4 API. Fix the ixgbevf Linux driver to stop attempting IPSEC offload when the mailbox API does not support it. The existing API design choice makes it difficult to support future API versions, as other non-Linux hosts do not implement IPSEC offload. If we add support for v1.5 to the Linux PF, then we lose support for IPSEC offload. A full solution likely requires a new mailbox API with a proper negotiation to check that IPSEC is actually supported by the host. Fixes: 339f28964147 ("ixgbevf: Add support for new mailbox communication between PF and VF") Signed-off-by: Jacob Keller Reviewed-by: Przemek Kitszel Tested-by: Rafal Romanowski Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/ixgbevf/ipsec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbevf/ipsec.c b/drivers/net/ethernet/intel/ixgbevf/ipsec.c index 66cf17f19408..f804b35d79c7 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ipsec.c +++ b/drivers/net/ethernet/intel/ixgbevf/ipsec.c @@ -629,7 +629,6 @@ void ixgbevf_init_ipsec_offload(struct ixgbevf_adapter *adapter) switch (adapter->hw.api_version) { case ixgbe_mbox_api_14: - case ixgbe_mbox_api_15: break; default: return; From patchwork Tue Dec 3 21:55:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13893015 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 BDD3320C460 for ; Tue, 3 Dec 2024 21:55:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262936; cv=none; b=bf5wAspvuZs0A0owyBc8Yw6O4Sd2QPUWmRFBE6twKfQnzLqaCIgLk+Xxvhv8qeWFrGj5li68oPfHwZVuSargZlEQ/MU0x6BtX8/wkqKhbbr7TO0XULvSnAEyvOMiCJJq3H0yoTnoZri5RtZGMpRa17BL41uDA6JXu527lWSygdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262936; c=relaxed/simple; bh=0W5qozaNSgmHSLoawvjWMy8/uDST6NkV9LAZd90ADUg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RXTKzu1I4YXLMGm+PyFVDW0ajANildGhlIb7+axbZO2Ctqh2uNbe0ofMNQBsO8EuO3M0AcBrFh6ihH56Wi9c3VoIDThYONZ2VpKlQDHnsdb+bq3XqYJFHMUxjsWVN1E4V07x7VnB1ILHy0OidbOpD2iftzj+/wS8AKdhU1nndIQ= 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=nE14gN64; arc=none smtp.client-ip=192.198.163.16 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="nE14gN64" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733262935; x=1764798935; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0W5qozaNSgmHSLoawvjWMy8/uDST6NkV9LAZd90ADUg=; b=nE14gN644NpmbtLexcv0UaZJNxPQymzU5cyGpFkEgzrRaDPchJzWXVxa sUO5DMsQgArNjY0iQHSFRuIz+XQ9tDbOfKxpmk5JVv/uBo35NqzoayXmO 7CrBDO8AmF5Ccr6iMPlbJEmQhHvwiL/e28U6+6ulGD+qjvezMCkFDPpuN 2+wiszL9ls4rBh/0VQUxV9+F6sgeDDVx9DJ5+hD6fuim960d+NHh2oQNA XEBzC9vervcQBePdR3QTPQtEOV7yFDVL6kv1v0E3FC8/lv5A4Z7lUS0yK yJqlQ9iNY6b7Br3cMHkqzwq6hTLmu2X6TtPm4JEkBAyYbAmywz628I0qc w==; X-CSE-ConnectionGUID: BIcN0AIARMOTKbY3nVxYVA== X-CSE-MsgGUID: oyIDR7fnSmOlWRj2k2Wp8A== X-IronPort-AV: E=McAfee;i="6700,10204,11275"; a="21087151" X-IronPort-AV: E=Sophos;i="6.12,206,1728975600"; d="scan'208";a="21087151" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2024 13:55:30 -0800 X-CSE-ConnectionGUID: g4GhHTQWTmO2iaqqDVoTMw== X-CSE-MsgGUID: MFFFVKzyTGSQzztiEbI/8w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="98578888" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa003.jf.intel.com with ESMTP; 03 Dec 2024 13:55:30 -0800 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, andrew+netdev@lunn.ch, netdev@vger.kernel.org Cc: Jacob Keller , anthony.l.nguyen@intel.com, Yifei Liu , Przemek Kitszel , Rafal Romanowski Subject: [PATCH net 7/9] ixgbe: downgrade logging of unsupported VF API version to debug Date: Tue, 3 Dec 2024 13:55:16 -0800 Message-ID: <20241203215521.1646668-8-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.46.0.522.gc50d79eeffbf In-Reply-To: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> References: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jacob Keller The ixgbe PF driver logs an info message when a VF attempts to negotiate an API version which it does not support: VF 0 requested invalid api version 6 The ixgbevf driver attempts to load with mailbox API v1.5, which is required for best compatibility with other hosts such as the ESX VMWare PF. The Linux PF only supports API v1.4, and does not currently have support for the v1.5 API. The logged message can confuse users, as the v1.5 API is valid, but just happens to not currently be supported by the Linux PF. Downgrade the info message to a debug message, and fix the language to use 'unsupported' instead of 'invalid' to improve message clarity. Long term, we should investigate whether the improvements in the v1.5 API make sense for the Linux PF, and if so implement them properly. This may require yet another API version to resolve issues with negotiating IPSEC offload support. Fixes: 339f28964147 ("ixgbevf: Add support for new mailbox communication between PF and VF") Reported-by: Yifei Liu Link: https://lore.kernel.org/intel-wired-lan/20240301235837.3741422-1-yifei.l.liu@oracle.com/ Signed-off-by: Jacob Keller Reviewed-by: Przemek Kitszel Tested-by: Rafal Romanowski Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/ixgbe/ixgbe_common.h | 2 ++ drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h index 6493abf189de..6639069ad528 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h @@ -194,6 +194,8 @@ u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg); dev_err(&adapter->pdev->dev, format, ## arg) #define e_dev_notice(format, arg...) \ dev_notice(&adapter->pdev->dev, format, ## arg) +#define e_dbg(msglvl, format, arg...) \ + netif_dbg(adapter, msglvl, adapter->netdev, format, ## arg) #define e_info(msglvl, format, arg...) \ netif_info(adapter, msglvl, adapter->netdev, format, ## arg) #define e_err(msglvl, format, arg...) \ diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index 9631559a5aea..ccdce80edd14 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -1048,7 +1048,7 @@ static int ixgbe_negotiate_vf_api(struct ixgbe_adapter *adapter, break; } - e_info(drv, "VF %d requested invalid api version %u\n", vf, api); + e_dbg(drv, "VF %d requested unsupported api version %u\n", vf, api); return -1; } From patchwork Tue Dec 3 21:55:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13893016 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 796D420C46F for ; Tue, 3 Dec 2024 21:55:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262937; cv=none; b=R/2sPmzxuCrcEARCwA5SkAS2Uz4UHHzu11xYl6ikRmEuw5ikmkOrVwWUBZ3kguXc/lVMnpSnVCd95TWZevwQCbROp7duoiiennq9tB4GSKYFU9x3mhL22Nbfe6QYfHZXfupJnJvOmIKGce/OCJ6fvixBJ5EMWWvgzmEgBEKQfSs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262937; c=relaxed/simple; bh=36E1tF73fRhT1Qc4HMd0JfiPteVCDgEUZcMK1NA3kWE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Esu9dWGL3z6sJgH2fpUUrU/DnD/JjDHwLBmw5B3RT4GvDNDCeyo8UFPcQ6k5ESN5iwoisxFlDI8ohLgNFcxOzd0IUrklbJaHIApVDfOPr8jl/kja8Fw6GkhmsYu3AeXOFyYYBcyO6YHD8CgxjfgdP01tA2IJDkNPmZDWOzhFgSg= 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=GeYBUc5R; arc=none smtp.client-ip=192.198.163.16 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="GeYBUc5R" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733262935; x=1764798935; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=36E1tF73fRhT1Qc4HMd0JfiPteVCDgEUZcMK1NA3kWE=; b=GeYBUc5ReM/v/OxXjGXVii1w76LO+VtLBi3znAiRZW3vjITlfPXCNLLY emnZRMIqhDuNoeZ0OvCdAlwSNB4o2eJ/DyapvRtKtrv+u1Z19abO181BS NScjl5J+DdT2I3cWfcgmvKTKrS0cvKwoyG/gvvjAO6mMVlWt+5i4eopEJ BOnwAddQl4ySAH57hkyQxp0SJKRWI9ZNicT8qK44NNU8dIrlJJ6QzyiS9 DxoofD8Vy9NCO7t4aw9kqQFWimx38U+94Ko6V3DOu5HAfjQQF2qgn4Lb1 UasthXuikytnhcSo7aIcA01+11GQnAF4g8oKwQOWFDZGrR8TRH6tGO0j5 w==; X-CSE-ConnectionGUID: DWNz/bIRTWihSl4wEvJmtg== X-CSE-MsgGUID: KwflW6uZQri6Jt6bceojcQ== X-IronPort-AV: E=McAfee;i="6700,10204,11275"; a="21087157" X-IronPort-AV: E=Sophos;i="6.12,206,1728975600"; d="scan'208";a="21087157" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2024 13:55:30 -0800 X-CSE-ConnectionGUID: hEaB4he3T6mZ56bKYM+UTg== X-CSE-MsgGUID: Ce4RmBucTiifG7hde0kczg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="98578891" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa003.jf.intel.com with ESMTP; 03 Dec 2024 13:55:30 -0800 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, andrew+netdev@lunn.ch, netdev@vger.kernel.org Cc: Tore Amundsen , anthony.l.nguyen@intel.com, ernesto@castellotti.net, przemyslaw.kitszel@intel.com, Paul Menzel , Pucha Himasekhar Reddy Subject: [PATCH net 8/9] ixgbe: Correct BASE-BX10 compliance code Date: Tue, 3 Dec 2024 13:55:17 -0800 Message-ID: <20241203215521.1646668-9-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.46.0.522.gc50d79eeffbf In-Reply-To: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> References: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Tore Amundsen SFF-8472 (section 5.4 Transceiver Compliance Codes) defines bit 6 as BASE-BX10. Bit 6 means a value of 0x40 (decimal 64). The current value in the source code is 0x64, which appears to be a mix-up of hex and decimal values. A value of 0x64 (binary 01100100) incorrectly sets bit 2 (1000BASE-CX) and bit 5 (100BASE-FX) as well. Fixes: 1b43e0d20f2d ("ixgbe: Add 1000BASE-BX support") Signed-off-by: Tore Amundsen Reviewed-by: Paul Menzel Acked-by: Ernesto Castellotti Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h index 14aa2ca51f70..81179c60af4e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h @@ -40,7 +40,7 @@ #define IXGBE_SFF_1GBASESX_CAPABLE 0x1 #define IXGBE_SFF_1GBASELX_CAPABLE 0x2 #define IXGBE_SFF_1GBASET_CAPABLE 0x8 -#define IXGBE_SFF_BASEBX10_CAPABLE 0x64 +#define IXGBE_SFF_BASEBX10_CAPABLE 0x40 #define IXGBE_SFF_10GBASESR_CAPABLE 0x10 #define IXGBE_SFF_10GBASELR_CAPABLE 0x20 #define IXGBE_SFF_SOFT_RS_SELECT_MASK 0x8 From patchwork Tue Dec 3 21:55:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13893017 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 2B3EB20C497 for ; Tue, 3 Dec 2024 21:55:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262937; cv=none; b=C8akR/0Llc1XEArFasFjjlgUmzbAYrwHGdj5oHAVWTu/tRQ9xdl9r7fukXenfqwI+xkPf4Nw0OeTRQjKxz0FmcP2Ghz6BXSncelLFUKQqlweukOsnkbrHI4fYdRJplQKlwDhyTOxEzjvey2RNmXDeOszKtSlJXb55cXm3jqhNLQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733262937; c=relaxed/simple; bh=mfWak91xVrSV62CVvvx7Nmp4Ro6KIxjB0GgynmGCXHo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e4YP054DaQl69dlHjQeYqhYXoadLd2dtxA57/+imEUVtmeWAM51rrd8c93tKoyLw9M5H/hom9DfGJopFoLsuvR279Ok+OBqtB/Lf+7qyrTtZRRLgMHwpgkjWCW+6neryJHpsXcA5USih/ctT9dQWKbmLYT2CSNTsOlH9b92f5ec= 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=Y2s2YxKY; arc=none smtp.client-ip=192.198.163.16 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="Y2s2YxKY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733262936; x=1764798936; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mfWak91xVrSV62CVvvx7Nmp4Ro6KIxjB0GgynmGCXHo=; b=Y2s2YxKYs4RyFFnKXiEkrjfMzJ8bQIZHeUJ2ni0zIAgEblVgvBR6dAyY kv+ffseSgCO4KCUVbEtYyzqPgVMHxgHV65LdhVxOsPR+slypHstXZb3dy r5BR4CaqbaVSmU9+otH9MEaXIfBuaivDnNIpJV7XTce6YxZQ66TlXzrfO y0fy3xRNWQD0SEzxJ/gazUh9HBaIt+YXTqaLEvqiQsq99VG2u0VpsuJqw Fy5si0I6B3VZfJ6o5fMoHHZFIn2HTgq4cs9ai8KpUfoLvA3cpKRyYFm1n Z4KvEI+g47VYm1iLtGZpuSEyF3GWZvUHxTQ/yDGLJiGEVs9gD2DYnPygH w==; X-CSE-ConnectionGUID: C9bawt0rSuCODSaVSEKC3w== X-CSE-MsgGUID: dczZMUTSRZiPq4u3YmD80g== X-IronPort-AV: E=McAfee;i="6700,10204,11275"; a="21087167" X-IronPort-AV: E=Sophos;i="6.12,206,1728975600"; d="scan'208";a="21087167" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2024 13:55:30 -0800 X-CSE-ConnectionGUID: 8P9D0qBUTuKBrwCxu2jabw== X-CSE-MsgGUID: ymLP07nbRSq2QXnV/2VwXg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="98578894" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa003.jf.intel.com with ESMTP; 03 Dec 2024 13:55:30 -0800 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, andrew+netdev@lunn.ch, netdev@vger.kernel.org Cc: Yuan Can , anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, Pucha Himasekhar Reddy Subject: [PATCH net 9/9] igb: Fix potential invalid memory access in igb_init_module() Date: Tue, 3 Dec 2024 13:55:18 -0800 Message-ID: <20241203215521.1646668-10-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.46.0.522.gc50d79eeffbf In-Reply-To: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> References: <20241203215521.1646668-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Yuan Can The pci_register_driver() can fail and when this happened, the dca_notifier needs to be unregistered, otherwise the dca_notifier can be called when igb fails to install, resulting to invalid memory access. Fixes: bbd98fe48a43 ("igb: Fix DCA errors and do not use context index for 82576") Signed-off-by: Yuan Can Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/igb/igb_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 08578980b651..288a4bb2683a 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -637,6 +637,10 @@ static int __init igb_init_module(void) dca_register_notify(&dca_notifier); #endif ret = pci_register_driver(&igb_driver); +#ifdef CONFIG_IGB_DCA + if (ret) + dca_unregister_notify(&dca_notifier); +#endif return ret; }