From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5B6684404F; Wed, 12 Jun 2024 17:21:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0021042FE1; Wed, 12 Jun 2024 17:06:26 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id A0B7042F81 for ; Wed, 12 Jun 2024 17:06:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718204784; x=1749740784; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=i36Q1cktxI0OFWh8qQULNn4kHL3WZMkJ39QBxIsd9dE=; b=YZdTap5iE+PrX7nJBvxPrcgXlk66QfI0qJucrkjIdL5D2nEDPPYRUdRr uRawW/zHsu2Kn+snjQtrKAOk061Na3Dur3bG3zO0zmHP3Yd5aV2xj4Tnm Ht5oI88hqaJYkhnPeB/9bhQBF2SdgAyRa/bXO5A798rsyInegsgkxAnZv Y8EE3RzwoMDpq1vZQTCpKd3hpuTrL70Kyr6MQMKuBNpZB9QKPsQe4TmP5 dqpCL8rM+VGeYsbhd5wD592hXfTBcqjOFZ85anJL7QNDQO70oI7hY5C57 bwVaW748GjFbMctdOGamEWQciQSMUJ/VmVpqaMC7kmv8s0KJfLduqKwmT A==; X-CSE-ConnectionGUID: T8JnrW8HTV6iUUa0sLBFiw== X-CSE-MsgGUID: 37C7Q3/uQeWwoBbPR0H/tQ== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="32459953" X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="32459953" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 08:06:23 -0700 X-CSE-ConnectionGUID: 0RC8uGUYTeSKXx6nDhmxhg== X-CSE-MsgGUID: K3hP9r9XQx+2cK/vRN8xgQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="39925878" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 12 Jun 2024 08:06:22 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: ian.stokes@intel.com, bruce.richardson@intel.com, Paul Greenwalt Subject: [PATCH v2 113/148] net/ice/base: add Get Link Status Data version 2 Date: Wed, 12 Jun 2024 16:01:47 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20240430154014.1026-1-ian.stokes@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org E830 introduces a new version of Get Link Status Data which increases the size of struct ice_aqc_get_link_status_data from 32 bytes to 51 bytes. Add new link partner fields to ice_aqc_get_link_status_data; PHY type, FEC, and flow control. Add new ICE_GET_LINK_STATUS_DATA_V2 and ICE_GET_LINK_STATUS_DATALEN_V2 to support the new version and data length. Also, moving ice_get_link_status_datalen and ice_get_link_status_datalen to ice_common.c Signed-off-by: Paul Greenwalt Signed-off-by: Anatoly Burakov --- drivers/net/ice/base/ice_adminq_cmd.h | 35 ++++++++++++++++++++++++++- drivers/net/ice/base/ice_common.c | 20 +++++++++++++-- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/base/ice_adminq_cmd.h b/drivers/net/ice/base/ice_adminq_cmd.h index a14f5f6140..6632465cb7 100644 --- a/drivers/net/ice/base/ice_adminq_cmd.h +++ b/drivers/net/ice/base/ice_adminq_cmd.h @@ -1539,7 +1539,16 @@ struct ice_aqc_get_link_status { __le32 addr_low; }; +enum ice_get_link_status_data_version { + ICE_GET_LINK_STATUS_DATA_V1 = 1, + ICE_GET_LINK_STATUS_DATA_V2 = 2, +}; + +#define ICE_GET_LINK_STATUS_DATALEN_V1 32 +#define ICE_GET_LINK_STATUS_DATALEN_V2 56 + /* Get link status response data structure, also used for Link Status Event */ +#pragma pack(1) struct ice_aqc_get_link_status_data { u8 topo_media_conflict; #define ICE_AQ_LINK_TOPO_CONFLICT BIT(0) @@ -1626,11 +1635,35 @@ struct ice_aqc_get_link_status_data { #define ICE_AQ_LINK_SPEED_100GB BIT(10) #define ICE_AQ_LINK_SPEED_200GB BIT(11) #define ICE_AQ_LINK_SPEED_UNKNOWN BIT(15) - __le32 reserved3; /* Aligns next field to 8-byte boundary */ + __le16 reserved3; /* Aligns next field to 8-byte boundary */ + u8 ext_fec_status; +#define ICE_AQ_LINK_RS_272_FEC_EN BIT(0) /* RS 272 FEC enabled */ + u8 reserved4; __le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */ __le64 phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */ + /* Get link status version 2 link partner data */ + __le64 lp_phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */ + __le64 lp_phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */ + u8 lp_fec_adv; +#define ICE_AQ_LINK_LP_10G_KR_FEC_CAP BIT(0) +#define ICE_AQ_LINK_LP_25G_KR_FEC_CAP BIT(1) +#define ICE_AQ_LINK_LP_RS_528_FEC_CAP BIT(2) +#define ICE_AQ_LINK_LP_50G_KR_272_FEC_CAP BIT(3) +#define ICE_AQ_LINK_LP_100G_KR_272_FEC_CAP BIT(4) +#define ICE_AQ_LINK_LP_200G_KR_272_FEC_CAP BIT(5) + u8 lp_fec_req; +#define ICE_AQ_LINK_LP_10G_KR_FEC_REQ BIT(0) +#define ICE_AQ_LINK_LP_25G_KR_FEC_REQ BIT(1) +#define ICE_AQ_LINK_LP_RS_528_FEC_REQ BIT(2) +#define ICE_AQ_LINK_LP_KR_272_FEC_REQ BIT(3) + u8 lp_flowcontrol; +#define ICE_AQ_LINK_LP_PAUSE_ADV BIT(0) +#define ICE_AQ_LINK_LP_ASM_DIR_ADV BIT(1) + u8 reserved[5]; }; +#pragma pack() + /* Set event mask command (direct 0x0613) */ struct ice_aqc_set_event_mask { u8 lport_num; diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c index cb468a2252..c0a92bc29b 100644 --- a/drivers/net/ice/base/ice_common.c +++ b/drivers/net/ice/base/ice_common.c @@ -566,6 +566,22 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode, return status; } +#define ice_get_link_status_data_ver(hw) ((hw)->mac_type == ICE_MAC_E830 ? \ + ICE_GET_LINK_STATUS_DATA_V2 : ICE_GET_LINK_STATUS_DATA_V1) + +/** + * ice_get_link_status_datalen + * @hw: pointer to the HW struct + * + * return Get Link Status datalen + */ +static u16 ice_get_link_status_datalen(struct ice_hw *hw) +{ + return (ice_get_link_status_data_ver(hw) == + ICE_GET_LINK_STATUS_DATA_V1) ? ICE_GET_LINK_STATUS_DATALEN_V1 : + ICE_GET_LINK_STATUS_DATALEN_V2; +} + /** * ice_aq_get_link_info * @pi: port information structure @@ -602,8 +618,8 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse, resp->cmd_flags = CPU_TO_LE16(cmd_flags); resp->lport_num = pi->lport; - status = ice_aq_send_cmd(hw, &desc, &link_data, sizeof(link_data), cd); - + status = ice_aq_send_cmd(hw, &desc, &link_data, + ice_get_link_status_datalen(hw), cd); if (status) return status; -- 2.43.0