Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: Anthony Nguyen <anthony.l.nguyen@intel.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next 12/13] ice: move prefetch enable to ice_setup_rx_ctx
Date: Wed, 28 Aug 2024 08:39:07 +0200	[thread overview]
Message-ID: <22ce29a2-a483-464c-8eea-edf7052534f5@intel.com> (raw)
In-Reply-To: <20240827-e810-live-migration-jk-prep-ctx-functions-v1-12-0442e2e42d32@intel.com>

On 8/27/24 23:52, Jacob Keller wrote:
> The ice_write_rxq_ctx() function is responsible for programming the Rx
> Queue context into hardware. It receives the configuration in unpacked form
> via the ice_rlan_ctx structure.
> 
> This function unconditionally modifies the context to set the prefetch
> enable bit. This was done by commit c31a5c25bb19 ("ice: Always set prefena
> when configuring an Rx queue"). Setting this bit makes sense, since
> prefetching descriptors is almost always the preferred behavior.
> 
> However, the ice_write_rxq_ctx() function is not the place that actually
> defines the queue context. We initialize the Rx Queue context in
> ice_setup_rx_ctx(). It is surprising to have the Rx queue context changed
> by a function who's responsibility is to program the given context to
> hardware.
> 
> Following the principle of least surprise, move the setting of the prefetch
> enable bit out of ice_write_rxq_ctx() and into the ice_setup_rx_ctx().
> 
> Fixes: c31a5c25bb19 ("ice: Always set prefena when configuring an Rx queue")

The code is fine, but I would drop fixes tag.
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>   drivers/net/ethernet/intel/ice/ice_base.c   | 3 +++
>   drivers/net/ethernet/intel/ice/ice_common.c | 9 +++------
>   2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c
> index 1881ce8105ca..3fe87a30c29e 100644
> --- a/drivers/net/ethernet/intel/ice/ice_base.c
> +++ b/drivers/net/ethernet/intel/ice/ice_base.c
> @@ -453,6 +453,9 @@ static int ice_setup_rx_ctx(struct ice_rx_ring *ring)
>   	/* Rx queue threshold in units of 64 */
>   	rlan_ctx.lrxqthresh = 1;
>   
> +	/* Enable descriptor prefetch */
> +	rlan_ctx.prefena = 1;
> +
>   	/* PF acts as uplink for switchdev; set flex descriptor with src_vsi
>   	 * metadata and flags to allow redirecting to PR netdev
>   	 */
> diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
> index 09a94c20e16d..67273e4af7ff 100644
> --- a/drivers/net/ethernet/intel/ice/ice_common.c
> +++ b/drivers/net/ethernet/intel/ice/ice_common.c
> @@ -1495,14 +1495,13 @@ const struct ice_ctx_ele ice_rlan_ctx_info[] = {
>   };
>   
>   /**
> - * ice_write_rxq_ctx
> + * ice_write_rxq_ctx - Write Rx Queue context to hardware
>    * @hw: pointer to the hardware structure
>    * @rlan_ctx: pointer to the rxq context
>    * @rxq_index: the index of the Rx queue
>    *
> - * Converts rxq context from sparse to dense structure and then writes
> - * it to HW register space and enables the hardware to prefetch descriptors
> - * instead of only fetching them on demand
> + * Pack the sparse Rx Queue context into dense hardware format and write it
> + * into the HW register space.
>    */
>   int ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
>   		      u32 rxq_index)
> @@ -1512,8 +1511,6 @@ int ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
>   	if (!rlan_ctx)
>   		return -EINVAL;
>   
> -	rlan_ctx->prefena = 1;
> -
>   	ice_pack_rxq_ctx(rlan_ctx, ctx_buf);
>   
>   	return ice_copy_rxq_ctx_to_hw(hw, ctx_buf, rxq_index);
> 


  reply	other threads:[~2024-08-28  6:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27 21:52 [Intel-wired-lan] [PATCH iwl-next 00/13] ice: use <linux/packing.h> for Tx and Rx queue context data Jacob Keller
2024-08-27 21:52 ` [Intel-wired-lan] [PATCH iwl-next 01/13] lib: packing: refuse operating on bit indices which exceed size of buffer Jacob Keller
2024-08-27 21:52 ` [Intel-wired-lan] [PATCH iwl-next 02/13] lib: packing: adjust definitions and implementation for arbitrary buffer lengths Jacob Keller
2024-08-27 21:52 ` [Intel-wired-lan] [PATCH iwl-next 03/13] lib: packing: remove kernel-doc from header file Jacob Keller
2024-08-27 21:52 ` [Intel-wired-lan] [PATCH iwl-next 04/13] lib: packing: add pack() and unpack() wrappers over packing() Jacob Keller
2024-08-27 21:52 ` [Intel-wired-lan] [PATCH iwl-next 05/13] lib: packing: duplicate pack() and unpack() implementations Jacob Keller
2024-08-27 21:52 ` [Intel-wired-lan] [PATCH iwl-next 06/13] lib: packing: add KUnit tests adapted from selftests Jacob Keller
2024-08-28 18:47   ` Jeff Johnson
2024-08-28 20:39     ` Jacob Keller
2024-08-27 21:52 ` [Intel-wired-lan] [PATCH iwl-next 07/13] lib: packing: add additional KUnit tests Jacob Keller
2024-08-27 21:52 ` [Intel-wired-lan] [PATCH iwl-next 08/13] lib: packing: fix QUIRK_MSB_ON_THE_RIGHT behavior Jacob Keller
2024-08-27 21:52 ` [Intel-wired-lan] [PATCH iwl-next 09/13] ice: remove int_q_state from ice_tlan_ctx Jacob Keller
2024-08-27 21:52 ` [Intel-wired-lan] [PATCH iwl-next 10/13] ice: use <linux/packing.h> for Tx and Rx queue context data Jacob Keller
2024-08-27 21:52 ` [Intel-wired-lan] [PATCH iwl-next 11/13] ice: reduce size of queue context fields Jacob Keller
2024-08-27 21:52 ` [Intel-wired-lan] [PATCH iwl-next 12/13] ice: move prefetch enable to ice_setup_rx_ctx Jacob Keller
2024-08-28  6:39   ` Przemek Kitszel [this message]
2024-08-28 18:17     ` Keller, Jacob E
2024-08-27 21:52 ` [Intel-wired-lan] [PATCH iwl-next 13/13] ice: cleanup Rx queue context programming functions Jacob Keller
2024-08-28  7:35   ` Przemek Kitszel
2024-08-28 18:16     ` Keller, Jacob E
2024-08-27 22:23 ` [Intel-wired-lan] [PATCH iwl-next 00/13] ice: use <linux/packing.h> for Tx and Rx queue context data Jacob Keller

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=22ce29a2-a483-464c-8eea-edf7052534f5@intel.com \
    --to=przemyslaw.kitszel@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jacob.e.keller@intel.com \
    --cc=olteanv@gmail.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