All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next v2] i40e: Fix i40e_print_features() VEB mode output
@ 2015-12-03 12:20 ` Jeff Kirsher
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Kirsher @ 2015-12-03 12:20 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Joe Perches, netdev, sergei.shtylyov, shannon.nelson

From: Joe Perches <joe@perches.com>

Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string building")
added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
function i40e_print_features.

Fix it.

Miscellanea:

- Remove unnecessary string variable
- Add space before not after fixed strings
- Use kmalloc not kzalloc
- Don't initialize i to 0, use result of first snprintf

Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Joe Perches <joe@perches.com>
---
v2: fixed patch conflicts when trying to apply to my next-queue tree
    (dev-queue branch), also fixed "Noticed-by" to the more acceptable
    "Reported-by"

 drivers/net/ethernet/intel/i40e/i40e_main.c | 42 +++++++++++++----------------
 1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 70a61bc..ad8cc14 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -10369,52 +10369,48 @@ static int i40e_setup_pf_filter_control(struct i40e_pf *pf)
 static void i40e_print_features(struct i40e_pf *pf)
 {
 	struct i40e_hw *hw = &pf->hw;
-	char *buf, *string;
-	int i = 0;
+	char *buf;
+	int i;
 
-	string = kzalloc(INFO_STRING_LEN, GFP_KERNEL);
-	if (!string) {
-		dev_err(&pf->pdev->dev, "Features string allocation failed\n");
+	buf = kmalloc(INFO_STRING_LEN, GFP_KERNEL);
+	if (!buf)
 		return;
-	}
-
-	buf = string;
 
-	i += snprintf(&buf[i], REMAIN(i), "Features: PF-id[%d] ", hw->pf_id);
+	i = snprintf(buf, INFO_STRING_LEN, "Features: PF-id[%d]", hw->pf_id);
 #ifdef CONFIG_PCI_IOV
-	i += snprintf(&buf[i], REMAIN(i), "VFs: %d ", pf->num_req_vfs);
+	i += snprintf(&buf[i], REMAIN(i), " VFs: %d", pf->num_req_vfs);
 #endif
-	i += snprintf(&buf[i], REMAIN(i), "VSIs: %d QP: %d RX: %s ",
+	i += snprintf(&buf[i], REMAIN(i), " VSIs: %d QP: %d RX: %s",
 		      pf->hw.func_caps.num_vsis,
 		      pf->vsi[pf->lan_vsi]->num_queue_pairs,
 		      pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" : "1BUF");
 
 	if (pf->flags & I40E_FLAG_RSS_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "RSS ");
+		i += snprintf(&buf[i], REMAIN(i), " RSS");
 	if (pf->flags & I40E_FLAG_FD_ATR_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "FD_ATR ");
+		i += snprintf(&buf[i], REMAIN(i), " FD_ATR");
 	if (pf->flags & I40E_FLAG_FD_SB_ENABLED) {
-		i += snprintf(&buf[i], REMAIN(i), "FD_SB ");
-		i += snprintf(&buf[i], REMAIN(i), "NTUPLE ");
+		i += snprintf(&buf[i], REMAIN(i), " FD_SB");
+		i += snprintf(&buf[i], REMAIN(i), " NTUPLE");
 	}
 	if (pf->flags & I40E_FLAG_DCB_CAPABLE)
-		i += snprintf(&buf[i], REMAIN(i), "DCB ");
+		i += snprintf(&buf[i], REMAIN(i), " DCB");
 #if IS_ENABLED(CONFIG_VXLAN)
-	i += snprintf(&buf[i], REMAIN(i), "VxLAN ");
+	i += snprintf(&buf[i], REMAIN(i), " VxLAN");
 #endif
 	if (pf->flags & I40E_FLAG_PTP)
-		i += snprintf(&buf[i], REMAIN(i), "PTP ");
+		i += snprintf(&buf[i], REMAIN(i), " PTP");
 #ifdef I40E_FCOE
 	if (pf->flags & I40E_FLAG_FCOE_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "FCOE ");
+		i += snprintf(&buf[i], REMAIN(i), " FCOE");
 #endif
 	if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "VEPA ");
+		i += snprintf(&buf[i], REMAIN(i), " VEB");
 	else
-		buf += sprintf(buf, "VEPA ");
+		i += snprintf(&buf[i], REMAIN(i), " VEPA");
 
-	dev_info(&pf->pdev->dev, "%s\n", string);
-	kfree(string);
+	dev_info(&pf->pdev->dev, "%s\n", buf);
+	kfree(buf);
 	WARN_ON(i > INFO_STRING_LEN);
 }
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Intel-wired-lan] [net-next v2] i40e: Fix i40e_print_features() VEB mode output
@ 2015-12-03 12:20 ` Jeff Kirsher
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Kirsher @ 2015-12-03 12:20 UTC (permalink / raw)
  To: intel-wired-lan

