All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] bnxt patch series
@ 2017-06-29  2:51 Ajit Khaparde
  2017-06-29  2:51 ` [PATCH 1/7] net/bnxt: add support for Stratus VF device Ajit Khaparde
                   ` (6 more replies)
  0 siblings, 7 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-29  2:51 UTC (permalink / raw)
  To: dev

The first patch of the series adds support for a new device.
Rest of the patches in the patchset fix some of the issues
found during testing.

  net/bnxt: add support for Stratus VF device
  net/bnxt: fix mtu configuration for the function
  net/bnxt: fix calculation of VNICs
  net/bnxt: pass func_default flag to VNIC_ALLOC
  net/bnxt: fix automatic clearing of VF stats
  net/bnxt: fix some link related issues
  net/bnxt: fix copy/pasted error message

 drivers/net/bnxt/bnxt.h                |   5 ++
 drivers/net/bnxt/bnxt_ethdev.c         |   6 +-
 drivers/net/bnxt/bnxt_hwrm.c           | 132 +++++++++++++++++++++++++--------
 drivers/net/bnxt/bnxt_hwrm.h           |   5 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h |  19 +++++
 drivers/net/bnxt/rte_pmd_bnxt.c        |  63 ++++++++++++++--
 drivers/net/bnxt/rte_pmd_bnxt.h        |  18 +++++
 7 files changed, 208 insertions(+), 40 deletions(-)

-- 
2.10.1 (Apple Git-78)

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

* [PATCH 1/7] net/bnxt: add support for Stratus VF device
  2017-06-29  2:51 [PATCH 0/7] bnxt patch series Ajit Khaparde
@ 2017-06-29  2:51 ` Ajit Khaparde
  2017-06-29  2:51 ` [PATCH 2/7] net/bnxt: fix mtu configuration for the function Ajit Khaparde
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-29  2:51 UTC (permalink / raw)
  To: dev

This patch adds support for Stratus VF devices.
Other than adding the VF device ID, we also are adding
support for short message format.

The new short firmware message of size 16 bytes points to a location
in host memory that contains the firmware message that the driver
wants the adapter to process. This indirection requires the
firmware to DMA the message into its own memory for processing.

When the firmware receives a Short Command Format, it will DMA the
firmware message from host memory into its internal memory and then
processes the message as it would have if it received the message
directly in the firmware communication channel.

With BCM57454, the number of VFs increase to 1K and so the requirement
for firmware communication channel memory on adapter becomes expensive.
The short firmware message saves the amount of memory required to support
1K VFs on adapter.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h                |  4 +++
 drivers/net/bnxt/bnxt_ethdev.c         |  6 +++-
 drivers/net/bnxt/bnxt_hwrm.c           | 64 ++++++++++++++++++++++++++++++++--
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 10 ++++++
 4 files changed, 80 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 1538aa5..d39baf1 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -162,6 +162,7 @@ struct bnxt_cos_queue_info {
 	uint8_t	profile;
 };
 
+#define BNXT_HWRM_SHORT_REQ_LEN		sizeof(struct hwrm_short_input)
 struct bnxt {
 	void				*bar0;
 
@@ -173,6 +174,7 @@ struct bnxt {
 #define BNXT_FLAG_VF		(1 << 1)
 #define BNXT_FLAG_PORT_STATS	(1 << 2)
 #define BNXT_FLAG_JUMBO		(1 << 3)
+#define BNXT_FLAG_SHORT_CMD	(1 << 4)
 #define BNXT_PF(bp)		(!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)		((bp)->flags & BNXT_FLAG_VF)
 #define BNXT_NPAR_ENABLED(bp)	((bp)->port_partition_type)
@@ -217,6 +219,8 @@ struct bnxt {
 	uint16_t			hwrm_cmd_seq;
 	void				*hwrm_cmd_resp_addr;
 	phys_addr_t			hwrm_cmd_resp_dma_addr;
+	void				*hwrm_short_cmd_req_addr;
+	phys_addr_t			hwrm_short_cmd_req_dma_addr;
 	rte_spinlock_t			hwrm_lock;
 	uint16_t			max_req_len;
 	uint16_t			max_resp_len;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index a2d46ee..c9d1122 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -60,6 +60,7 @@ static const char bnxt_version[] =
 
 #define PCI_VENDOR_ID_BROADCOM 0x14E4
 
+#define BROADCOM_DEV_ID_STRATUS_NIC_VF 0x1609
 #define BROADCOM_DEV_ID_STRATUS_NIC 0x1614
 #define BROADCOM_DEV_ID_57414_VF 0x16c1
 #define BROADCOM_DEV_ID_57301 0x16c8
@@ -96,6 +97,8 @@ static const char bnxt_version[] =
 #define BROADCOM_DEV_ID_57416_MF 0x16ee
 
 static const struct rte_pci_id bnxt_pci_id_map[] = {
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM,
+			 BROADCOM_DEV_ID_STRATUS_NIC_VF) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_STRATUS_NIC) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57414_VF) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57301) },
@@ -1569,7 +1572,8 @@ static bool bnxt_vf_pciid(uint16_t id)
 	    id == BROADCOM_DEV_ID_57406_VF ||
 	    id == BROADCOM_DEV_ID_5731X_VF ||
 	    id == BROADCOM_DEV_ID_5741X_VF ||
-	    id == BROADCOM_DEV_ID_57414_VF)
+	    id == BROADCOM_DEV_ID_57414_VF ||
+	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF)
 		return true;
 	return false;
 }
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index f45b883..e237041 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -106,6 +106,30 @@ static int bnxt_hwrm_send_message_locked(struct bnxt *bp, void *msg,
 	uint32_t *data = msg;
 	uint8_t *bar;
 	uint8_t *valid;
+	uint16_t max_req_len = bp->max_req_len;
+	struct hwrm_short_input short_input = { 0 };
+
+	if (bp->flags & BNXT_FLAG_SHORT_CMD) {
+		void *short_cmd_req = bp->hwrm_short_cmd_req_addr;
+
+		memset(short_cmd_req, 0, bp->max_req_len);
+		memcpy(short_cmd_req, req, msg_len);
+
+		short_input.req_type = rte_cpu_to_le_16(req->req_type);
+		short_input.signature = rte_cpu_to_le_16(
+					HWRM_SHORT_REQ_SIGNATURE_SHORT_CMD);
+		short_input.size = rte_cpu_to_le_16(msg_len);
+		short_input.req_addr =
+			rte_cpu_to_le_64(bp->hwrm_short_cmd_req_dma_addr);
+
+		data = (uint32_t *)&short_input;
+		msg_len = sizeof(short_input);
+
+		/* Sync memory write before updating doorbell */
+		rte_wmb();
+
+		max_req_len = BNXT_HWRM_SHORT_REQ_LEN;
+	}
 
 	/* Write request msg to hwrm channel */
 	for (i = 0; i < msg_len; i += 4) {
@@ -115,7 +139,7 @@ static int bnxt_hwrm_send_message_locked(struct bnxt *bp, void *msg,
 	}
 
 	/* Zero the rest of the request space */
-	for (; i < bp->max_req_len; i += 4) {
+	for (; i < max_req_len; i += 4) {
 		bar = (uint8_t *)bp->bar0 + i;
 		rte_write32(0, bar);
 	}
@@ -457,7 +481,9 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 	uint32_t fw_version;
 	uint16_t max_resp_len;
 	char type[RTE_MEMZONE_NAMESIZE];
+	uint32_t dev_caps_cfg;
 
+	bp->max_req_len = HWRM_MAX_REQ_LEN;
 	HWRM_PREP(req, VER_GET, -1, resp);
 
 	req.hwrm_intf_maj = HWRM_VERSION_MAJOR;
@@ -514,8 +540,10 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 		RTE_LOG(ERR, PMD, "Unsupported request length\n");
 		rc = -EINVAL;
 	}
-	bp->max_req_len = resp->max_req_win_len;
+	bp->max_req_len = rte_le_to_cpu_16(resp->max_req_win_len);
 	max_resp_len = resp->max_resp_len;
+	dev_caps_cfg = rte_le_to_cpu_32(resp->dev_caps_cfg);
+
 	if (bp->max_resp_len != max_resp_len) {
 		sprintf(type, "bnxt_hwrm_%04x:%02x:%02x:%02x",
 			bp->pdev->addr.domain, bp->pdev->addr.bus,
@@ -540,6 +568,34 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 		bp->max_resp_len = max_resp_len;
 	}
 
+	if ((dev_caps_cfg &
+		HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_SUPPORTED) &&
+	    (dev_caps_cfg &
+	     HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_INPUTUIRED)) {
+		RTE_LOG(DEBUG, PMD, "Short command supported\n");
+
+		rte_free(bp->hwrm_short_cmd_req_addr);
+
+		bp->hwrm_short_cmd_req_addr = rte_malloc(type,
+							bp->max_req_len, 0);
+		if (bp->hwrm_short_cmd_req_addr == NULL) {
+			rc = -ENOMEM;
+			goto error;
+		}
+		rte_mem_lock_page(bp->hwrm_short_cmd_req_addr);
+		bp->hwrm_short_cmd_req_dma_addr =
+			rte_mem_virt2phy(bp->hwrm_short_cmd_req_addr);
+		if (bp->hwrm_short_cmd_req_dma_addr == 0) {
+			rte_free(bp->hwrm_short_cmd_req_addr);
+			RTE_LOG(ERR, PMD,
+				"Unable to map buffer to physical memory.\n");
+			rc = -ENOMEM;
+			goto error;
+		}
+
+		bp->flags |= BNXT_FLAG_SHORT_CMD;
+	}
+
 error:
 	rte_spinlock_unlock(&bp->hwrm_lock);
 	return rc;
@@ -1529,8 +1585,11 @@ void bnxt_free_hwrm_resources(struct bnxt *bp)
 {
 	/* Release memzone */
 	rte_free(bp->hwrm_cmd_resp_addr);
+	rte_free(bp->hwrm_short_cmd_req_addr);
 	bp->hwrm_cmd_resp_addr = NULL;
+	bp->hwrm_short_cmd_req_addr = NULL;
 	bp->hwrm_cmd_resp_dma_addr = 0;
+	bp->hwrm_short_cmd_req_dma_addr = 0;
 }
 
 int bnxt_alloc_hwrm_resources(struct bnxt *bp)
@@ -1540,7 +1599,6 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp)
 
 	sprintf(type, "bnxt_hwrm_%04x:%02x:%02x:%02x", pdev->addr.domain,
 		pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
-	bp->max_req_len = HWRM_MAX_REQ_LEN;
 	bp->max_resp_len = HWRM_MAX_RESP_LEN;
 	bp->hwrm_cmd_resp_addr = rte_malloc(type, bp->max_resp_len, 0);
 	rte_mem_lock_page(bp->hwrm_cmd_resp_addr);
diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h
index e082d33..c2335d0 100644
--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
@@ -10300,6 +10300,16 @@ struct output {
 	 */
 } __attribute__((packed));
 
+/* Short Command Structure (16 bytes) */
+struct hwrm_short_input {
+	uint16_t req_type;
+	uint16_t signature;
+	#define HWRM_SHORT_REQ_SIGNATURE_SHORT_CMD	(UINT32_C(0x4321))
+	uint16_t unused_0;
+	uint16_t size;
+	uint64_t req_addr;
+} __attribute__((packed));
+
 #define HWRM_GET_HWRM_ERROR_CODE(arg) \
 	{ \
 		typeof(arg) x = (arg); \
-- 
2.10.1 (Apple Git-78)

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

* [PATCH 2/7] net/bnxt: fix mtu configuration for the function
  2017-06-29  2:51 [PATCH 0/7] bnxt patch series Ajit Khaparde
  2017-06-29  2:51 ` [PATCH 1/7] net/bnxt: add support for Stratus VF device Ajit Khaparde
@ 2017-06-29  2:51 ` Ajit Khaparde
  2017-06-29 10:55   ` Ferruh Yigit
  2017-06-29  2:51 ` [PATCH 3/7] net/bnxt: fix calculation of VNICs Ajit Khaparde
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-29  2:51 UTC (permalink / raw)
  To: dev

Set the MTU of the device to MAX size possible.
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index e237041..580b2d8 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2023,8 +2023,7 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp, int tx_rings)
 			HWRM_FUNC_CFG_INPUT_ENABLES_NUM_VNICS |
 			HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS);
 	req.flags = rte_cpu_to_le_32(bp->pf.func_cfg_flags);
-	req.mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
-				   ETHER_CRC_LEN + VLAN_TAG_SIZE);
+	req.mtu = rte_cpu_to_le_16(BNXT_MAX_MTU);
 	req.mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
 				   ETHER_CRC_LEN + VLAN_TAG_SIZE);
 	req.num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx);
-- 
2.10.1 (Apple Git-78)

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

* [PATCH 3/7] net/bnxt: fix calculation of VNICs
  2017-06-29  2:51 [PATCH 0/7] bnxt patch series Ajit Khaparde
  2017-06-29  2:51 ` [PATCH 1/7] net/bnxt: add support for Stratus VF device Ajit Khaparde
  2017-06-29  2:51 ` [PATCH 2/7] net/bnxt: fix mtu configuration for the function Ajit Khaparde
@ 2017-06-29  2:51 ` Ajit Khaparde
  2017-06-29  2:51 ` [PATCH 4/7] net/bnxt: pass func_default flag to VNIC_ALLOC Ajit Khaparde
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-29  2:51 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hurd

We used the default as a work-around for the 4-byte MTU VNICs,
but we filter those out now. So fix the calculation of VNICs
accordingly.

Fixes: ff63ebbb67a7 ("net/bnxt: determine the Rx status of VF")

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c    | 10 +++++-----
 drivers/net/bnxt/bnxt_hwrm.h    |  2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 580b2d8..7fb9800 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2740,12 +2740,12 @@ int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on)
 	return rc;
 }
 
-static void bnxt_vnic_count(struct bnxt_vnic_info *vnic, void *cbdata)
+static void
+bnxt_vnic_count(struct bnxt_vnic_info *vnic __rte_unused, void *cbdata)
 {
 	uint32_t *count = cbdata;
 
-	if (vnic->func_default)
-		*count = *count + 1;
+	*count = *count + 1;
 }
 
 static int bnxt_vnic_count_hwrm_stub(struct bnxt *bp __rte_unused,
@@ -2754,7 +2754,7 @@ static int bnxt_vnic_count_hwrm_stub(struct bnxt *bp __rte_unused,
 	return 0;
 }
 
-int bnxt_vf_default_vnic_count(struct bnxt *bp, uint16_t vf)
+int bnxt_vf_vnic_count(struct bnxt *bp, uint16_t vf)
 {
 	uint32_t count = 0;
 
@@ -2837,7 +2837,7 @@ int bnxt_hwrm_func_vf_vnic_query_and_config(struct bnxt *bp, uint16_t vf,
 		rc = bnxt_hwrm_vnic_qcfg(bp, &vnic, bp->pf.first_vf_id + vf);
 		if (rc)
 			break;
-		if (vnic.mru == 4)	/* Indicates unallocated */
+		if (vnic.mru <= 4)	/* Indicates unallocated */
 			continue;
 
 		vnic_cb(&vnic, cbdata);
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index a603dda..82cca3a 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -145,7 +145,7 @@ int bnxt_hwrm_port_led_qcaps(struct bnxt *bp);
 int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf);
 void vf_vnic_set_rxmask_cb(struct bnxt_vnic_info *vnic, void *flagp);
 int bnxt_set_rx_mask_no_vlan(struct bnxt *bp, struct bnxt_vnic_info *vnic);
-int bnxt_vf_default_vnic_count(struct bnxt *bp, uint16_t vf);
+int bnxt_vf_vnic_count(struct bnxt *bp, uint16_t vf);
 int bnxt_hwrm_func_vf_vnic_query_and_config(struct bnxt *bp, uint16_t vf,
 	void (*vnic_cb)(struct bnxt_vnic_info *, void *), void *cbdata,
 	int (*hwrm_cb)(struct bnxt *bp, struct bnxt_vnic_info *vnic));
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index faeb6f4..1bd5aee 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -610,7 +610,7 @@ int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id)
 		return -ENOTSUP;
 	}
 
-	return bnxt_vf_default_vnic_count(bp, vf_id);
+	return bnxt_vf_vnic_count(bp, vf_id);
 }
 
 int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
-- 
2.10.1 (Apple Git-78)

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

* [PATCH 4/7] net/bnxt: pass func_default flag to VNIC_ALLOC
  2017-06-29  2:51 [PATCH 0/7] bnxt patch series Ajit Khaparde
                   ` (2 preceding siblings ...)
  2017-06-29  2:51 ` [PATCH 3/7] net/bnxt: fix calculation of VNICs Ajit Khaparde
@ 2017-06-29  2:51 ` Ajit Khaparde
  2017-06-29  2:51 ` [PATCH 5/7] net/bnxt: fix automatic clearing of VF stats Ajit Khaparde
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-29  2:51 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hurd

Previously, no VNICs were allocated as the default VNIC,
even if they were configured as one.  This patch fixes that error.

Fixes: db678d5c2b54 ("net/bnxt: add HWRM VNIC configure")

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 7fb9800..eccfe7f 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -970,6 +970,8 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 				ETHER_CRC_LEN + VLAN_TAG_SIZE;
 	HWRM_PREP(req, VNIC_ALLOC, -1, resp);
 
+	if (vnic->func_default)
+		req.flags = HWRM_VNIC_ALLOC_INPUT_FLAGS_DEFAULT;
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
 
 	HWRM_CHECK_RESULT;
-- 
2.10.1 (Apple Git-78)

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

* [PATCH 5/7] net/bnxt: fix automatic clearing of VF stats
  2017-06-29  2:51 [PATCH 0/7] bnxt patch series Ajit Khaparde
                   ` (3 preceding siblings ...)
  2017-06-29  2:51 ` [PATCH 4/7] net/bnxt: pass func_default flag to VNIC_ALLOC Ajit Khaparde
@ 2017-06-29  2:51 ` Ajit Khaparde
  2017-06-29 10:53   ` Ferruh Yigit
  2017-06-29  2:51 ` [PATCH 6/7] net/bnxt: fix some link related issues Ajit Khaparde
  2017-06-29  2:51 ` [PATCH 7/7] net/bnxt: fix copy/pasted error message Ajit Khaparde
  6 siblings, 1 reply; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-29  2:51 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hurd

