Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>,
	<intel-wired-lan@osuosl.org>
Cc: tee.min.tan@linux.intel.com
Subject: Re: [Intel-wired-lan] [PATCH 2/5] igc: remove I226 Qbv BaseTime restriction
Date: Thu, 3 Nov 2022 11:26:08 -0700	[thread overview]
Message-ID: <f4ab8643-483b-665c-3ae0-62ed3ff97497@intel.com> (raw)
In-Reply-To: <20221030045324.25207-3-muhammad.husaini.zulkifli@intel.com>

On 10/29/2022 9:53 PM, Muhammad Husaini Zulkifli wrote:
> Remove the Qbv BaseTime restriction for I226 so that the BaseTime can be
> scheduled to the future time. A new register bit of Tx Qav Control
> (Bit-7: FutScdDis) was introduced to allow I226 scheduling future time as
> Qbv BaseTime and not having the Tx hang timeout issue.
> 
> Besides, according to datasheet section 7.5.2.9.3.3, FutScdDis bit has to
> be configured first before the cycle time and base time.
> 
> Indeed the FutScdDis bit is only active on re-configuration, thus we have
> to set the BASET_L to zero and then only set it to the desired value.
> 
> Please also note that the Qbv configuration flow is moved around based on
> the Qbv programming guideline that is documented in the latest datasheet.
> 
> Co-Developed-by : Tan Tee Min <tee.min.tan@linux.intel.com>

Nit: no space after the -by i.e. 'Co-Developed-by:'
However, if this doesn't need a revision outside of this, I'll fix it up 
myself.

> Signed-off-by: Tan Tee Min <tee.min.tan@linux.intel.com>
> Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
> ---

<snip>

> @@ -240,21 +232,43 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)
>   		wr32(IGC_TXQCTL(i), txqctl);
>   	}
>   
> +	tqavctrl = rd32(IGC_TQAVCTRL);
> +	tqavctrl |= IGC_TQAVCTRL_TRANSMIT_MODE_TSN | IGC_TQAVCTRL_ENHANCED_QAV;
> +
> +	cycle = adapter->cycle_time;
> +	base_time = adapter->base_time;
> +
>   	nsec = rd32(IGC_SYSTIML);
>   	sec = rd32(IGC_SYSTIMH);
>   
>   	systim = ktime_set(sec, nsec);
> -
>   	if (ktime_compare(systim, base_time) > 0) {
> -		s64 n;
> +		s64 n = div64_s64(ktime_sub_ns(systim, base_time), cycle);
>   
> -		n = div64_s64(ktime_sub_ns(systim, base_time), cycle);
>   		base_time = ktime_add_ns(base_time, (n + 1) * cycle);
> +	} else {
> +		/* According to datasheet section 7.5.2.9.3.3, FutScdDis bit
> +		 * has to be configured before the cycle time and base time.
> +		 */
> +		if (igc_is_device_id_i226(hw))
> +			tqavctrl |= IGC_TQAVCTRL_FUTSCDDIS;
>   	}
>   
> -	baset_h = div_s64_rem(base_time, NSEC_PER_SEC, &baset_l);
> +	wr32(IGC_TQAVCTRL, tqavctrl);
> +
> +	wr32(IGC_QBVCYCLET_S, cycle);
> +	wr32(IGC_QBVCYCLET, cycle);
>   
> +	baset_h = div_s64_rem(base_time, NSEC_PER_SEC, &baset_l);
>   	wr32(IGC_BASET_H, baset_h);
> +
> +	/* In i226, Future base time is only supported when FutScdDis bit
> +	 * is enabled and only active for re-configuration.
> +	 * In this case, initialize the base time with zero to create
> +	 * "re-configuration" scenario then only set the desired base time.
> +	 */
> +	if (tqavctrl & IGC_TQAVCTRL_FUTSCDDIS)
> +		wr32(IGC_BASET_L, 0);
>   	wr32(IGC_BASET_L, baset_l);

Do you need to flush the registers?

>   	return 0;
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

  reply	other threads:[~2022-11-03 18:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-30  4:53 [Intel-wired-lan] [PATCH 0/5] igc: TSN Qbv Improvement for I226 Stepping Muhammad Husaini Zulkifli
2022-10-30  4:53 ` [Intel-wired-lan] [PATCH 1/5] igc: allow BaseTime 0 enrollment for Qbv Muhammad Husaini Zulkifli
2022-11-13  7:28   ` naamax.meir
2022-10-30  4:53 ` [Intel-wired-lan] [PATCH 2/5] igc: remove I226 Qbv BaseTime restriction Muhammad Husaini Zulkifli
2022-11-03 18:26   ` Tony Nguyen [this message]
2022-11-04  8:28     ` Zulkifli, Muhammad Husaini
2022-11-13  7:29   ` naamax.meir
2022-10-30  4:53 ` [Intel-wired-lan] [PATCH 3/5] igc: recalculate Qbv end_time by considering cycle time Muhammad Husaini Zulkifli
2022-11-13  7:31   ` naamax.meir
2022-10-30  4:53 ` [Intel-wired-lan] [PATCH 4/5] igc: enable Qbv configuration for 2nd GCL Muhammad Husaini Zulkifli
2022-11-13  7:32   ` naamax.meir
2022-10-30  4:53 ` [Intel-wired-lan] [PATCH 5/5] igc: Set Qbv start_time and end_time to end_time if not being configured in GCL Muhammad Husaini Zulkifli
2022-11-13  7:33   ` naamax.meir

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f4ab8643-483b-665c-3ae0-62ed3ff97497@intel.com \
    --to=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    --cc=muhammad.husaini.zulkifli@intel.com \
    --cc=tee.min.tan@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox