From patchwork Wed Aug 7 23:13:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13756841 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 3731D155A4E for ; Wed, 7 Aug 2024 23:13:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723072419; cv=none; b=HOUemdU/doYYALOQfenervNMmw2LO7BQmQjxMkorQUon4g7rT6EnzItvXeXeKhgZ00E6Mk2mG9ehQSpOTyCsZ4zhc8dNnTkupy2C5DZFP4FAVprw6XpDdKiT77xN7wAo9D0NKriX4lsxJbHRj7q2d3M92FVZt6cPn3cLuT+G3Jc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723072419; c=relaxed/simple; bh=s8Gpoq+a1FXQpGV0dffXHi9wn93/tOl3XrZZ5RFQ9xo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B8pp4JZkTwjB2j5Ko3NLvLjH4A4py5uEfXp0HLx2obohwvan5NXtzrIRjyzVcg5PTQ4HZi2lJQVwU3nTzklkVAQf+wAElwMZe/0J7GQcViTtneOETDA7JAh/OfsRlRFS6MNTF3y+Xpl4uk9uE9ye8NATvA7seEbxmFVVnktu1c4= 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=OzsX+1dW; arc=none smtp.client-ip=192.198.163.10 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="OzsX+1dW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723072418; x=1754608418; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=s8Gpoq+a1FXQpGV0dffXHi9wn93/tOl3XrZZ5RFQ9xo=; b=OzsX+1dWTSu5INFdoK7PtXAeFyPZFCOMDpcXPXuwLXwtwxFcmSTbRqPU WlkDmA+vT8Sxf8GAuLb1hp7yCNyxfLjvRJrxhvEu8sVd3RaibtB28hgne C9Lhy1Ahixg9NoZPYpy6W+zwhxhp5eQXpF53k7CuA7ZvLSE59cVbuhfW9 8NHgwAhM/8YZL0TDCXgzsyLuUftweDkHI2Y5Y+SiaCZMmJIeYDk1nDRJ+ nFOKu2ELTZ/E1Y3QxP/kUAttciKBR367rO/eToPEMoTe9xjCPaqJf5t0n FjYl4HI2vRgRzmdiIoU+MNiK7efoFHfP3AJh7Qh4VJCvsI9ZO1zM0kDQc Q==; X-CSE-ConnectionGUID: eAtLRVhwR06/Bpr0628pgg== X-CSE-MsgGUID: z2tACQQdRYmJJxqwlNLHxA== X-IronPort-AV: E=McAfee;i="6700,10204,11157"; a="32577320" X-IronPort-AV: E=Sophos;i="6.09,271,1716274800"; d="scan'208";a="32577320" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2024 16:13:34 -0700 X-CSE-ConnectionGUID: NufDwa/1TQauKYTm/Slu0A== X-CSE-MsgGUID: wEfcjE98QH6ue/Jzv2jOTQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,271,1716274800"; d="scan'208";a="61956629" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa004.jf.intel.com with ESMTP; 07 Aug 2024 16:13:34 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Faizal Rahim , anthony.l.nguyen@intel.com, vinicius.gomes@intel.com, sasha.neftin@intel.com, richardcochran@gmail.com, horms@kernel.org, rodrigo.cadore@l-acoustics.com, Mor Bar-Gabay Subject: [PATCH net 4/4] igc: Fix qbv tx latency by setting gtxoffset Date: Wed, 7 Aug 2024 16:13:28 -0700 Message-ID: <20240807231329.3827092-5-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240807231329.3827092-1-anthony.l.nguyen@intel.com> References: <20240807231329.3827092-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: Faizal Rahim A large tx latency issue was discovered during testing when only QBV was enabled. The issue occurs because gtxoffset was not set when QBV is active, it was only set when launch time is active. The patch "igc: Correct the launchtime offset" only sets gtxoffset when the launchtime_enable field is set by the user. Enabling launchtime_enable ultimately sets the register IGC_TXQCTL_QUEUE_MODE_LAUNCHT (referred to as LaunchT in the SW user manual). Section 7.5.2.6 of the IGC i225/6 SW User Manual Rev 1.2.4 states: "The latency between transmission scheduling (launch time) and the time the packet is transmitted to the network is listed in Table 7-61." However, the patch misinterprets the phrase "launch time" in that section by assuming it specifically refers to the LaunchT register, whereas it actually denotes the generic term for when a packet is released from the internal buffer to the MAC transmit logic. This launch time, as per that section, also implicitly refers to the QBV gate open time, where a packet waits in the buffer for the QBV gate to open. Therefore, latency applies whenever QBV is in use. TSN features such as QBU and QAV reuse QBV, making the latency universal to TSN features. Discussed with i226 HW owner (Shalev, Avi) and we were in agreement that the term "launch time" used in Section 7.5.2.6 is not clear and can be easily misinterpreted. Avi will update this section to: "When TQAVCTRL.TRANSMIT_MODE = TSN, the latency between transmission scheduling and the time the packet is transmitted to the network is listed in Table 7-61." Fix this issue by using igc_tsn_is_tx_mode_in_tsn() as a condition to write to gtxoffset, aligning with the newly updated SW User Manual. Tested: 1. Enrol taprio on talker board base-time 0 cycle-time 1000000 flags 0x2 index 0 cmd S gatemask 0x1 interval1 index 0 cmd S gatemask 0x1 interval2 Note: interval1 = interval for a 64 bytes packet to go through interval2 = cycle-time - interval1 2. Take tcpdump on listener board 3. Use udp tai app on talker to send packets to listener 4. Check the timestamp on listener via wireshark Test Result: 100 Mbps: 113 ~193 ns 1000 Mbps: 52 ~ 84 ns 2500 Mbps: 95 ~ 223 ns Note that the test result is similar to the patch "igc: Correct the launchtime offset". Fixes: 790835fcc0cb ("igc: Correct the launchtime offset") Signed-off-by: Faizal Rahim Reviewed-by: Simon Horman Acked-by: Vinicius Costa Gomes Tested-by: Mor Bar-Gabay Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c index ada751430517..d68fa7f3d5f0 100644 --- a/drivers/net/ethernet/intel/igc/igc_tsn.c +++ b/drivers/net/ethernet/intel/igc/igc_tsn.c @@ -61,7 +61,7 @@ void igc_tsn_adjust_txtime_offset(struct igc_adapter *adapter) struct igc_hw *hw = &adapter->hw; u16 txoffset; - if (!is_any_launchtime(adapter)) + if (!igc_tsn_is_tx_mode_in_tsn(adapter)) return; switch (adapter->link_speed) {