Add code to avoid automatic clearing of VF stats on a function
reset or a stat context free.

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h                |  1 +
 drivers/net/bnxt/bnxt_hwrm.c           |  5 +--
 drivers/net/bnxt/bnxt_hwrm.h           |  3 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h |  9 ++++++
 drivers/net/bnxt/rte_pmd_bnxt.c        | 59 +++++++++++++++++++++++++++++++---
 drivers/net/bnxt/rte_pmd_bnxt.h        | 18 +++++++++++
 6 files changed, 88 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index d39baf1..44b1ac5 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -109,6 +109,7 @@ struct bnxt_child_vf_info {
 	uint8_t			mac_spoof_en;
 	uint8_t			vlan_spoof_en;
 	bool			random_mac;
+	bool			persist_stats;
 };
 
 struct bnxt_pf_info {
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index eccfe7f..3d2d408 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2367,7 +2367,8 @@ int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, uint16_t port,
 	return rc;
 }
 
-int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf)
+int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf,
+					uint32_t flags)
 {
 	struct hwrm_func_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 	struct hwrm_func_cfg_input req = {0};
@@ -2375,7 +2376,7 @@ int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf)
 
 	HWRM_PREP(req, FUNC_CFG, -1, resp);
 	req.fid = rte_cpu_to_le_16(bp->pf.vf_info[vf].fid);
-	req.flags = rte_cpu_to_le_32(bp->pf.vf_info[vf].func_cfg_flags);
+	req.flags = rte_cpu_to_le_32(flags);
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
 	HWRM_CHECK_RESULT;
 
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index 82cca3a..dd0999a 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -142,7 +142,8 @@ int bnxt_hwrm_port_qstats(struct bnxt *bp);
 int bnxt_hwrm_port_clr_stats(struct bnxt *bp);
 int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on);
 int bnxt_hwrm_port_led_qcaps(struct bnxt *bp);
-int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf);
+int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf,
+					uint32_t flags);
 void vf_vnic_set_rxmask_cb(struct bnxt_vnic_info *vnic, void *flagp);
 int bnxt_set_rx_mask_no_vlan(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_vf_vnic_count(struct bnxt *bp, uint16_t vf);
diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h
index c2335d0..1eb8d33 100644
--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
@@ -3190,6 +3190,15 @@ struct hwrm_func_cfg_input {
 	 * command will be persistent over warm boot.
 	 */
 	#define HWRM_FUNC_CFG_INPUT_FLAGS_VIRT_MAC_PERSIST	UINT32_C(0x800)
+	/*
+	 * This bit only applies to the VF. If this bit is set, the
+	 * statistic context counters will not be cleared when the
+	 * statistic context is freed or a function reset is called on
+	 * VF. This bit will be cleared when the PF is unloaded or a
+	 * function reset is called on the PF.
+	 */
+	#define HWRM_FUNC_CFG_INPUT_FLAGS_NO_AUTOCLEAR_STATISTIC	\
+		UINT32_C(0x1000)
 	uint32_t enables;
 	/* This bit must be '1' for the mtu field to be configured. */
 	#define HWRM_FUNC_CFG_INPUT_ENABLES_MTU	UINT32_C(0x1)
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 1bd5aee..1903101 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -274,6 +274,8 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
 		return 0;
 
 	func_flags = bp->pf.vf_info[vf].func_cfg_flags;
+	func_flags &= ~(HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_ENABLE |
+	    HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE);
 
 	if (on)
 		func_flags |=
@@ -282,11 +284,11 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
 		func_flags |=
 			HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE;
 
-	bp->pf.vf_info[vf].func_cfg_flags = func_flags;
-
-	rc = bnxt_hwrm_func_cfg_vf_set_flags(bp, vf);
-	if (!rc)
+	rc = bnxt_hwrm_func_cfg_vf_set_flags(bp, vf, func_flags);
+	if (!rc) {
 		bp->pf.vf_info[vf].mac_spoof_en = on;
+		bp->pf.vf_info[vf].func_cfg_flags = func_flags;
+	}
 
 	return rc;
 }
@@ -754,3 +756,52 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint8_t port, uint16_t vf,
 
 	return rc;
 }
+
+int rte_pmd_bnxt_set_vf_persist_stats(uint8_t port, uint16_t vf, uint8_t on)
+{
+	struct rte_eth_dev_info dev_info;
+	struct rte_eth_dev *dev;
+	uint32_t func_flags;
+	struct bnxt *bp;
+	int rc;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	if (on > 1)
+		return -EINVAL;
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+	bp = (struct bnxt *)dev->data->dev_private;
+
+	if (!BNXT_PF(bp)) {
+		RTE_LOG(ERR, PMD,
+			"Attempt to set persist stats on non-PF port %d!\n",
+			port);
+		return -EINVAL;
+	}
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	/* Prev setting same as new setting. */
+	if (on == bp->pf.vf_info[vf].persist_stats)
+		return 0;
+
+	func_flags = bp->pf.vf_info[vf].func_cfg_flags;
+
+	if (on)
+		func_flags |=
+			HWRM_FUNC_CFG_INPUT_FLAGS_NO_AUTOCLEAR_STATISTIC;
+	else
+		func_flags &=
+			~HWRM_FUNC_CFG_INPUT_FLAGS_NO_AUTOCLEAR_STATISTIC;
+
+	rc = bnxt_hwrm_func_cfg_vf_set_flags(bp, vf, func_flags);
+	if (!rc) {
+		bp->pf.vf_info[vf].persist_stats = on;
+		bp->pf.vf_info[vf].func_cfg_flags = func_flags;
+	}
+
+	return rc;
+}
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h
index 964aa97..c4c4770 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.h
+++ b/drivers/net/bnxt/rte_pmd_bnxt.h
@@ -333,4 +333,22 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
  */
 int rte_pmd_bnxt_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
 				uint32_t vf_id);
+
+/**
+ * Enable/Disable VF statistics retention
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @param on
+ *    1 - Prevent VF statistics from automatically resetting
+ *    0 - Allow VF statistics to automatically reset
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_bnxt_set_vf_persist_stats(uint8_t port, uint16_t vf, uint8_t on);
 #endif /* _PMD_BNXT_H_ */
-- 
2.10.1 (Apple Git-78)

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

* [PATCH 6/7] net/bnxt: fix some link related issues
  2017-06-29  2:51 [PATCH 0/7] bnxt patch series Ajit Khaparde
                   ` (4 preceding siblings ...)
  2017-06-29  2:51 ` [PATCH 5/7] net/bnxt: fix automatic clearing of VF stats Ajit Khaparde
@ 2017-06-29  2:51 ` Ajit Khaparde
  2017-06-29 10:55   ` Ferruh Yigit
  2017-06-29  2:51 ` [PATCH 7/7] net/bnxt: fix copy/pasted error message Ajit Khaparde
  6 siblings, 1 reply; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-29  2:51 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hurd

This patch fixes some link related issues that can occur because:

bnxt_hwrm_port_phy_cfg() was setting enables inappropriately.
bnxt_hwrm_port_phy_qcfg() was overly complex.
bnxt_get_hwrm_link_config() was basing the speed on the link status.
bnxt_get_hwrm_link_config() was using the incorrect macros for auto_mode
we are not using supported speeds from phy_qcfg for auto mask.

Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 48 ++++++++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 3d2d408..da078f9 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -628,6 +628,8 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)
 	struct hwrm_port_phy_cfg_input req = {0};
 	struct hwrm_port_phy_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 	uint32_t enables = 0;
+	uint32_t link_speed_mask =
+		HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK;
 
 	HWRM_PREP(req, PORT_PHY_CFG, -1, resp);
 
@@ -639,14 +641,20 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)
 		 * any auto mode, even "none".
 		 */
 		if (!conf->link_speed) {
-			req.auto_mode |= conf->auto_mode;
-			enables = HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE;
-			req.auto_link_speed_mask = conf->auto_link_speed_mask;
-			enables |=
-			   HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK;
-			req.auto_link_speed = bp->link_info.auto_link_speed;
-			enables |=
+			req.auto_mode = conf->auto_mode;
+			enables |= HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE;
+			if (conf->auto_mode ==
+			    HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK) {
+				req.auto_link_speed_mask =
+					conf->auto_link_speed_mask;
+				enables |= link_speed_mask;
+			}
+			if (bp->link_info.auto_link_speed) {
+				req.auto_link_speed =
+					bp->link_info.auto_link_speed;
+				enables |=
 				HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED;
+			}
 		}
 		req.auto_duplex = conf->duplex;
 		enables |= HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_DUPLEX;
@@ -686,13 +694,10 @@ static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp,
 	HWRM_CHECK_RESULT;
 
 	link_info->phy_link_status = resp->link;
-	if (link_info->phy_link_status == HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK) {
-		link_info->link_up = 1;
-		link_info->link_speed = rte_le_to_cpu_16(resp->link_speed);
-	} else {
-		link_info->link_up = 0;
-		link_info->link_speed = 0;
-	}
+	link_info->link_up =
+		(link_info->phy_link_status ==
+		 HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK) ? 1 : 0;
+	link_info->link_speed = rte_le_to_cpu_16(resp->link_speed);
 	link_info->duplex = resp->duplex;
 	link_info->pause = resp->pause;
 	link_info->auto_pause = resp->auto_pause;
@@ -1790,12 +1795,16 @@ static int bnxt_valid_link_speed(uint32_t link_speed, uint8_t port_id)
 	return 0;
 }
 
-static uint16_t bnxt_parse_eth_link_speed_mask(uint32_t link_speed)
+static uint16_t
+bnxt_parse_eth_link_speed_mask(struct bnxt *bp, uint32_t link_speed)
 {
 	uint16_t ret = 0;
 
-	if (link_speed == ETH_LINK_SPEED_AUTONEG)
+	if (link_speed == ETH_LINK_SPEED_AUTONEG) {
+		if (bp->link_info.support_speeds)
+			return bp->link_info.support_speeds;
 		link_speed = BNXT_SUPPORTED_SPEEDS;
+	}
 
 	if (link_speed & ETH_LINK_SPEED_100M)
 		ret |= HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MB;
@@ -1887,7 +1896,7 @@ int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link)
 			"Get link config failed with rc %d\n", rc);
 		goto exit;
 	}
-	if (link_info->link_up)
+	if (link_info->link_speed)
 		link->link_speed =
 			bnxt_parse_hw_link_speed(link_info->link_speed);
 	else
@@ -1896,7 +1905,7 @@ int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link)
 	link->link_status = link_info->link_up;
 	link->link_autoneg = link_info->auto_mode ==
 		HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE ?
-		ETH_LINK_SPEED_FIXED : ETH_LINK_SPEED_AUTONEG;
+		ETH_LINK_FIXED : ETH_LINK_AUTONEG;
 exit:
 	return rc;
 }
@@ -1929,7 +1938,8 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 		link_req.auto_mode =
 				HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK;
 		link_req.auto_link_speed_mask =
-			bnxt_parse_eth_link_speed_mask(dev_conf->link_speeds);
+			bnxt_parse_eth_link_speed_mask(bp,
+						       dev_conf->link_speeds);
 	} else {
 		link_req.phy_flags |= HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE;
 		link_req.link_speed = speed;
-- 
2.10.1 (Apple Git-78)

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

* [PATCH 7/7] net/bnxt: fix copy/pasted error message
  2017-06-29  2:51 [PATCH 0/7] bnxt patch series Ajit Khaparde
                   ` (5 preceding siblings ...)
  2017-06-29  2:51 ` [PATCH 6/7] net/bnxt: fix some link related issues Ajit Khaparde
@ 2017-06-29  2:51 ` Ajit Khaparde
  2017-06-29 10:56   ` Ferruh Yigit
  6 siblings, 1 reply; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-29  2:51 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hurd

Fix an error message. Probably a copy/paste error.

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/rte_pmd_bnxt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 1903101..1131f53 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -316,7 +316,7 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
 
 	if (!BNXT_PF(bp)) {
 		RTE_LOG(ERR, PMD,
-			"Attempt to set mac spoof on non-PF port %d!\n", port);
+			"Attempt to set VLAN spoof on non-PF port %d!\n", port);
 		return -EINVAL;
 	}
 
-- 
2.10.1 (Apple Git-78)

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

* Re: [PATCH 5/7] net/bnxt: fix automatic clearing of VF stats
  2017-06-29  2:51 ` [PATCH 5/7] net/bnxt: fix automatic clearing of VF stats Ajit Khaparde
