[1/5] net/bnxt: fix to avoid unnecessary memory allocation

Message ID 20200709093832.7616-2-kalesh-anakkur.purayil@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers
Series bnxt bug fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Kalesh A P July 9, 2020, 9:38 a.m. UTC
  From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

VFs are not privileged to issue HWRM_PORT_LED_QCFG/CFG.
There is no need to allocate "bp->leds" memory.

Fixes: 205b74295282 ("net/bnxt: fix allocation of LED config info")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Patch

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d228223..65094a3 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -194,6 +194,9 @@  static void bnxt_free_link_info(struct bnxt *bp)
 
 static void bnxt_free_leds_info(struct bnxt *bp)
 {
+	if (BNXT_VF(bp))
+		return;
+
 	rte_free(bp->leds);
 	bp->leds = NULL;
 }
@@ -263,6 +266,9 @@  static int bnxt_alloc_link_info(struct bnxt *bp)
 
 static int bnxt_alloc_leds_info(struct bnxt *bp)
 {
+	if (BNXT_VF(bp))
+		return 0;
+
 	bp->leds = rte_zmalloc("bnxt_leds",
 			       BNXT_MAX_LED * sizeof(struct bnxt_led_info),
 			       0);