Skip to contentSkip to conversation

bnxt patch series

PATCH In review Ajit Khaparde 2 participants 25 messages Jun 29, 2017 – Jul 3, 2017 Network drivers

lore
Share & tools
lore
#0 lore raw

cover bnxt patch series

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(-)
Signature · 1 line
2.10.1 (Apple Git-78)
#1 lore raw

PATCH 1/7 net/bnxt: add support for Stratus VF device

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.

---
 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(-)
drivers/net/bnxt/bnxt.h +4 -0
index 1538aa5..d39baf1 100644
@@ -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;
drivers/net/bnxt/bnxt_ethdev.c +5 -1
index a2d46ee..c9d1122 100644
@@ -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;
 }
drivers/net/bnxt/bnxt_hwrm.c +61 -3

110 lines not on this page · raw message

drivers/net/bnxt/hsi_struct_def_dpdk.h +10 -0
index e082d33..c2335d0 100644
@@ -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); \
Signature · 1 line
2.10.1 (Apple Git-78)
#2 lore raw

PATCH 2/7 net/bnxt: fix mtu configuration for the function

In reply to Ajit Khaparde

Set the MTU of the device to MAX size possible.

---
 drivers/net/bnxt/bnxt_hwrm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +1 -2
index e237041..580b2d8 100644
@@ -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);
Signature · 1 line
2.10.1 (Apple Git-78)
#3 lore raw

Re: [PATCH 2/7] net/bnxt: fix mtu configuration for the function

Quoted 1 line · Ajit Khaparde

Set the MTU of the device to MAX size possible.

What was the failure with existing code?

Quoted 1 line

Can you please add the Fixes tag.

Quoted 9 lines
---
 drivers/net/bnxt/bnxt_hwrm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +0 -0
index e237041..580b2d8 100644

drivers/net/bnxt/bnxt_hwrm.c static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp, int tx_rings) · line 2026

Quoted 6 lines
drivers/net/bnxt/bnxt_hwrm.c +1 -2
@@ -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?

Quoted 4 lines
drivers/net/bnxt/bnxt_hwrm.c +0 -0
 	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);
#4 lore raw

Re: [PATCH 2/7] net/bnxt: fix mtu configuration for the function

Quoted 1 line · Ferruh Yigit

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.

#5 lore raw

PATCH 3/7 net/bnxt: fix calculation of VNICs

In reply to Ajit Khaparde

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")
---
 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(-)
drivers/net/bnxt/bnxt_hwrm.c +5 -5
index 580b2d8..7fb9800 100644
@@ -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);
drivers/net/bnxt/bnxt_hwrm.h +1 -1
index a603dda..82cca3a 100644
@@ -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));
drivers/net/bnxt/rte_pmd_bnxt.c +1 -1
index faeb6f4..1bd5aee 100644
@@ -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,
Signature · 1 line
2.10.1 (Apple Git-78)
#6 lore raw

PATCH 4/7 net/bnxt: pass func_default flag to VNIC_ALLOC

In reply to Ajit Khaparde

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")
---
 drivers/net/bnxt/bnxt_hwrm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +2 -0
index 7fb9800..eccfe7f 100644
@@ -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;
Signature · 1 line
2.10.1 (Apple Git-78)
#7 lore raw

PATCH 5/7 net/bnxt: fix automatic clearing of VF stats

In reply to Ajit Khaparde

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

---
 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(-)
drivers/net/bnxt/bnxt.h +1 -0
index d39baf1..44b1ac5 100644
@@ -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 {
drivers/net/bnxt/bnxt_hwrm.c +3 -2
index eccfe7f..3d2d408 100644
@@ -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;
 
drivers/net/bnxt/bnxt_hwrm.h +2 -1
index 82cca3a..dd0999a 100644
@@ -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);
drivers/net/bnxt/hsi_struct_def_dpdk.h +9 -0
index c2335d0..1eb8d33 100644
@@ -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)
drivers/net/bnxt/rte_pmd_bnxt.c +55 -4

75 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.h +18 -0
index 964aa97..c4c4770 100644
@@ -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_ */
Signature · 1 line
2.10.1 (Apple Git-78)
#8 lore raw

Re: [PATCH 5/7] net/bnxt: fix automatic clearing of VF stats

Quoted 5 lines · Ajit Khaparde

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

<...>