@ 2017-06-29 10:53   ` Ferruh Yigit
  0 siblings, 0 replies; 25+ messages in thread
From: Ferruh Yigit @ 2017-06-29 10:53 UTC (permalink / raw)
  To: Ajit Khaparde, dev; +Cc: Stephen Hurd

On 6/29/2017 3:51 AM, Ajit Khaparde wrote:
> Add code to avoid automatic clearing of VF stats on a function
> reset or a stat context free.
> 
> Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

<...>

> +
> +/**
> + * Enable/Disable VF statistics retention
> + *
> + * @param port
> + *    The port identifier of the Ethernet device.
> + * @param vf
> + *   VF id.
> + * @param on
> + *    1 - Prevent VF statistics from automatically resetting
> + *    0 - Allow VF statistics to automatically reset
> + *
> + * @return
> + *   - (0) if successful.
> + *   - (-ENODEV) if *port* invalid.
> + *   - (-EINVAL) if bad parameter.
> + */
> +int rte_pmd_bnxt_set_vf_persist_stats(uint8_t port, uint16_t vf, uint8_t on);
>  #endif /* _PMD_BNXT_H_ */
> 

This patch adds a new PMD specific API, .map file should be updated too
for shared library builds.

This is not easy to catch because API not used anywhere, what do you
think updating testpmd to use this API, which also lets testing the API?

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

* Re: [PATCH 6/7] net/bnxt: fix some link related issues
  2017-06-29  2:51 ` [PATCH 6/7] net/bnxt: fix some link related issues Ajit Khaparde
@ 2017-06-29 10:55   ` Ferruh Yigit
  2017-06-30  2:27     ` Ajit Khaparde
  2017-06-30 14:20     ` [PATCH v2 0/9] bnxt patch series Ajit Khaparde
  0 siblings, 2 replies; 25+ messages in thread
From: Ferruh Yigit @ 2017-06-29 10:55 UTC (permalink / raw)
  To: Ajit Khaparde, dev; +Cc: Stephen Hurd

On 6/29/2017 3:51 AM, Ajit Khaparde wrote:
> This patch fixes some link related issues that can occur because:
> 
> bnxt_hwrm_port_phy_cfg() was setting enables inappropriately.
> bnxt_hwrm_port_phy_qcfg() was overly complex.
> bnxt_get_hwrm_link_config() was basing the speed on the link status.
> bnxt_get_hwrm_link_config() was using the incorrect macros for auto_mode
> we are not using supported speeds from phy_qcfg for auto mask.

Does it make sense to split patch per issue fixed?

> 
> Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")
> 
> Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
<...>

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

* Re: [PATCH 2/7] net/bnxt: fix mtu configuration for the function
  2017-06-29  2:51 ` [PATCH 2/7] net/bnxt: fix mtu configuration for the function Ajit Khaparde
@ 2017-06-29 10:55   ` Ferruh Yigit
  2017-06-30  2:27     ` Ajit Khaparde
  0 siblings, 1 reply; 25+ messages in thread
From: Ferruh Yigit @ 2017-06-29 10:55 UTC (permalink / raw)
  To: Ajit Khaparde, dev

On 6/29/2017 3:51 AM, Ajit Khaparde wrote:
> Set the MTU of the device to MAX size possible.

What was the failure with existing code?

> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

Can you please add the Fixes tag.

> ---
>  drivers/net/bnxt/bnxt_hwrm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
> index e237041..580b2d8 100644
> --- a/drivers/net/bnxt/bnxt_hwrm.c
> +++ b/drivers/net/bnxt/bnxt_hwrm.c
> @@ -2023,8 +2023,7 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp, int tx_rings)
>  			HWRM_FUNC_CFG_INPUT_ENABLES_NUM_VNICS |
>  			HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS);
>  	req.flags = rte_cpu_to_le_32(bp->pf.func_cfg_flags);
> -	req.mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
> -				   ETHER_CRC_LEN + VLAN_TAG_SIZE);
> +	req.mtu = rte_cpu_to_le_16(BNXT_MAX_MTU);

Just question, would this cause larger frames than expected in application?

>  	req.mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
>  				   ETHER_CRC_LEN + VLAN_TAG_SIZE);
>  	req.num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx);
> 

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

* Re: [PATCH 7/7] net/bnxt: fix copy/pasted error message
  2017-06-29  2:51 ` [PATCH 7/7] net/bnxt: fix copy/pasted error message Ajit Khaparde
@ 2017-06-29 10:56   ` Ferruh Yigit
  0 siblings, 0 replies; 25+ messages in thread
From: Ferruh Yigit @ 2017-06-29 10:56 UTC (permalink / raw)
  To: Ajit Khaparde, dev; +Cc: Stephen Hurd

On 6/29/2017 3:51 AM, Ajit Khaparde wrote:
> Fix an error message. Probably a copy/paste error.

Can you please add Fixes tag?

> 
> Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
<...>

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

* Re: [PATCH 2/7] net/bnxt: fix mtu configuration for the function
  2017-06-29 10:55   ` Ferruh Yigit
@ 2017-06-30  2:27     ` Ajit Khaparde
  0 siblings, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-30  2:27 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev

On Thu, Jun 29, 2017 at 5:55 AM, Ferruh Yigit <ferruh.yigit@intel.com>
wrote:

> Just question, would this cause larger frames than expected in application?


No. It just initializes the hardware early. T​he bp->eth_dev->data->mtu
still
controls what goes to the application.

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

* Re: [PATCH 6/7] net/bnxt: fix some link related issues
  2017-06-29 10:55   ` Ferruh Yigit
@ 2017-06-30  2:27     ` Ajit Khaparde
  2017-06-30 14:20     ` [PATCH v2 0/9] bnxt patch series Ajit Khaparde
  1 sibling, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-30  2:27 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Stephen Hurd

On Thu, Jun 29, 2017 at 5:55 AM, Ferruh Yigit <ferruh.yigit@intel.com>
wrote:

> On 6/29/2017 3:51 AM, Ajit Khaparde wrote:
> > This patch fixes some link related issues that can occur because:
> >
> > bnxt_hwrm_port_phy_cfg() was setting enables inappropriately.
> > bnxt_hwrm_port_phy_qcfg() was overly complex.
> > bnxt_get_hwrm_link_config() was basing the speed on the link status.
> > bnxt_get_hwrm_link_config() was using the incorrect macros for auto_mode
> > we are not using supported speeds from phy_qcfg for auto mask.
>
> Does it make sense to split patch per issue fixed?
>
Sure. Working on that. Thanks
​


>
> >
> > Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")
> >
> > Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
> > Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> <...>
>
>

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

* [PATCH v2 0/9] bnxt patch series
  2017-06-29 10:55   ` Ferruh Yigit
  2017-06-30  2:27     ` Ajit Khaparde
@ 2017-06-30 14:20     ` Ajit Khaparde
  2017-06-30 14:20       ` [PATCH v2 1/9] net/bnxt: add support for Stratus VF device Ajit Khaparde
                         ` (9 more replies)
  1 sibling, 10 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-30 14:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

