lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 5 Jan 2024 10:22:09 +0000
From: Simon Horman <horms@...nel.org>
To: Shinas Rasheed <srasheed@...vell.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org, hgani@...vell.com,
	vimleshk@...vell.com, sedara@...vell.com, egallen@...hat.com,
	mschmidt@...hat.com, pabeni@...hat.com, kuba@...nel.org,
	wizhao@...hat.com, kheib@...hat.com, konguyen@...hat.com,
	Veerasenareddy Burru <vburru@...vell.com>,
	Satananda Burla <sburla@...vell.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net-next v2 2/8] octeon_ep_vf: add hardware configuration
 APIs

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@...vell.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.

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