2021-10-25 19:23:39

by Rakesh Babu Saladi

[permalink] [raw]
Subject: [net-next PATCH 1/3] octeontx2-af: debugfs: Minor changes.

Few changes in rvu_debugfs.c file to remove unwanted characters,
indenting the code etc.

Signed-off-by: Rakesh Babu <[email protected]>
Signed-off-by: Sunil Kovvuri Goutham <[email protected]>
---
.../marvell/octeontx2/af/rvu_debugfs.c | 26 +++++++++----------
.../ethernet/marvell/octeontx2/af/rvu_nix.c | 3 +++
2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
index 9338765da048..54f8fac34215 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
@@ -95,7 +95,7 @@ static char *cgx_tx_stats_fields[] = {
[CGX_STAT5] = "Total frames sent on the interface",
[CGX_STAT6] = "Packets sent with an octet count < 64",
[CGX_STAT7] = "Packets sent with an octet count == 64",
- [CGX_STAT8] = "Packets sent with an octet count of 65–127",
+ [CGX_STAT8] = "Packets sent with an octet count of 65-127",
[CGX_STAT9] = "Packets sent with an octet count of 128-255",
[CGX_STAT10] = "Packets sent with an octet count of 256-511",
[CGX_STAT11] = "Packets sent with an octet count of 512-1023",
@@ -125,7 +125,7 @@ static char *rpm_rx_stats_fields[] = {
"Total frames received on interface",
"Packets received with an octet count < 64",
"Packets received with an octet count == 64",
- "Packets received with an octet count of 65–127",
+ "Packets received with an octet count of 65-127",
"Packets received with an octet count of 128-255",
"Packets received with an octet count of 256-511",
"Packets received with an octet count of 512-1023",
@@ -164,7 +164,7 @@ static char *rpm_tx_stats_fields[] = {
"Packets sent to the multicast DMAC",
"Packets sent to a broadcast DMAC",
"Packets sent with an octet count == 64",
- "Packets sent with an octet count of 65–127",
+ "Packets sent with an octet count of 65-127",
"Packets sent with an octet count of 128-255",
"Packets sent with an octet count of 256-511",
"Packets sent with an octet count of 512-1023",
@@ -487,7 +487,7 @@ static ssize_t rvu_dbg_qsize_write(struct file *filp,
int ret, lf;

cmd_buf = memdup_user(buffer, count + 1);
- if (IS_ERR(cmd_buf))
+ if (IS_ERR_OR_NULL(cmd_buf))
return -ENOMEM;

cmd_buf[count] = '\0';
@@ -504,7 +504,7 @@ static ssize_t rvu_dbg_qsize_write(struct file *filp,
if (cmd_buf)
ret = -EINVAL;

- if (!strncmp(subtoken, "help", 4) || ret < 0) {
+ if (ret < 0 || !strncmp(subtoken, "help", 4)) {
dev_info(rvu->dev, "Use echo <%s-lf > qsize\n", blk_string);
goto qsize_write_done;
}
@@ -1878,7 +1878,7 @@ static int cgx_print_stats(struct seq_file *s, int lmac_id)
return -ENODEV;

mac_ops = get_mac_ops(cgxd);
-
+ /* There can be no CGX devices at all */
if (!mac_ops)
return 0;

@@ -1956,13 +1956,13 @@ static int cgx_print_stats(struct seq_file *s, int lmac_id)
if (err)
return err;

- if (is_rvu_otx2(rvu))
- seq_printf(s, "%s: %llu\n", cgx_tx_stats_fields[stat],
- tx_stat);
- else
- seq_printf(s, "%s: %llu\n", rpm_tx_stats_fields[stat],
- tx_stat);
- stat++;
+ if (is_rvu_otx2(rvu))
+ seq_printf(s, "%s: %llu\n", cgx_tx_stats_fields[stat],
+ tx_stat);
+ else
+ seq_printf(s, "%s: %llu\n", rpm_tx_stats_fields[stat],
+ tx_stat);
+ stat++;
}

return err;
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
index 7761dcf17b91..d8b1948aaa0a 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
@@ -2583,6 +2583,9 @@ static void nix_free_tx_vtag_entries(struct rvu *rvu, u16 pcifunc)
return;

nix_hw = get_nix_hw(rvu->hw, blkaddr);
+ if (!nix_hw)
+ return;
+
vlan = &nix_hw->txvlan;

mutex_lock(&vlan->rsrc_lock);
--
2.17.1


2021-10-26 05:58:29

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [net-next PATCH 1/3] octeontx2-af: debugfs: Minor changes.

On Tue, 26 Oct 2021 00:44:40 +0530 Rakesh Babu wrote:
> cmd_buf = memdup_user(buffer, count + 1);
> - if (IS_ERR(cmd_buf))
> + if (IS_ERR_OR_NULL(cmd_buf))
> return -ENOMEM;

memdup_user() returns NULL now?

> cmd_buf[count] = '\0';
> @@ -504,7 +504,7 @@ static ssize_t rvu_dbg_qsize_write(struct file *filp,
> if (cmd_buf)
> ret = -EINVAL;
>
> - if (!strncmp(subtoken, "help", 4) || ret < 0) {
> + if (ret < 0 || !strncmp(subtoken, "help", 4)) {

The commit message does not mention this change.

> dev_info(rvu->dev, "Use echo <%s-lf > qsize\n", blk_string);
> goto qsize_write_done;
> }

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
> index 7761dcf17b91..d8b1948aaa0a 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
> @@ -2583,6 +2583,9 @@ static void nix_free_tx_vtag_entries(struct rvu *rvu, u16 pcifunc)
> return;
>
> nix_hw = get_nix_hw(rvu->hw, blkaddr);
> + if (!nix_hw)
> + return;

This does not fall under "remove unwanted characters, indenting
the code" either.

2021-10-26 12:46:26

by Rakesh Babu Saladi

[permalink] [raw]
Subject: RE: [EXT] Re: [net-next PATCH 1/3] octeontx2-af: debugfs: Minor changes.

Hi Jakub,

Please see inline.

Thanks,
Rakesh.

-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Tuesday, October 26, 2021 6:43 AM
To: Rakesh Babu Saladi <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Sunil Kovvuri Goutham <[email protected]>; Geethasowjanya Akula <[email protected]>; Subbaraya Sundeep Bhatta <[email protected]>; Hariprasad Kelam <[email protected]>
Subject: [EXT] Re: [net-next PATCH 1/3] octeontx2-af: debugfs: Minor changes.

External Email

----------------------------------------------------------------------
On Tue, 26 Oct 2021 00:44:40 +0530 Rakesh Babu wrote:
> cmd_buf = memdup_user(buffer, count + 1);
> - if (IS_ERR(cmd_buf))
> + if (IS_ERR_OR_NULL(cmd_buf))
> return -ENOMEM;

memdup_user() returns NULL now?

Rakesh > I checked now. It is not returning NULL. I'll revert this change.

> cmd_buf[count] = '\0';
> @@ -504,7 +504,7 @@ static ssize_t rvu_dbg_qsize_write(struct file *filp,
> if (cmd_buf)
> ret = -EINVAL;
>
> - if (!strncmp(subtoken, "help", 4) || ret < 0) {
> + if (ret < 0 || !strncmp(subtoken, "help", 4)) {

The commit message does not mention this change.
Rakesh >> ACK. Will address this in v2.

> dev_info(rvu->dev, "Use echo <%s-lf > qsize\n", blk_string);
> goto qsize_write_done;
> }

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
> b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
> index 7761dcf17b91..d8b1948aaa0a 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
> @@ -2583,6 +2583,9 @@ static void nix_free_tx_vtag_entries(struct rvu *rvu, u16 pcifunc)
> return;
>
> nix_hw = get_nix_hw(rvu->hw, blkaddr);
> + if (!nix_hw)
> + return;

This does not fall under "remove unwanted characters, indenting the code" either.
Rakesh >> ACK. I'll address this in v2.