netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Shinas Rasheed <srasheed@marvell.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	hgani@marvell.com, vimleshk@marvell.com, sedara@marvell.com,
	egallen@redhat.com, mschmidt@redhat.com, pabeni@redhat.com,
	kuba@kernel.org, wizhao@redhat.com, kheib@redhat.com,
	konguyen@redhat.com, Veerasenareddy Burru <vburru@marvell.com>,
	Satananda Burla <sburla@marvell.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH net-next v2 2/8] octeon_ep_vf: add hardware configuration APIs
Date: Fri, 5 Jan 2024 10:22:09 +0000	[thread overview]
Message-ID: <20240105102209.GR31813@kernel.org> (raw)
In-Reply-To: <20231223134000.2906144-3-srasheed@marvell.com>

On Sat, Dec 23, 2023 at 05:39:54AM -0800, Shinas Rasheed wrote:
> Implement hardware resource init and shutdown helper APIs, like
> hardware Tx/Rx queue init/enable/disable/reset.
> 
> Signed-off-by: Shinas Rasheed <srasheed@marvell.com>

Hi Shinas,

some minor feedback from my side.

...

> diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c

...

> +/* Reset Hardware Tx queue */
> +static int cn93_vf_reset_iq(struct octep_vf_device *oct, int q_no)
> +{
> +	u64 val = 0ULL;
> +
> +	dev_dbg(&oct->pdev->dev, "Reset VF IQ-%d\n", q_no);
> +
> +	/* Disable the Tx/Instruction Ring */
> +	octep_vf_write_csr64(oct, CN93_VF_SDP_R_IN_ENABLE(q_no), val);
> +
> +	/* clear the Instruction Ring packet/byte counts and doorbell CSRs */
> +	octep_vf_write_csr64(oct, CN93_VF_SDP_R_IN_INT_LEVELS(q_no), val);
> +	octep_vf_write_csr64(oct, CN93_VF_SDP_R_IN_PKT_CNT(q_no), val);
> +	octep_vf_write_csr64(oct, CN93_VF_SDP_R_IN_BYTE_CNT(q_no), val);
> +	octep_vf_write_csr64(oct, CN93_VF_SDP_R_IN_INSTR_BADDR(q_no), val);
> +	octep_vf_write_csr64(oct, CN93_VF_SDP_R_IN_INSTR_RSIZE(q_no), val);
> +
> +	val = 0xFFFFFFFF;
> +	octep_vf_write_csr64(oct, CN93_VF_SDP_R_IN_INSTR_DBELL(q_no), val);
> +
> +	val = octep_vf_read_csr64(oct, CN93_VF_SDP_R_IN_CNTS(q_no));
> +	octep_vf_write_csr64(oct, CN93_VF_SDP_R_IN_CNTS(q_no), val & 0xFFFFFFFF);

This function uses values that appear to have special values:
0, and 0xFFFFFFFF (as a value and a mask).

I think it would be nice to name these using #defines
In the case of masks, using GENMASK_ULL() and FILED_PREP()
may be appropriate.

Likewise elsewhere in this patch.
Usage of BIT() and BIT_ULL() may also be appropriate.

> +
> +	return 0;
> +}

...

>  /* Tx/Rx queue interrupt handler */
>  static irqreturn_t octep_vf_ioq_intr_handler_cn93(void *data)
>  {
> +	struct octep_vf_ioq_vector *vector = (struct octep_vf_ioq_vector *)data;

nit: there is no need to cast a void pointer.

> +	struct octep_vf_oq *oq = vector->oq;
> +	struct octep_vf_device *oct = vector->octep_vf_dev;
> +	u64 reg_val = 0ULL;

As it looks like there will be a v3 of this patchset,
please consider arranging local variables in Networking code
in reverse xmas tree order - longest line to shortest.

	struct octep_vf_ioq_vector *vector = data;
	struct octep_vf_device *oct;
	struct octep_vf_oq *oq;
	u64 reg_val = 0ULL;

	oct = vector->octep_vf_dev;
	oq = vector->oq;

...

> diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cnxk.c b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cnxk.c

...

>  /* Tx/Rx queue interrupt handler */
>  static irqreturn_t octep_vf_ioq_intr_handler_cnxk(void *data)
>  {
> +	struct octep_vf_ioq_vector *vector = (struct octep_vf_ioq_vector *)data;
> +	struct octep_vf_oq *oq = vector->oq;
> +	struct octep_vf_device *oct = vector->octep_vf_dev;
> +	u64 reg_val = 0ULL;

Likewise, here too.

...

  reply	other threads:[~2024-01-05 10:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-23 13:39 [PATCH net-next v2 0/8] add octeon_ep_vf driver Shinas Rasheed
2023-12-23 13:39 ` [PATCH net-next v2 1/8] octeon_ep_vf: Add driver framework and device initialization Shinas Rasheed
2024-01-05 10:58   ` Simon Horman
2023-12-23 13:39 ` [PATCH net-next v2 2/8] octeon_ep_vf: add hardware configuration APIs Shinas Rasheed
2024-01-05 10:22   ` Simon Horman [this message]
2023-12-23 13:39 ` [PATCH net-next v2 3/8] octeon_ep_vf: add VF-PF mailbox communication Shinas Rasheed
2023-12-23 13:39 ` [PATCH net-next v2 4/8] octeon_ep_vf: add Tx/Rx ring resource setup and cleanup Shinas Rasheed
2024-01-05 10:50   ` Simon Horman
2023-12-23 13:39 ` [PATCH net-next v2 5/8] octeon_ep_vf: add support for ndo ops Shinas Rasheed
2023-12-23 13:39 ` [PATCH net-next v2 6/8] octeon_ep_vf: add Tx/Rx processing and interrupt support Shinas Rasheed
2024-01-04 21:00   ` Jakub Kicinski
2024-01-05  7:26     ` [EXT] " Shinas Rasheed
2024-01-05 11:05       ` Simon Horman
2024-01-05 15:08         ` Shinas Rasheed
2023-12-23 13:39 ` [PATCH net-next v2 7/8] octeon_ep_vf: add ethtool support Shinas Rasheed
2024-01-04 20:53   ` Jakub Kicinski
2023-12-23 13:40 ` [PATCH net-next v2 8/8] octeon_ep_vf: update MAINTAINERS Shinas Rasheed
2024-01-02 14:30 ` [PATCH net-next v2 0/8] add octeon_ep_vf driver patchwork-bot+netdevbpf
2024-01-04 21:03   ` Jakub Kicinski

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=20240105102209.GR31813@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=egallen@redhat.com \
    --cc=hgani@marvell.com \
    --cc=kheib@redhat.com \
    --cc=konguyen@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mschmidt@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sburla@marvell.com \
    --cc=sedara@marvell.com \
    --cc=srasheed@marvell.com \
    --cc=vburru@marvell.com \
    --cc=vimleshk@marvell.com \
    --cc=wizhao@redhat.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;
as well as URLs for NNTP newsgroup(s).