Quoted 10 lines
drivers/net/bnxt/rte_pmd_bnxt.h +9 -0
+
+/**
+ * Enable/Disable VF statistics retention
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @param on

drivers/net/bnxt/rte_pmd_bnxt.h int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id, · line 354

Quoted 10 lines
drivers/net/bnxt/rte_pmd_bnxt.h +9 -0
+ *    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?

#9 lore raw

PATCH 6/7 net/bnxt: fix some link related issues

In reply to Ajit Khaparde

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")
---
 drivers/net/bnxt/bnxt_hwrm.c | 48 ++++++++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 19 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +29 -19
index 3d2d408..da078f9 100644
@@ -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;
Signature · 1 line
2.10.1 (Apple Git-78)
#10 lore raw

Re: [PATCH 6/7] net/bnxt: fix some link related issues

Quoted 7 lines · Ajit Khaparde

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?

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

<...>

#11 lore raw

Re: [PATCH 6/7] net/bnxt: fix some link related issues

Quoted 11 lines · Ferruh Yigit
Quoted 7 lines · Ajit Khaparde

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
​

Quoted 9 lines
Quoted 6 lines
Fixes 7bc8e9a227cc ("net/bnxt: support async link notification")

<...>

#12 lore raw

v2 cover bnxt patch series

In reply to 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(-)
Signature · 1 line
2.10.1 (Apple Git-78)
#13 lore raw

PATCH v2 1/9 net/bnxt: add support for Stratus VF device

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.

---
 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(-)
drivers/net/bnxt/bnxt.h +4 -0
index 1538aa5..d39baf1 100644
@@ -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;
drivers/net/bnxt/bnxt_ethdev.c +5 -1
index a2d46ee..c9d1122 100644
@@ -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;
 }
drivers/net/bnxt/bnxt_hwrm.c +61 -3

110 lines not on this page · raw message

drivers/net/bnxt/hsi_struct_def_dpdk.h +10 -0
index e082d33..c2335d0 100644
@@ -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); \
Signature · 1 line
2.10.1 (Apple Git-78)
#14 lore raw

PATCH v2 2/9 net/bnxt: fix mtu configuration for the function

In reply to Ajit Khaparde

Set the MTU of the device to MAX size possible.

Fixes b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources
		     for PF/VF")

--
v1->v2: Fix the commit log

---
 drivers/net/bnxt/bnxt_hwrm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +1 -2
index e237041..580b2d8 100644
@@ -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);
Signature · 1 line
2.10.1 (Apple Git-78)
#15 lore raw

PATCH v2 3/9 net/bnxt: fix calculation of VNICs

In reply to Ajit Khaparde

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")

--
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(-)
drivers/net/bnxt/bnxt_hwrm.c +5 -5
index 580b2d8..7fb9800 100644
@@ -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);
drivers/net/bnxt/bnxt_hwrm.h +1 -1
index a603dda..82cca3a 100644
@@ -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));
drivers/net/bnxt/rte_pmd_bnxt.c +1 -1
index faeb6f4..1bd5aee 100644
@@ -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,
Signature · 1 line
2.10.1 (Apple Git-78)
#16 lore raw

PATCH v2 4/9 net/bnxt: pass func_default flag to VNIC_ALLOC

In reply to Ajit Khaparde

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")
---
 drivers/net/bnxt/bnxt_hwrm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +2 -0
index 7fb9800..eccfe7f 100644
@@ -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;
Signature · 1 line
2.10.1 (Apple Git-78)
#17 lore raw

PATCH v2 5/9 net/bnxt: fix automatic clearing of VF stats

In reply to Ajit Khaparde

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")

--
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(-)
drivers/net/bnxt/bnxt.h +1 -0
index d39baf1..44b1ac5 100644
@@ -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 {
drivers/net/bnxt/bnxt_hwrm.c +3 -2
index eccfe7f..3d2d408 100644
@@ -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;
 
drivers/net/bnxt/bnxt_hwrm.h +2 -1
index 82cca3a..dd0999a 100644
@@ -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);
drivers/net/bnxt/hsi_struct_def_dpdk.h +9 -0
index c2335d0..1eb8d33 100644
@@ -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)
drivers/net/bnxt/rte_pmd_bnxt.c +55 -4

75 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.h +18 -0
index 964aa97..c4c4770 100644
@@ -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_ */
drivers/net/bnxt/rte_pmd_bnxt_version.map +1 -0
index 974e240..4750d40 100644
@@ -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: *;
 };
Signature · 1 line
2.10.1 (Apple Git-78)
#18 lore raw

PATCH v2 6/9 net/bnxt: fix get link config

In reply to Ajit Khaparde

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")

--
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(-)
drivers/net/bnxt/bnxt_hwrm.c +6 -9
index 3d2d408..9b00b60 100644
@@ -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;
 }
Signature · 1 line
2.10.1 (Apple Git-78)
#19 lore raw

PATCH v2 7/9 net/bnxt: fix autoneg on 10GBase-T links

In reply to Ajit Khaparde

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")

--
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(-)
drivers/net/bnxt/bnxt_hwrm.c +8 -3
index 9b00b60..85ef0e3 100644
@@ -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;
Signature · 1 line
2.10.1 (Apple Git-78)
#20 lore raw

PATCH v2 8/9 net/bnxt: fix set link config

In reply to Ajit Khaparde

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")

--
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(-)
drivers/net/bnxt/bnxt_hwrm.c +15 -7
index 85ef0e3..da078f9 100644
@@ -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;
Signature · 1 line
2.10.1 (Apple Git-78)
#21 lore raw

PATCH v2 9/9 net/bnxt: fix copy/pasted error message

In reply to Ajit Khaparde

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

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

--
v1->v2: Fix the commit log

---
 drivers/net/bnxt/rte_pmd_bnxt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/rte_pmd_bnxt.c +1 -1
index 1903101..1131f53 100644
@@ -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;
 	}
 
Signature · 1 line
2.10.1 (Apple Git-78)
#22 lore raw
In reply to Ajit Khaparde
Quoted 6 lines · Ajit Khaparde

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

Quoted 9 lines

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.

#23 lore raw

PATCH 7/7 net/bnxt: fix copy/pasted error message

In reply to Ajit Khaparde

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

---
 drivers/net/bnxt/rte_pmd_bnxt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/rte_pmd_bnxt.c +1 -1
index 1903101..1131f53 100644
@@ -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;
 	}
 
Signature · 1 line
2.10.1 (Apple Git-78)