The first patch of the series adds support for a new device.
Rest of the patches in the patchset fix some of the issues
found during testing.

v1->v2: incorporate review comments

  net/bnxt: add support for Stratus VF device
  net/bnxt: fix mtu configuration for the function
  net/bnxt: fix calculation of VNICs
  net/bnxt: pass func_default flag to VNIC_ALLOC
  net/bnxt: fix automatic clearing of VF stats
  net/bnxt: fix get link config
  net/bnxt: fix autoneg on 10GBase-T links
  net/bnxt: fix set link config
  net/bnxt: fix copy/pasted error message

 drivers/net/bnxt/bnxt.h                   |   5 ++
 drivers/net/bnxt/bnxt_ethdev.c            |   6 +-
 drivers/net/bnxt/bnxt_hwrm.c              | 132 +++++++++++++++++++++++-------
 drivers/net/bnxt/bnxt_hwrm.h              |   5 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h    |  19 +++++
 drivers/net/bnxt/rte_pmd_bnxt.c           |  63 ++++++++++++--
 drivers/net/bnxt/rte_pmd_bnxt.h           |  18 ++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map |   1 +
 8 files changed, 209 insertions(+), 40 deletions(-)

-- 
2.10.1 (Apple Git-78)

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

* [PATCH v2 1/9] net/bnxt: add support for Stratus VF device
  2017-06-30 14:20     ` [PATCH v2 0/9] bnxt patch series Ajit Khaparde
@ 2017-06-30 14:20       ` Ajit Khaparde
  2017-06-30 14:20       ` [PATCH v2 2/9] net/bnxt: fix mtu configuration for the function Ajit Khaparde
                         ` (8 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-30 14:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

This patch adds support for Stratus VF devices.
Other than adding the VF device ID, we also are adding
support for short message format.

The new short firmware message of size 16 bytes points to a location
in host memory that contains the firmware message that the driver
wants the adapter to process. This indirection requires the
firmware to DMA the message into its own memory for processing.

When the firmware receives a Short Command Format, it will DMA the
firmware message from host memory into its internal memory and then
processes the message as it would have if it received the message
directly in the firmware communication channel.

With BCM57454, the number of VFs increase to 1K and so the requirement
for firmware communication channel memory on adapter becomes expensive.
The short firmware message saves the amount of memory required to support
1K VFs on adapter.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h                |  4 +++
 drivers/net/bnxt/bnxt_ethdev.c         |  6 +++-
 drivers/net/bnxt/bnxt_hwrm.c           | 64 ++++++++++++++++++++++++++++++++--
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 10 ++++++
 4 files changed, 80 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 1538aa5..d39baf1 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -162,6 +162,7 @@ struct bnxt_cos_queue_info {
 	uint8_t	profile;
 };
 
+#define BNXT_HWRM_SHORT_REQ_LEN		sizeof(struct hwrm_short_input)
 struct bnxt {
 	void				*bar0;
 
@@ -173,6 +174,7 @@ struct bnxt {
 #define BNXT_FLAG_VF		(1 << 1)
 #define BNXT_FLAG_PORT_STATS	(1 << 2)
 #define BNXT_FLAG_JUMBO		(1 << 3)
+#define BNXT_FLAG_SHORT_CMD	(1 << 4)
 #define BNXT_PF(bp)		(!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)		((bp)->flags & BNXT_FLAG_VF)
 #define BNXT_NPAR_ENABLED(bp)	((bp)->port_partition_type)
@@ -217,6 +219,8 @@ struct bnxt {
 	uint16_t			hwrm_cmd_seq;
 	void				*hwrm_cmd_resp_addr;
 	phys_addr_t			hwrm_cmd_resp_dma_addr;
+	void				*hwrm_short_cmd_req_addr;
+	phys_addr_t			hwrm_short_cmd_req_dma_addr;
 	rte_spinlock_t			hwrm_lock;
 	uint16_t			max_req_len;
 	uint16_t			max_resp_len;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index a2d46ee..c9d1122 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -60,6 +60,7 @@ static const char bnxt_version[] =
 
 #define PCI_VENDOR_ID_BROADCOM 0x14E4
 
+#define BROADCOM_DEV_ID_STRATUS_NIC_VF 0x1609
 #define BROADCOM_DEV_ID_STRATUS_NIC 0x1614
 #define BROADCOM_DEV_ID_57414_VF 0x16c1
 #define BROADCOM_DEV_ID_57301 0x16c8
@@ -96,6 +97,8 @@ static const char bnxt_version[] =
 #define BROADCOM_DEV_ID_57416_MF 0x16ee
 
 static const struct rte_pci_id bnxt_pci_id_map[] = {
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM,
+			 BROADCOM_DEV_ID_STRATUS_NIC_VF) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_STRATUS_NIC) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57414_VF) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57301) },
@@ -1569,7 +1572,8 @@ static bool bnxt_vf_pciid(uint16_t id)
 	    id == BROADCOM_DEV_ID_57406_VF ||
 	    id == BROADCOM_DEV_ID_5731X_VF ||
 	    id == BROADCOM_DEV_ID_5741X_VF ||