From: Joe Perches <joe@perches.com>

Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string building")
added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
function i40e_print_features.

Fix it.

Miscellanea:

- Remove unnecessary string variable
- Add space before not after fixed strings
- Use kmalloc not kzalloc
- Don't initialize i to 0, use result of first snprintf

Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Joe Perches <joe@perches.com>
---
v2: fixed patch conflicts when trying to apply to my next-queue tree
    (dev-queue branch), also fixed "Noticed-by" to the more acceptable
    "Reported-by"

 drivers/net/ethernet/intel/i40e/i40e_main.c | 42 +++++++++++++----------------
 1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 70a61bc..ad8cc14 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -10369,52 +10369,48 @@ static int i40e_setup_pf_filter_control(struct i40e_pf *pf)
 static void i40e_print_features(struct i40e_pf *pf)
 {
 	struct i40e_hw *hw = &pf->hw;
-	char *buf, *string;
-	int i = 0;
+	char *buf;
+	int i;
 
-	string = kzalloc(INFO_STRING_LEN, GFP_KERNEL);
-	if (!string) {
-		dev_err(&pf->pdev->dev, "Features string allocation failed\n");
+	buf = kmalloc(INFO_STRING_LEN, GFP_KERNEL);
+	if (!buf)
 		return;
-	}
-
-	buf = string;
 
-	i += snprintf(&buf[i], REMAIN(i), "Features: PF-id[%d] ", hw->pf_id);
+	i = snprintf(buf, INFO_STRING_LEN, "Features: PF-id[%d]", hw->pf_id);
 #ifdef CONFIG_PCI_IOV
-	i += snprintf(&buf[i], REMAIN(i), "VFs: %d ", pf->num_req_vfs);
+	i += snprintf(&buf[i], REMAIN(i), " VFs: %d", pf->num_req_vfs);
 #endif
-	i += snprintf(&buf[i], REMAIN(i), "VSIs: %d QP: %d RX: %s ",
+	i += snprintf(&buf[i], REMAIN(i), " VSIs: %d QP: %d RX: %s",
 		      pf->hw.func_caps.num_vsis,
 		      pf->vsi[pf->lan_vsi]->num_queue_pairs,
 		      pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" : "1BUF");
 
 	if (pf->flags & I40E_FLAG_RSS_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "RSS ");
+		i += snprintf(&buf[i], REMAIN(i), " RSS");
 	if (pf->flags & I40E_FLAG_FD_ATR_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "FD_ATR ");
+		i += snprintf(&buf[i], REMAIN(i), " FD_ATR");
 	if (pf->flags & I40E_FLAG_FD_SB_ENABLED) {
-		i += snprintf(&buf[i], REMAIN(i), "FD_SB ");
-		i += snprintf(&buf[i], REMAIN(i), "NTUPLE ");
+		i += snprintf(&buf[i], REMAIN(i), " FD_SB");
+		i += snprintf(&buf[i], REMAIN(i), " NTUPLE");
 	}
 	if (pf->flags & I40E_FLAG_DCB_CAPABLE)
-		i += snprintf(&buf[i], REMAIN(i), "DCB ");
+		i += snprintf(&buf[i], REMAIN(i), " DCB");
 #if IS_ENABLED(CONFIG_VXLAN)
-	i += snprintf(&buf[i], REMAIN(i), "VxLAN ");
+	i += snprintf(&buf[i], REMAIN(i), " VxLAN");
 #endif
 	if (pf->flags & I40E_FLAG_PTP)
-		i += snprintf(&buf[i], REMAIN(i), "PTP ");
+		i += snprintf(&buf[i], REMAIN(i), " PTP");
 #ifdef I40E_FCOE
 	if (pf->flags & I40E_FLAG_FCOE_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "FCOE ");
+		i += snprintf(&buf[i], REMAIN(i), " FCOE");
 #endif
 	if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "VEPA ");
+		i += snprintf(&buf[i], REMAIN(i), " VEB");
 	else
-		buf += sprintf(buf, "VEPA ");
+		i += snprintf(&buf[i], REMAIN(i), " VEPA");
 
-	dev_info(&pf->pdev->dev, "%s\n", string);
-	kfree(string);
+	dev_info(&pf->pdev->dev, "%s\n", buf);
+	kfree(buf);
 	WARN_ON(i > INFO_STRING_LEN);
 }
 
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Intel-wired-lan] [net-next v2] i40e: Fix i40e_print_features() VEB mode output
  2015-12-03 12:20 ` [Intel-wired-lan] " Jeff Kirsher
  (?)
@ 2015-12-03 16:46 ` Bowers, AndrewX
  -1 siblings, 0 replies; 5+ messages in thread
