From patchwork Wed Aug 14 13:05:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karol Kolacinski X-Patchwork-Id: 13763482 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 0EF731B151C for ; Wed, 14 Aug 2024 13:09:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723640975; cv=none; b=SFjuiQGb8C5pn9flNWWGgceXyGbKimPcsr7GKW7UwEiDO2cMrj4ktTPUoWuPKVT9hID17Xp1j+vqQ+LyzuHurhxs4mjW5qNA1vZYWVDmXTcxdF32ykqTA49E4Oa0B5ipiC3V+KqYHlHIpk7eNQ7t/XEygtDNFRA0+jbvRwdY4Sk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723640975; c=relaxed/simple; bh=7N5eGTkDiG8Qvv/AIj8ZvUfBEc+qQ7WfM1ZJ92TKzX0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GVarupTObbjXVfViIKKqFQimYcaJbIBTJInCFCrGb6ldqKpfzIWby3ulGJcgNn673mx+l0Obcfq9OurKZcj9epcnqgvc3dEdeALeSo/o4rlBUChwnTcg+//d0OoNjWpTsEKO47weDgVBj9a0+diiaSyv7kHybIL6xUg0ZQAHXCc= 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=RUYZdJ6l; arc=none smtp.client-ip=198.175.65.14 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="RUYZdJ6l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723640974; x=1755176974; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7N5eGTkDiG8Qvv/AIj8ZvUfBEc+qQ7WfM1ZJ92TKzX0=; b=RUYZdJ6lm5B0LomiQTY2T7No++VPaFfEzJ4Lt8IhyfHKBxLTX2WfWEH/ i1Yg8ya88v3KvB42mpp/MFmc12gRS/FTBE7w5uPX/69pIL2swYYgbM0Uh Ebs6Pmx+eslfwoofWmhBldfi27HmXreZ1XV+Wm0xjaVAAVyDmsNDyOfoo ACJOzO3bcu61CE9+0YLY1Ztnijk0Hjbf9kL0CnQ1KJBqGP3KH+YXPtSVk ByfYYxoIAXENN47RNTshsPv+ZFjWYAsCSUMWp/ZSzpw8nmwzzKxRZRmQV Xjbi8tb4d6uMNunEHkUHu5c2rSGPzNJen+a9duXfdVfS9QrNRb0LgkEgp A==; X-CSE-ConnectionGUID: JoU7KjcKSv29sUKxP5eiOA== X-CSE-MsgGUID: bHE9WcC+TlytNTfTzgunyQ== X-IronPort-AV: E=McAfee;i="6700,10204,11164"; a="25658813" X-IronPort-AV: E=Sophos;i="6.10,145,1719903600"; d="scan'208";a="25658813" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2024 06:09:33 -0700 X-CSE-ConnectionGUID: gq7NS4JtThCL9s3fr/Dirg== X-CSE-MsgGUID: 0W/NlcGhSVCvMzMtHns3fw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,145,1719903600"; d="scan'208";a="59009710" Received: from unknown (HELO kkolacin-desk1.igk.intel.com) ([10.217.160.108]) by fmviesa009.fm.intel.com with ESMTP; 14 Aug 2024 06:09:31 -0700 From: Karol Kolacinski To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, Karol Kolacinski Subject: [PATCH v6 iwl-next 5/6] ice: Add timestamp ready bitmap for E830 products Date: Wed, 14 Aug 2024 15:05:43 +0200 Message-ID: <20240814130918.58444-13-karol.kolacinski@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240814130918.58444-8-karol.kolacinski@intel.com> References: <20240814130918.58444-8-karol.kolacinski@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 E830 PHY supports timestamp ready bitmap. Enable the bitmap by refactoring tx init function. Reviewed-by: Przemek Kitszel Signed-off-by: Karol Kolacinski --- drivers/net/ethernet/intel/ice/ice_ptp.c | 56 +++++++----------------- drivers/net/ethernet/intel/ice/ice_ptp.h | 3 +- 2 files changed, 17 insertions(+), 42 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index 861f6224540a..b438647717cc 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -942,28 +942,6 @@ ice_ptp_release_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx) tx->len = 0; } -/** - * ice_ptp_init_tx_eth56g - Initialize tracking for Tx timestamps - * @pf: Board private structure - * @tx: the Tx tracking structure to initialize - * @port: the port this structure tracks - * - * Initialize the Tx timestamp tracker for this port. ETH56G PHYs - * have independent memory blocks for all ports. - * - * Return: 0 for success, -ENOMEM when failed to allocate Tx tracker - */ -static int ice_ptp_init_tx_eth56g(struct ice_pf *pf, struct ice_ptp_tx *tx, - u8 port) -{ - tx->block = port; - tx->offset = 0; - tx->len = INDEX_PER_PORT_ETH56G; - tx->has_ready_bitmap = 1; - - return ice_ptp_alloc_tx_tracker(tx); -} - /** * ice_ptp_init_tx_e82x - Initialize tracking for Tx timestamps * @pf: Board private structure @@ -974,9 +952,11 @@ static int ice_ptp_init_tx_eth56g(struct ice_pf *pf, struct ice_ptp_tx *tx, * the timestamp block is shared for all ports in the same quad. To avoid * ports using the same timestamp index, logically break the block of * registers into chunks based on the port number. + * + * Return: 0 on success, -ENOMEM when out of memory */ -static int -ice_ptp_init_tx_e82x(struct ice_pf *pf, struct ice_ptp_tx *tx, u8 port) +static int ice_ptp_init_tx_e82x(struct ice_pf *pf, struct ice_ptp_tx *tx, + u8 port) { tx->block = ICE_GET_QUAD_NUM(port); tx->offset = (port % ICE_PORTS_PER_QUAD) * INDEX_PER_PORT_E82X; @@ -987,24 +967,27 @@ ice_ptp_init_tx_e82x(struct ice_pf *pf, struct ice_ptp_tx *tx, u8 port) } /** - * ice_ptp_init_tx_e810 - Initialize tracking for Tx timestamps + * ice_ptp_init_tx - Initialize tracking for Tx timestamps * @pf: Board private structure * @tx: the Tx tracking structure to initialize + * @port: the port this structure tracks * - * Initialize the Tx timestamp tracker for this PF. For E810 devices, each - * port has its own block of timestamps, independent of the other ports. + * Initialize the Tx timestamp tracker for this PF. For all PHYs except E82X, + * each port has its own block of timestamps, independent of the other ports. + * + * Return: 0 on success, -ENOMEM when out of memory */ -static int -ice_ptp_init_tx_e810(struct ice_pf *pf, struct ice_ptp_tx *tx) +static int ice_ptp_init_tx(struct ice_pf *pf, struct ice_ptp_tx *tx, u8 port) { - tx->block = pf->hw.port_info->lport; + tx->block = port; tx->offset = 0; - tx->len = INDEX_PER_PORT_E810; + tx->len = INDEX_PER_PORT; + /* The E810 PHY does not provide a timestamp ready bitmap. Instead, * verify new timestamps against cached copy of the last read * timestamp. */ - tx->has_ready_bitmap = 0; + tx->has_ready_bitmap = pf->hw.mac_type != ICE_MAC_E810; return ice_ptp_alloc_tx_tracker(tx); } @@ -3344,20 +3327,13 @@ static int ice_ptp_init_port(struct ice_pf *pf, struct ice_ptp_port *ptp_port) mutex_init(&ptp_port->ps_lock); switch (hw->mac_type) { - case ICE_MAC_E810: - case ICE_MAC_E830: - return ice_ptp_init_tx_e810(pf, &ptp_port->tx); case ICE_MAC_GENERIC: kthread_init_delayed_work(&ptp_port->ov_work, ice_ptp_wait_for_offsets); - return ice_ptp_init_tx_e82x(pf, &ptp_port->tx, ptp_port->port_num); - case ICE_MAC_GENERIC_3K_E825: - return ice_ptp_init_tx_eth56g(pf, &ptp_port->tx, - ptp_port->port_num); default: - return -ENODEV; + return ice_ptp_init_tx(pf, &ptp_port->tx, ptp_port->port_num); } } diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.h b/drivers/net/ethernet/intel/ice/ice_ptp.h index 5122b3a862fb..eae15b3b0286 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.h +++ b/drivers/net/ethernet/intel/ice/ice_ptp.h @@ -128,8 +128,7 @@ struct ice_ptp_tx { /* Quad and port information for initializing timestamp blocks */ #define INDEX_PER_QUAD 64 #define INDEX_PER_PORT_E82X 16 -#define INDEX_PER_PORT_E810 64 -#define INDEX_PER_PORT_ETH56G 64 +#define INDEX_PER_PORT 64 /** * struct ice_ptp_port - data used to initialize an external port for PTP