-	    id == BROADCOM_DEV_ID_57414_VF)
+	    id == BROADCOM_DEV_ID_57414_VF ||
+	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF)
 		return true;
 	return false;
 }
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index f45b883..e237041 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -106,6 +106,30 @@ static int bnxt_hwrm_send_message_locked(struct bnxt *bp, void *msg,
 	uint32_t *data = msg;
 	uint8_t *bar;
 	uint8_t *valid;
+	uint16_t max_req_len = bp->max_req_len;
+	struct hwrm_short_input short_input = { 0 };
+
+	if (bp->flags & BNXT_FLAG_SHORT_CMD) {
+		void *short_cmd_req = bp->hwrm_short_cmd_req_addr;
+
+		memset(short_cmd_req, 0, bp->max_req_len);
+		memcpy(short_cmd_req, req, msg_len);
+
+		short_input.req_type = rte_cpu_to_le_16(req->req_type);
+		short_input.signature = rte_cpu_to_le_16(
+					HWRM_SHORT_REQ_SIGNATURE_SHORT_CMD);
+		short_input.size = rte_cpu_to_le_16(msg_len);
+		short_input.req_addr =
+			rte_cpu_to_le_64(bp->hwrm_short_cmd_req_dma_addr);
+
+		data = (uint32_t *)&short_input;
+		msg_len = sizeof(short_input);
+
+		/* Sync memory write before updating doorbell */
+		rte_wmb();
+
+		max_req_len = BNXT_HWRM_SHORT_REQ_LEN;
+	}
 
 	/* Write request msg to hwrm channel */
 	for (i = 0; i < msg_len; i += 4) {
@@ -115,7 +139,7 @@ static int bnxt_hwrm_send_message_locked(struct bnxt *bp, void *msg,
 	}
 
 	/* Zero the rest of the request space */
-	for (; i < bp->max_req_len; i += 4) {
+	for (; i < max_req_len; i += 4) {
 		bar = (uint8_t *)bp->bar0 + i;
 		rte_write32(0, bar);
 	}
@@ -457,7 +481,9 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 	uint32_t fw_version;
 	uint16_t max_resp_len;
 	char type[RTE_MEMZONE_NAMESIZE];
+	uint32_t dev_caps_cfg;
 
+	bp->max_req_len = HWRM_MAX_REQ_LEN;
 	HWRM_PREP(req, VER_GET, -1, resp);
 
 	req.hwrm_intf_maj = HWRM_VERSION_MAJOR;
@@ -514,8 +540,10 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 		RTE_LOG(ERR, PMD, "Unsupported request length\n");
 		rc = -EINVAL;
 	}
-	bp->max_req_len = resp->max_req_win_len;
+	bp->max_req_len = rte_le_to_cpu_16(resp->max_req_win_len);
 	max_resp_len = resp->max_resp_len;
+	dev_caps_cfg = rte_le_to_cpu_32(resp->dev_caps_cfg);
+
 	if (bp->max_resp_len != max_resp_len) {
 		sprintf(type, "bnxt_hwrm_%04x:%02x:%02x:%02x",
 			bp->pdev->addr.domain, bp->pdev->addr.bus,
@@ -540,6 +568,34 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 		bp->max_resp_len = max_resp_len;
 	}
 
+	if ((dev_caps_cfg &
+		HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_SUPPORTED) &&
+	    (dev_caps_cfg &
+	     HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_INPUTUIRED)) {
+		RTE_LOG(DEBUG, PMD, "Short command supported\n");
+
+		rte_free(bp->hwrm_short_cmd_req_addr);
+
+		bp->hwrm_short_cmd_req_addr = rte_malloc(type,
+							bp->max_req_len, 0);
+		if (bp->hwrm_short_cmd_req_addr == NULL) {
+			rc = -ENOMEM;
+			goto error;
+		}
+		rte_mem_lock_page(bp->hwrm_short_cmd_req_addr);
+		bp->hwrm_short_cmd_req_dma_addr =
+			rte_mem_virt2phy(bp->hwrm_short_cmd_req_addr);
+		if (bp->hwrm_short_cmd_req_dma_addr == 0) {
+			rte_free(bp->hwrm_short_cmd_req_addr);
+			RTE_LOG(ERR, PMD,
+				"Unable to map buffer to physical memory.\n");
+			rc = -ENOMEM;
+			goto error;
+		}
+
+		bp->flags |= BNXT_FLAG_SHORT_CMD;
+	}
+
 error:
 	rte_spinlock_unlock(&bp->hwrm_lock);
 	return rc;
@@ -1529,8 +1585,11 @@ void bnxt_free_hwrm_resources(struct bnxt *bp)
 {
 	/* Release memzone */
 	rte_free(bp->hwrm_cmd_resp_addr);
+	rte_free(bp->hwrm_short_cmd_req_addr);
 	bp->hwrm_cmd_resp_addr = NULL;
+	bp->hwrm_short_cmd_req_addr = NULL;
 	bp->hwrm_cmd_resp_dma_addr = 0;
+	bp->hwrm_short_cmd_req_dma_addr = 0;
 }
 
 int bnxt_alloc_hwrm_resources(struct bnxt *bp)
@@ -1540,7 +1599,6 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp)
 
 	sprintf(type, "bnxt_hwrm_%04x:%02x:%02x:%02x", pdev->addr.domain,
 		pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
-	bp->max_req_len = HWRM_MAX_REQ_LEN;
 	bp->max_resp_len = HWRM_MAX_RESP_LEN;
 	bp->hwrm_cmd_resp_addr = rte_malloc(type, bp->max_resp_len, 0);
 	rte_mem_lock_page(bp->hwrm_cmd_resp_addr);
diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h
index e082d33..c2335d0 100644
--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
@@ -10300,6 +10300,16 @@ struct output {
 	 */
 } __attribute__((packed));
 
+/* Short Command Structure (16 bytes) */
+struct hwrm_short_input {
+	uint16_t req_type;
+	uint16_t signature;
+	#define HWRM_SHORT_REQ_SIGNATURE_SHORT_CMD	(UINT32_C(0x4321))
+	uint16_t unused_0;
+	uint16_t size;
+	uint64_t req_addr;
+} __attribute__((packed));
+
 #define HWRM_GET_HWRM_ERROR_CODE(arg) \
 	{ \
 		typeof(arg) x = (arg); \
-- 
2.10.1 (Apple Git-78)

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

* [PATCH v2 2/9] net/bnxt: fix mtu configuration for the function
  2017-06-30 14:20     ` [PATCH v2 0/9] bnxt patch series Ajit Khaparde
  2017-06-30 14:20       ` [PATCH v2 1/9] net/bnxt: add support for Stratus VF device Ajit Khaparde
@ 2017-06-30 14:20       ` Ajit Khaparde
  2017-06-30 14:20       ` [PATCH v2 3/9] net/bnxt: fix calculation of VNICs Ajit Khaparde
                         ` (7 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-30 14:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

Set the MTU of the device to MAX size possible.
Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources
		     for PF/VF")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: Fix the commit log
---
 drivers/net/bnxt/bnxt_hwrm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index e237041..580b2d8 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2023,8 +2023,7 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp, int tx_rings)
 			HWRM_FUNC_CFG_INPUT_ENABLES_NUM_VNICS |
 			HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS);
 	req.flags = rte_cpu_to_le_32(bp->pf.func_cfg_flags);
-	req.mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
-				   ETHER_CRC_LEN + VLAN_TAG_SIZE);
+	req.mtu = rte_cpu_to_le_16(BNXT_MAX_MTU);
 	req.mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
 				   ETHER_CRC_LEN + VLAN_TAG_SIZE);
 	req.num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx);
-- 
2.10.1 (Apple Git-78)

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

* [PATCH v2 3/9] net/bnxt: fix calculation of VNICs
  2017-06-30 14:20     ` [PATCH v2 0/9] bnxt patch series Ajit Khaparde
  2017-06-30 14:20       ` [PATCH v2 1/9] net/bnxt: add support for Stratus VF device Ajit Khaparde
  2017-06-30 14:20       ` [PATCH v2 2/9] net/bnxt: fix mtu configuration for the function Ajit Khaparde
@ 2017-06-30 14:20       ` Ajit Khaparde
  2017-06-30 14:20       ` [PATCH v2 4/9] net/bnxt: pass func_default flag to VNIC_ALLOC Ajit Khaparde
                         ` (6 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-30 14:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Stephen Hurd

We used the default as a work-around for the 4-byte MTU VNICs,
but we filter those out now. So fix the calculation of VNICs
accordingly.

Fixes: ff63ebbb67a7 ("net/bnxt: determine the Rx status of VF")

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: Fix the commit log.
---
 drivers/net/bnxt/bnxt_hwrm.c    | 10 +++++-----
 drivers/net/bnxt/bnxt_hwrm.h    |  2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 580b2d8..7fb9800 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2740,12 +2740,12 @@ int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on)
 	return rc;
 }
 
-static void bnxt_vnic_count(struct bnxt_vnic_info *vnic, void *cbdata)
+static void
+bnxt_vnic_count(struct bnxt_vnic_info *vnic __rte_unused, void *cbdata)
 {
 	uint32_t *count = cbdata;
 
-	if (vnic->func_default)
-		*count = *count + 1;
+	*count = *count + 1;
 }
 
 static int bnxt_vnic_count_hwrm_stub(struct bnxt *bp __rte_unused,
@@ -2754,7 +2754,7 @@ static int bnxt_vnic_count_hwrm_stub(struct bnxt *bp __rte_unused,
 	return 0;
 }
 
-int bnxt_vf_default_vnic_count(struct bnxt *bp, uint16_t vf)
+int bnxt_vf_vnic_count(struct bnxt *bp, uint16_t vf)
 {
 	uint32_t count = 0;
 
@@ -2837,7 +2837,7 @@ int bnxt_hwrm_func_vf_vnic_query_and_config(struct bnxt *bp, uint16_t vf,
 		rc = bnxt_hwrm_vnic_qcfg(bp, &vnic, bp->pf.first_vf_id + vf);
 		if (rc)
 			break;
-		if (vnic.mru == 4)	/* Indicates unallocated */
+		if (vnic.mru <= 4)	/* Indicates unallocated */
 			continue;
 
 		vnic_cb(&vnic, cbdata);
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index a603dda..82cca3a 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -145,7 +145,7 @@ int bnxt_hwrm_port_led_qcaps(struct bnxt *bp);
 int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf);
 void vf_vnic_set_rxmask_cb(struct bnxt_vnic_info *vnic, void *flagp);
 int bnxt_set_rx_mask_no_vlan(struct bnxt *bp, struct bnxt_vnic_info *vnic);
-int bnxt_vf_default_vnic_count(struct bnxt *bp, uint16_t vf);
+int bnxt_vf_vnic_count(struct bnxt *bp, uint16_t vf);
 int bnxt_hwrm_func_vf_vnic_query_and_config(struct bnxt *bp, uint16_t vf,
 	void (*vnic_cb)(struct bnxt_vnic_info *, void *), void *cbdata,
 	int (*hwrm_cb)(struct bnxt *bp, struct bnxt_vnic_info *vnic));
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index faeb6f4..1bd5aee 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -610,7 +610,7 @@ int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id)
 		return -ENOTSUP;
 	}
 
-	return bnxt_vf_default_vnic_count(bp, vf_id);
+	return bnxt_vf_vnic_count(bp, vf_id);
 }
 
 int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
-- 
2.10.1 (Apple Git-78)

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

* [PATCH v2 4/9] net/bnxt: pass func_default flag to VNIC_ALLOC
  2017-06-30 14:20     ` [PATCH v2 0/9] bnxt patch series Ajit Khaparde
                         ` (2 preceding siblings ...)
  2017-06-30 14:20       ` [PATCH v2 3/9] net/bnxt: fix calculation of VNICs Ajit Khaparde
@ 2017-06-30 14:20       ` Ajit Khaparde
  2017-06-30 14:20       ` [PATCH v2 5/9] net/bnxt: fix automatic clearing of VF stats Ajit Khaparde
                         ` (5 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-30 14:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Stephen Hurd

Previously, no VNICs were allocated as the default VNIC,
even if they were configured as one.  This patch fixes that error.

Fixes: db678d5c2b54 ("net/bnxt: add HWRM VNIC configure")

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 7fb9800..eccfe7f 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -970,6 +970,8 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 				ETHER_CRC_LEN + VLAN_TAG_SIZE;
 	HWRM_PREP(req, VNIC_ALLOC, -1, resp);
 
+	if (vnic->func_default)
+		req.flags = HWRM_VNIC_ALLOC_INPUT_FLAGS_DEFAULT;
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
 
 	HWRM_CHECK_RESULT;
-- 
2.10.1 (Apple Git-78)

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

* [PATCH v2 5/9] net/bnxt: fix automatic clearing of VF stats
  2017-06-30 14:20     ` [PATCH v2 0/9] bnxt patch series Ajit Khaparde
                         ` (3 preceding siblings ...)
  2017-06-30 14:20       ` [PATCH v2 4/9] net/bnxt: pass func_default flag to VNIC_ALLOC Ajit Khaparde
@ 2017-06-30 14:20       ` Ajit Khaparde
  2017-06-30 14:20       ` [PATCH v2 6/9] net/bnxt: fix get link config Ajit Khaparde
                         ` (4 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-30 14:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Stephen Hurd

Add code to avoid automatic clearing of VF stats on a function
reset or a stat context free.

Fixes: dd46c6bbd5d6 ("net/bnxt: support get and clear VF specific stats")
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: Update the appropriate .map file
---
 drivers/net/bnxt/bnxt.h                   |  1 +
 drivers/net/bnxt/bnxt_hwrm.c              |  5 +--
 drivers/net/bnxt/bnxt_hwrm.h              |  3 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h    |  9 +++++
 drivers/net/bnxt/rte_pmd_bnxt.c           | 59 ++++++++++++++++++++++++++++---
 drivers/net/bnxt/rte_pmd_bnxt.h           | 18 ++++++++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map |  1 +
 7 files changed, 89 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index d39baf1..44b1ac5 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -109,6 +109,7 @@ struct bnxt_child_vf_info {
 	uint8_t			mac_spoof_en;
 	uint8_t			vlan_spoof_en;
 	bool			random_mac;
+	bool			persist_stats;
 };
 
 struct bnxt_pf_info {
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index eccfe7f..3d2d408 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2367,7 +2367,8 @@ int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, uint16_t port,
 	return rc;
 }
 
-int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf)
+int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf,
+					uint32_t flags)
 {
 	struct hwrm_func_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 	struct hwrm_func_cfg_input req = {0};
@@ -2375,7 +2376,7 @@ int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf)
 
 	HWRM_PREP(req, FUNC_CFG, -1, resp);
 	req.fid = rte_cpu_to_le_16(bp->pf.vf_info[vf].fid);
-	req.flags = rte_cpu_to_le_32(bp->pf.vf_info[vf].func_cfg_flags);
+	req.flags = rte_cpu_to_le_32(flags);
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
 	HWRM_CHECK_RESULT;
 
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index 82cca3a..dd0999a 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -142,7 +142,8 @@ int bnxt_hwrm_port_qstats(struct bnxt *bp);
 int bnxt_hwrm_port_clr_stats(struct bnxt *bp);
 int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on);
 int bnxt_hwrm_port_led_qcaps(struct bnxt *bp);
-int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf);
+int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf,
+					uint32_t flags);
 void vf_vnic_set_rxmask_cb(struct bnxt_vnic_info *vnic, void *flagp);
 int bnxt_set_rx_mask_no_vlan(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_vf_vnic_count(struct bnxt *bp, uint16_t vf);
diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h
index c2335d0..1eb8d33 100644
--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
@@ -3190,6 +3190,15 @@ struct hwrm_func_cfg_input {
 	 * command will be persistent over warm boot.
 	 */
 	#define HWRM_FUNC_CFG_INPUT_FLAGS_VIRT_MAC_PERSIST	UINT32_C(0x800)
+	/*
+	 * This bit only applies to the VF. If this bit is set, the
+	 * statistic context counters will not be cleared when the
+	 * statistic context is freed or a function reset is called on
+	 * VF. This bit will be cleared when the PF is unloaded or a
+	 * function reset is called on the PF.
+	 */
+	#define HWRM_FUNC_CFG_INPUT_FLAGS_NO_AUTOCLEAR_STATISTIC	\
+		UINT32_C(0x1000)
 	uint32_t enables;
 	/* This bit must be '1' for the mtu field to be configured. */
 	#define HWRM_FUNC_CFG_INPUT_ENABLES_MTU	UINT32_C(0x1)
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 1bd5aee..1903101 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -274,6 +274,8 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
 		return 0;
 
 	func_flags = bp->pf.vf_info[vf].func_cfg_flags;
+	func_flags &= ~(HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_ENABLE |
+	    HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE);
 
 	if (on)
 		func_flags |=
@@ -282,11 +284,11 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
 		func_flags |=
 			HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE;
 
-	bp->pf.vf_info[vf].func_cfg_flags = func_flags;
-
-	rc = bnxt_hwrm_func_cfg_vf_set_flags(bp, vf);
-	if (!rc)
+	rc = bnxt_hwrm_func_cfg_vf_set_flags(bp, vf, func_flags);
+	if (!rc) {
 		bp->pf.vf_info[vf].mac_spoof_en = on;
+		bp->pf.vf_info[vf].func_cfg_flags = func_flags;
+	}
 
 	return rc;
 }
@@ -754,3 +756,52 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint8_t port, uint16_t vf,
 
 	return rc;
 }
+
+int rte_pmd_bnxt_set_vf_persist_stats(uint8_t port, uint16_t vf, uint8_t on)
+{
+	struct rte_eth_dev_info dev_info;
+	struct rte_eth_dev *dev;
+	uint32_t func_flags;
+	struct bnxt *bp;
+	int rc;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	if (on > 1)
+		return -EINVAL;
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+	bp = (struct bnxt *)dev->data->dev_private;
+
+	if (!BNXT_PF(bp)) {
+		RTE_LOG(ERR, PMD,
+			"Attempt to set persist stats on non-PF port %d!\n",
+			port);
+		return -EINVAL;
+	}
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	/* Prev setting same as new setting. */
+	if (on == bp->pf.vf_info[vf].persist_stats)
+		return 0;
+
+	func_flags = bp->pf.vf_info[vf].func_cfg_flags;
+
+	if (on)
+		func_flags |=
+			HWRM_FUNC_CFG_INPUT_FLAGS_NO_AUTOCLEAR_STATISTIC;
+	else
+		func_flags &=
+			~HWRM_FUNC_CFG_INPUT_FLAGS_NO_AUTOCLEAR_STATISTIC;
+
+	rc = bnxt_hwrm_func_cfg_vf_set_flags(bp, vf, func_flags);
+	if (!rc) {
+		bp->pf.vf_info[vf].persist_stats = on;
+		bp->pf.vf_info[vf].func_cfg_flags = func_flags;
+	}
+
+	return rc;
+}
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h
index 964aa97..c4c4770 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.h
+++ b/drivers/net/bnxt/rte_pmd_bnxt.h
@@ -333,4 +333,22 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
  */
 int rte_pmd_bnxt_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
 				uint32_t vf_id);
+
+/**
+ * Enable/Disable VF statistics retention
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @param on
+ *    1 - Prevent VF statistics from automatically resetting
+ *    0 - Allow VF statistics to automatically reset
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_bnxt_set_vf_persist_stats(uint8_t port, uint16_t vf, uint8_t on);
 #endif /* _PMD_BNXT_H_ */
diff --git a/drivers/net/bnxt/rte_pmd_bnxt_version.map b/drivers/net/bnxt/rte_pmd_bnxt_version.map
index 974e240..4750d40 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt_version.map
+++ b/drivers/net/bnxt/rte_pmd_bnxt_version.map
@@ -16,6 +16,7 @@ DPDK_17.08 {
 	rte_pmd_bnxt_set_vf_vlan_filter;
 	rte_pmd_bnxt_set_vf_vlan_insert;
 	rte_pmd_bnxt_set_vf_vlan_stripq;
+	rte_pmd_bnxt_set_vf_persist_stats;
 
 	local: *;
 };
-- 
2.10.1 (Apple Git-78)

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

* [PATCH v2 6/9] net/bnxt: fix get link config
  2017-06-30 14:20     ` [PATCH v2 0/9] bnxt patch series Ajit Khaparde
                         ` (4 preceding siblings ...)
  2017-06-30 14:20       ` [PATCH v2 5/9] net/bnxt: fix automatic clearing of VF stats Ajit Khaparde
@ 2017-06-30 14:20       ` Ajit Khaparde
  2017-06-30 14:20       ` [PATCH v2 7/9] net/bnxt: fix autoneg on 10GBase-T links Ajit Khaparde
                         ` (3 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-30 14:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Stephen Hurd

This patch fixes the get link configuration code.
bnxt_get_hwrm_link_config was using wrong macros and wrongly
deriving link speed based on link status which was causing
incorrect link information to be displayed in few scenarios.

Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: split the patch into relevant patches based on code review
---
 drivers/net/bnxt/bnxt_hwrm.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 3d2d408..9b00b60 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -686,13 +686,10 @@ static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp,
 	HWRM_CHECK_RESULT;
 
 	link_info->phy_link_status = resp->link;
-	if (link_info->phy_link_status == HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK) {
-		link_info->link_up = 1;
-		link_info->link_speed = rte_le_to_cpu_16(resp->link_speed);
-	} else {
-		link_info->link_up = 0;
-		link_info->link_speed = 0;
-	}
+	link_info->link_up =
+		(link_info->phy_link_status ==
+		 HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK) ? 1 : 0;
+	link_info->link_speed = rte_le_to_cpu_16(resp->link_speed);
 	link_info->duplex = resp->duplex;
 	link_info->pause = resp->pause;
 	link_info->auto_pause = resp->auto_pause;
@@ -1887,7 +1884,7 @@ int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link)
 			"Get link config failed with rc %d\n", rc);
 		goto exit;
 	}
-	if (link_info->link_up)
+	if (link_info->link_speed)
 		link->link_speed =
 			bnxt_parse_hw_link_speed(link_info->link_speed);
 	else
@@ -1896,7 +1893,7 @@ int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link)
 	link->link_status = link_info->link_up;
 	link->link_autoneg = link_info->auto_mode ==
 		HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE ?
-		ETH_LINK_SPEED_FIXED : ETH_LINK_SPEED_AUTONEG;
+		ETH_LINK_FIXED : ETH_LINK_AUTONEG;
 exit:
 	return rc;
 }
-- 
2.10.1 (Apple Git-78)

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

* [PATCH v2 7/9] net/bnxt: fix autoneg on 10GBase-T links
  2017-06-30 14:20     ` [PATCH v2 0/9] bnxt patch series Ajit Khaparde
                         ` (5 preceding siblings ...)
  2017-06-30 14:20       ` [PATCH v2 6/9] net/bnxt: fix get link config Ajit Khaparde
@ 2017-06-30 14:20       ` Ajit Khaparde
  2017-06-30 14:20       ` [PATCH v2 8/9] net/bnxt: fix set link config Ajit Khaparde
                         ` (2 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-30 14:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Stephen Hurd

We are not passing proper speed mask causing autoneg to not work
properly on 10GBase-T links. Use supported speeds from phy_qcfg
for auto mask to fix this.

Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: split the patch into relevant patches based on code review
---
 drivers/net/bnxt/bnxt_hwrm.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 9b00b60..85ef0e3 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1787,12 +1787,16 @@ static int bnxt_valid_link_speed(uint32_t link_speed, uint8_t port_id)
 	return 0;
 }
 
-static uint16_t bnxt_parse_eth_link_speed_mask(uint32_t link_speed)
+static uint16_t
+bnxt_parse_eth_link_speed_mask(struct bnxt *bp, uint32_t link_speed)
 {
 	uint16_t ret = 0;
 
-	if (link_speed == ETH_LINK_SPEED_AUTONEG)
+	if (link_speed == ETH_LINK_SPEED_AUTONEG) {
+		if (bp->link_info.support_speeds)
+			return bp->link_info.support_speeds;
 		link_speed = BNXT_SUPPORTED_SPEEDS;
+	}
 
 	if (link_speed & ETH_LINK_SPEED_100M)
 		ret |= HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MB;
@@ -1926,7 +1930,8 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 		link_req.auto_mode =
 				HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK;
 		link_req.auto_link_speed_mask =
-			bnxt_parse_eth_link_speed_mask(dev_conf->link_speeds);
+			bnxt_parse_eth_link_speed_mask(bp,
+						       dev_conf->link_speeds);
 	} else {
 		link_req.phy_flags |= HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE;
 		link_req.link_speed = speed;
-- 
2.10.1 (Apple Git-78)

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

* [PATCH v2 8/9] net/bnxt: fix set link config
  2017-06-30 14:20     ` [PATCH v2 0/9] bnxt patch series Ajit Khaparde
                         ` (6 preceding siblings ...)
  2017-06-30 14:20       ` [PATCH v2 7/9] net/bnxt: fix autoneg on 10GBase-T links Ajit Khaparde
@ 2017-06-30 14:20       ` Ajit Khaparde
  2017-06-30 14:20       ` [PATCH v2 9/9] net/bnxt: fix copy/pasted error message Ajit Khaparde
  2017-07-03  9:40       ` [PATCH v2 0/9] bnxt patch series Ferruh Yigit
  9 siblings, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-30 14:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Stephen Hurd

bnxt_hwrm_port_phy_cfg() was not setting enables appropriately.
This was causing undesired issues with link config.
This patch takes care of that.

Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: split the patch into relevant patches based on code review
---
 drivers/net/bnxt/bnxt_hwrm.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 85ef0e3..da078f9 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -628,6 +628,8 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)
 	struct hwrm_port_phy_cfg_input req = {0};
 	struct hwrm_port_phy_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 	uint32_t enables = 0;
+	uint32_t link_speed_mask =
+		HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK;
 
 	HWRM_PREP(req, PORT_PHY_CFG, -1, resp);
 
@@ -639,14 +641,20 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)
 		 * any auto mode, even "none".
 		 */
 		if (!conf->link_speed) {
-			req.auto_mode |= conf->auto_mode;
-			enables = HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE;
-			req.auto_link_speed_mask = conf->auto_link_speed_mask;
-			enables |=
-			   HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK;
-			req.auto_link_speed = bp->link_info.auto_link_speed;
-			enables |=
+			req.auto_mode = conf->auto_mode;
+			enables |= HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE;
+			if (conf->auto_mode ==
+			    HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK) {
+				req.auto_link_speed_mask =
+					conf->auto_link_speed_mask;
+				enables |= link_speed_mask;
+			}
+			if (bp->link_info.auto_link_speed) {
+				req.auto_link_speed =
+					bp->link_info.auto_link_speed;
+				enables |=
 				HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED;
+			}
 		}
 		req.auto_duplex = conf->duplex;
 		enables |= HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_DUPLEX;
-- 
2.10.1 (Apple Git-78)

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

* [PATCH v2 9/9] net/bnxt: fix copy/pasted error message
  2017-06-30 14:20     ` [PATCH v2 0/9] bnxt patch series Ajit Khaparde
                         ` (7 preceding siblings ...)
  2017-06-30 14:20       ` [PATCH v2 8/9] net/bnxt: fix set link config Ajit Khaparde
@ 2017-06-30 14:20       ` Ajit Khaparde
  2017-07-03  9:40       ` [PATCH v2 0/9] bnxt patch series Ferruh Yigit
  9 siblings, 0 replies; 25+ messages in thread
From: Ajit Khaparde @ 2017-06-30 14:20 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Stephen Hurd

Fix an error message. Probably a copy/paste error.

Fixes: 36735a932ca7 ("support set VF QOS and MAC anti spoof")

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: Fix the commit log
---
 drivers/net/bnxt/rte_pmd_bnxt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 1903101..1131f53 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -316,7 +316,7 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
 
 	if (!BNXT_PF(bp)) {
 		RTE_LOG(ERR, PMD,
-			"Attempt to set mac spoof on non-PF port %d!\n", port);
+			"Attempt to set VLAN spoof on non-PF port %d!\n", port);
 		return -EINVAL;
 	}
 
-- 
2.10.1 (Apple Git-78)

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

* Re: [PATCH v2 0/9] bnxt patch series
  2017-06-30 14:20     ` [PATCH v2 0/9] bnxt patch series Ajit Khaparde
                         ` (8 preceding siblings ...)
  2017-06-30 14:20       ` [PATCH v2 9/9] net/bnxt: fix copy/pasted error message Ajit Khaparde
@ 2017-07-03  9:40       ` Ferruh Yigit
  9 siblings, 0 replies; 25+ messages in thread
From: Ferruh Yigit @ 2017-07-03  9:40 UTC (permalink / raw)
  To: Ajit Khaparde, dev

On 6/30/2017 3:20 PM, Ajit Khaparde wrote:
> The first patch of the series adds support for a new device.
> Rest of the patches in the patchset fix some of the issues
> found during testing.
> 
> v1->v2: incorporate review comments
> 
>   net/bnxt: add support for Stratus VF device
>   net/bnxt: fix mtu configuration for the function
>   net/bnxt: fix calculation of VNICs
>   net/bnxt: pass func_default flag to VNIC_ALLOC
>   net/bnxt: fix automatic clearing of VF stats
>   net/bnxt: fix get link config
>   net/bnxt: fix autoneg on 10GBase-T links
>   net/bnxt: fix set link config
>   net/bnxt: fix copy/pasted error message

Series applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2017-07-03  9:41 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29  2:51 [PATCH 0/7] bnxt patch series Ajit Khaparde
2017-06-29  2:51 ` [PATCH 1/7] net/bnxt: add support for Stratus VF device Ajit Khaparde
2017-06-29  2:51 ` [PATCH 2/7] net/bnxt: fix mtu configuration for the function Ajit Khaparde
2017-06-29 10:55   ` Ferruh Yigit
2017-06-30  2:27     ` Ajit Khaparde
2017-06-29  2:51 ` [PATCH 3/7] net/bnxt: fix calculation of VNICs Ajit Khaparde
2017-06-29  2:51 ` [PATCH 4/7] net/bnxt: pass func_default flag to VNIC_ALLOC Ajit Khaparde
2017-06-29  2:51 ` [PATCH 5/7] net/bnxt: fix automatic clearing of VF stats Ajit Khaparde
2017-06-29 10:53   ` Ferruh Yigit
2017-06-29  2:51 ` [PATCH 6/7] net/bnxt: fix some link related issues Ajit Khaparde
2017-06-29 10:55   ` Ferruh Yigit
2017-06-30  2:27     ` Ajit Khaparde
2017-06-30 14:20     ` [PATCH v2 0/9] bnxt patch series Ajit Khaparde
2017-06-30 14:20       ` [PATCH v2 1/9] net/bnxt: add support for Stratus VF device Ajit Khaparde
2017-06-30 14:20       ` [PATCH v2 2/9] net/bnxt: fix mtu configuration for the function Ajit Khaparde
2017-06-30 14:20       ` [PATCH v2 3/9] net/bnxt: fix calculation of VNICs Ajit Khaparde
2017-06-30 14:20       ` [PATCH v2 4/9] net/bnxt: pass func_default flag to VNIC_ALLOC Ajit Khaparde
2017-06-30 14:20       ` [PATCH v2 5/9] net/bnxt: fix automatic clearing of VF stats Ajit Khaparde
2017-06-30 14:20       ` [PATCH v2 6/9] net/bnxt: fix get link config Ajit Khaparde
2017-06-30 14:20       ` [PATCH v2 7/9] net/bnxt: fix autoneg on 10GBase-T links Ajit Khaparde
2017-06-30 14:20       ` [PATCH v2 8/9] net/bnxt: fix set link config Ajit Khaparde
2017-06-30 14:20       ` [PATCH v2 9/9] net/bnxt: fix copy/pasted error message Ajit Khaparde
2017-07-03  9:40       ` [PATCH v2 0/9] bnxt patch series Ferruh Yigit
2017-06-29  2:51 ` [PATCH 7/7] net/bnxt: fix copy/pasted error message Ajit Khaparde
2017-06-29 10:56   ` Ferruh Yigit

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.