From: Bowers, AndrewX @ 2015-12-03 16:46 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On
> Behalf Of Jeff Kirsher
> Sent: Thursday, December 03, 2015 4:21 AM
> To: intel-wired-lan at lists.osuosl.org
> Cc: Joe Perches <joe@perches.com>; netdev at vger.kernel.org;
> sergei.shtylyov at cogentembedded.com
> Subject: [Intel-wired-lan] [net-next v2] i40e: Fix i40e_print_features() VEB
> mode output
> 
> From: Joe Perches <joe@perches.com>
> 
> Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string building")
> added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
> function i40e_print_features.
> 
> Fix it.
> 
> Miscellanea:
> 
> - Remove unnecessary string variable
> - Add space before not after fixed strings
> - Use kmalloc not kzalloc
> - Don't initialize i to 0, use result of first snprintf
> 
> Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> v2: fixed patch conflicts when trying to apply to my next-queue tree
>     (dev-queue branch), also fixed "Noticed-by" to the more acceptable
>     "Reported-by"
> 
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 42 +++++++++++++------------
> ----
>  1 file changed, 19 insertions(+), 23 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Patch code changes correctly applied, features correctly print on driver init.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [net-next v2] i40e: Fix i40e_print_features() VEB mode output
  2015-12-03 12:20 ` [Intel-wired-lan] " Jeff Kirsher
@ 2015-12-03 16:49   ` David Miller
  -1 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-12-03 16:49 UTC (permalink / raw)
  To: jeffrey.t.kirsher
  Cc: intel-wired-lan, joe, netdev, sergei.shtylyov, shannon.nelson

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Thu,  3 Dec 2015 04:20:57 -0800

> From: Joe Perches <joe@perches.com>
> 
> Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string building")
> added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
> function i40e_print_features.
> 
> Fix it.
> 
> Miscellanea:
> 
> - Remove unnecessary string variable
> - Add space before not after fixed strings
> - Use kmalloc not kzalloc
> - Don't initialize i to 0, use result of first snprintf
> 
> Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> v2: fixed patch conflicts when trying to apply to my next-queue tree
>     (dev-queue branch), also fixed "Noticed-by" to the more acceptable
>     "Reported-by"

Applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Intel-wired-lan] [net-next v2] i40e: Fix i40e_print_features() VEB mode output
@ 2015-12-03 16:49   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-12-03 16:49 UTC (permalink / raw)
  To: intel-wired-lan

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Thu,  3 Dec 2015 04:20:57 -0800

> From: Joe Perches <joe@perches.com>
> 
> Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string building")
> added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
> function i40e_print_features.
> 
> Fix it.
> 
> Miscellanea:
> 
> - Remove unnecessary string variable
> - Add space before not after fixed strings
> - Use kmalloc not kzalloc
> - Don't initialize i to 0, use result of first snprintf
> 
> Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> v2: fixed patch conflicts when trying to apply to my next-queue tree
>     (dev-queue branch), also fixed "Noticed-by" to the more acceptable
>     "Reported-by"

Applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-03 16:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-03 12:20 [net-next v2] i40e: Fix i40e_print_features() VEB mode output Jeff Kirsher
2015-12-03 12:20 ` [Intel-wired-lan] " Jeff Kirsher
2015-12-03 16:46 ` Bowers, AndrewX
2015-12-03 16:49 ` David Miller
2015-12-03 16:49   ` [Intel-wired-lan] " David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.