Skip to contentSkip to conversation

bnxt patchset

PATCH Superseded Ajit Khaparde 3 participants 130 messages May 18, 2017 – Jun 6, 2017 Network drivers Page 2 of 2

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#89 lore raw

PATCH v3 21/26 net/bnxt: add support to get and clear VF specific stats

In reply to Ajit Khaparde

This patch adds code to get and clear VF stats.
It also adds the necessary HWRM structures to send the command to the firmware.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Add a protection against application calling the API for different vendor's port_id
- Move the PF related MAC/VLAN anti spoof counter to xstats.

---
 app/test-pmd/cmdline.c                    | 23 +++++++--
 drivers/net/bnxt/bnxt_hwrm.c              | 38 ++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h              |  3 ++
 drivers/net/bnxt/bnxt_stats.c             | 60 +++++++++++++++++++++-
 drivers/net/bnxt/rte_pmd_bnxt.c           | 83 +++++++++++++++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt.h           | 52 +++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map |  3 ++
 7 files changed, 255 insertions(+), 7 deletions(-)
app/test-pmd/cmdline.c +18 -5
index 90e4a27..f49d83b 100644
@@ -13079,9 +13079,16 @@ cmd_show_vf_stats_parsed(
 	memset(&stats, 0, sizeof(stats));
 
 #ifdef RTE_LIBRTE_I40E_PMD
-	ret = rte_pmd_i40e_get_vf_stats(res->port_id,
-					res->vf_id,
-					&stats);
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_i40e_get_vf_stats(res->port_id,
+						res->vf_id,
+						&stats);
+#endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_get_vf_stats(res->port_id,
+						res->vf_id,
+						&stats);
 #endif
 
 	switch (ret) {
@@ -13177,8 +13184,14 @@ cmd_clear_vf_stats_parsed(
 		return;
 
 #ifdef RTE_LIBRTE_I40E_PMD
-	ret = rte_pmd_i40e_reset_vf_stats(res->port_id,
-					  res->vf_id);
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_i40e_reset_vf_stats(res->port_id,
+						  res->vf_id);
+#endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_reset_vf_stats(res->port_id,
+						  res->vf_id);
 #endif
 
 	switch (ret) {
drivers/net/bnxt/bnxt_hwrm.c +38 -0
index f143541..6ea31ca 100644
@@ -1237,6 +1237,27 @@ int bnxt_hwrm_func_vf_mac(struct bnxt *bp, uint16_t vf, const uint8_t *mac_addr)
 	return rc;
 }
 
+int bnxt_hwrm_func_qstats_tx_drop(struct bnxt *bp, uint16_t fid,
+				  uint64_t *dropped)
+{
+	int rc = 0;
+	struct hwrm_func_qstats_input req = {.req_type = 0};
+	struct hwrm_func_qstats_output *resp = bp->hwrm_cmd_resp_addr;
+
+	HWRM_PREP(req, FUNC_QSTATS, -1, resp);
+
+	req.fid = rte_cpu_to_le_16(fid);
+
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+
+	HWRM_CHECK_RESULT;
+
+	if (dropped)
+		*dropped = rte_le_to_cpu_64(resp->tx_drop_pkts);
+
+	return rc;
+}
+
 int bnxt_hwrm_func_qstats(struct bnxt *bp, uint16_t fid,
 			  struct rte_eth_stats *stats)
 {
@@ -1274,6 +1295,23 @@ int bnxt_hwrm_func_qstats(struct bnxt *bp, uint16_t fid,
 	return rc;
 }
 
+int bnxt_hwrm_func_clr_stats(struct bnxt *bp, uint16_t fid)
+{
+	int rc = 0;
+	struct hwrm_func_clr_stats_input req = {.req_type = 0};
+	struct hwrm_func_clr_stats_output *resp = bp->hwrm_cmd_resp_addr;
+
+	HWRM_PREP(req, FUNC_CLR_STATS, -1, resp);
+
+	req.fid = rte_cpu_to_le_16(fid);
+
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+
+	HWRM_CHECK_RESULT;
+
+	return rc;
+}
+
 /*
  * HWRM utility functions
  */
drivers/net/bnxt/bnxt_hwrm.h +3 -0
index f51ebcf..5aaf947 100644
@@ -66,6 +66,9 @@ int bnxt_hwrm_func_reset(struct bnxt *bp);
 int bnxt_hwrm_func_driver_unregister(struct bnxt *bp, uint32_t flags);
 int bnxt_hwrm_func_qstats(struct bnxt *bp, uint16_t fid,
 			  struct rte_eth_stats *stats);
+int bnxt_hwrm_func_qstats_tx_drop(struct bnxt *bp, uint16_t fid,
+				  uint64_t *dropped);
+int bnxt_hwrm_func_clr_stats(struct bnxt *bp, uint16_t fid);
 int bnxt_hwrm_func_cfg_def_cp(struct bnxt *bp);
 int bnxt_hwrm_vf_func_cfg_def_cp(struct bnxt *bp);
 
drivers/net/bnxt/bnxt_stats.c +58 -2

99 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.c +83 -0

86 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.h +52 -0

62 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt_version.map +3 -0
index 770b076..f0eda7b 100644
@@ -9,6 +9,9 @@ DPDK_17.08 {
 	rte_pmd_bnxt_set_vf_vlan_stripq;
 	rte_pmd_bnxt_set_vf_vlan_filter;
 	rte_pmd_bnxt_set_vf_vlan_anti_spoof;
+	rte_pmd_bnxt_get_vf_stats;
+	rte_pmd_bnxt_reset_vf_stats;
+	rte_pmd_bnxt_get_vf_tx_drop_count;
 
 	local: *;
 };
Signature · 1 line
2.10.1 (Apple Git-78)
#90 lore raw

PATCH v3 22/26 net/bnxt: add code to determine the Rx status of VF

In reply to Ajit Khaparde

This patch adds code to determine the Rx status of a VF. It adds the rte_pmd_bnxt_get_vf_rx_status call, which calculates the VNIC count of the function to get the Rx status.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Add a protection against application calling the API for different vendor's port_id

---
 drivers/net/bnxt/bnxt_hwrm.c              | 24 ++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h              |  1 +
 drivers/net/bnxt/rte_pmd_bnxt.c           | 42 +++++++++++++++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt.h           | 17 +++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map |  1 +
 5 files changed, 85 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +24 -0
index 6ea31ca..721e652 100644
@@ -2626,6 +2626,30 @@ 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)
+{
+	uint32_t *count = cbdata;
+
+	if (vnic->func_default)
+		*count = *count + 1;
+}
+
+static int bnxt_vnic_count_hwrm_stub(struct bnxt *bp __rte_unused,
+				     struct bnxt_vnic_info *vnic __rte_unused)
+{
+	return 0;
+}
+
+int bnxt_vf_default_vnic_count(struct bnxt *bp, uint16_t vf)
+{
+	uint32_t count = 0;
+
+	bnxt_hwrm_func_vf_vnic_query_and_config(bp, vf, bnxt_vnic_count,
+	    &count, bnxt_vnic_count_hwrm_stub);
+
+	return count;
+}
+
 static int bnxt_hwrm_func_vf_vnic_query(struct bnxt *bp, uint16_t vf,
 					uint16_t *vnic_ids)
 {
drivers/net/bnxt/bnxt_hwrm.h +1 -0
index 5aaf947..01e72fa 100644
@@ -141,6 +141,7 @@ 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_vf_default_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 +42 -0

48 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.h +17 -0
index eef5212..e69910e 100644
@@ -217,6 +217,23 @@ int rte_pmd_bnxt_reset_vf_stats(uint8_t port,
  */
 int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
 
+
+/**
+ * Returns the number of default RX queues on a VF
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @return
+ *   - Non-negative value - Number of default RX queues
+ *   - (-EINVAL) if bad parameter.
+ *   - (-ENOTSUP) if on a function without VFs
+ *   - (-ENOMEM) on an allocation failure
+ *   - (-1) firmware interface error
+ */
+int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id);
+
 /**
  * Queries the TX drop counter for the function
  *
drivers/net/bnxt/rte_pmd_bnxt_version.map +1 -0
index f0eda7b..c68c125 100644
@@ -3,6 +3,7 @@ DPDK_17.08 {
 
 	rte_pmd_bnxt_set_tx_loopback;
 	rte_pmd_bnxt_set_all_queues_drop_en;
+	rte_pmd_bnxt_get_vf_rx_status;
 	rte_pmd_bnxt_set_vf_mac_addr;
 	rte_pmd_bnxt_set_vf_mac_anti_spoof;
 	rte_pmd_bnxt_set_vf_rate_limit;
Signature · 1 line
2.10.1 (Apple Git-78)
#91 lore raw

Re: [PATCH v3 22/26] net/bnxt: add code to determine the Rx status of VF

Hi Ajit,

Quoted 6 lines · Ajit Khaparde

This patch adds code to determine the Rx status of a VF. It adds the rte_pmd_bnxt_get_vf_rx_status call, which calculates the VNIC count of the function to get the Rx status.

<...>

Quoted 5 lines
drivers/net/bnxt/rte_pmd_bnxt.c +5 -0
+int rte_pmd_bnxt_get_tx_drop_count(uint8_t port, uint64_t *count)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct bnxt *bp;

drivers/net/bnxt/rte_pmd_bnxt.c int rte_pmd_bnxt_reset_vf_stats(uint8_t port, · line 553

Quoted 10 lines
drivers/net/bnxt/rte_pmd_bnxt.c +10 -0
+
+	dev = &rte_eth_devices[port];
+	if (!is_bnxt_supported(dev))
+		return -ENOTSUP;
+
+	rte_eth_dev_info_get(port, &dev_info);
+	bp = (struct bnxt *)dev->data->dev_private;
+
+	return bnxt_hwrm_func_qstats_tx_drop(bp, 0xffff, count);
+}

I guess there is rebasing error here, this function left here and causing a build error [1].
(or function tries to sneak in within another patch :)

[1]
.../drivers/net/bnxt/rte_pmd_bnxt.c:639:5: error: no previous prototype for function 'rte_pmd_bnxt_get_tx_drop_count' [-Werror,-Wmissing-prototypes] int rte_pmd_bnxt_get_tx_drop_count(uint8_t port, uint64_t *count)

    ^
#92 lore raw

Re: [PATCH v3 22/26] net/bnxt: add code to determine the Rx status of VF

Quoted 23 lines · Ferruh Yigit

Hi Ajit,

Quoted 6 lines · Ajit Khaparde

This patch adds code to determine the Rx status of a VF. It adds the rte_pmd_bnxt_get_vf_rx_status call, which calculates the VNIC count of the function to get the Rx status.

<...>

Quoted 11 lines
drivers/net/bnxt/rte_pmd_bnxt.c +11 -0
+int rte_pmd_bnxt_get_tx_drop_count(uint8_t port, uint64_t *count)
+{
+     struct rte_eth_dev *dev;
+     struct rte_eth_dev_info dev_info;
+     struct bnxt *bp;
+
+     dev = &rte_eth_devices[port];
+     if (!is_bnxt_supported(dev))
+             return -ENOTSUP;
+
+     rte_eth_dev_info_get(port, &dev_info);
Quoted 9 lines

drivers/net/bnxt/rte_pmd_bnxt.c int rte_pmd_bnxt_reset_vf_stats(uint8_t port, · line 553

Quoted 4 lines
drivers/net/bnxt/rte_pmd_bnxt.c +4 -0
+     bp = (struct bnxt *)dev->data->dev_private;
+
+     return bnxt_hwrm_func_qstats_tx_drop(bp, 0xffff, count);
+}

I guess there is rebasing error here, this function left here and causing a build error [1].
(or function tries to sneak in within another patch :)

​Yes. It seems to have. I was actually trying to avoid this and compile testing
at a minimum during each rebase step to make sure.
But may be the warning message scrolled away.

I am sending a new series.

Thanks
​

Quoted 8 lines

[1]
.../drivers/net/bnxt/rte_pmd_bnxt.c:639:5: error: no previous prototype for function 'rte_pmd_bnxt_get_tx_drop_count' [-Werror,-Wmissing-prototypes]
int rte_pmd_bnxt_get_tx_drop_count(uint8_t port, uint64_t *count)

    ^
#93 lore raw

PATCH v3 23/26 net/bnxt: add support to add a VF MAC address

In reply to Ajit Khaparde

This patch adds support to allocate a filter and program it in the hardware for every MAC address added to the specified function.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Add a protection against application calling the API for different vendor's port_id

---
 drivers/net/bnxt/bnxt_filter.c            | 22 +++++++++
 drivers/net/bnxt/bnxt_filter.h            |  1 +
 drivers/net/bnxt/rte_pmd_bnxt.c           | 76 +++++++++++++++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt.h           | 18 ++++++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map |  1 +
 5 files changed, 118 insertions(+)
drivers/net/bnxt/bnxt_filter.c +22 -0
index 0afde86..e9aac27 100644
@@ -68,6 +68,22 @@ struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp)
 	return filter;
 }
 
+struct bnxt_filter_info *bnxt_alloc_vf_filter(struct bnxt *bp, uint16_t vf)
+{
+	struct bnxt_filter_info *filter;
+
+	filter = rte_zmalloc("bnxt_vf_filter_info", sizeof(*filter), 0);
+	if (!filter) {
+		RTE_LOG(ERR, PMD, "Failed to alloc memory for VF %hu filters\n",
+			vf);
+		return NULL;
+	}
+
+	filter->fw_l2_filter_id = UINT64_MAX;
+	STAILQ_INSERT_TAIL(&bp->pf.vf_info[vf].filter, filter, next);
+	return filter;
+}
+
 void bnxt_init_filters(struct bnxt *bp)
 {
 	struct bnxt_filter_info *filter;
@@ -102,6 +118,12 @@ void bnxt_free_all_filters(struct bnxt *bp)
 			STAILQ_INIT(&vnic->filter);
 		}
 	}
+
+	for (i = 0; i < bp->pf.max_vfs; i++) {
+		STAILQ_FOREACH(filter, &bp->pf.vf_info[i].filter, next) {
+			bnxt_hwrm_clear_filter(bp, filter);
+		}
+	}
 }
 
 void bnxt_free_filter_mem(struct bnxt *bp)
drivers/net/bnxt/bnxt_filter.h +1 -0
index 353b7f7..613b2ee 100644
@@ -68,6 +68,7 @@ struct bnxt_filter_info {
 };
 
 struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp);
+struct bnxt_filter_info *bnxt_alloc_vf_filter(struct bnxt *bp, uint16_t vf);
 void bnxt_init_filters(struct bnxt *bp);
 void bnxt_free_all_filters(struct bnxt *bp);
 void bnxt_free_filter_mem(struct bnxt *bp);
drivers/net/bnxt/rte_pmd_bnxt.c +76 -0

79 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.h +18 -0
index e69910e..f1127a6 100644
@@ -250,4 +250,22 @@ int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id);
  */
 int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
 				      uint64_t *count);
+
+/**
+ * Programs the MAC address for the function specified
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param mac_addr
+ *    The MAC address to be programmed in the filter.
+ * @param vf_id
+ *    VF on which to get.
+ * @return
+ *   - Positive Non-zero value - Error code from HWRM
+ *   - (-EINVAL) invalid vf_id specified.
+ *   - (-ENOTSUP) Ethernet device is not a PF
+ *   - (-ENOMEM) on an allocation failure
+ */
+int rte_pmd_bnxt_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
+				uint32_t vf_id);
 #endif /* _PMD_BNXT_H_ */
drivers/net/bnxt/rte_pmd_bnxt_version.map +1 -0
index c68c125..e3cc7bc 100644
@@ -13,6 +13,7 @@ DPDK_17.08 {
 	rte_pmd_bnxt_get_vf_stats;
 	rte_pmd_bnxt_reset_vf_stats;
 	rte_pmd_bnxt_get_vf_tx_drop_count;
+	rte_pmd_bnxt_mac_addr_add;
 
 	local: *;
 };
Signature · 1 line
2.10.1 (Apple Git-78)
#94 lore raw

PATCH v3 24/26 net/bnxt: add code to configure a default VF VLAN

In reply to Ajit Khaparde

This patch adds code to insert a default VF VLAN.
Also track the current default VLAN per vnic for the VF. When setting the default VLAN, avoid setting it to the current value.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Add a protection against application calling the API for different vendor's port_id
- update testpmd to use these vendor specific APIs

---
 app/test-pmd/cmdline.c                    |  5 ++++
 drivers/net/bnxt/bnxt.h                   |  2 +-
 drivers/net/bnxt/bnxt_hwrm.c              | 39 ++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h              |  2 ++
 drivers/net/bnxt/rte_pmd_bnxt.c           | 50 +++++++++++++++++++++++++++++--
 drivers/net/bnxt/rte_pmd_bnxt.h           | 22 +++++++++++++-
 drivers/net/bnxt/rte_pmd_bnxt_version.map |  1 +
 7 files changed, 117 insertions(+), 4 deletions(-)
app/test-pmd/cmdline.c +5 -0
index f49d83b..ff623c1 100644
@@ -11334,6 +11334,11 @@ cmd_set_vf_vlan_insert_parsed(
 		ret = rte_pmd_i40e_set_vf_vlan_insert(res->port_id, res->vf_id,
 			res->vlan_id);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_set_vf_vlan_insert(res->port_id, res->vf_id,
+			res->vlan_id);
+#endif
 
 	switch (ret) {
 	case 0:
drivers/net/bnxt/bnxt.h +1 -1
index c1f9095..54428ba 100644
@@ -103,8 +103,8 @@ struct bnxt_child_vf_info {
 	uint32_t		func_cfg_flags;
 	uint32_t		l2_rx_mask;
 	uint16_t		fid;
-	uint16_t		dflt_vlan;
 	uint16_t		max_tx_rate;
+	uint16_t		dflt_vlan;
 	uint16_t		vlan_count;
 	uint8_t			mac_spoof_en;
 	uint8_t			vlan_spoof_en;
drivers/net/bnxt/bnxt_hwrm.c +39 -0
index 721e652..bf0526d 100644
@@ -2069,6 +2069,27 @@ static void reserve_resources_from_vf(struct bnxt *bp,
 	bp->max_ring_grps -= rte_le_to_cpu_16(resp->max_hw_ring_grps);
 }
 
+int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf)
+{
+	struct hwrm_func_qcfg_input req = {0};
+	struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
+	int rc;
+
+	/* Check for zero MAC address */
+	HWRM_PREP(req, FUNC_QCFG, -1, resp);
+	req.fid = rte_cpu_to_le_16(bp->pf.vf_info[vf].fid);
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+	if (rc) {
+		RTE_LOG(ERR, PMD, "hwrm_func_qcfg failed rc:%d\n", rc);
+		return -1;
+	} else if (resp->error_code) {
+		rc = rte_le_to_cpu_16(resp->error_code);
+		RTE_LOG(ERR, PMD, "hwrm_func_qcfg error %d\n", rc);
+		return -1;
+	}
+	return rte_le_to_cpu_16(resp->vlan);
+}
+
 static int update_pf_resource_max(struct bnxt *bp)
 {
 	struct hwrm_func_qcfg_input req = {0};
@@ -2423,6 +2444,24 @@ int bnxt_hwrm_func_bw_cfg(struct bnxt *bp, uint16_t vf,
 	return rc;
 }
 
+int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf)
+{
+	struct hwrm_func_cfg_input req = {0};
+	struct hwrm_func_cfg_output *resp = bp->hwrm_cmd_resp_addr;
+	int rc = 0;
+
+	HWRM_PREP(req, FUNC_CFG, -1, resp);
+	req.flags = rte_cpu_to_le_32(bp->pf.vf_info[vf].func_cfg_flags);
+	req.fid = rte_cpu_to_le_16(bp->pf.vf_info[vf].fid);
+	req.enables |= rte_cpu_to_le_32(HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_VLAN);
+	req.dflt_vlan = rte_cpu_to_le_16(bp->pf.vf_info[vf].dflt_vlan);
+
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+	HWRM_CHECK_RESULT;
+
+	return rc;
+}
+
 int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
 			      void *encaped, size_t ec_size)
 {
drivers/net/bnxt/bnxt_hwrm.h +2 -0
index 01e72fa..33d2885 100644
@@ -128,8 +128,10 @@ int bnxt_hwrm_func_vf_mac(struct bnxt *bp, uint16_t vf,
 int bnxt_hwrm_pf_evb_mode(struct bnxt *bp);
 int bnxt_hwrm_func_bw_cfg(struct bnxt *bp, uint16_t vf,
 			uint16_t max_bw, uint16_t enables);
+int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf);
 int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf,
 				       struct ether_addr *mac);
+int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf);
 int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port,
 				uint8_t tunnel_type);
 int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, uint16_t port,
drivers/net/bnxt/rte_pmd_bnxt.c +48 -2

66 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.h +21 -1
index f1127a6..2144601 100644
@@ -92,6 +92,26 @@ int
 rte_pmd_bnxt_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
 
 /**
+ * Enable/Disable vf vlan insert
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param vlan_id
+ *    0 - Disable VF's vlan insert.
+ *    n - Enable; n is inserted as the vlan id.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int
+rte_pmd_bnxt_set_vf_vlan_insert(uint8_t port, uint16_t vf,
+		uint16_t vlan_id);
+
+/**
  * Enable/Disable hardware VF VLAN filtering by an Ethernet device of
  * received VLAN packets tagged with a given VLAN Tag Identifier.
  *
@@ -110,7 +130,7 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
  *   - (-ENODEV) if *port_id* invalid.
  *   - (-EINVAL) if bad parameter.
  */
-int rte_pmd_bnxt_set_vf_vlan_filter(struct rte_eth_dev *dev, uint16_t vlan,
+int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
 				    uint64_t vf_mask, uint8_t vlan_on);
 
 /**
drivers/net/bnxt/rte_pmd_bnxt_version.map +1 -0
index e3cc7bc..9433a1e 100644
@@ -14,6 +14,7 @@ DPDK_17.08 {
 	rte_pmd_bnxt_reset_vf_stats;
 	rte_pmd_bnxt_get_vf_tx_drop_count;
 	rte_pmd_bnxt_mac_addr_add;
+	rte_pmd_bnxt_set_vf_vlan_insert;
 
 	local: *;
 };
Signature · 1 line
2.10.1 (Apple Git-78)
#95 lore raw

PATCH v3 25/26 net/bnxt: add support to set VF rxmode

In reply to Ajit Khaparde

This patch adds support to configure the VF L2 Rx settings. The per VF setting is maintained in bnxt_child_vf_info.l2_rx_mask

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Add a protection against application calling the API for different vendor's port_id
- update testpmd to use these vendor specific APIs

---
 app/test-pmd/cmdline.c                    | 15 +++++++--
 drivers/net/bnxt/bnxt_hwrm.c              | 24 ++++++++++++--
 drivers/net/bnxt/bnxt_hwrm.h              |  2 ++
 drivers/net/bnxt/bnxt_rxq.c               | 13 ++++++--
 drivers/net/bnxt/bnxt_vnic.h              |  5 +++
 drivers/net/bnxt/rte_pmd_bnxt.c           | 54 +++++++++++++++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt.h           | 19 +++++++++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map |  1 +
 8 files changed, 124 insertions(+), 9 deletions(-)
app/test-pmd/cmdline.c +12 -3
index ff623c1..28ff7cf 100644
@@ -6802,7 +6802,7 @@ cmd_set_vf_rxmode_parsed(void *parsed_result,
 		       __attribute__((unused)) struct cmdline *cl,
 		       __attribute__((unused)) void *data)
 {
-	int ret;
+	int ret = -ENOTSUP;
 	uint16_t rx_mode = 0;
 	struct cmd_set_vf_rxmode *res = parsed_result;
 
@@ -6818,7 +6818,16 @@ cmd_set_vf_rxmode_parsed(void *parsed_result,
 			rx_mode |= ETH_VMDQ_ACCEPT_MULTICAST;
 	}
 
-	ret = rte_pmd_ixgbe_set_vf_rxmode(res->port_id, res->vf_id, rx_mode, (uint8_t)is_on);
+#ifdef RTE_LIBRTE_IXGBE_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_ixgbe_set_vf_rxmode(res->port_id, res->vf_id,
+						  rx_mode, (uint8_t)is_on);
+#endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_set_vf_rxmode(res->port_id, res->vf_id,
+						 rx_mode, (uint8_t)is_on);
+#endif
 	if (ret < 0)
 		printf("bad VF receive mode parameter, return code = %d \n",
 		ret);
@@ -13786,9 +13795,9 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_set_macsec_offload_off,
 	(cmdline_parse_inst_t *)&cmd_set_macsec_sc,
 	(cmdline_parse_inst_t *)&cmd_set_macsec_sa,
-	(cmdline_parse_inst_t *)&cmd_set_vf_rxmode,
 	(cmdline_parse_inst_t *)&cmd_set_vf_traffic,
 #endif
+	(cmdline_parse_inst_t *)&cmd_set_vf_rxmode,
 	(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
 	(cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
 	(cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
drivers/net/bnxt/bnxt_hwrm.c +21 -3
index bf0526d..6d98d5a 100644
@@ -229,23 +229,29 @@ int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp,
 	/* FIXME add multicast flag, when multicast adding options is supported
 	 * by ethtool.
 	 */
+	if (vnic->flags & BNXT_VNIC_INFO_BCAST)
+		mask = HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST;
+	if (vnic->flags & BNXT_VNIC_INFO_UNTAGGED)
+		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN;
 	if (vnic->flags & BNXT_VNIC_INFO_PROMISC)
-		mask = HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS;
+		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS;
 	if (vnic->flags & BNXT_VNIC_INFO_ALLMULTI)
 		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST;
+	if (vnic->flags & BNXT_VNIC_INFO_MCAST)
+		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST;
 	if (vnic->mc_addr_cnt) {
 		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST;
 		req.num_mc_entries = rte_cpu_to_le_32(vnic->mc_addr_cnt);
 		req.mc_tbl_addr = rte_cpu_to_le_64(vnic->mc_list_dma_addr);
 	}
-	req.mask = rte_cpu_to_le_32(HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST |
-				    mask);
 	if (vlan_count && vlan_table) {
 		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLANONLY;
 		req.vlan_tag_tbl_addr = rte_cpu_to_le_16(
 			 rte_mem_virt2phy(vlan_table));
 		req.num_vlan_tags = rte_cpu_to_le_32((uint32_t)vlan_count);
 	}
+	req.mask = rte_cpu_to_le_32(HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST |
+				    mask);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
 
@@ -2317,6 +2323,18 @@ int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf)
 	return rc;
 }
 
+void vf_vnic_set_rxmask_cb(struct bnxt_vnic_info *vnic, void *flagp)
+{
+	uint32_t *flag = flagp;
+
+	vnic->flags = *flag;
+}
+
+int bnxt_set_rx_mask_no_vlan(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+{
+	return bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+}
+
 int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp)
 {
 	int rc = 0;
drivers/net/bnxt/bnxt_hwrm.h +2 -0
index 33d2885..a603dda 100644
@@ -143,6 +143,8 @@ 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);
+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_hwrm_func_vf_vnic_query_and_config(struct bnxt *bp, uint16_t vf,
 	void (*vnic_cb)(struct bnxt_vnic_info *, void *), void *cbdata,
drivers/net/bnxt/bnxt_rxq.c +10 -3
index d8b970e..0793820 100644
@@ -76,6 +76,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 			rc = -ENOMEM;
 			goto err_out;
 		}
+		vnic->flags |= BNXT_VNIC_INFO_BCAST;
 		STAILQ_INSERT_TAIL(&bp->ff_pool[0], vnic, next);
 		bp->nr_vnics++;
 
@@ -120,6 +121,9 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 		}
 		/* For each pool, allocate MACVLAN CFA rule & VNIC */
 		if (!pools) {
+			pools = RTE_MIN(bp->max_vnics,
+			    RTE_MIN(bp->max_l2_ctx,
+			     RTE_MIN(bp->max_rsscos_ctx, ETH_64_POOLS)));
 			RTE_LOG(ERR, PMD,
 				"VMDq pool not set, defaulted to 64\n");
 			pools = ETH_64_POOLS;
@@ -137,6 +141,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 				rc = -ENOMEM;
 				goto err_out;
 			}
+			vnic->flags |= BNXT_VNIC_INFO_BCAST;
 			STAILQ_INSERT_TAIL(&bp->ff_pool[i], vnic, next);
 			bp->nr_vnics++;
 
@@ -177,6 +182,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 		rc = -ENOMEM;
 		goto err_out;
 	}
+	vnic->flags |= BNXT_VNIC_INFO_BCAST;
 	/* Partition the rx queues for the single pool */
 	for (i = 0; i < bp->rx_cp_nr_rings; i++) {
 		rxq = bp->eth_dev->data->rx_queues[i];
@@ -295,7 +301,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	int rc = 0;
 
 	if (!nb_desc || nb_desc > MAX_RX_DESC_CNT) {
-		RTE_LOG(ERR, PMD, "nb_desc %d is invalid", nb_desc);
+		RTE_LOG(ERR, PMD, "nb_desc %d is invalid\n", nb_desc);
 		rc = -EINVAL;
 		goto out;
 	}
@@ -308,7 +314,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	rxq = rte_zmalloc_socket("bnxt_rx_queue", sizeof(struct bnxt_rx_queue),
 				 RTE_CACHE_LINE_SIZE, socket_id);
 	if (!rxq) {
-		RTE_LOG(ERR, PMD, "bnxt_rx_queue allocation failed!");
+		RTE_LOG(ERR, PMD, "bnxt_rx_queue allocation failed!\n");
 		rc = -ENOMEM;
 		goto out;
 	}
@@ -333,7 +339,8 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	/* Allocate RX ring hardware descriptors */
 	if (bnxt_alloc_rings(bp, queue_idx, NULL, rxq->rx_ring, rxq->cp_ring,
 			"rxr")) {
-		RTE_LOG(ERR, PMD, "ring_dma_zone_reserve for rx_ring failed!");
+		RTE_LOG(ERR, PMD,
+			"ring_dma_zone_reserve for rx_ring failed!\n");
 		bnxt_rx_queue_release_op(rxq);
 		rc = -ENOMEM;
 		goto out;
drivers/net/bnxt/bnxt_vnic.h +5 -0
index 0d50224..993f221 100644
@@ -64,6 +64,11 @@ struct bnxt_vnic_info {
 	uint32_t	flags;
 #define BNXT_VNIC_INFO_PROMISC			(1 << 0)
 #define BNXT_VNIC_INFO_ALLMULTI			(1 << 1)
+#define BNXT_VNIC_INFO_BCAST			(1 << 2)
+#define BNXT_VNIC_INFO_UCAST			(1 << 3)
+#define BNXT_VNIC_INFO_MCAST			(1 << 4)
+#define BNXT_VNIC_INFO_TAGGED			(1 << 5)
+#define BNXT_VNIC_INFO_UNTAGGED			(1 << 6)
 
 	uint16_t	cos_rule;
 	uint16_t	lb_rule;
drivers/net/bnxt/rte_pmd_bnxt.c +54 -0

60 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.h +19 -0
index 2144601..db9ce77 100644
@@ -237,6 +237,25 @@ int rte_pmd_bnxt_reset_vf_stats(uint8_t port,
  */
 int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
 
+/**
+ * Set RX L2 Filtering mode of a VF of an Ethernet device.
+ *
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @param rx_mask
+ *    The RX mode mask
+ * @param on
+ *    1 - Enable a VF RX mode.
+ *    0 - Disable a VF RX mode.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_bnxt_set_vf_rxmode(uint8_t port, uint16_t vf,
+				uint16_t rx_mask, uint8_t on);
 
 /**
  * Returns the number of default RX queues on a VF
drivers/net/bnxt/rte_pmd_bnxt_version.map +1 -0
index 9433a1e..f61c736 100644
@@ -15,6 +15,7 @@ DPDK_17.08 {
 	rte_pmd_bnxt_get_vf_tx_drop_count;
 	rte_pmd_bnxt_mac_addr_add;
 	rte_pmd_bnxt_set_vf_vlan_insert;
+	rte_pmd_bnxt_set_vf_rxmode;
 
 	local: *;
 };
Signature · 1 line
2.10.1 (Apple Git-78)
#96 lore raw

PATCH v3 26/26 doc: update release notes

In reply to Ajit Khaparde

Update release doc briefly describing updates to bnxt PMD.

v1->v2:
- Rebasing to next-net tree
- Use doc in the patch subject line

---
 doc/guides/rel_notes/release_17_08.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)
doc/guides/rel_notes/release_17_08.rst +10 -0
index 7f12120..7bf6d25 100644
@@ -56,6 +56,16 @@ New Features
   TX and RX path reworked to improve performance.  Also reduced latency
   for slow traffic.
 
+* **Updated bnxt PMD.**
+
+  Major enhancements include:
+  * Support MTU modification.
+  * Support LRO.
+  * Support VLAN filter and strip functionality.
+  * Other enhancements to add support for more dev_ops.
+  * Add PMD specific APIs mainly to control VF from PF.
+  * Update HWRM version to 1.7.7
+
 
 Resolved Issues
 ---------------
Signature · 1 line
2.10.1 (Apple Git-78)
#97 lore raw

v4 cover bnxt patchset

In reply to Ajit Khaparde

This patchset amongst other changes adds support few more dev_ops, updates HWRM to version 1.7.7, switches to polling stats from the hardware, support for Jumbo MTU, LRO etc..

v1->v2:
- Grouped in the end, it also has PMD specific APIs to control VF from PF.
- I have updated the release notes and the features file wherever possible.

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- update testpmd to use the vendor specific APIs
- Addressed other review comments as appropriate

v3->v4:
- fix a rebase error

--

net/bnxt: update to new HWRM version
net/bnxt: code reorg to properly allocate resources for PF/VF net/bnxt: handle VF/PF initialization appropriately net/bnxt: support lack of huge pages
net/bnxt: add additonal HWRM debug info to error messages net/bnxt: add tunneling support
net/bnxt: add support for xstats get/reset
net/bnxt: add support for VLAN filter and strip net/bnxt: add support for set multicast addr list and MAC addr set
doc: update bnxt.ini to document Allmulticast mode net/bnxt: add support to get fw version
net/bnxt: add support to set MTU
net/bnxt: add support for LRO
net/bnxt: add rxq/txq info_get
net/bnxt: add code to support VLAN pvid
net/bnxt: reorg the query stats code
doc: update default.ini to add LED support
net/bnxt: add support for led on/off
net/bnxt: add support for tx loopback, set vf mac and queues drop net/bnxt: add support for set VF QOS and MAC anti spoof net/bnxt: add support to get and clear VF specific stats net/bnxt: add code to determine the Rx status of VF net/bnxt: add support to add a VF MAC address
net/bnxt: add code to configure a default VF VLAN net/bnxt: add support to set VF rxmode
doc: update release notes

 app/test-pmd/Makefile                     |    4 +
 app/test-pmd/cmdline.c                    |   92 +-
 app/test-pmd/config.c                     |   20 +-
 doc/guides/nics/features/bnxt.ini         |   10 +
 doc/guides/nics/features/default.ini      |    1 +
 doc/guides/rel_notes/release_17_08.rst    |   10 +
 drivers/net/bnxt/Makefile                 |    4 +
 drivers/net/bnxt/bnxt.h                   |  144 +-
 drivers/net/bnxt/bnxt_cpr.c               |  132 +-
 drivers/net/bnxt/bnxt_cpr.h               |   17 +
 drivers/net/bnxt/bnxt_ethdev.c            |  852 ++-
 drivers/net/bnxt/bnxt_filter.c            |   54 +-
 drivers/net/bnxt/bnxt_filter.h            |    3 +
 drivers/net/bnxt/bnxt_hwrm.c              | 1605 ++++-
 drivers/net/bnxt/bnxt_hwrm.h              |   66 +-
 drivers/net/bnxt/bnxt_irq.c               |   21 +-
 drivers/net/bnxt/bnxt_ring.c              |  159 +-
 drivers/net/bnxt/bnxt_ring.h              |    4 +-
 drivers/net/bnxt/bnxt_rxq.c               |   54 +-
 drivers/net/bnxt/bnxt_rxq.h               |    3 +
 drivers/net/bnxt/bnxt_rxr.c               |  396 +-
 drivers/net/bnxt/bnxt_rxr.h               |   46 +
 drivers/net/bnxt/bnxt_stats.c             |  322 +-
 drivers/net/bnxt/bnxt_stats.h             |   10 +
 drivers/net/bnxt/bnxt_txr.c               |    3 +-
 drivers/net/bnxt/bnxt_vnic.c              |   68 +-
 drivers/net/bnxt/bnxt_vnic.h              |   20 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h    | 9678 +++++++++++++++++++++--------
 drivers/net/bnxt/rte_pmd_bnxt.c           |  738 +++
 drivers/net/bnxt/rte_pmd_bnxt.h           |  310 +
 drivers/net/bnxt/rte_pmd_bnxt_version.map |   19 +-
 31 files changed, 11899 insertions(+), 2966 deletions(-)
 create mode 100644 drivers/net/bnxt/rte_pmd_bnxt.c
 create mode 100644 drivers/net/bnxt/rte_pmd_bnxt.h
Signature · 1 line
2.10.1 (Apple Git-78)
#98 lore raw

PATCH v4 1/26 net/bnxt: update to new HWRM version

This patch updates the Broadcom bnxt PMD to version 1.7.7 Most of the changes in the patch are in the hsi_struct_def_dpdk.h - an autogenerated file. The changes in the *.c files are because of changes in the macro names.

--
v1->v2: regroup related patches per review comment

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject

---
 drivers/net/bnxt/bnxt_hwrm.c           |   10 +-
 drivers/net/bnxt/bnxt_ring.c           |    8 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 8710 +++++++++++++++++++++++---------
 3 files changed, 6241 insertions(+), 2487 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +5 -5
index 3849d1a..9100b7b 100644
@@ -511,7 +511,7 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)
 		req.enables = rte_cpu_to_le_32(enables);
 	} else {
 		req.flags =
-		rte_cpu_to_le_32(HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE_LINK_DOWN);
+		rte_cpu_to_le_32(HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE_LINK_DWN);
 		RTE_LOG(INFO, PMD, "Force Link Down\n");
 	}
 
@@ -618,7 +618,7 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
 		req.enables = rte_cpu_to_le_32(rte_le_to_cpu_32(req.enables) |
 			HWRM_RING_ALLOC_INPUT_ENABLES_STAT_CTX_ID_VALID);
 		break;
-	case HWRM_RING_ALLOC_INPUT_RING_TYPE_CMPL:
+	case HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL:
 		req.ring_type = ring_type;
 		/*
 		 * TODO: Some HWRM versions crash with
@@ -639,7 +639,7 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
 		if (rc == 0 && resp->error_code)
 			rc = rte_le_to_cpu_16(resp->error_code);
 		switch (ring_type) {
-		case HWRM_RING_FREE_INPUT_RING_TYPE_CMPL:
+		case HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL:
 			RTE_LOG(ERR, PMD,
 				"hwrm_ring_alloc cp failed. rc:%d\n", rc);
 			return rc;
@@ -680,7 +680,7 @@ int bnxt_hwrm_ring_free(struct bnxt *bp,
 			rc = rte_le_to_cpu_16(resp->error_code);
 
 		switch (ring_type) {
-		case HWRM_RING_FREE_INPUT_RING_TYPE_CMPL:
+		case HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL:
 			RTE_LOG(ERR, PMD, "hwrm_ring_free cp failed. rc:%d\n",
 				rc);
 			return rc;
@@ -1063,7 +1063,7 @@ static void bnxt_free_cp_ring(struct bnxt *bp,
 	struct bnxt_ring *cp_ring = cpr->cp_ring_struct;
 
 	bnxt_hwrm_ring_free(bp, cp_ring,
-			HWRM_RING_FREE_INPUT_RING_TYPE_CMPL);
+			HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL);
 	cp_ring->fw_ring_id = INVALID_HW_RING_ID;
 	bp->grp_info[idx].cp_fw_ring_id = INVALID_HW_RING_ID;
 	memset(cpr->cp_desc_ring, 0, cpr->cp_ring_struct->ring_size *
drivers/net/bnxt/bnxt_ring.c +4 -4
index 0fafa13..52fbd89 100644
@@ -219,8 +219,8 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		struct bnxt_ring *cp_ring = cpr->cp_ring_struct;
 
 		rc = bnxt_hwrm_ring_alloc(bp, cp_ring,
-					  HWRM_RING_ALLOC_INPUT_RING_TYPE_CMPL,
-					  0, HWRM_NA_SIGNATURE);
+					HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL,
+					0, HWRM_NA_SIGNATURE);
 		if (rc)
 			goto err_out;
 		cpr->cp_doorbell = pci_dev->mem_resource[2].addr;
@@ -238,7 +238,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 
 		/* Rx cmpl */
 		rc = bnxt_hwrm_ring_alloc(bp, cp_ring,
-					HWRM_RING_ALLOC_INPUT_RING_TYPE_CMPL,
+					HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL,
 					idx, HWRM_NA_SIGNATURE);
 		if (rc)
 			goto err_out;
@@ -276,7 +276,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 
 		/* Tx cmpl */
 		rc = bnxt_hwrm_ring_alloc(bp, cp_ring,
-					HWRM_RING_ALLOC_INPUT_RING_TYPE_CMPL,
+					HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL,
 					idx, HWRM_NA_SIGNATURE);
 		if (rc)
 			goto err_out;
drivers/net/bnxt/hsi_struct_def_dpdk.h +6232 -2478

2,934 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.10.1 (Apple Git-78)

Part of the diff is not shown here. View the raw message.

#99 lore raw

PATCH v4 2/26 net/bnxt: code reorg to properly allocate resources for PF/VF

In reply to Ajit Khaparde

1) Move the function reset to bnxt_dev_init.
On the same lines, setup, enable and request interrupt to init path. Memory allocation is also being done in the init path.
2) After a function reset, configure the VFs. Distribute resources evenly between all functions (PF and VF) for now. In the future, this should be controllable.
3) The bnxt_vf_info and bnxt_pf_info had lot of duplication. Move the common items to struct bnxt. And only unique items specific to PF remain in the struct bnxt_pf_info.
4) Program the firmware to allow certain commands sent by a VF. Disallowing these will prevent clean VF driver cleanup.
5) Since PF/VF need to allocate resources from a pool in the hardware, use func_qcaps and func_qcfg to appropriately query the capabilities and available resources.
6) If a PF is being initialized and no VFs are allocated, explicitly call func_cfg to allocate the resources.
7) Once resources are requested from the firmware, update local copy of resource count in struct bnxt only after sending the func_qcfg to make sure the allocation request in the firmware went through.

The changes in this patch will be used by the subsequent patches to allow proper initialization of PF/VF instance.

--
v1->v2: Regroup related patches per review comment
Also split bigger patch into smaller patches if possible.

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject

---
 drivers/net/bnxt/bnxt.h        |  80 ++++--
 drivers/net/bnxt/bnxt_ethdev.c | 155 ++++++++---
 drivers/net/bnxt/bnxt_filter.c |  30 +-
 drivers/net/bnxt/bnxt_hwrm.c   | 614 +++++++++++++++++++++++++++++++++++++----
 drivers/net/bnxt/bnxt_hwrm.h   |  17 +-
 drivers/net/bnxt/bnxt_vnic.c   |  45 +--
 drivers/net/bnxt/bnxt_vnic.h   |  11 +-
 7 files changed, 764 insertions(+), 188 deletions(-)
drivers/net/bnxt/bnxt.h +59 -21
index 4418c7f..0c59c66 100644
@@ -35,6 +35,7 @@
 #define _BNXT_H_
 
 #include <inttypes.h>
+#include <stdbool.h>
 #include <sys/queue.h>
 
 #include <rte_ethdev.h>
@@ -54,17 +55,19 @@ enum bnxt_hw_context {
 	HW_CONTEXT_IS_LB    = 3,
 };
 
-struct bnxt_vf_info {
-	uint16_t		fw_fid;
-	uint8_t			mac_addr[ETHER_ADDR_LEN];
-	uint16_t		max_rsscos_ctx;
-	uint16_t		max_cp_rings;
-	uint16_t		max_tx_rings;
-	uint16_t		max_rx_rings;
-	uint16_t		max_l2_ctx;
-	uint16_t		max_vnics;
-	uint16_t		vlan;
-	struct bnxt_pf_info	*pf;
+struct bnxt_vlan_table_entry {
+	uint16_t		tpid;
+	uint16_t		vid;
+} __attribute__((packed));
+
+struct bnxt_child_vf_info {
+	void			*req_buf;
+	struct bnxt_vlan_table_entry	*vlan_table;
+	STAILQ_HEAD(, bnxt_filter_info)	filter;
+	uint32_t		func_cfg_flags;
+	uint32_t		l2_rx_mask;
+	uint16_t		fid;
+	bool			random_mac;
 };
 
 struct bnxt_pf_info {
@@ -73,22 +76,20 @@ struct bnxt_pf_info {
 #define BNXT_FIRST_VF_FID	128
 #define BNXT_PF_RINGS_USED(bp)	bnxt_get_num_queues(bp)
 #define BNXT_PF_RINGS_AVAIL(bp)	(bp->pf.max_cp_rings - BNXT_PF_RINGS_USED(bp))
-	uint32_t		fw_fid;
 	uint8_t			port_id;
-	uint8_t			mac_addr[ETHER_ADDR_LEN];
-	uint16_t		max_rsscos_ctx;
-	uint16_t		max_cp_rings;
-	uint16_t		max_tx_rings;
-	uint16_t		max_rx_rings;
-	uint16_t		max_l2_ctx;
-	uint16_t		max_vnics;
 	uint16_t		first_vf_id;
 	uint16_t		active_vfs;
 	uint16_t		max_vfs;
+	uint32_t		func_cfg_flags;
 	void			*vf_req_buf;
 	phys_addr_t		vf_req_buf_dma_addr;
 	uint32_t		vf_req_fwd[8];
-	struct bnxt_vf_info	*vf;
+	uint16_t		total_vnics;
+	struct bnxt_child_vf_info	*vf_info;
+#define BNXT_EVB_MODE_NONE	0
+#define BNXT_EVB_MODE_VEB	1
+#define BNXT_EVB_MODE_VEPA	2
+	uint8_t			evb_mode;
 };
 
 /* Max wait time is 10 * 100ms = 1s */
@@ -174,12 +175,49 @@ struct bnxt {
 	struct bnxt_link_info	link_info;
 	struct bnxt_cos_queue_info	cos_queue[BNXT_COS_QUEUE_COUNT];
 
+	uint16_t		fw_fid;
+	uint8_t			dflt_mac_addr[ETHER_ADDR_LEN];
+	uint16_t		max_rsscos_ctx;
+	uint16_t		max_cp_rings;
+	uint16_t		max_tx_rings;
+	uint16_t		max_rx_rings;
+	uint16_t		max_l2_ctx;
+	uint16_t		max_vnics;
+	uint16_t		max_stat_ctx;
+	uint16_t		vlan;
 	struct bnxt_pf_info		pf;
-	struct bnxt_vf_info		vf;
 	uint8_t			port_partition_type;
 	uint8_t			dev_stopped;
+	uint32_t		fw_ver;
+};
+
+/*
+ * Response sent back to the caller after callback
+ */
+enum rte_pmd_bnxt_mb_event_rsp {
+	RTE_PMD_BNXT_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
+	RTE_PMD_BNXT_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
+	RTE_PMD_BNXT_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
+	RTE_PMD_BNXT_MB_EVENT_MAX       /**< max value of this enum */
+};
+
+/* mailbox message types */
+#define BNXT_VF_RESET			0x01 /* VF requests reset */
+#define BNXT_VF_SET_MAC_ADDR	0x02 /* VF requests PF to set MAC addr */
+#define BNXT_VF_SET_VLAN		0x03 /* VF requests PF to set VLAN */
+#define BNXT_VF_SET_MTU			0x04 /* VF requests PF to set MTU */
+#define BNXT_VF_SET_MRU			0x05 /* VF requests PF to set MRU */
+
+/*
+ * Data sent to the caller when the callback is executed.
+ */
+struct rte_pmd_bnxt_mb_event_param {
+	uint16_t vf_id;	/* Virtual Function number */
+	int	retval;	/* return value */
+	void	*msg;	/* pointer to message */
 };
 
 int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete);
+int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);
 
 #endif
drivers/net/bnxt/bnxt_ethdev.c +111 -44

242 lines not on this page · raw message

drivers/net/bnxt/bnxt_filter.c +3 -27
index df1042c..137c7b7 100644
@@ -73,15 +73,7 @@ void bnxt_init_filters(struct bnxt *bp)
 	struct bnxt_filter_info *filter;
 	int i, max_filters;
 
-	if (BNXT_PF(bp)) {
-		struct bnxt_pf_info *pf = &bp->pf;
-
-		max_filters = pf->max_l2_ctx;
-	} else {
-		struct bnxt_vf_info *vf = &bp->vf;
-
-		max_filters = vf->max_l2_ctx;
-	}
+	max_filters = bp->max_l2_ctx;
 	STAILQ_INIT(&bp->free_filter_list);
 	for (i = 0; i < max_filters; i++) {
 		filter = &bp->filter_info[i];
@@ -122,15 +114,7 @@ void bnxt_free_filter_mem(struct bnxt *bp)
 		return;
 
 	/* Ensure that all filters are freed */
-	if (BNXT_PF(bp)) {
-		struct bnxt_pf_info *pf = &bp->pf;
-
-		max_filters = pf->max_l2_ctx;
-	} else {
-		struct bnxt_vf_info *vf = &bp->vf;
-
-		max_filters = vf->max_l2_ctx;
-	}
+	max_filters = bp->max_l2_ctx;
 	for (i = 0; i < max_filters; i++) {
 		filter = &bp->filter_info[i];
 		if (filter->fw_l2_filter_id != ((uint64_t)-1)) {
@@ -155,15 +139,7 @@ int bnxt_alloc_filter_mem(struct bnxt *bp)
 	struct bnxt_filter_info *filter_mem;
 	uint16_t max_filters;
 
-	if (BNXT_PF(bp)) {
-		struct bnxt_pf_info *pf = &bp->pf;
-
-		max_filters = pf->max_l2_ctx;
-	} else {
-		struct bnxt_vf_info *vf = &bp->vf;
-
-		max_filters = vf->max_l2_ctx;
-	}
+	max_filters = bp->max_l2_ctx;
 	/* Allocate memory for VNIC pool and filter pool */
 	filter_mem = rte_zmalloc("bnxt_filter_info",
 				 max_filters * sizeof(struct bnxt_filter_info),
drivers/net/bnxt/bnxt_hwrm.c +561 -53

738 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +14 -3
index 6519ef2..0046ba4 100644
@@ -51,14 +51,17 @@ int bnxt_hwrm_clear_filter(struct bnxt *bp,
 int bnxt_hwrm_set_filter(struct bnxt *bp,
 			 struct bnxt_vnic_info *vnic,
 			 struct bnxt_filter_info *filter);
-
 int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, void *fwd_cmd);
+int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
+			      void *encaped, size_t ec_size);
 
-int bnxt_hwrm_func_driver_register(struct bnxt *bp, uint32_t flags,
-				   uint32_t *vf_req_fwd);
+int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp);
+int bnxt_hwrm_func_buf_unrgtr(struct bnxt *bp);
+int bnxt_hwrm_func_driver_register(struct bnxt *bp);
 int bnxt_hwrm_func_qcaps(struct bnxt *bp);
 int bnxt_hwrm_func_reset(struct bnxt *bp);
 int bnxt_hwrm_func_driver_unregister(struct bnxt *bp, uint32_t flags);
+int bnxt_hwrm_func_cfg_def_cp(struct bnxt *bp);
 
 int bnxt_hwrm_queue_qportcfg(struct bnxt *bp);
 
@@ -81,6 +84,8 @@ int bnxt_hwrm_ver_get(struct bnxt *bp);
 
 int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic);
+int bnxt_hwrm_vnic_qcfg(struct bnxt *bp, struct bnxt_vnic_info *vnic,
+				int16_t fw_vf_id);
 int bnxt_hwrm_vnic_ctx_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_vnic_ctx_free(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_vnic_free(struct bnxt *bp, struct bnxt_vnic_info *vnic);
@@ -101,5 +106,11 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp);
 int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link);
 int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up);
 int bnxt_hwrm_func_qcfg(struct bnxt *bp);
+int bnxt_hwrm_allocate_pf_only(struct bnxt *bp);
+int bnxt_hwrm_allocate_vfs(struct bnxt *bp, int num_vfs);
+int bnxt_hwrm_func_vf_mac(struct bnxt *bp, uint16_t vf,
+			  const uint8_t *mac_addr);
+int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf,
+				       struct ether_addr *mac);
 
 #endif
drivers/net/bnxt/bnxt_vnic.c +7 -38

73 lines not on this page · raw message

drivers/net/bnxt/bnxt_vnic.h +9 -2
index 9671ba4..ca1c9cf 100644
@@ -42,8 +42,7 @@ struct bnxt_vnic_info {
 	uint8_t		ff_pool_idx;
 
 	uint16_t	fw_vnic_id; /* returned by Chimp during alloc */
-	uint16_t	fw_rss_cos_lb_ctx;
-	uint16_t	ctx_is_rss_cos_lb;
+	uint16_t	rss_rule;
 #define MAX_NUM_TRAFFIC_CLASSES		8
 #define MAX_NUM_RSS_QUEUES_PER_VNIC	16
 #define MAX_QUEUES_PER_VNIC	(MAX_NUM_RSS_QUEUES_PER_VNIC + \
@@ -51,6 +50,8 @@ struct bnxt_vnic_info {
 	uint16_t	start_grp_id;
 	uint16_t	end_grp_id;
 	uint16_t	fw_grp_ids[MAX_QUEUES_PER_VNIC];
+	uint16_t	dflt_ring_grp;
+	uint16_t	mru;
 	uint16_t	hash_type;
 	phys_addr_t	rss_table_dma_addr;
 	uint16_t	*rss_table;
@@ -60,8 +61,14 @@ struct bnxt_vnic_info {
 #define BNXT_VNIC_INFO_PROMISC			(1 << 0)
 #define BNXT_VNIC_INFO_ALLMULTI			(1 << 1)
 
+	uint16_t	cos_rule;
+	uint16_t	lb_rule;
 	bool		vlan_strip;
 	bool		func_default;
+	bool		bd_stall;
+	bool		roce_dual;
+	bool		roce_only;
+	bool		rss_dflt_cr;
 
 	STAILQ_HEAD(, bnxt_filter_info)	filter;
 };
Signature · 1 line
2.10.1 (Apple Git-78)
#100 lore raw

PATCH v4 3/26 net/bnxt: handle VF/PF initialization appropriately

In reply to Ajit Khaparde

1) For a VF, query the firmware to determine if a MAC address is already configured. If not configure a random default MAC address.
2) Do not initialize the default completion ring in bnxt_alloc_hwrm_rings().
3) While registering for async events with the firmware,
use func_vf_cfg for a VF and use func_cfg for a PF.
4) Query the VNIC plcmode config using the bnxt_hwrm_vnic_plcmodes_qcfg before a VNIC is updated. Reconfigure the VNIC with the plcmode configuration queried earlier. Not doing this could overwrite the plcmodes in some cases.
5) Reorg the bnxt_handle_fwd_req to properly handle the forwarded requests. The previous code did not handle it completely.

--
v1->v2: regroup related patches and incorporate other
review comments.

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject

---
 doc/guides/nics/features/bnxt.ini |   2 +
 drivers/net/bnxt/bnxt_cpr.c       | 131 ++++++++++++++++++++++---------
 drivers/net/bnxt/bnxt_cpr.h       |  17 ++++
 drivers/net/bnxt/bnxt_ethdev.c    |  30 +++++---
 drivers/net/bnxt/bnxt_filter.c    |   2 +-
 drivers/net/bnxt/bnxt_hwrm.c      | 158 +++++++++++++++++++++++++++++++++-----
 drivers/net/bnxt/bnxt_hwrm.h      |   4 +-
 drivers/net/bnxt/bnxt_irq.c       |  21 +++--
 drivers/net/bnxt/bnxt_ring.c      |  17 +---
 9 files changed, 294 insertions(+), 88 deletions(-)
doc/guides/nics/features/bnxt.ini +2 -0
index 013a9cd..8fcabdb 100644
@@ -12,5 +12,7 @@ Multicast MAC filter = Y
 RSS reta update      = Y
 Basic stats          = Y
 Extended stats       = Y
+SR-IOV               = Y
+Linux VFIO           = Y
 Linux UIO            = Y
 x86-64               = Y
drivers/net/bnxt/bnxt_cpr.c +95 -36

151 lines not on this page · raw message

drivers/net/bnxt/bnxt_cpr.h +17 -0
index 83e5376..a6e8785 100644
@@ -33,6 +33,7 @@
 
 #ifndef _BNXT_CPR_H_
 #define _BNXT_CPR_H_
+#include <stdbool.h>
 
 #include <rte_io.h>
 
@@ -56,6 +57,19 @@
 		    RING_CMP(((cpr)->cp_ring_struct), raw_cons)),	\
 		    ((cpr)->cp_doorbell))
 
+#define B_CP_DB_ARM(cpr)	rte_write32((DB_KEY_CP), ((cpr)->cp_doorbell))
+#define B_CP_DB_DISARM(cpr)	(*(uint32_t *)((cpr)->cp_doorbell) = \
+				 DB_KEY_CP | DB_IRQ_DIS)
+
+#define B_CP_DB_IDX_ARM(cpr, cons)					\
+		(*(uint32_t *)((cpr)->cp_doorbell) = (DB_CP_REARM_FLAGS | \
+				(cons)))
+
+#define B_CP_DB_IDX_DISARM(cpr, cons)	do {				\
+		rte_smp_wmb();						\
+		(*(uint32_t *)((cpr)->cp_doorbell) = (DB_CP_FLAGS |	\
+				(cons));				\
+} while (0)
 #define B_CP_DIS_DB(cpr, raw_cons)					\
 	rte_write32((DB_CP_FLAGS |					\
 		    RING_CMP(((cpr)->cp_ring_struct), raw_cons)),	\
@@ -75,6 +89,8 @@ struct bnxt_cp_ring_info {
 	uint32_t		hw_stats_ctx_id;
 
 	struct bnxt_ring	*cp_ring_struct;
+	uint16_t		cp_cons;
+	bool			v;
 };
 
 #define RX_CMP_L2_ERRORS						\
@@ -82,6 +98,7 @@ struct bnxt_cp_ring_info {
 
 
 struct bnxt;
+int bnxt_alloc_def_cp_ring(struct bnxt *bp);
 void bnxt_free_def_cp_ring(struct bnxt *bp);
 int bnxt_init_def_ring_struct(struct bnxt *bp, unsigned int socket_id);
 void bnxt_handle_async_event(struct bnxt *bp, struct cmpl_base *cmp);
drivers/net/bnxt/bnxt_ethdev.c +19 -11
index 6e7e4f6..7fe6969 100644
@@ -228,28 +228,31 @@ static int bnxt_init_chip(struct bnxt *bp)
 
 		rc = bnxt_hwrm_vnic_alloc(bp, vnic);
 		if (rc) {
-			RTE_LOG(ERR, PMD, "HWRM vnic alloc failure rc: %x\n",
-				rc);
+			RTE_LOG(ERR, PMD, "HWRM vnic %d alloc failure rc: %x\n",
+				i, rc);
 			goto err_out;
 		}
 
 		rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic);
 		if (rc) {
 			RTE_LOG(ERR, PMD,
-				"HWRM vnic ctx alloc failure rc: %x\n", rc);
+				"HWRM vnic %d ctx alloc failure rc: %x\n",
+				i, rc);
 			goto err_out;
 		}
 
 		rc = bnxt_hwrm_vnic_cfg(bp, vnic);
 		if (rc) {
-			RTE_LOG(ERR, PMD, "HWRM vnic cfg failure rc: %x\n", rc);
+			RTE_LOG(ERR, PMD, "HWRM vnic %d cfg failure rc: %x\n",
+				i, rc);
 			goto err_out;
 		}
 
 		rc = bnxt_set_hwrm_vnic_filters(bp, vnic);
 		if (rc) {
-			RTE_LOG(ERR, PMD, "HWRM vnic filter failure rc: %x\n",
-				rc);
+			RTE_LOG(ERR, PMD,
+				"HWRM vnic %d filter failure rc: %x\n",
+				i, rc);
 			goto err_out;
 		}
 		if (vnic->rss_table && vnic->hash_type) {
@@ -269,8 +272,8 @@ static int bnxt_init_chip(struct bnxt *bp)
 			rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
 			if (rc) {
 				RTE_LOG(ERR, PMD,
-					"HWRM vnic set RSS failure rc: %x\n",
-					rc);
+					"HWRM vnic %d set RSS failure rc: %x\n",
+					i, rc);
 				goto err_out;
 			}
 		}
@@ -638,7 +641,7 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
 			new.link_speed = ETH_LINK_SPEED_100M;
 			new.link_duplex = ETH_LINK_FULL_DUPLEX;
 			RTE_LOG(ERR, PMD,
-				"Failed to retrieve link rc = 0x%x!", rc);
+				"Failed to retrieve link rc = 0x%x!\n", rc);
 			goto out;
 		}
 		rte_delay_ms(BNXT_LINK_WAIT_INTERVAL);
@@ -1010,7 +1013,8 @@ static bool bnxt_vf_pciid(uint16_t id)
 	if (id == BROADCOM_DEV_ID_57304_VF ||
 	    id == BROADCOM_DEV_ID_57406_VF ||
 	    id == BROADCOM_DEV_ID_5731X_VF ||
-	    id == BROADCOM_DEV_ID_5741X_VF)
+	    id == BROADCOM_DEV_ID_5741X_VF ||
+	    id == BROADCOM_DEV_ID_57414_VF)
 		return true;
 	return false;
 }
@@ -1066,7 +1070,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	int rc;
 
 	if (version_printed++ == 0)
-		RTE_LOG(INFO, PMD, "%s", bnxt_version);
+		RTE_LOG(INFO, PMD, "%s\n", bnxt_version);
 
 	rte_eth_copy_pci_info(eth_dev, pci_dev);
 	eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
@@ -1207,6 +1211,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	if (rc)
 		goto error_free_int;
 
+	rc = bnxt_alloc_def_cp_ring(bp);
+	if (rc)
+		goto error_free_int;
+
 	bnxt_enable_int(bp);
 
 	return 0;
drivers/net/bnxt/bnxt_filter.c +1 -1
index 137c7b7..0afde86 100644
@@ -126,7 +126,7 @@ void bnxt_free_filter_mem(struct bnxt *bp)
 				       "HWRM filter cannot be freed rc = %d\n",
 					rc);
 		}
-		filter->fw_l2_filter_id = -1;
+		filter->fw_l2_filter_id = UINT64_MAX;
 	}
 	STAILQ_INIT(&bp->free_filter_list);
 
drivers/net/bnxt/bnxt_hwrm.c +140 -18

209 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +3 -1
index 0046ba4..1ea78b2 100644
@@ -51,7 +51,8 @@ int bnxt_hwrm_clear_filter(struct bnxt *bp,
 int bnxt_hwrm_set_filter(struct bnxt *bp,
 			 struct bnxt_vnic_info *vnic,
 			 struct bnxt_filter_info *filter);
-int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, void *fwd_cmd);
+int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, uint16_t target_id,
+			    void *encaped, size_t ec_size);
 int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
 			      void *encaped, size_t ec_size);
 
@@ -62,6 +63,7 @@ int bnxt_hwrm_func_qcaps(struct bnxt *bp);
 int bnxt_hwrm_func_reset(struct bnxt *bp);
 int bnxt_hwrm_func_driver_unregister(struct bnxt *bp, uint32_t flags);
 int bnxt_hwrm_func_cfg_def_cp(struct bnxt *bp);
+int bnxt_hwrm_vf_func_cfg_def_cp(struct bnxt *bp);
 
 int bnxt_hwrm_queue_qportcfg(struct bnxt *bp);
 
drivers/net/bnxt/bnxt_irq.c +16 -5
index 20e17ff..a3d235d 100644
@@ -66,16 +66,26 @@ static void bnxt_int_handler(void *param)
 			/* Handle any async event */
 			bnxt_handle_async_event(bp, cmp);
 			break;
-		case CMPL_BASE_TYPE_HWRM_FWD_RESP:
+		case CMPL_BASE_TYPE_HWRM_FWD_REQ:
 			/* Handle HWRM forwarded responses */
 			bnxt_handle_fwd_req(bp, cmp);
 			break;
 		default:
 			/* Ignore any other events */
+			if (cmp->type & rte_cpu_to_le_16(0x01)) {
+				if (!CMP_VALID(cmp, raw_cons,
+					       cpr->cp_ring_struct))
+					goto no_more;
+			}
+			RTE_LOG(INFO, PMD,
+				"Ignoring %02x completion\n", CMP_TYPE(cmp));
 			break;
 		}
 		raw_cons = NEXT_RAW_CMP(raw_cons);
-	}
+
+	};
+no_more:
+	cpr->cp_raw_cons = raw_cons;
 	B_CP_DB_REARM(cpr, cpr->cp_raw_cons);
 }
 
@@ -102,14 +112,15 @@ void bnxt_disable_int(struct bnxt *bp)
 	struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;
 
 	/* Only the default completion ring */
-	B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
+	if (cpr != NULL && cpr->cp_doorbell != NULL)
+		B_CP_DB_DISARM(cpr);
 }
 
 void bnxt_enable_int(struct bnxt *bp)
 {
 	struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;
 
-	B_CP_DB_REARM(cpr, cpr->cp_raw_cons);
+	B_CP_DB_ARM(cpr);
 }
 
 int bnxt_setup_int(struct bnxt *bp)
@@ -136,7 +147,7 @@ int bnxt_setup_int(struct bnxt *bp)
 	return 0;
 
 setup_exit:
-	RTE_LOG(ERR, PMD, "bnxt_irq_tbl setup failed");
+	RTE_LOG(ERR, PMD, "bnxt_irq_tbl setup failed\n");
 	return rc;
 }
 
drivers/net/bnxt/bnxt_ring.c +1 -16
index 52fbd89..c1698ea 100644
@@ -213,21 +213,6 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 	unsigned int i;
 	int rc = 0;
 
-	/* Default completion ring */
-	{
-		struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;
-		struct bnxt_ring *cp_ring = cpr->cp_ring_struct;
-
-		rc = bnxt_hwrm_ring_alloc(bp, cp_ring,
-					HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL,
-					0, HWRM_NA_SIGNATURE);
-		if (rc)
-			goto err_out;
-		cpr->cp_doorbell = pci_dev->mem_resource[2].addr;
-		B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
-		bp->grp_info[0].cp_fw_ring_id = cp_ring->fw_ring_id;
-	}
-
 	for (i = 0; i < bp->rx_cp_nr_rings; i++) {
 		struct bnxt_rx_queue *rxq = bp->rx_queues[i];
 		struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
@@ -259,7 +244,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		bp->grp_info[idx].rx_fw_ring_id = ring->fw_ring_id;
 		B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
 		if (bnxt_init_one_rx_ring(rxq)) {
-			RTE_LOG(ERR, PMD, "bnxt_init_one_rx_ring failed!");
+			RTE_LOG(ERR, PMD, "bnxt_init_one_rx_ring failed!\n");
 			bnxt_rx_queue_release_op(rxq);
 			return -ENOMEM;
 		}
Signature · 1 line
2.10.1 (Apple Git-78)
#101 lore raw

PATCH v4 4/26 net/bnxt: support lack of huge pages

In reply to Ajit Khaparde

rte_malloc_virt2phy() does not return a physical address if huge pages aren't in use. Further, rte_memzone->phys_addr is not a physical address.

Use rte_mem_virt2phy() and manually lock pages to support lack of huge pages.

Also check the return value of rte_mem_virt2phy()

Verify the function returns an address. Otherwise return an error and log a message.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject

---
 drivers/net/bnxt/bnxt_hwrm.c | 17 +++++++++++++++--
 drivers/net/bnxt/bnxt_ring.c | 31 +++++++++++++++++++++++++------
 drivers/net/bnxt/bnxt_vnic.c | 16 +++++++++++++++-
 3 files changed, 55 insertions(+), 9 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +15 -2
index 7c7c9ce..d2a8d8f 100644
@@ -489,8 +489,15 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 			rc = -ENOMEM;
 			goto error;
 		}
+		rte_mem_lock_page(bp->hwrm_cmd_resp_addr);
 		bp->hwrm_cmd_resp_dma_addr =
-			rte_malloc_virt2phy(bp->hwrm_cmd_resp_addr);
+			rte_mem_virt2phy(bp->hwrm_cmd_resp_addr);
+		if (bp->hwrm_cmd_resp_dma_addr == 0) {
+			RTE_LOG(ERR, PMD,
+			"Unable to map response buffer to physical memory.\n");
+			rc = -ENOMEM;
+			goto error;
+		}
 		bp->max_resp_len = max_resp_len;
 	}
 
@@ -1363,10 +1370,16 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp)
 	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);
 	if (bp->hwrm_cmd_resp_addr == NULL)
 		return -ENOMEM;
 	bp->hwrm_cmd_resp_dma_addr =
-		rte_malloc_virt2phy(bp->hwrm_cmd_resp_addr);
+		rte_mem_virt2phy(bp->hwrm_cmd_resp_addr);
+	if (bp->hwrm_cmd_resp_dma_addr == 0) {
+		RTE_LOG(ERR, PMD,
+			"unable to map response address to physical memory\n");
+		return -ENOMEM;
+	}
 	rte_spinlock_init(&bp->hwrm_lock);
 
 	return 0;
drivers/net/bnxt/bnxt_ring.c +25 -6
index c1698ea..5e4236a 100644
@@ -32,6 +32,7 @@
  */
 
 #include <rte_memzone.h>
+#include <unistd.h>
 
 #include "bnxt.h"
 #include "bnxt_cpr.h"
@@ -96,6 +97,8 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	struct rte_pci_device *pdev = bp->pdev;
 	const struct rte_memzone *mz = NULL;
 	char mz_name[RTE_MEMZONE_NAMESIZE];
+	phys_addr_t mz_phys_addr;
+	int sz;
 
 	int stats_len = (tx_ring_info || rx_ring_info) ?
 	    RTE_CACHE_LINE_ROUNDUP(sizeof(struct ctx_hw_stats64)) : 0;
@@ -136,21 +139,37 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
 	mz = rte_memzone_lookup(mz_name);
 	if (!mz) {
-		mz = rte_memzone_reserve(mz_name, total_alloc_len,
+		mz = rte_memzone_reserve_aligned(mz_name, total_alloc_len,
 					 SOCKET_ID_ANY,
 					 RTE_MEMZONE_2MB |
-					 RTE_MEMZONE_SIZE_HINT_ONLY);
+					 RTE_MEMZONE_SIZE_HINT_ONLY,
+					 getpagesize());
 		if (mz == NULL)
 			return -ENOMEM;
 	}
 	memset(mz->addr, 0, mz->len);
+	mz_phys_addr = mz->phys_addr;
+	if ((unsigned long)mz->addr == mz_phys_addr) {
+		RTE_LOG(WARNING, PMD,
+			"Memzone physical address same as virtual.\n");
+		RTE_LOG(WARNING, PMD,
+			"Using rte_mem_virt2phy()\n");
+		for (sz = 0; sz < total_alloc_len; sz += getpagesize())
+			rte_mem_lock_page(((char *)mz->addr) + sz);
+		mz_phys_addr = rte_mem_virt2phy(mz->addr);
+		if (mz_phys_addr == 0) {
+			RTE_LOG(ERR, PMD,
+			"unable to map ring address to physical memory\n");
+			return -ENOMEM;
+		}
+	}
 
 	if (tx_ring_info) {
 		tx_ring = tx_ring_info->tx_ring_struct;
 
 		tx_ring->bd = ((char *)mz->addr + tx_ring_start);
 		tx_ring_info->tx_desc_ring = (struct tx_bd_long *)tx_ring->bd;
-		tx_ring->bd_dma = mz->phys_addr + tx_ring_start;
+		tx_ring->bd_dma = mz_phys_addr + tx_ring_start;
 		tx_ring_info->tx_desc_mapping = tx_ring->bd_dma;
 		tx_ring->mem_zone = (const void *)mz;
 
@@ -170,7 +189,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 		rx_ring->bd = ((char *)mz->addr + rx_ring_start);
 		rx_ring_info->rx_desc_ring =
 		    (struct rx_prod_pkt_bd *)rx_ring->bd;
-		rx_ring->bd_dma = mz->phys_addr + rx_ring_start;
+		rx_ring->bd_dma = mz_phys_addr + rx_ring_start;
 		rx_ring_info->rx_desc_mapping = rx_ring->bd_dma;
 		rx_ring->mem_zone = (const void *)mz;
 
@@ -185,7 +204,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	}
 
 	cp_ring->bd = ((char *)mz->addr + cp_ring_start);
-	cp_ring->bd_dma = mz->phys_addr + cp_ring_start;
+	cp_ring->bd_dma = mz_phys_addr + cp_ring_start;
 	cp_ring_info->cp_desc_ring = cp_ring->bd;
 	cp_ring_info->cp_desc_mapping = cp_ring->bd_dma;
 	cp_ring->mem_zone = (const void *)mz;
@@ -196,7 +215,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 		*cp_ring->vmem = ((char *)mz->addr + stats_len);
 	if (stats_len) {
 		cp_ring_info->hw_stats = mz->addr;
-		cp_ring_info->hw_stats_map = mz->phys_addr;
+		cp_ring_info->hw_stats_map = mz_phys_addr;
 	}
 	cp_ring_info->hw_stats_ctx_id = HWRM_NA_SIGNATURE;
 	return 0;
drivers/net/bnxt/bnxt_vnic.c +15 -1
index 4e378a9..fe2244b 100644
@@ -173,6 +173,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 				HW_HASH_KEY_SIZE);
 	uint16_t max_vnics;
 	int i;
+	phys_addr_t mz_phys_addr;
 
 	max_vnics = bp->max_vnics;
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
@@ -189,6 +190,19 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 		if (!mz)
 			return -ENOMEM;
 	}
+	mz_phys_addr = mz->phys_addr;
+	if ((unsigned long)mz->addr == mz_phys_addr) {
+		RTE_LOG(WARNING, PMD,
+			"Memzone physical address same as virtual.\n");
+		RTE_LOG(WARNING, PMD,
+			"Using rte_mem_virt2phy()\n");
+		mz_phys_addr = rte_mem_virt2phy(mz->addr);
+		if (mz_phys_addr == 0) {
+			RTE_LOG(ERR, PMD,
+			"unable to map vnic address to physical memory\n");
+			return -ENOMEM;
+		}
+	}
 
 	for (i = 0; i < max_vnics; i++) {
 		vnic = &bp->vnic_info[i];
@@ -198,7 +212,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 			(void *)((char *)mz->addr + (entry_length * i));
 		memset(vnic->rss_table, -1, entry_length);
 
-		vnic->rss_table_dma_addr = mz->phys_addr + (entry_length * i);
+		vnic->rss_table_dma_addr = mz_phys_addr + (entry_length * i);
 		vnic->rss_hash_key = (void *)((char *)vnic->rss_table +
 			     HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table));
 
Signature · 1 line
2.10.1 (Apple Git-78)
#102 lore raw

PATCH v4 5/26 net/bnxt: add additonal HWRM debug info to error messages

In reply to Ajit Khaparde

Add the cmd_err and opaque_0 and opaque_1 fields to HWRM error messages. These allow better debugging of some classes of HWRM errors.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject

---
 drivers/net/bnxt/bnxt_hwrm.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +17 -2
index d2a8d8f..3c2f148 100644
@@ -139,7 +139,7 @@ static int bnxt_hwrm_send_message_locked(struct bnxt *bp, void *msg,
 	}
 
 	if (i >= HWRM_CMD_TIMEOUT) {
-		RTE_LOG(ERR, PMD, "Error sending msg %x\n",
+		RTE_LOG(ERR, PMD, "Error sending msg 0x%04x\n",
 			req->req_type);
 		goto err_ret;
 	}
@@ -176,7 +176,22 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, uint32_t msg_len)
 		} \
 		if (resp->error_code) { \
 			rc = rte_le_to_cpu_16(resp->error_code); \
-			RTE_LOG(ERR, PMD, "%s error %d\n", __func__, rc); \
+			if (resp->resp_len >= 16) { \
+				struct hwrm_err_output *tmp_hwrm_err_op = \
+							(void *)resp; \
+				RTE_LOG(ERR, PMD, \
+					"%s error %d:%d:%08x:%04x\n", \
+					__func__, \
+					rc, tmp_hwrm_err_op->cmd_err, \
+					rte_le_to_cpu_32(\
+						tmp_hwrm_err_op->opaque_0), \
+					rte_le_to_cpu_16(\
+						tmp_hwrm_err_op->opaque_1)); \
+			} \
+			else { \
+				RTE_LOG(ERR, PMD, \
+					"%s error %d\n", __func__, rc); \
+			} \
 			return rc; \
 		} \
 	}
Signature · 1 line
2.10.1 (Apple Git-78)
#103 lore raw

PATCH v4 6/26 net/bnxt: add tunneling support

In reply to Ajit Khaparde

Add support for udp_tunnel_port_add/del dev_ops to configure a UDP port for VXLAN and Geneve Tunnel protocols.
The HWRM supports only one global destination port for a tunnel type, use a referene counter to keep track of its usage.
Cache the configured VXLAN/Geneve ports and use that value to check if the right UDP port is being freed up.
Skip calling bnxt_hwrm_tunnel_dst_port_alloc if the same UDP port is being programmed.
Skip calling bnxt_hwrm_tunnel_dst_port_free if no UDP port has been configured.
Also update tx offload capabilities

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject

---
 drivers/net/bnxt/bnxt.h        |   6 +++
 drivers/net/bnxt/bnxt_ethdev.c | 119 ++++++++++++++++++++++++++++++++++++++++-
 drivers/net/bnxt/bnxt_hwrm.c   |  56 +++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h   |   5 ++
 drivers/net/bnxt/bnxt_txr.c    |   3 +-
 5 files changed, 187 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt.h +6 -0
index 0c59c66..3bc3f99 100644
@@ -188,6 +188,12 @@ struct bnxt {
 	struct bnxt_pf_info		pf;
 	uint8_t			port_partition_type;
 	uint8_t			dev_stopped;
+	uint8_t			vxlan_port_cnt;
+	uint8_t			geneve_port_cnt;
+	uint16_t		vxlan_port;
+	uint16_t		geneve_port;
+	uint16_t		vxlan_fw_dst_port_id;
+	uint16_t		geneve_fw_dst_port_id;
 	uint32_t		fw_ver;
 };
 
drivers/net/bnxt/bnxt_ethdev.c +118 -1

137 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +56 -0

74 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +5 -0
index 1ea78b2..cee8fca 100644
@@ -114,5 +114,10 @@ int bnxt_hwrm_func_vf_mac(struct bnxt *bp, uint16_t vf,
 			  const uint8_t *mac_addr);
 int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf,
 				       struct ether_addr *mac);
+int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port,
+				uint8_t tunnel_type);
+int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, uint16_t port,
+				uint8_t tunnel_type);
+void bnxt_free_tunnel_ports(struct bnxt *bp);
 
 #endif
drivers/net/bnxt/bnxt_txr.c +2 -1
index 0d15bb1..6870b16 100644
@@ -213,7 +213,8 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 			/* TSO */
 			txbd1->lflags = TX_BD_LONG_LFLAGS_LSO;
 			txbd1->hdr_size = tx_pkt->l2_len + tx_pkt->l3_len +
-					tx_pkt->l4_len;
+					tx_pkt->l4_len + tx_pkt->outer_l2_len +
+					tx_pkt->outer_l3_len;
 			txbd1->mss = tx_pkt->tso_segsz;
 
 		} else if (tx_pkt->ol_flags & (PKT_TX_TCP_CKSUM |
Signature · 1 line
2.10.1 (Apple Git-78)
#104 lore raw

PATCH v4 7/26 net/bnxt: add support for xstats get/reset

In reply to Ajit Khaparde

This patch adds support to get and reset xstats dev_ops

dev_ops added:
xstats_get, xstats_get_name, xstats_reset

HWRM commands added:
hwrm_port_qstats, hwrm_port_clr_stats

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject

---
 drivers/net/bnxt/bnxt.h        |   7 ++
 drivers/net/bnxt/bnxt_ethdev.c |  84 +++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.c   |  36 +++++++
 drivers/net/bnxt/bnxt_hwrm.h   |   3 +-
 drivers/net/bnxt/bnxt_stats.c  | 207 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_stats.h  |  10 ++
 6 files changed, 346 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt.h +7 -0
index 3bc3f99..fde2202 100644
@@ -130,6 +130,7 @@ struct bnxt {
 	uint32_t		flags;
 #define BNXT_FLAG_REGISTERED	(1 << 0)
 #define BNXT_FLAG_VF		(1 << 1)
+#define BNXT_FLAG_PORT_STATS	(1 << 2)
 #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)
@@ -138,10 +139,16 @@ struct bnxt {
 	unsigned int		rx_nr_rings;
 	unsigned int		rx_cp_nr_rings;
 	struct bnxt_rx_queue **rx_queues;
+	const void		*rx_mem_zone;
+	struct rx_port_stats    *hw_rx_port_stats;
+	phys_addr_t		hw_rx_port_stats_map;
 
 	unsigned int		tx_nr_rings;
 	unsigned int		tx_cp_nr_rings;
 	struct bnxt_tx_queue **tx_queues;
+	const void		*tx_mem_zone;
+	struct tx_port_stats    *hw_tx_port_stats;
+	phys_addr_t		hw_tx_port_stats_map;
 
 	/* Default completion ring */
 	struct bnxt_cp_ring_info	*def_cp_ring;
drivers/net/bnxt/bnxt_ethdev.c +84 -0

115 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +36 -0
index dab4171..d942648 100644
@@ -2246,3 +2246,39 @@ int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, uint16_t target_id,
 
 	return rc;
 }
+
+int bnxt_hwrm_port_qstats(struct bnxt *bp)
+{
+	struct hwrm_port_qstats_input req = {0};
+	struct hwrm_port_qstats_output *resp = bp->hwrm_cmd_resp_addr;
+	struct bnxt_pf_info *pf = &bp->pf;
+	int rc;
+
+	if (!(bp->flags & BNXT_FLAG_PORT_STATS))
+		return 0;
+
+	HWRM_PREP(req, PORT_QSTATS, -1, resp);
+	req.port_id = rte_cpu_to_le_16(pf->port_id);
+	req.tx_stat_host_addr = rte_cpu_to_le_64(bp->hw_tx_port_stats_map);
+	req.rx_stat_host_addr = rte_cpu_to_le_64(bp->hw_rx_port_stats_map);
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+	HWRM_CHECK_RESULT;
+	return rc;
+}
+
+int bnxt_hwrm_port_clr_stats(struct bnxt *bp)
+{
+	struct hwrm_port_clr_stats_input req = {0};
+	struct hwrm_port_clr_stats_output *resp = bp->hwrm_cmd_resp_addr;
+	struct bnxt_pf_info *pf = &bp->pf;
+	int rc;
+
+	if (!(bp->flags & BNXT_FLAG_PORT_STATS))
+		return 0;
+
+	HWRM_PREP(req, PORT_CLR_STATS, -1, resp);
+	req.port_id = rte_cpu_to_le_16(pf->port_id);
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+	HWRM_CHECK_RESULT;
+	return rc;
+}
drivers/net/bnxt/bnxt_hwrm.h +2 -1
index cee8fca..8f7d103 100644
@@ -119,5 +119,6 @@ int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port,
 int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, uint16_t port,
 				uint8_t tunnel_type);
 void bnxt_free_tunnel_ports(struct bnxt *bp);
-
+int bnxt_hwrm_port_qstats(struct bnxt *bp);
+int bnxt_hwrm_port_clr_stats(struct bnxt *bp);
 #endif
drivers/net/bnxt/bnxt_stats.c +207 -0

216 lines not on this page · raw message

drivers/net/bnxt/bnxt_stats.h +10 -0
index 65408a4..b6d133e 100644
@@ -40,5 +40,15 @@ void bnxt_free_stats(struct bnxt *bp);
 void bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 			   struct rte_eth_stats *bnxt_stats);
 void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev);
+int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
+	struct rte_eth_xstat_name *xstats_names,
+	__rte_unused unsigned int limit);
+int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
+			   struct rte_eth_xstat *xstats, unsigned int n);
+void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev);
 
+struct bnxt_xstats_name_off {
+	char name[RTE_ETH_XSTATS_NAME_SIZE];
+	uint64_t offset;
+};
 #endif
Signature · 1 line
2.10.1 (Apple Git-78)
#105 lore raw

PATCH v4 8/26 net/bnxt: add support for VLAN filter and strip

In reply to Ajit Khaparde

This patch adds VLAN strip and offload callbacks.
To add a VLAN filter:
For each VNIC and each associated filter(s)
if VLAN exists:
if VLAN matches vlan_id
VLAN filter already exists, just skip and continue
else
add a new MAC+VLAN filter
else
Remove the old MAC only filter
Add a new MAC+VLAN filter

To remove a VLAN filter:
For each VNIC and each associated filter(s)
if VLAN exists && VLAN matches vlan_id
remove the MAC+VLAN filter
add a new MAC only filter
else
VLAN filter doesn't exist, just skip and continue

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Fix a "pointer from integer" warning seen during compilation

---
 doc/guides/nics/features/bnxt.ini |   2 +
 drivers/net/bnxt/bnxt_ethdev.c    | 201 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 203 insertions(+)
doc/guides/nics/features/bnxt.ini +2 -0
index 8fcabdb..78a738f 100644
@@ -9,6 +9,8 @@ Queue start/stop     = Y
 Promiscuous mode     = Y
 Unicast MAC filter   = Y
 Multicast MAC filter = Y
+VLAN filter          = Y
+VLAN offload         = Y
 RSS reta update      = Y
 Basic stats          = Y
 Extended stats       = Y
drivers/net/bnxt/bnxt_ethdev.c +201 -0

231 lines not on this page · raw message

Signature · 1 line
2.10.1 (Apple Git-78)
#106 lore raw

PATCH v4 9/26 net/bnxt: add support for set multicast addr list and MAC addr set

In reply to Ajit Khaparde

This patch adds support for set_mc_addr_list and
mac_addr_set dev_ops

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Split the patch to document "Allmulticast mode" in bnxt.ini

---
 drivers/net/bnxt/bnxt_ethdev.c | 74 ++++++++++++++++++++++++++++++++++++++++--
 drivers/net/bnxt/bnxt_hwrm.c   | 13 +++++---
 drivers/net/bnxt/bnxt_hwrm.h   |  2 +-
 drivers/net/bnxt/bnxt_vnic.c   |  7 +++-
 drivers/net/bnxt/bnxt_vnic.h   |  4 +++
 5 files changed, 91 insertions(+), 9 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +71 -3
index 5073cd8..ef14fb9 100644
@@ -638,7 +638,7 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev,
 	STAILQ_INSERT_TAIL(&vnic->filter, filter, next);
 	filter->mac_index = index;
 	memcpy(filter->l2_addr, mac_addr, ETHER_ADDR_LEN);
-	return bnxt_hwrm_set_filter(bp, vnic, filter);
+	return bnxt_hwrm_set_filter(bp, vnic->fw_vnic_id, filter);
 }
 
 int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
@@ -1155,7 +1155,7 @@ static int bnxt_del_vlan_filter(struct bnxt *bp, uint16_t vlan_id)
 					       filter->l2_addr, ETHER_ADDR_LEN);
 					/* MAC only filter */
 					rc = bnxt_hwrm_set_filter(bp,
-							vnic,
+							vnic->fw_vnic_id,
 							new_filter);
 					if (rc)
 						goto exit;
@@ -1229,7 +1229,7 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id)
 				new_filter->l2_ovlan = vlan_id;
 				new_filter->l2_ovlan_mask = 0xF000;
 				new_filter->enables |= en;
-				rc = bnxt_hwrm_set_filter(bp, vnic,
+				rc = bnxt_hwrm_set_filter(bp, vnic->fw_vnic_id,
 							  new_filter);
 				if (rc)
 					goto exit;
@@ -1290,6 +1290,72 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)
 		RTE_LOG(ERR, PMD, "Extend VLAN Not supported\n");
 }
 
+static void
+bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	/* Default Filter is tied to VNIC 0 */
+	struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
+	struct bnxt_filter_info *filter;
+	int rc;
+
+	if (BNXT_VF(bp))
+		return;
+
+	memcpy(bp->mac_addr, addr, sizeof(bp->mac_addr));
+	memcpy(&dev->data->mac_addrs[0], bp->mac_addr, ETHER_ADDR_LEN);
+
+	STAILQ_FOREACH(filter, &vnic->filter, next) {
+		/* Default Filter is at Index 0 */
+		if (filter->mac_index != 0)
+			continue;
+		rc = bnxt_hwrm_clear_filter(bp, filter);
+		if (rc)
+			break;
+		memcpy(filter->l2_addr, bp->mac_addr, ETHER_ADDR_LEN);
+		memset(filter->l2_addr_mask, 0xff, ETHER_ADDR_LEN);
+		filter->flags |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX;
+		filter->enables |=
+			HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR |
+			HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK;
+		rc = bnxt_hwrm_set_filter(bp, vnic->fw_vnic_id, filter);
+		if (rc)
+			break;
+		filter->mac_index = 0;
+		RTE_LOG(DEBUG, PMD, "Set MAC addr\n");
+	}
+}
+
+static int
+bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev,
+			  struct ether_addr *mc_addr_set,
+			  uint32_t nb_mc_addr)
+{
+	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	char *mc_addr_list = (char *)mc_addr_set;
+	struct bnxt_vnic_info *vnic;
+	uint32_t off = 0, i = 0;
+
+	vnic = &bp->vnic_info[0];
+
+	if (nb_mc_addr > BNXT_MAX_MC_ADDRS) {
+		vnic->flags |= BNXT_VNIC_INFO_ALLMULTI;
+		goto allmulti;
+	}
+
+	/* TODO Check for Duplicate mcast addresses */
+	vnic->flags &= ~BNXT_VNIC_INFO_ALLMULTI;
+	for (i = 0; i < nb_mc_addr; i++) {
+		memcpy(vnic->mc_list + off, &mc_addr_list[i], ETHER_ADDR_LEN);
+		off += ETHER_ADDR_LEN;
+	}
+
+	vnic->mc_addr_cnt = i;
+
+allmulti:
+	return bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic);
+}
+
 /*
  * Initialization
  */
@@ -1325,9 +1391,11 @@ static const struct eth_dev_ops bnxt_dev_ops = {
 	.udp_tunnel_port_del  = bnxt_udp_tunnel_port_del_op,
 	.vlan_filter_set = bnxt_vlan_filter_set_op,
 	.vlan_offload_set = bnxt_vlan_offload_set_op,
+	.mac_addr_set = bnxt_set_default_mac_addr_op,
 	.xstats_get = bnxt_dev_xstats_get_op,
 	.xstats_get_names = bnxt_dev_xstats_get_names_op,
 	.xstats_reset = bnxt_dev_xstats_reset_op,
+	.set_mc_addr_list = bnxt_dev_set_mc_addr_list_op,
 };
 
 static bool bnxt_vf_pciid(uint16_t id)
drivers/net/bnxt/bnxt_hwrm.c +9 -4
index d942648..22e18d6 100644
@@ -229,7 +229,12 @@ int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	if (vnic->flags & BNXT_VNIC_INFO_PROMISC)
 		mask = HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS;
 	if (vnic->flags & BNXT_VNIC_INFO_ALLMULTI)
-		mask = HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST;
+		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST;
+	if (vnic->mc_addr_cnt) {
+		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST;
+		req.num_mc_entries = rte_cpu_to_le_32(vnic->mc_addr_cnt);
+		req.mc_tbl_addr = rte_cpu_to_le_64(vnic->mc_list_dma_addr);
+	}
 	req.mask = rte_cpu_to_le_32(HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST |
 				    mask);
 
@@ -261,7 +266,7 @@ int bnxt_hwrm_clear_filter(struct bnxt *bp,
 }
 
 int bnxt_hwrm_set_filter(struct bnxt *bp,
-			 struct bnxt_vnic_info *vnic,
+			 uint16_t dst_id,
 			 struct bnxt_filter_info *filter)
 {
 	int rc = 0;
@@ -275,7 +280,7 @@ int bnxt_hwrm_set_filter(struct bnxt *bp,
 
 	enables = filter->enables |
 	      HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_DST_ID;
-	req.dst_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
+	req.dst_id = rte_cpu_to_le_16(dst_id);
 
 	if (enables &
 	    HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR)
@@ -1419,7 +1424,7 @@ int bnxt_set_hwrm_vnic_filters(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	int rc = 0;
 
 	STAILQ_FOREACH(filter, &vnic->filter, next) {
-		rc = bnxt_hwrm_set_filter(bp, vnic, filter);
+		rc = bnxt_hwrm_set_filter(bp, vnic->fw_vnic_id, filter);
 		if (rc)
 			break;
 	}
drivers/net/bnxt/bnxt_hwrm.h +1 -1
index 8f7d103..c15404f 100644
@@ -49,7 +49,7 @@ int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_clear_filter(struct bnxt *bp,
 			   struct bnxt_filter_info *filter);
 int bnxt_hwrm_set_filter(struct bnxt *bp,
-			 struct bnxt_vnic_info *vnic,
+			 uint16_t dst_id,
 			 struct bnxt_filter_info *filter);
 int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, uint16_t target_id,
 			    void *encaped, size_t ec_size);
drivers/net/bnxt/bnxt_vnic.c +6 -1
index fe2244b..db9fb07 100644
@@ -170,7 +170,8 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 	char mz_name[RTE_MEMZONE_NAMESIZE];
 	uint32_t entry_length = RTE_CACHE_LINE_ROUNDUP(
 				HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table) +
-				HW_HASH_KEY_SIZE);
+				HW_HASH_KEY_SIZE +
+				BNXT_MAX_MC_ADDRS * ETHER_ADDR_LEN);
 	uint16_t max_vnics;
 	int i;
 	phys_addr_t mz_phys_addr;
@@ -218,6 +219,10 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 
 		vnic->rss_hash_key_dma_addr = vnic->rss_table_dma_addr +
 			     HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table);
+		vnic->mc_list = (void *)((char *)vnic->rss_hash_key +
+				HW_HASH_KEY_SIZE);
+		vnic->mc_list_dma_addr = vnic->rss_hash_key_dma_addr +
+				HW_HASH_KEY_SIZE;
 	}
 
 	return 0;
drivers/net/bnxt/bnxt_vnic.h +4 -0
index ca1c9cf..0d50224 100644
@@ -57,6 +57,10 @@ struct bnxt_vnic_info {
 	uint16_t	*rss_table;
 	phys_addr_t	rss_hash_key_dma_addr;
 	void		*rss_hash_key;
+	phys_addr_t	mc_list_dma_addr;
+	char		*mc_list;
+	uint32_t	mc_addr_cnt;
+#define BNXT_MAX_MC_ADDRS		16
 	uint32_t	flags;
 #define BNXT_VNIC_INFO_PROMISC			(1 << 0)
 #define BNXT_VNIC_INFO_ALLMULTI			(1 << 1)
Signature · 1 line
2.10.1 (Apple Git-78)
#107 lore raw

PATCH v4 10/26 doc: update bnxt.ini to document Allmulticast mode

In reply to Ajit Khaparde

This patch update bnxt.int to document Allmulticast mode which is already supported by the PMD.

---
 doc/guides/nics/features/bnxt.ini | 1 +
 1 file changed, 1 insertion(+)
doc/guides/nics/features/bnxt.ini +1 -0
index 78a738f..9b3cd94 100644
@@ -11,6 +11,7 @@ Unicast MAC filter   = Y
 Multicast MAC filter = Y
 VLAN filter          = Y
 VLAN offload         = Y
+Allmulticast mode    = Y
 RSS reta update      = Y
 Basic stats          = Y
 Extended stats       = Y
Signature · 1 line
2.10.1 (Apple Git-78)
#108 lore raw

PATCH v4 11/26 net/bnxt: add support to get fw version

In reply to Ajit Khaparde

This patch adds support for fw_version_get dev_op

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Avoid using dev_ops in the patch subject line

---
 doc/guides/nics/features/bnxt.ini |  1 +
 drivers/net/bnxt/bnxt_ethdev.c    | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)
doc/guides/nics/features/bnxt.ini +1 -0
index 9b3cd94..b1be3fd 100644
@@ -16,6 +16,7 @@ RSS reta update      = Y
 Basic stats          = Y
 Extended stats       = Y
 SR-IOV               = Y
+FW version           = Y
 Linux VFIO           = Y
 Linux UIO            = Y
 x86-64               = Y
drivers/net/bnxt/bnxt_ethdev.c +20 -0
index ef14fb9..e987732 100644
@@ -1356,6 +1356,25 @@ bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev,
 	return bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic);
 }
 
+static int
+bnxt_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	uint8_t fw_major = (bp->fw_ver >> 24) & 0xff;
+	uint8_t fw_minor = (bp->fw_ver >> 16) & 0xff;
+	uint8_t fw_updt = (bp->fw_ver >> 8) & 0xff;
+	int ret;
+
+	ret = snprintf(fw_version, fw_size, "%d.%d.%d",
+			fw_major, fw_minor, fw_updt);
+
+	ret += 1; /* add the size of '\0' */
+	if (fw_size < (uint32_t)ret)
+		return ret;
+	else
+		return 0;
+}
+
 /*
  * Initialization
  */
@@ -1395,6 +1414,7 @@ static const struct eth_dev_ops bnxt_dev_ops = {
 	.xstats_get = bnxt_dev_xstats_get_op,
 	.xstats_get_names = bnxt_dev_xstats_get_names_op,
 	.xstats_reset = bnxt_dev_xstats_reset_op,
+	.fw_version_get = bnxt_fw_version_get,
 	.set_mc_addr_list = bnxt_dev_set_mc_addr_list_op,
 };
 
Signature · 1 line
2.10.1 (Apple Git-78)
#109 lore raw

PATCH v4 12/26 net/bnxt: add support to set MTU

In reply to Ajit Khaparde

This patch adds support to modify MTU using the set_mtu dev_op. To support frames > 2k, the PMD creates an aggregator ring. When a frame greater than 2k is received, it is fragmented and the resulting fragments are DMA'ed to the aggregator ring. Now the driver can support jumbo frames upto 9500 bytes.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject

---
 doc/guides/nics/features/bnxt.ini      |   2 +
 drivers/net/bnxt/bnxt.h                |   4 +-
 drivers/net/bnxt/bnxt_cpr.c            |   3 +-
 drivers/net/bnxt/bnxt_ethdev.c         |  59 ++++++++++
 drivers/net/bnxt/bnxt_hwrm.c           | 121 ++++++++++++--------
 drivers/net/bnxt/bnxt_hwrm.h           |   4 +-
 drivers/net/bnxt/bnxt_ring.c           |  81 ++++++++++++--
 drivers/net/bnxt/bnxt_ring.h           |   2 +
 drivers/net/bnxt/bnxt_rxq.c            |  29 +++--
 drivers/net/bnxt/bnxt_rxq.h            |   1 +
 drivers/net/bnxt/bnxt_rxr.c            | 195 +++++++++++++++++++++++++++++----
 drivers/net/bnxt/bnxt_rxr.h            |   6 +
 drivers/net/bnxt/hsi_struct_def_dpdk.h |   1 -
 13 files changed, 422 insertions(+), 86 deletions(-)
doc/guides/nics/features/bnxt.ini +2 -0
index b1be3fd..066cb01 100644
@@ -17,6 +17,8 @@ Basic stats          = Y
 Extended stats       = Y
 SR-IOV               = Y
 FW version           = Y
+Jumbo frame          = Y
+MTU update           = Y
 Linux VFIO           = Y
 Linux UIO            = Y
 x86-64               = Y
drivers/net/bnxt/bnxt.h +3 -1
index fde2202..8e6689f 100644
@@ -45,7 +45,7 @@
 
 #include "bnxt_cpr.h"
 
-#define BNXT_MAX_MTU		9000
+#define BNXT_MAX_MTU		9500
 #define VLAN_TAG_SIZE		4
 
 enum bnxt_hw_context {
@@ -131,6 +131,7 @@ struct bnxt {
 #define BNXT_FLAG_REGISTERED	(1 << 0)
 #define BNXT_FLAG_VF		(1 << 1)
 #define BNXT_FLAG_PORT_STATS	(1 << 2)
+#define BNXT_FLAG_JUMBO		(1 << 3)
 #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)
@@ -233,4 +234,5 @@ struct rte_pmd_bnxt_mb_event_param {
 int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete);
 int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);
 
+#define RX_PROD_AGG_BD_TYPE_RX_PROD_AGG		0x6
 #endif
drivers/net/bnxt/bnxt_cpr.c +2 -1
index d13e6cc..f369cf6 100644
@@ -159,7 +159,8 @@ int bnxt_alloc_def_cp_ring(struct bnxt *bp)
 
 	rc = bnxt_hwrm_ring_alloc(bp, cp_ring,
 				  HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL,
-				  0, HWRM_NA_SIGNATURE);
+				  0, HWRM_NA_SIGNATURE,
+				  HWRM_NA_SIGNATURE);
 	if (rc)
 		goto err_out;
 	cpr->cp_doorbell = bp->pdev->mem_resource[2].addr;
drivers/net/bnxt/bnxt_ethdev.c +59 -0

77 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +76 -45

258 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +3 -1
index c15404f..79b27ee 100644
@@ -70,7 +70,7 @@ int bnxt_hwrm_queue_qportcfg(struct bnxt *bp);
 int bnxt_hwrm_ring_alloc(struct bnxt *bp,
 			 struct bnxt_ring *ring,
 			 uint32_t ring_type, uint32_t map_index,
-			 uint32_t stats_ctx_id);
+			 uint32_t stats_ctx_id, uint32_t cmpl_ring_id);
 int bnxt_hwrm_ring_free(struct bnxt *bp,
 			struct bnxt_ring *ring, uint32_t ring_type);
 int bnxt_hwrm_ring_grp_alloc(struct bnxt *bp, unsigned int idx);
@@ -93,6 +93,8 @@ int bnxt_hwrm_vnic_ctx_free(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_vnic_free(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_vnic_rss_cfg(struct bnxt *bp,
 			   struct bnxt_vnic_info *vnic);
+int bnxt_hwrm_vnic_plcmode_cfg(struct bnxt *bp,
+				struct bnxt_vnic_info *vnic);
 
 int bnxt_alloc_all_hwrm_stat_ctxs(struct bnxt *bp);
 int bnxt_clear_all_hwrm_stat_ctxs(struct bnxt *bp);
drivers/net/bnxt/bnxt_ring.c +72 -9

156 lines not on this page · raw message

drivers/net/bnxt/bnxt_ring.h +2 -0
index 8656549..b5bd287 100644
@@ -58,6 +58,7 @@
 #define DEFAULT_TX_RING_SIZE	256
 
 #define MAX_TPA		128
+#define AGG_RING_SIZE_FACTOR 2
 
 /* These assume 4k pages */
 #define MAX_RX_DESC_CNT (8 * 1024)
@@ -65,6 +66,7 @@
 #define MAX_CP_DESC_CNT (16 * 1024)
 
 #define INVALID_HW_RING_ID      ((uint16_t)-1)
+#define INVALID_STATS_CTX_ID		((uint16_t)-1)
 
 struct bnxt_ring {
 	void			*bd;
drivers/net/bnxt/bnxt_rxq.c +21 -8
index 7625fb1..0d7d708 100644
@@ -84,9 +84,8 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 
 		vnic->func_default = true;
 		vnic->ff_pool_idx = 0;
-		vnic->start_grp_id = 1;
-		vnic->end_grp_id = vnic->start_grp_id +
-				   bp->rx_cp_nr_rings - 1;
+		vnic->start_grp_id = 0;
+		vnic->end_grp_id = vnic->start_grp_id;
 		filter = bnxt_alloc_filter(bp);
 		if (!filter) {
 			RTE_LOG(ERR, PMD, "L2 filter alloc failed\n");
@@ -126,8 +125,8 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 			pools = ETH_64_POOLS;
 		}
 		nb_q_per_grp = bp->rx_cp_nr_rings / pools;
-		start_grp_id = 1;
-		end_grp_id = start_grp_id + nb_q_per_grp - 1;
+		start_grp_id = 0;
+		end_grp_id = nb_q_per_grp;
 
 		ring_idx = 0;
 		for (i = 0; i < pools; i++) {
@@ -188,9 +187,8 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 
 	vnic->func_default = true;
 	vnic->ff_pool_idx = 0;
-	vnic->start_grp_id = 1;
-	vnic->end_grp_id = vnic->start_grp_id +
-			   bp->rx_cp_nr_rings - 1;
+	vnic->start_grp_id = 0;
+	vnic->end_grp_id = bp->rx_cp_nr_rings;
 	filter = bnxt_alloc_filter(bp);
 	if (!filter) {
 		RTE_LOG(ERR, PMD, "L2 filter alloc failed\n");
@@ -228,6 +226,16 @@ static void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
 				}
 			}
 		}
+		/* Free up mbufs in Agg ring */
+		sw_ring = rxq->rx_ring->ag_buf_ring;
+		if (sw_ring) {
+			for (i = 0; i < rxq->nb_rx_desc; i++) {
+				if (sw_ring[i].mbuf) {
+					rte_pktmbuf_free_seg(sw_ring[i].mbuf);
+					sw_ring[i].mbuf = NULL;
+				}
+			}
+		}
 	}
 }
 
@@ -251,6 +259,8 @@ void bnxt_rx_queue_release_op(void *rx_queue)
 
 		/* Free RX ring hardware descriptors */
 		bnxt_free_ring(rxq->rx_ring->rx_ring_struct);
+		/* Free RX Agg ring hardware descriptors */
+		bnxt_free_ring(rxq->rx_ring->ag_ring_struct);
 
 		/* Free RX completion ring hardware descriptors */
 		bnxt_free_ring(rxq->cp_ring->cp_ring_struct);
@@ -295,6 +305,9 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	rxq->nb_rx_desc = nb_desc;
 	rxq->rx_free_thresh = rx_conf->rx_free_thresh;
 
+	RTE_LOG(DEBUG, PMD, "RX Buf size is %d\n", rxq->rx_buf_use_size);
+	RTE_LOG(DEBUG, PMD, "RX Buf MTU %d\n", eth_dev->data->mtu);
+
 	rc = bnxt_init_rx_ring_struct(rxq, socket_id);
 	if (rc)
 		goto out;
drivers/net/bnxt/bnxt_rxq.h +1 -0
index 9554329..0695214 100644
@@ -52,6 +52,7 @@ struct bnxt_rx_queue {
 	uint8_t			crc_len; /* 0 if CRC stripped, 4 otherwise */
 
 	struct bnxt		*bp;
+	int			index;
 	struct bnxt_vnic_info	*vnic;
 
 	uint32_t			rx_buf_size;
drivers/net/bnxt/bnxt_rxr.c +175 -20

332 lines not on this page · raw message

drivers/net/bnxt/bnxt_rxr.h +6 -0
index f766b26..e104fbd 100644
@@ -43,14 +43,20 @@ struct bnxt_sw_rx_bd {
 
 struct bnxt_rx_ring_info {
 	uint16_t		rx_prod;
+	uint16_t		ag_prod;
 	void			*rx_doorbell;
+	void			*ag_doorbell;
 
 	struct rx_prod_pkt_bd	*rx_desc_ring;
+	struct rx_prod_pkt_bd	*ag_desc_ring;
 	struct bnxt_sw_rx_bd	*rx_buf_ring; /* sw ring */
+	struct bnxt_sw_rx_bd	*ag_buf_ring; /* sw ring */
 
 	phys_addr_t		rx_desc_mapping;
+	phys_addr_t		ag_desc_mapping;
 
 	struct bnxt_ring	*rx_ring_struct;
+	struct bnxt_ring	*ag_ring_struct;
 };
 
 uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
drivers/net/bnxt/hsi_struct_def_dpdk.h +0 -1
index 518f16d..2fcfce6 100644
@@ -7252,7 +7252,6 @@ struct hwrm_vnic_tpa_cfg_output {
 	 */
 } __attribute__((packed));
 
-
 /* hwrm_ring_alloc */
 /*
  * Description: This command allocates and does basic preparation for a ring.
Signature · 1 line
2.10.1 (Apple Git-78)
#110 lore raw

Re: [PATCH v4 12/26] net/bnxt: add support to set MTU

Quoted 15 lines · Ajit Khaparde

This patch adds support to modify MTU using the set_mtu dev_op. To support frames > 2k, the PMD creates an aggregator ring. When a frame greater than 2k is received, it is fragmented and the resulting fragments are DMA'ed to the aggregator ring. Now the driver can support jumbo frames upto 9500 bytes.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject

<...>

Quoted 5 lines
drivers/net/bnxt/bnxt_hwrm.c +5 -0
+int bnxt_hwrm_vnic_plcmode_cfg(struct bnxt *bp,
+			struct bnxt_vnic_info *vnic)
+{
+	int rc = 0;
+	struct hwrm_vnic_plcmodes_cfg_input req = {.req_type = 0 };

drivers/net/bnxt/bnxt_hwrm.c int bnxt_hwrm_vnic_rss_cfg(struct bnxt *bp, · line 1158

Quoted 10 lines
drivers/net/bnxt/bnxt_hwrm.c +10 -0
+	struct hwrm_vnic_plcmodes_cfg_output *resp = bp->hwrm_cmd_resp_addr;
+	uint16_t size;
+
+	HWRM_PREP(req, VNIC_PLCMODES_CFG, -1, resp);
+
+	req.flags = rte_cpu_to_le_32(
+//			HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_REGULAR_PLACEMENT |
+			HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_JUMBO_PLACEMENT);
+//			HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV4 | //TODO
+//			HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV6);

Hi Ajit,

Would you mind if I remove these commented code, in this patch and other patches, while applying?

Of course it would be better if you send the new version of the patch to fix them, but I believe I can do this faster. Just let me know please.

Thanks,
ferruh

Quoted 17 lines
drivers/net/bnxt/bnxt_hwrm.c +17 -0
+	req.enables = rte_cpu_to_le_32(
+		HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_JUMBO_THRESH_VALID);
+//		HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_HDS_THRESHOLD_VALID);
+
+	size = rte_pktmbuf_data_room_size(bp->rx_queues[0]->mb_pool);
+	size -= RTE_PKTMBUF_HEADROOM;
+
+	req.jumbo_thresh = rte_cpu_to_le_16(size);
+//	req.hds_threshold = rte_cpu_to_le_16(size);
+	req.vnic_id = rte_cpu_to_le_32(vnic->fw_vnic_id);
+
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+
+	HWRM_CHECK_RESULT;
+
+	return rc;
+}

<...>

#111 lore raw

Re: [PATCH v4 12/26] net/bnxt: add support to set MTU

Ferruh, if it save times, can you please do that.

Thanks
Ajit

Quoted 71 lines · Ferruh Yigit
Quoted 15 lines · Ajit Khaparde

This patch adds support to modify MTU using the set_mtu dev_op. To support frames > 2k, the PMD creates an aggregator ring. When a frame greater than 2k is received, it is fragmented and the resulting fragments are DMA'ed to the aggregator ring. Now the driver can support jumbo frames upto 9500 bytes.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject

<...>

drivers/net/bnxt/bnxt_hwrm.c int bnxt_hwrm_vnic_rss_cfg(struct bnxt *bp,

Quoted 6 lines
drivers/net/bnxt/bnxt_hwrm.c +6 -0
+int bnxt_hwrm_vnic_plcmode_cfg(struct bnxt *bp,
+                     struct bnxt_vnic_info *vnic)
+{
+     int rc = 0;
+     struct hwrm_vnic_plcmodes_cfg_input req = {.req_type = 0 };
+     struct hwrm_vnic_plcmodes_cfg_output *resp =

bp->hwrm_cmd_resp_addr;

drivers/net/bnxt/bnxt_hwrm.c int bnxt_hwrm_vnic_rss_cfg(struct bnxt *bp,

Quoted 6 lines
drivers/net/bnxt/bnxt_hwrm.c +6 -0
+     uint16_t size;
+
+     HWRM_PREP(req, VNIC_PLCMODES_CFG, -1, resp);
+
+     req.flags = rte_cpu_to_le_32(
+//                   HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_REGULAR_PLACEMENT

|

Quoted 1 line

+ HWRM_VNIC_PLCMODES_CFG_INPUT_

FLAGS_JUMBO_PLACEMENT);

Quoted 1 line

+// HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV4 |

//TODO

Quoted 1 line

+// HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV6);

Hi Ajit,

Would you mind if I remove these commented code, in this patch and other patches, while applying?

Of course it would be better if you send the new version of the patch to fix them, but I believe I can do this faster. Just let me know please.

Thanks,
ferruh

Quoted 17 lines
drivers/net/bnxt/bnxt_hwrm.c +17 -0
+     req.enables = rte_cpu_to_le_32(
+             HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_JUMBO_THRESH_VALID);
+//           HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_HDS_THRESHOLD_VALID);
+
+     size = rte_pktmbuf_data_room_size(bp->rx_queues[0]->mb_pool);
+     size -= RTE_PKTMBUF_HEADROOM;
+
+     req.jumbo_thresh = rte_cpu_to_le_16(size);
+//   req.hds_threshold = rte_cpu_to_le_16(size);
+     req.vnic_id = rte_cpu_to_le_32(vnic->fw_vnic_id);
+
+     rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+
+     HWRM_CHECK_RESULT;
+
+     return rc;
+}

<...>

#112 lore raw

Re: [PATCH v4 12/26] net/bnxt: add support to set MTU

Quoted 1 line · Ajit Khaparde

Ferruh, if it save times, can you please do that.

Done.

Quoted 77 lines

Thanks
Ajit

Quoted 71 lines · Ferruh Yigit
Quoted 15 lines · Ajit Khaparde

This patch adds support to modify MTU using the set_mtu dev_op. To support frames > 2k, the PMD creates an aggregator ring. When a frame greater than 2k is received, it is fragmented and the resulting fragments are DMA'ed to the aggregator ring. Now the driver can support jumbo frames upto 9500 bytes.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject

<...>

drivers/net/bnxt/bnxt_hwrm.c int bnxt_hwrm_vnic_rss_cfg(struct bnxt *bp,

Quoted 6 lines
drivers/net/bnxt/bnxt_hwrm.c +6 -0
+int bnxt_hwrm_vnic_plcmode_cfg(struct bnxt *bp,
+                     struct bnxt_vnic_info *vnic)
+{
+     int rc = 0;
+     struct hwrm_vnic_plcmodes_cfg_input req = {.req_type = 0 };
+     struct hwrm_vnic_plcmodes_cfg_output *resp =

bp->hwrm_cmd_resp_addr;

drivers/net/bnxt/bnxt_hwrm.c int bnxt_hwrm_vnic_rss_cfg(struct bnxt *bp,

Quoted 6 lines
drivers/net/bnxt/bnxt_hwrm.c +6 -0
+     uint16_t size;
+
+     HWRM_PREP(req, VNIC_PLCMODES_CFG, -1, resp);
+
+     req.flags = rte_cpu_to_le_32(
+//                   HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_REGULAR_PLACEMENT

|

Quoted 1 line

+ HWRM_VNIC_PLCMODES_CFG_INPUT_

FLAGS_JUMBO_PLACEMENT);

Quoted 1 line

+// HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV4 |

//TODO

Quoted 1 line

+// HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV6);

Hi Ajit,

Would you mind if I remove these commented code, in this patch and other patches, while applying?

Of course it would be better if you send the new version of the patch to fix them, but I believe I can do this faster. Just let me know please.

Thanks,
ferruh

Quoted 17 lines
drivers/net/bnxt/bnxt_hwrm.c +17 -0
+     req.enables = rte_cpu_to_le_32(
+             HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_JUMBO_THRESH_VALID);
+//           HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_HDS_THRESHOLD_VALID);
+
+     size = rte_pktmbuf_data_room_size(bp->rx_queues[0]->mb_pool);
+     size -= RTE_PKTMBUF_HEADROOM;
+
+     req.jumbo_thresh = rte_cpu_to_le_16(size);
+//   req.hds_threshold = rte_cpu_to_le_16(size);
+     req.vnic_id = rte_cpu_to_le_32(vnic->fw_vnic_id);
+
+     rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+
+     HWRM_CHECK_RESULT;
+
+     return rc;
+}

<...>

#113 lore raw

PATCH v4 13/26 net/bnxt: add support for LRO

In reply to Ajit Khaparde

This patch adds support to enable and disable LRO
To support this feature, the driver creates an aggregrator ring. When the hardware starts doing LRO, it sends a tpa_start completion. When the driver receives a tpa_end completion, it indicates that the LRO chaining is complete.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject

---
 doc/guides/nics/features/bnxt.ini |   1 +
 drivers/net/bnxt/bnxt_ethdev.c    |   7 +
 drivers/net/bnxt/bnxt_hwrm.c      |  44 +++++-
 drivers/net/bnxt/bnxt_hwrm.h      |   2 +
 drivers/net/bnxt/bnxt_ring.c      |  32 +++-
 drivers/net/bnxt/bnxt_ring.h      |   4 +-
 drivers/net/bnxt/bnxt_rxq.c       |  12 ++
 drivers/net/bnxt/bnxt_rxq.h       |   2 +
 drivers/net/bnxt/bnxt_rxr.c       | 315 +++++++++++++++++++++++++++++---------
 drivers/net/bnxt/bnxt_rxr.h       |  40 +++++
 10 files changed, 374 insertions(+), 85 deletions(-)
doc/guides/nics/features/bnxt.ini +1 -0
index 066cb01..4fd8abb 100644
@@ -19,6 +19,7 @@ SR-IOV               = Y
 FW version           = Y
 Jumbo frame          = Y
 MTU update           = Y
+LRO                  = Y
 Linux VFIO           = Y
 Linux UIO            = Y
 x86-64               = Y
drivers/net/bnxt/bnxt_ethdev.c +7 -0
index 6197be1..8f8024c 100644
@@ -286,6 +286,13 @@ static int bnxt_init_chip(struct bnxt *bp)
 				goto err_out;
 			}
 		}
+
+		bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
+
+		if (bp->eth_dev->data->dev_conf.rxmode.enable_lro)
+			bnxt_hwrm_vnic_tpa_cfg(bp, vnic, 1);
+		else
+			bnxt_hwrm_vnic_tpa_cfg(bp, vnic, 0);
 	}
 	rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, &bp->vnic_info[0]);
 	if (rc) {
drivers/net/bnxt/bnxt_hwrm.c +39 -5

70 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +2 -0
index 79b27ee..6ce0bc3 100644
@@ -95,6 +95,8 @@ int bnxt_hwrm_vnic_rss_cfg(struct bnxt *bp,
 			   struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_vnic_plcmode_cfg(struct bnxt *bp,
 				struct bnxt_vnic_info *vnic);
+int bnxt_hwrm_vnic_tpa_cfg(struct bnxt *bp,
+			   struct bnxt_vnic_info *vnic, bool enable);
 
 int bnxt_alloc_all_hwrm_stat_ctxs(struct bnxt *bp);
 int bnxt_clear_all_hwrm_stat_ctxs(struct bnxt *bp);
drivers/net/bnxt/bnxt_ring.c +28 -4
index a12c0aa..9d0ae27 100644
@@ -31,6 +31,7 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <rte_bitmap.h>
 #include <rte_memzone.h>
 #include <unistd.h>
 
@@ -137,11 +138,23 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 		RTE_CACHE_LINE_ROUNDUP(rx_ring_info->rx_ring_struct->ring_size *
 		sizeof(struct rx_prod_pkt_bd)) : 0;
 
-	int total_alloc_len = rx_ring_start + rx_ring_len;
-	int ag_ring_start = 0;
+	int ag_ring_start = rx_ring_start + rx_ring_len;
+	int ag_ring_len = rx_ring_len * AGG_RING_SIZE_FACTOR;
 
-	ag_ring_start = rx_ring_start + rx_ring_len;
-	total_alloc_len = ag_ring_start + rx_ring_len * AGG_RING_SIZE_FACTOR;
+	int ag_bitmap_start = ag_ring_start + ag_ring_len;
+	int ag_bitmap_len =  rx_ring_info ?
+		RTE_CACHE_LINE_ROUNDUP(rte_bitmap_get_memory_footprint(
+			rx_ring_info->rx_ring_struct->ring_size *
+			AGG_RING_SIZE_FACTOR)) : 0;
+
+	int tpa_info_start = ag_bitmap_start + ag_bitmap_len;
+	int tpa_info_len = rx_ring_info ?
+		RTE_CACHE_LINE_ROUNDUP(BNXT_TPA_MAX *
+				       sizeof(struct bnxt_tpa_info)) : 0;
+
+	int total_alloc_len = tpa_info_start;
+	if (bp->eth_dev->data->dev_conf.rxmode.enable_lro)
+		total_alloc_len += tpa_info_len;
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
 		 "bnxt_%04x:%02x:%02x:%02x-%04x_%s", pdev->addr.domain,
@@ -230,6 +243,17 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 			rx_ring_info->ag_buf_ring =
 			    (struct bnxt_sw_rx_bd *)rx_ring->vmem;
 		}
+
+		rx_ring_info->ag_bitmap =
+		    rte_bitmap_init(rx_ring_info->rx_ring_struct->ring_size *
+				    AGG_RING_SIZE_FACTOR, (uint8_t *)mz->addr +
+				    ag_bitmap_start, ag_bitmap_len);
+
+		/* TPA info */
+		if (bp->eth_dev->data->dev_conf.rxmode.enable_lro)
+			rx_ring_info->tpa_info =
+				((struct bnxt_tpa_info *)((char *)mz->addr +
+							  tpa_info_start));
 	}
 
 	cp_ring->bd = ((char *)mz->addr + cp_ring_start);
drivers/net/bnxt/bnxt_ring.h +2 -2
index b5bd287..6d1eb58 100644
@@ -57,8 +57,8 @@
 #define DEFAULT_RX_RING_SIZE	256
 #define DEFAULT_TX_RING_SIZE	256
 
-#define MAX_TPA		128
-#define AGG_RING_SIZE_FACTOR 2
+#define BNXT_TPA_MAX		64
+#define AGG_RING_SIZE_FACTOR	2
 
 /* These assume 4k pages */
 #define MAX_RX_DESC_CNT (8 * 1024)
drivers/net/bnxt/bnxt_rxq.c +12 -0
index 0d7d708..d8b970e 100644
@@ -214,6 +214,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 static void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
 {
 	struct bnxt_sw_rx_bd *sw_ring;
+	struct bnxt_tpa_info *tpa_info;
 	uint16_t i;
 
 	if (rxq) {
@@ -236,6 +237,17 @@ static void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
 				}
 			}
 		}
+
+		/* Free up mbufs in TPA */
+		tpa_info = rxq->rx_ring->tpa_info;
+		if (tpa_info) {
+			for (i = 0; i < BNXT_TPA_MAX; i++) {
+				if (tpa_info[i].mbuf) {
+					rte_pktmbuf_free_seg(tpa_info[i].mbuf);
+					tpa_info[i].mbuf = NULL;
+				}
+			}
+		}
 	}
 }
 
drivers/net/bnxt/bnxt_rxq.h +2 -0
index 0695214..01aaa00 100644
@@ -59,6 +59,8 @@ struct bnxt_rx_queue {
 	uint32_t			rx_buf_use_size;  /* useable size */
 	struct bnxt_rx_ring_info	*rx_ring;
 	struct bnxt_cp_ring_info	*cp_ring;
+
+	struct bnxt_tpa_info		*rx_tpa;
 };
 
 void bnxt_free_rxq_stats(struct bnxt_rx_queue *rxq);
drivers/net/bnxt/bnxt_rxr.c +241 -74

405 lines not on this page · raw message

drivers/net/bnxt/bnxt_rxr.h +40 -0
index e104fbd..f8d6dc8 100644
@@ -37,6 +37,39 @@
 #define B_RX_DB(db, prod)						\
 		(*(uint32_t *)db = (DB_KEY_RX | prod))
 
+#define BNXT_TPA_L4_SIZE(x)	\
+	{ \
+		typeof(x) hdr_info = (x); \
+		(((hdr_info) & 0xf8000000) ? ((hdr_info) >> 27) : 32) \
+	}
+
+#define BNXT_TPA_INNER_L3_OFF(hdr_info)	\
+	(((hdr_info) >> 18) & 0x1ff)
+
+#define BNXT_TPA_INNER_L2_OFF(hdr_info)	\
+	(((hdr_info) >> 9) & 0x1ff)
+
+#define BNXT_TPA_OUTER_L3_OFF(hdr_info)	\
+	((hdr_info) & 0x1ff)
+
+enum pkt_hash_types {
+	PKT_HASH_TYPE_NONE,	/* Undefined type */
+	PKT_HASH_TYPE_L2,	/* Input: src_MAC, dest_MAC */
+	PKT_HASH_TYPE_L3,	/* Input: src_IP, dst_IP */
+	PKT_HASH_TYPE_L4,	/* Input: src_IP, dst_IP, src_port, dst_port */
+};
+
+struct bnxt_tpa_info {
+	struct rte_mbuf		*mbuf;
+	uint16_t			len;
+	unsigned short		gso_type;
+	uint32_t			flags2;
+	uint32_t			metadata;
+	enum pkt_hash_types	hash_type;
+	uint32_t			rss_hash;
+	uint32_t			hdr_info;
+};
+
 struct bnxt_sw_rx_bd {
 	struct rte_mbuf		*mbuf; /* data associated with RX descriptor */
 };
@@ -57,6 +90,13 @@ struct bnxt_rx_ring_info {
 
 	struct bnxt_ring	*rx_ring_struct;
 	struct bnxt_ring	*ag_ring_struct;
+
+	/*
+	 * To deal with out of order return from TPA, use free buffer indicator
+	 */
+	struct rte_bitmap	*ag_bitmap;
+
+	struct bnxt_tpa_info *tpa_info;
 };
 
 uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
Signature · 1 line
2.10.1 (Apple Git-78)
#114 lore raw

PATCH v4 14/26 net/bnxt: add rxq/txq info_get

In reply to Ajit Khaparde

Add support for txq_info_get and rxq_info_get dev_ops

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Avoid using dev_ops in the patch subject line

---
 drivers/net/bnxt/bnxt_ethdev.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +39 -0
index 8f8024c..d884c7e 100644
@@ -1390,6 +1390,43 @@ bnxt_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
 		return 0;
 }
 
+static void
+bnxt_rxq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo)
+{
+	struct bnxt_rx_queue *rxq;
+
+	rxq = dev->data->rx_queues[queue_id];
+
+	qinfo->mp = rxq->mb_pool;
+	qinfo->scattered_rx = dev->data->scattered_rx;
+	qinfo->nb_desc = rxq->nb_rx_desc;
+
+	qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
+	qinfo->conf.rx_drop_en = 0;
+	qinfo->conf.rx_deferred_start = 0;
+}
+
+static void
+bnxt_txq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo)
+{
+	struct bnxt_tx_queue *txq;
+
+	txq = dev->data->tx_queues[queue_id];
+
+	qinfo->nb_desc = txq->nb_tx_desc;
+
+	qinfo->conf.tx_thresh.pthresh = txq->pthresh;
+	qinfo->conf.tx_thresh.hthresh = txq->hthresh;
+	qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+
+	qinfo->conf.tx_free_thresh = txq->tx_free_thresh;
+	qinfo->conf.tx_rs_thresh = 0;
+	qinfo->conf.txq_flags = txq->txq_flags;
+	qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
+}
+
 static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
@@ -1482,6 +1519,8 @@ static const struct eth_dev_ops bnxt_dev_ops = {
 	.xstats_reset = bnxt_dev_xstats_reset_op,
 	.fw_version_get = bnxt_fw_version_get,
 	.set_mc_addr_list = bnxt_dev_set_mc_addr_list_op,
+	.rxq_info_get = bnxt_rxq_info_get_op,
+	.txq_info_get = bnxt_txq_info_get_op,
 };
 
 static bool bnxt_vf_pciid(uint16_t id)
Signature · 1 line
2.10.1 (Apple Git-78)
#115 lore raw

PATCH v4 15/26 net/bnxt: add code to support VLAN pvid

In reply to Ajit Khaparde

This patch adds code to support vlan_pvid_set dev_op

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Avoid using dev_ops in the patch subject line

---
 drivers/net/bnxt/bnxt.h        |  1 +
 drivers/net/bnxt/bnxt_ethdev.c | 21 +++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.c   | 31 +++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h   |  1 +
 4 files changed, 54 insertions(+)
drivers/net/bnxt/bnxt.h +1 -0
index 8e6689f..adf0ab1 100644
@@ -67,6 +67,7 @@ struct bnxt_child_vf_info {
 	uint32_t		func_cfg_flags;
 	uint32_t		l2_rx_mask;
 	uint16_t		fid;
+	uint16_t		dflt_vlan;
 	bool			random_mac;
 };
 
drivers/net/bnxt/bnxt_ethdev.c +21 -0
index d884c7e..178e581 100644
@@ -1477,6 +1477,26 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 	return rc;
 }
 
+static int
+bnxt_vlan_pvid_set_op(struct rte_eth_dev *dev, uint16_t pvid, int on)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	uint16_t vlan = bp->vlan;
+	int rc;
+
+	if (BNXT_NPAR_PF(bp) || BNXT_VF(bp)) {
+		RTE_LOG(ERR, PMD,
+			"PVID cannot be modified for this function\n");
+		return -ENOTSUP;
+	}
+	bp->vlan = on ? pvid : 0;
+
+	rc = bnxt_hwrm_set_default_vlan(bp, 0, 0);
+	if (rc)
+		bp->vlan = vlan;
+	return rc;
+}
+
 /*
  * Initialization
  */
@@ -1512,6 +1532,7 @@ static const struct eth_dev_ops bnxt_dev_ops = {
 	.udp_tunnel_port_del  = bnxt_udp_tunnel_port_del_op,
 	.vlan_filter_set = bnxt_vlan_filter_set_op,
 	.vlan_offload_set = bnxt_vlan_offload_set_op,
+	.vlan_pvid_set = bnxt_vlan_pvid_set_op,
 	.mtu_set = bnxt_mtu_set_op,
 	.mac_addr_set = bnxt_set_default_mac_addr_op,
 	.xstats_get = bnxt_dev_xstats_get_op,
drivers/net/bnxt/bnxt_hwrm.c +31 -0
index dc4bb1b..3e595c3 100644
@@ -2256,6 +2256,37 @@ int bnxt_hwrm_vf_func_cfg_def_cp(struct bnxt *bp)
 	return rc;
 }
 
+int bnxt_hwrm_set_default_vlan(struct bnxt *bp, int vf, uint8_t is_vf)
+{
+	struct hwrm_func_cfg_input req = {0};
+	struct hwrm_func_cfg_output *resp = bp->hwrm_cmd_resp_addr;
+	uint16_t dflt_vlan, fid;
+	uint32_t func_cfg_flags;
+	int rc = 0;
+
+	HWRM_PREP(req, FUNC_CFG, -1, resp);
+
+	if (is_vf) {
+		dflt_vlan = bp->pf.vf_info[vf].dflt_vlan;
+		fid = bp->pf.vf_info[vf].fid;
+		func_cfg_flags = bp->pf.vf_info[vf].func_cfg_flags;
+	} else {
+		fid = rte_cpu_to_le_16(0xffff);
+		func_cfg_flags = bp->pf.func_cfg_flags;
+		dflt_vlan = bp->vlan;
+	}
+
+	req.flags = rte_cpu_to_le_32(func_cfg_flags);
+	req.fid = rte_cpu_to_le_16(fid);
+	req.enables |= rte_cpu_to_le_32(HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_VLAN);
+	req.dflt_vlan = rte_cpu_to_le_16(dflt_vlan);
+
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+	HWRM_CHECK_RESULT;
+
+	return rc;
+}
+
 int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
 			      void *encaped, size_t ec_size)
 {
drivers/net/bnxt/bnxt_hwrm.h +1 -0
index 6ce0bc3..1759187 100644
@@ -123,6 +123,7 @@ int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port,
 int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, uint16_t port,
 				uint8_t tunnel_type);
 void bnxt_free_tunnel_ports(struct bnxt *bp);
+int bnxt_hwrm_set_default_vlan(struct bnxt *bp, int vf, uint8_t is_vf);
 int bnxt_hwrm_port_qstats(struct bnxt *bp);
 int bnxt_hwrm_port_clr_stats(struct bnxt *bp);
 #endif
Signature · 1 line
2.10.1 (Apple Git-78)
#116 lore raw

PATCH v4 16/26 net/bnxt: reorg the query stats code

In reply to Ajit Khaparde

1) Use hwrm_stat_ctx_query command to query statistics Using hwrm_stat_ctx_query command will allow polling
the statistics from hardware instead of using the current push model from the hardware which does a DMA of the stats to the host at fixed intervals.
2) Use the rx_mbuf_alloc_fail to track mbuf alloc failures.
3) We were wrongly incrementing hwrm_cmd_seq in bnxt_hwrm_stat_clear and bnxt_hwrm_stat_ctx_alloc functions. This patch fixes that.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject

---
 drivers/net/bnxt/bnxt.h        |  1 +
 drivers/net/bnxt/bnxt_ethdev.c |  2 ++
 drivers/net/bnxt/bnxt_hwrm.c   | 82 ++++++++++++++++++++++++++++++++++++++----
 drivers/net/bnxt/bnxt_hwrm.h   |  4 +++
 drivers/net/bnxt/bnxt_rxr.c    | 16 ++++++---
 drivers/net/bnxt/bnxt_stats.c  | 59 ++++--------------------------
 6 files changed, 102 insertions(+), 62 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
index adf0ab1..e411704 100644
@@ -204,6 +204,7 @@ struct bnxt {
 	uint16_t		vxlan_fw_dst_port_id;
 	uint16_t		geneve_fw_dst_port_id;
 	uint32_t		fw_ver;
+	rte_atomic64_t		rx_mbuf_alloc_fail;
 };
 
 /*
drivers/net/bnxt/bnxt_ethdev.c +2 -0
index 178e581..4576156 100644
@@ -1616,6 +1616,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
 
 	bp = eth_dev->data->dev_private;
+
+	rte_atomic64_init(&bp->rx_mbuf_alloc_fail);
 	bp->dev_stopped = 1;
 
 	if (bnxt_vf_pciid(pci_dev->id.device_id))
drivers/net/bnxt/bnxt_hwrm.c +76 -6

117 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +4 -0
index 1759187..ab42913 100644
@@ -62,6 +62,8 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp);
 int bnxt_hwrm_func_qcaps(struct bnxt *bp);
 int bnxt_hwrm_func_reset(struct bnxt *bp);
 int bnxt_hwrm_func_driver_unregister(struct bnxt *bp, uint32_t flags);
+int bnxt_hwrm_func_qstats(struct bnxt *bp, uint16_t fid,
+			  struct rte_eth_stats *stats);
 int bnxt_hwrm_func_cfg_def_cp(struct bnxt *bp);
 int bnxt_hwrm_vf_func_cfg_def_cp(struct bnxt *bp);
 
@@ -81,6 +83,8 @@ int bnxt_hwrm_stat_ctx_alloc(struct bnxt *bp,
 			     struct bnxt_cp_ring_info *cpr, unsigned int idx);
 int bnxt_hwrm_stat_ctx_free(struct bnxt *bp,
 			    struct bnxt_cp_ring_info *cpr, unsigned int idx);
+int bnxt_hwrm_ctx_qstats(struct bnxt *bp, uint32_t cid, int idx,
+			 struct rte_eth_stats *stats);
 
 int bnxt_hwrm_ver_get(struct bnxt *bp);
 
drivers/net/bnxt/bnxt_rxr.c +12 -4
index 1f0afcb..3001d81 100644
@@ -68,8 +68,10 @@ static inline int bnxt_alloc_rx_data(struct bnxt_rx_queue *rxq,
 	struct rte_mbuf *data;
 
 	data = __bnxt_alloc_rx_data(rxq->mb_pool);
-	if (!data)
+	if (!data) {
+		rte_atomic64_inc(&rxq->bp->rx_mbuf_alloc_fail);
 		return -ENOMEM;
+	}
 
 	rx_buf->mbuf = data;
 
@@ -87,8 +89,10 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 	struct rte_mbuf *data;
 
 	data = __bnxt_alloc_rx_data(rxq->mb_pool);
-	if (!data)
+	if (!data) {
+		rte_atomic64_inc(&rxq->bp->rx_mbuf_alloc_fail);
 		return -ENOMEM;
+	}
 
 	if (rxbd == NULL)
 		RTE_LOG(ERR, PMD, "Jumbo Frame. rxbd is NULL\n");
@@ -321,8 +325,10 @@ static inline struct rte_mbuf *bnxt_tpa_end(
 
 	struct rte_mbuf *new_data = __bnxt_alloc_rx_data(rxq->mb_pool);
 	RTE_ASSERT(new_data != NULL);
-	if (!new_data)
+	if (!new_data) {
+		rte_atomic64_inc(&rxq->bp->rx_mbuf_alloc_fail);
 		return NULL;
+	}
 	tpa_info->mbuf = new_data;
 
 	return mbuf;
@@ -679,8 +685,10 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 		for (i = 0; i < BNXT_TPA_MAX; i++) {
 			rxr->tpa_info[i].mbuf =
 				__bnxt_alloc_rx_data(rxq->mb_pool);
-			if (!rxr->tpa_info[i].mbuf)
+			if (!rxr->tpa_info[i].mbuf) {
+				rte_atomic64_inc(&rxq->bp->rx_mbuf_alloc_fail);
 				return -ENOMEM;
+			}
 		}
 	}
 	RTE_LOG(DEBUG, PMD, "%s TPA alloc Done!\n", __func__);
drivers/net/bnxt/bnxt_stats.c +7 -52

77 lines not on this page · raw message

Signature · 1 line
2.10.1 (Apple Git-78)
#117 lore raw

PATCH v4 17/26 doc: update default.ini to add LED support

In reply to Ajit Khaparde

Update default.ini to indicate LED on/off support

---
 doc/guides/nics/features/default.ini | 1 +
 1 file changed, 1 insertion(+)
doc/guides/nics/features/default.ini +1 -0
index cafc6c7..5549acd 100644
@@ -60,6 +60,7 @@ Stats per queue      =
 FW version           =
 EEPROM dump          =
 Registers dump       =
+LED                  =
 Multiprocess aware   =
 BSD nic_uio          =
 Linux UIO            =
Signature · 1 line
2.10.1 (Apple Git-78)
#118 lore raw

PATCH v4 18/26 net/bnxt: add support for led on/off

In reply to Ajit Khaparde

This patch adds support for dev_led_on/off dev_ops

HWRM calls added:
bnxt_hwrm_port_led_qcaps()
bnxt_hwrm_port_led_cfg()

--
v1-v2:
- rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Update bnxt.ini indicating support for LED on/off

---
 doc/guides/nics/features/bnxt.ini      |   1 +
 drivers/net/bnxt/bnxt.h                |  39 ++
 drivers/net/bnxt/bnxt_ethdev.c         |  20 +
 drivers/net/bnxt/bnxt_hwrm.c           |  70 +++
 drivers/net/bnxt/bnxt_hwrm.h           |   2 +
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 977 +++++++++++++++++++++++++++++++++
 6 files changed, 1109 insertions(+)
doc/guides/nics/features/bnxt.ini +1 -0
index 4fd8abb..f582836 100644
@@ -20,6 +20,7 @@ FW version           = Y
 Jumbo frame          = Y
 MTU update           = Y
 LRO                  = Y
+LED                  = Y
 Linux VFIO           = Y
 Linux UIO            = Y
 x86-64               = Y
drivers/net/bnxt/bnxt.h +39 -0
index e411704..c23a836 100644
@@ -47,6 +47,42 @@
 
 #define BNXT_MAX_MTU		9500
 #define VLAN_TAG_SIZE		4
+#define BNXT_MAX_LED		4
+
+struct bnxt_led_info {
+	uint8_t      led_id;
+	uint8_t      led_type;
+	uint8_t      led_group_id;
+	uint8_t      unused;
+	uint16_t  led_state_caps;
+#define BNXT_LED_ALT_BLINK_CAP(x)       ((x) &  \
+	rte_cpu_to_le_16(HWRM_PORT_LED_QCFG_OUTPUT_LED0_STATE_BLINKALT))
+
+	uint16_t  led_color_caps;
+};
+
+struct bnxt_led_cfg {
+	uint8_t led_id;
+	uint8_t led_state;
+	uint8_t led_color;
+	uint8_t unused;
+	uint16_t led_blink_on;
+	uint16_t led_blink_off;
+	uint8_t led_group_id;
+	uint8_t rsvd;
+};
+
+#define BNXT_LED_DFLT_ENA                               \
+	(HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_ID |             \
+	 HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_STATE |          \
+	 HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_BLINK_ON |       \
+	 HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_BLINK_OFF |      \
+	 HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_GROUP_ID)
+
+#define BNXT_LED_DFLT_ENA_SHIFT		6
+
+#define BNXT_LED_DFLT_ENABLES(x)                        \
+	rte_cpu_to_le_32(BNXT_LED_DFLT_ENA << (BNXT_LED_DFLT_ENA_SHIFT * (x)))
 
 enum bnxt_hw_context {
 	HW_CONTEXT_NONE     = 0,
@@ -205,6 +241,9 @@ struct bnxt {
 	uint16_t		geneve_fw_dst_port_id;
 	uint32_t		fw_ver;
 	rte_atomic64_t		rx_mbuf_alloc_fail;
+
+	struct bnxt_led_info	leds[BNXT_MAX_LED];
+	uint8_t			num_leds;
 };
 
 /*
drivers/net/bnxt/bnxt_ethdev.c +20 -0
index 4576156..de901eb 100644
@@ -1497,6 +1497,22 @@ bnxt_vlan_pvid_set_op(struct rte_eth_dev *dev, uint16_t pvid, int on)
 	return rc;
 }
 
+static int
+bnxt_dev_led_on_op(struct rte_eth_dev *dev)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+
+	return bnxt_hwrm_port_led_cfg(bp, true);
+}
+
+static int
+bnxt_dev_led_off_op(struct rte_eth_dev *dev)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+
+	return bnxt_hwrm_port_led_cfg(bp, false);
+}
+
 /*
  * Initialization
  */
@@ -1542,6 +1558,8 @@ static const struct eth_dev_ops bnxt_dev_ops = {
 	.set_mc_addr_list = bnxt_dev_set_mc_addr_list_op,
 	.rxq_info_get = bnxt_rxq_info_get_op,
 	.txq_info_get = bnxt_txq_info_get_op,
+	.dev_led_on = bnxt_dev_led_on_op,
+	.dev_led_off = bnxt_dev_led_off_op,
 };
 
 static bool bnxt_vf_pciid(uint16_t id)
@@ -1815,6 +1833,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 		}
 	}
 
+	bnxt_hwrm_port_led_qcaps(bp);
+
 	rc = bnxt_setup_int(bp);
 	if (rc)
 		goto error_free;
drivers/net/bnxt/bnxt_hwrm.c +70 -0

73 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +2 -0
index ab42913..3591917 100644
@@ -130,4 +130,6 @@ void bnxt_free_tunnel_ports(struct bnxt *bp);
 int bnxt_hwrm_set_default_vlan(struct bnxt *bp, int vf, uint8_t is_vf);
 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);
 #endif
drivers/net/bnxt/hsi_struct_def_dpdk.h +977 -0

983 lines not on this page · raw message

Signature · 1 line
2.10.1 (Apple Git-78)
#119 lore raw

PATCH v4 19/26 net/bnxt: add support for tx loopback, set vf mac and queues drop

In reply to Ajit Khaparde

Add functions rte_pmd_bnxt_set_tx_loopback, rte_pmd_bnxt_set_all_queues_drop_en and rte_pmd_bnxt_set_vf_mac_addr to configure tx_loopback, queue_drop and VF MAC address setting in the hardware. It also adds the necessary functions to send the HWRM commands to the firmware.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Add the copyright year.
- Add a protection against application calling the API for different vendor's port_id
- update testpmd to use these vendor specific APIs

---
 app/test-pmd/Makefile                     |   4 +
 app/test-pmd/cmdline.c                    |  25 ++++-
 drivers/net/bnxt/Makefile                 |   4 +
 drivers/net/bnxt/bnxt.h                   |   2 +
 drivers/net/bnxt/bnxt_ethdev.c            |  15 +++
 drivers/net/bnxt/bnxt_hwrm.c              | 106 ++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h              |   4 +
 drivers/net/bnxt/rte_pmd_bnxt.c           | 172 ++++++++++++++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt.h           |  87 +++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map |   7 +-
 10 files changed, 422 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/bnxt/rte_pmd_bnxt.c
 create mode 100644 drivers/net/bnxt/rte_pmd_bnxt.h
app/test-pmd/Makefile +4 -0
index 35ecee9..c36be19 100644
@@ -73,6 +73,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y)
 LDLIBS += -lrte_pmd_i40e
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD),y)
+LDLIBS += -lrte_pmd_bnxt
+endif
+
 ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y)
 LDLIBS += -lrte_pmd_xenvirt
 endif
app/test-pmd/cmdline.c +22 -3
index 0afac68..26b0da1 100644
@@ -94,6 +94,9 @@
 #ifdef RTE_LIBRTE_I40E_PMD
 #include <rte_pmd_i40e.h>
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+#include <rte_pmd_bnxt.h>
+#endif
 #include "testpmd.h"
 
 static struct cmdline *testpmd_cl;
@@ -11402,6 +11405,10 @@ cmd_set_tx_loopback_parsed(
 	if (ret == -ENOTSUP)
 		ret = rte_pmd_i40e_set_tx_loopback(res->port_id, is_on);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_set_tx_loopback(res->port_id, is_on);
+#endif
 
 	switch (ret) {
 	case 0:
@@ -11434,7 +11441,6 @@ cmdline_parse_inst_t cmd_set_tx_loopback = {
 	},
 };
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
 /* all queues drop enable configuration */
 
 /* Common result structure for all queues drop enable */
@@ -11480,13 +11486,20 @@ cmd_set_all_queues_drop_en_parsed(
 	__attribute__((unused)) void *data)
 {
 	struct cmd_all_queues_drop_en_result *res = parsed_result;
-	int ret = 0;
+	int ret = -ENOTSUP;
 	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
 
 	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
 		return;
 
-	ret = rte_pmd_ixgbe_set_all_queues_drop_en(res->port_id, is_on);
+#ifdef RTE_LIBRTE_IXGBE_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_ixgbe_set_all_queues_drop_en(res->port_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_set_all_queues_drop_en(res->port_id, is_on);
+#endif
 	switch (ret) {
 	case 0:
 		break;
@@ -11519,6 +11532,7 @@ cmdline_parse_inst_t cmd_set_all_queues_drop_en = {
 	},
 };
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
 /* vf split drop enable configuration */
 
 /* Common result structure for vf split drop enable */
@@ -11673,6 +11687,11 @@ cmd_set_vf_mac_addr_parsed(
 		ret = rte_pmd_i40e_set_vf_mac_addr(res->port_id, res->vf_id,
 				&res->mac_addr);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_set_vf_mac_addr(res->port_id, res->vf_id,
+				&res->mac_addr);
+#endif
 
 	switch (ret) {
 	case 0:
drivers/net/bnxt/Makefile +4 -0
index 0fffe35..b03f65d 100644
@@ -38,6 +38,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 #
 LIB = librte_pmd_bnxt.a
 
+EXPORT_MAP := rte_pmd_bnxt_version.map
+
 LIBABIVER := 1
 
 CFLAGS += -O3
@@ -60,10 +62,12 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txq.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txr.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_vnic.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_irq.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += rte_pmd_bnxt.c
 
 #
 # Export include files
 #
 SYMLINK-y-include +=
+SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include := rte_pmd_bnxt.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/bnxt/bnxt.h +2 -0
index c23a836..e918517 100644
@@ -276,4 +276,6 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete);
 int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);
 
 #define RX_PROD_AGG_BD_TYPE_RX_PROD_AGG		0x6
+
+bool is_bnxt_supported(struct rte_eth_dev *dev);
 #endif
drivers/net/bnxt/bnxt_ethdev.c +15 -0
index de901eb..57f9064 100644
@@ -142,6 +142,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 	ETH_RSS_NONFRAG_IPV6_UDP)
 
 static void bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
+
 /***********************/
 
 /*
@@ -1936,6 +1937,20 @@ static struct rte_pci_driver bnxt_rte_pmd = {
 	.remove = bnxt_pci_remove,
 };
 
+static bool
+is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv)
+{
+	if (strcmp(dev->data->drv_name, drv->driver.name))
+		return false;
+
+	return true;
+}
+
+bool is_bnxt_supported(struct rte_eth_dev *dev)
+{
+	return is_device_supported(dev, &bnxt_rte_pmd);
+}
+
 RTE_PMD_REGISTER_PCI(net_bnxt, bnxt_rte_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_bnxt, bnxt_pci_id_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_bnxt, "* igb_uio | uio_pci_generic | vfio");
drivers/net/bnxt/bnxt_hwrm.c +106 -0

115 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +4 -0
index 3591917..b79df9d 100644
@@ -120,6 +120,7 @@ int bnxt_hwrm_allocate_pf_only(struct bnxt *bp);
 int bnxt_hwrm_allocate_vfs(struct bnxt *bp, int num_vfs);
 int bnxt_hwrm_func_vf_mac(struct bnxt *bp, uint16_t vf,
 			  const uint8_t *mac_addr);
+int bnxt_hwrm_pf_evb_mode(struct bnxt *bp);
 int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf,
 				       struct ether_addr *mac);
 int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port,
@@ -132,4 +133,7 @@ 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_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));
 #endif
drivers/net/bnxt/rte_pmd_bnxt.c new file +172 -0

172 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.h new file +87 -0

87 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt_version.map +6 -1
index 349c6e1..fa291cb 100644
@@ -1,4 +1,9 @@
-DPDK_16.04 {
+DPDK_17.08 {
+	global:
+
+	rte_pmd_bnxt_set_tx_loopback;
+	rte_pmd_bnxt_set_all_queues_drop_en;
+	rte_pmd_bnxt_set_vf_mac_addr;
 
 	local: *;
 };
Signature · 1 line
2.10.1 (Apple Git-78)
#120 lore raw

Re: [PATCH v4 19/26] net/bnxt: add support for tx loopback, set vf mac and queues drop

Quoted 8 lines · Ajit Khaparde

Add functions rte_pmd_bnxt_set_tx_loopback, rte_pmd_bnxt_set_all_queues_drop_en and rte_pmd_bnxt_set_vf_mac_addr to configure tx_loopback, queue_drop and VF MAC address setting in the hardware. It also adds the necessary functions to send the HWRM commands to the firmware.

From the patch title it is clear that this patch add three different

functionality.

For this patchset, since it already went for a few releases I wouldn't mind, but for future, please send separate patches for each individual feature.

Thanks,
ferruh

Quoted 3 lines

<...>

#121 lore raw

Re: [PATCH v4 19/26] net/bnxt: add support for tx loopback, set vf mac and queues drop

Quoted 8 lines · Ferruh Yigit
Quoted 6 lines · Ajit Khaparde

Add functions rte_pmd_bnxt_set_tx_loopback, rte_pmd_bnxt_set_all_queues_drop_en and rte_pmd_bnxt_set_vf_mac_addr to configure tx_loopback, queue_drop and VF MAC address setting in the hardware. It also adds the necessary functions to send the HWRM commands to the firmware.

Quoted 6 lines

From the patch title it is clear that this patch add three different functionality.

For this patchset, since it already went for a few releases I wouldn't mind, but for future, please send separate patches for each individual feature.

​Sure, Ferruh.

Thanks
Ajit​

#122 lore raw

PATCH v4 20/26 net/bnxt: add support for set VF QOS and MAC anti spoof

In reply to Ajit Khaparde

This patch adds support to
1) enable VF MAC anti spoof.
2) QOS configuration for specified VF.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Add a protection against application calling the API for different vendor's port_id
- update testpmd to use these vendor specific APIs

---
 app/test-pmd/cmdline.c                    |  24 ++-
 app/test-pmd/config.c                     |  20 ++-
 drivers/net/bnxt/bnxt.h                   |   4 +
 drivers/net/bnxt/bnxt_ethdev.c            |  12 +-
 drivers/net/bnxt/bnxt_filter.h            |   2 +
 drivers/net/bnxt/bnxt_hwrm.c              | 117 +++++++++++-
 drivers/net/bnxt/bnxt_hwrm.h              |  10 +-
 drivers/net/bnxt/rte_pmd_bnxt.c           | 289 ++++++++++++++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt.h           |  97 ++++++++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map |   5 +
 10 files changed, 564 insertions(+), 16 deletions(-)
app/test-pmd/cmdline.c +21 -3
index 26b0da1..90e4a27 100644
@@ -6964,6 +6964,11 @@ cmd_vf_rx_vlan_filter_parsed(void *parsed_result,
 		ret = rte_pmd_i40e_set_vf_vlan_filter(res->port_id,
 				res->vlan_id, res->vf_mask, is_add);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_set_vf_vlan_filter(res->port_id,
+				res->vlan_id, res->vf_mask, is_add);
+#endif
 
 	switch (ret) {
 	case 0:
@@ -7089,7 +7094,6 @@ cmdline_parse_inst_t cmd_queue_rate_limit = {
 	},
 };
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
 /* *** SET RATE LIMIT FOR A VF OF A PORT *** */
 struct cmd_vf_rate_limit_result {
 	cmdline_fixed_string_t set;
@@ -7168,7 +7172,6 @@ cmdline_parse_inst_t cmd_vf_rate_limit = {
 		NULL,
 	},
 };
-#endif
 
 /* *** ADD TUNNEL FILTER OF A PORT *** */
 struct cmd_tunnel_filter_result {
@@ -11015,6 +11018,11 @@ cmd_set_vf_vlan_anti_spoof_parsed(
 		ret = rte_pmd_i40e_set_vf_vlan_anti_spoof(res->port_id,
 				res->vf_id, is_on);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_set_vf_vlan_anti_spoof(res->port_id,
+				res->vf_id, is_on);
+#endif
 
 	switch (ret) {
 	case 0:
@@ -11116,6 +11124,11 @@ cmd_set_vf_mac_anti_spoof_parsed(
 		ret = rte_pmd_i40e_set_vf_mac_anti_spoof(res->port_id,
 			res->vf_id, is_on);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_set_vf_mac_anti_spoof(res->port_id,
+			res->vf_id, is_on);
+#endif
 
 	switch (ret) {
 	case 0:
@@ -11217,6 +11230,11 @@ cmd_set_vf_vlan_stripq_parsed(
 		ret = rte_pmd_i40e_set_vf_vlan_stripq(res->port_id,
 			res->vf_id, is_on);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_set_vf_vlan_stripq(res->port_id,
+			res->vf_id, is_on);
+#endif
 
 	switch (ret) {
 	case 0:
@@ -13752,8 +13770,8 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_set_macsec_sa,
 	(cmdline_parse_inst_t *)&cmd_set_vf_rxmode,
 	(cmdline_parse_inst_t *)&cmd_set_vf_traffic,
-	(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
 #endif
+	(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
 	(cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
 	(cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
 	(cmdline_parse_inst_t *)&cmd_set_vf_promisc,
app/test-pmd/config.c +15 -5
index 4d873cd..35eddc9 100644
@@ -97,6 +97,9 @@
 #ifdef RTE_LIBRTE_IXGBE_PMD
 #include <rte_pmd_ixgbe.h>
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+#include <rte_pmd_bnxt.h>
+#endif
 
 #include "testpmd.h"
 
@@ -3053,20 +3056,27 @@ set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)
 	return diag;
 }
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
 int
 set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
 {
-	int diag;
+	int diag = -ENOTSUP;
 
-	diag = rte_pmd_ixgbe_set_vf_rate_limit(port_id, vf, rate, q_msk);
+#ifdef RTE_LIBRTE_IXGBE_PMD
+	if (diag == -ENOTSUP)
+		diag = rte_pmd_ixgbe_set_vf_rate_limit(port_id, vf, rate,
+						       q_msk);
+#endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (diag == -ENOTSUP)
+		diag = rte_pmd_bnxt_set_vf_rate_limit(port_id, vf, rate, q_msk);
+#endif
 	if (diag == 0)
 		return diag;
-	printf("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed diag=%d\n",
+
+	printf("set_vf_rate_limit for port_id=%d failed diag=%d\n",
 		port_id, diag);
 	return diag;
 }
-#endif
 
 /*
  * Functions to manage the set of filtered Multicast MAC addresses.
drivers/net/bnxt/bnxt.h +4 -0
index e918517..c1f9095 100644
@@ -104,6 +104,10 @@ struct bnxt_child_vf_info {
 	uint32_t		l2_rx_mask;
 	uint16_t		fid;
 	uint16_t		dflt_vlan;
+	uint16_t		max_tx_rate;
+	uint16_t		vlan_count;
+	uint8_t			mac_spoof_en;
+	uint8_t			vlan_spoof_en;
 	bool			random_mac;
 };
 
drivers/net/bnxt/bnxt_ethdev.c +6 -6
index 57f9064..a710c41 100644
@@ -295,7 +295,7 @@ static int bnxt_init_chip(struct bnxt *bp)
 		else
 			bnxt_hwrm_vnic_tpa_cfg(bp, vnic, 0);
 	}
-	rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, &bp->vnic_info[0]);
+	rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, &bp->vnic_info[0], 0, NULL);
 	if (rc) {
 		RTE_LOG(ERR, PMD,
 			"HWRM cfa l2 rx mask failure rc: %x\n", rc);
@@ -703,7 +703,7 @@ static void bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
 	vnic = &bp->vnic_info[0];
 
 	vnic->flags |= BNXT_VNIC_INFO_PROMISC;
-	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic);
+	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
 }
 
 static void bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
@@ -717,7 +717,7 @@ static void bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
 	vnic = &bp->vnic_info[0];
 
 	vnic->flags &= ~BNXT_VNIC_INFO_PROMISC;
-	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic);
+	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
 }
 
 static void bnxt_allmulticast_enable_op(struct rte_eth_dev *eth_dev)
@@ -731,7 +731,7 @@ static void bnxt_allmulticast_enable_op(struct rte_eth_dev *eth_dev)
 	vnic = &bp->vnic_info[0];
 
 	vnic->flags |= BNXT_VNIC_INFO_ALLMULTI;
-	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic);
+	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
 }
 
 static void bnxt_allmulticast_disable_op(struct rte_eth_dev *eth_dev)
@@ -745,7 +745,7 @@ static void bnxt_allmulticast_disable_op(struct rte_eth_dev *eth_dev)
 	vnic = &bp->vnic_info[0];
 
 	vnic->flags &= ~BNXT_VNIC_INFO_ALLMULTI;
-	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic);
+	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
 }
 
 static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,
@@ -1369,7 +1369,7 @@ bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev,
 	vnic->mc_addr_cnt = i;
 
 allmulti:
-	return bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic);
+	return bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
 }
 
 static int
drivers/net/bnxt/bnxt_filter.h +2 -0
index 06fe134..353b7f7 100644
@@ -63,6 +63,8 @@ struct bnxt_filter_info {
 	uint32_t		vni;
 	uint8_t			pri_hint;
 	uint64_t		l2_filter_id_hint;
+	uint32_t		src_id;
+	uint8_t			src_type;
 };
 
 struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp);
drivers/net/bnxt/bnxt_hwrm.c +116 -1

150 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +9 -1
index b79df9d..f51ebcf 100644
@@ -45,7 +45,9 @@ struct bnxt_cp_ring_info;
 
 int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp,
 				   struct bnxt_vnic_info *vnic);
-int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic);
+int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic,
+				 uint16_t vlan_count,
+				 struct bnxt_vlan_table_entry *vlan_table);
 int bnxt_hwrm_clear_filter(struct bnxt *bp,
 			   struct bnxt_filter_info *filter);
 int bnxt_hwrm_set_filter(struct bnxt *bp,
@@ -121,6 +123,8 @@ int bnxt_hwrm_allocate_vfs(struct bnxt *bp, int num_vfs);
 int bnxt_hwrm_func_vf_mac(struct bnxt *bp, uint16_t vf,
 			  const uint8_t *mac_addr);
 int bnxt_hwrm_pf_evb_mode(struct bnxt *bp);
+int bnxt_hwrm_func_bw_cfg(struct bnxt *bp, uint16_t vf,
+			uint16_t max_bw, uint16_t enables);
 int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf,
 				       struct ether_addr *mac);
 int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port,
@@ -133,7 +137,11 @@ 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_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));
+int bnxt_hwrm_func_cfg_vf_set_vlan_anti_spoof(struct bnxt *bp, uint16_t vf,
+					      bool on);
+int bnxt_hwrm_func_qcfg_vf_dflt_vnic_id(struct bnxt *bp, int vf);
 #endif
drivers/net/bnxt/rte_pmd_bnxt.c +289 -0

298 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.h +97 -0

113 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt_version.map +5 -0
index fa291cb..770b076 100644
@@ -4,6 +4,11 @@ DPDK_17.08 {
 	rte_pmd_bnxt_set_tx_loopback;
 	rte_pmd_bnxt_set_all_queues_drop_en;
 	rte_pmd_bnxt_set_vf_mac_addr;
+	rte_pmd_bnxt_set_vf_mac_anti_spoof;
+	rte_pmd_bnxt_set_vf_rate_limit;
+	rte_pmd_bnxt_set_vf_vlan_stripq;
+	rte_pmd_bnxt_set_vf_vlan_filter;
+	rte_pmd_bnxt_set_vf_vlan_anti_spoof;
 
 	local: *;
 };
Signature · 1 line
2.10.1 (Apple Git-78)
#123 lore raw

PATCH v4 21/26 net/bnxt: add support to get and clear VF specific stats

In reply to Ajit Khaparde

This patch adds code to get and clear VF stats.
It also adds the necessary HWRM structures to send the command to the firmware.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Add a protection against application calling the API for different vendor's port_id
- Move the PF related MAC/VLAN anti spoof counter to xstats.

---
 app/test-pmd/cmdline.c                    | 23 +++++++--
 drivers/net/bnxt/bnxt_hwrm.c              | 38 ++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h              |  3 ++
 drivers/net/bnxt/bnxt_stats.c             | 60 +++++++++++++++++++++-
 drivers/net/bnxt/rte_pmd_bnxt.c           | 83 +++++++++++++++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt.h           | 52 +++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map |  3 ++
 7 files changed, 255 insertions(+), 7 deletions(-)
app/test-pmd/cmdline.c +18 -5
index 90e4a27..f49d83b 100644
@@ -13079,9 +13079,16 @@ cmd_show_vf_stats_parsed(
 	memset(&stats, 0, sizeof(stats));
 
 #ifdef RTE_LIBRTE_I40E_PMD
-	ret = rte_pmd_i40e_get_vf_stats(res->port_id,
-					res->vf_id,
-					&stats);
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_i40e_get_vf_stats(res->port_id,
+						res->vf_id,
+						&stats);
+#endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_get_vf_stats(res->port_id,
+						res->vf_id,
+						&stats);
 #endif
 
 	switch (ret) {
@@ -13177,8 +13184,14 @@ cmd_clear_vf_stats_parsed(
 		return;
 
 #ifdef RTE_LIBRTE_I40E_PMD
-	ret = rte_pmd_i40e_reset_vf_stats(res->port_id,
-					  res->vf_id);
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_i40e_reset_vf_stats(res->port_id,
+						  res->vf_id);
+#endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_reset_vf_stats(res->port_id,
+						  res->vf_id);
 #endif
 
 	switch (ret) {
drivers/net/bnxt/bnxt_hwrm.c +38 -0
index f143541..6ea31ca 100644
@@ -1237,6 +1237,27 @@ int bnxt_hwrm_func_vf_mac(struct bnxt *bp, uint16_t vf, const uint8_t *mac_addr)
 	return rc;
 }
 
+int bnxt_hwrm_func_qstats_tx_drop(struct bnxt *bp, uint16_t fid,
+				  uint64_t *dropped)
+{
+	int rc = 0;
+	struct hwrm_func_qstats_input req = {.req_type = 0};
+	struct hwrm_func_qstats_output *resp = bp->hwrm_cmd_resp_addr;
+
+	HWRM_PREP(req, FUNC_QSTATS, -1, resp);
+
+	req.fid = rte_cpu_to_le_16(fid);
+
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+
+	HWRM_CHECK_RESULT;
+
+	if (dropped)
+		*dropped = rte_le_to_cpu_64(resp->tx_drop_pkts);
+
+	return rc;
+}
+
 int bnxt_hwrm_func_qstats(struct bnxt *bp, uint16_t fid,
 			  struct rte_eth_stats *stats)
 {
@@ -1274,6 +1295,23 @@ int bnxt_hwrm_func_qstats(struct bnxt *bp, uint16_t fid,
 	return rc;
 }
 
+int bnxt_hwrm_func_clr_stats(struct bnxt *bp, uint16_t fid)
+{
+	int rc = 0;
+	struct hwrm_func_clr_stats_input req = {.req_type = 0};
+	struct hwrm_func_clr_stats_output *resp = bp->hwrm_cmd_resp_addr;
+
+	HWRM_PREP(req, FUNC_CLR_STATS, -1, resp);
+
+	req.fid = rte_cpu_to_le_16(fid);
+
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+
+	HWRM_CHECK_RESULT;
+
+	return rc;
+}
+
 /*
  * HWRM utility functions
  */
drivers/net/bnxt/bnxt_hwrm.h +3 -0
index f51ebcf..5aaf947 100644
@@ -66,6 +66,9 @@ int bnxt_hwrm_func_reset(struct bnxt *bp);
 int bnxt_hwrm_func_driver_unregister(struct bnxt *bp, uint32_t flags);
 int bnxt_hwrm_func_qstats(struct bnxt *bp, uint16_t fid,
 			  struct rte_eth_stats *stats);
+int bnxt_hwrm_func_qstats_tx_drop(struct bnxt *bp, uint16_t fid,
+				  uint64_t *dropped);
+int bnxt_hwrm_func_clr_stats(struct bnxt *bp, uint16_t fid);
 int bnxt_hwrm_func_cfg_def_cp(struct bnxt *bp);
 int bnxt_hwrm_vf_func_cfg_def_cp(struct bnxt *bp);
 
drivers/net/bnxt/bnxt_stats.c +58 -2

99 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.c +83 -0

86 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.h +52 -0

62 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt_version.map +3 -0
index 770b076..f0eda7b 100644
@@ -9,6 +9,9 @@ DPDK_17.08 {
 	rte_pmd_bnxt_set_vf_vlan_stripq;
 	rte_pmd_bnxt_set_vf_vlan_filter;
 	rte_pmd_bnxt_set_vf_vlan_anti_spoof;
+	rte_pmd_bnxt_get_vf_stats;
+	rte_pmd_bnxt_reset_vf_stats;
+	rte_pmd_bnxt_get_vf_tx_drop_count;
 
 	local: *;
 };
Signature · 1 line
2.10.1 (Apple Git-78)
#124 lore raw

PATCH v4 22/26 net/bnxt: add code to determine the Rx status of VF

In reply to Ajit Khaparde

This patch adds code to determine the Rx status of a VF. It adds the rte_pmd_bnxt_get_vf_rx_status call, which calculates the VNIC count of the function to get the Rx status.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Add a protection against application calling the API for different vendor's port_id

v3->v4: fix a rebase error

---
 drivers/net/bnxt/bnxt_hwrm.c              | 24 ++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h              |  1 +
 drivers/net/bnxt/rte_pmd_bnxt.c           | 26 ++++++++++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt.h           | 17 +++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map |  1 +
 5 files changed, 69 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +24 -0
index 6ea31ca..721e652 100644
@@ -2626,6 +2626,30 @@ 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)
+{
+	uint32_t *count = cbdata;
+
+	if (vnic->func_default)
+		*count = *count + 1;
+}
+
+static int bnxt_vnic_count_hwrm_stub(struct bnxt *bp __rte_unused,
+				     struct bnxt_vnic_info *vnic __rte_unused)
+{
+	return 0;
+}
+
+int bnxt_vf_default_vnic_count(struct bnxt *bp, uint16_t vf)
+{
+	uint32_t count = 0;
+
+	bnxt_hwrm_func_vf_vnic_query_and_config(bp, vf, bnxt_vnic_count,
+	    &count, bnxt_vnic_count_hwrm_stub);
+
+	return count;
+}
+
 static int bnxt_hwrm_func_vf_vnic_query(struct bnxt *bp, uint16_t vf,
 					uint16_t *vnic_ids)
 {
drivers/net/bnxt/bnxt_hwrm.h +1 -0
index 5aaf947..01e72fa 100644
@@ -141,6 +141,7 @@ 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_vf_default_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 +26 -0
index ebe95b6..05dfbb5 100644
@@ -515,6 +515,32 @@ int rte_pmd_bnxt_reset_vf_stats(uint8_t port,
 	return bnxt_hwrm_func_clr_stats(bp, bp->pf.first_vf_id + vf_id);
 }
 
+int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct bnxt *bp;
+
+	dev = &rte_eth_devices[port];
+	if (!is_bnxt_supported(dev))
+		return -ENOTSUP;
+
+	rte_eth_dev_info_get(port, &dev_info);
+	bp = (struct bnxt *)dev->data->dev_private;
+
+	if (vf_id >= dev_info.max_vfs)
+		return -EINVAL;
+
+	if (!BNXT_PF(bp)) {
+		RTE_LOG(ERR, PMD,
+			"Attempt to query VF %d RX stats on non-PF port %d!\n",
+			vf_id, port);
+		return -ENOTSUP;
+	}
+
+	return bnxt_vf_default_vnic_count(bp, vf_id);
+}
+
 int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
 				      uint64_t *count)
 {
drivers/net/bnxt/rte_pmd_bnxt.h +17 -0
index 7bfd376..0987c0f 100644
@@ -217,6 +217,23 @@ int rte_pmd_bnxt_reset_vf_stats(uint8_t port,
  */
 int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
 
+
+/**
+ * Returns the number of default RX queues on a VF
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @return
+ *   - Non-negative value - Number of default RX queues
+ *   - (-EINVAL) if bad parameter.
+ *   - (-ENOTSUP) if on a function without VFs
+ *   - (-ENOMEM) on an allocation failure
+ *   - (-1) firmware interface error
+ */
+int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id);
+
 /**
  * Queries the TX drop counter for the function
  *
drivers/net/bnxt/rte_pmd_bnxt_version.map +1 -0
index f0eda7b..c68c125 100644
@@ -3,6 +3,7 @@ DPDK_17.08 {
 
 	rte_pmd_bnxt_set_tx_loopback;
 	rte_pmd_bnxt_set_all_queues_drop_en;
+	rte_pmd_bnxt_get_vf_rx_status;
 	rte_pmd_bnxt_set_vf_mac_addr;
 	rte_pmd_bnxt_set_vf_mac_anti_spoof;
 	rte_pmd_bnxt_set_vf_rate_limit;
Signature · 1 line
2.10.1 (Apple Git-78)
#125 lore raw

PATCH v4 23/26 net/bnxt: add support to add a VF MAC address

In reply to Ajit Khaparde

This patch adds support to allocate a filter and program it in the hardware for every MAC address added to the specified function.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Add a protection against application calling the API for different vendor's port_id

---
 drivers/net/bnxt/bnxt_filter.c            | 22 +++++++++
 drivers/net/bnxt/bnxt_filter.h            |  1 +
 drivers/net/bnxt/rte_pmd_bnxt.c           | 76 +++++++++++++++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt.h           | 18 ++++++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map |  1 +
 5 files changed, 118 insertions(+)
drivers/net/bnxt/bnxt_filter.c +22 -0
index 0afde86..e9aac27 100644
@@ -68,6 +68,22 @@ struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp)
 	return filter;
 }
 
+struct bnxt_filter_info *bnxt_alloc_vf_filter(struct bnxt *bp, uint16_t vf)
+{
+	struct bnxt_filter_info *filter;
+
+	filter = rte_zmalloc("bnxt_vf_filter_info", sizeof(*filter), 0);
+	if (!filter) {
+		RTE_LOG(ERR, PMD, "Failed to alloc memory for VF %hu filters\n",
+			vf);
+		return NULL;
+	}
+
+	filter->fw_l2_filter_id = UINT64_MAX;
+	STAILQ_INSERT_TAIL(&bp->pf.vf_info[vf].filter, filter, next);
+	return filter;
+}
+
 void bnxt_init_filters(struct bnxt *bp)
 {
 	struct bnxt_filter_info *filter;
@@ -102,6 +118,12 @@ void bnxt_free_all_filters(struct bnxt *bp)
 			STAILQ_INIT(&vnic->filter);
 		}
 	}
+
+	for (i = 0; i < bp->pf.max_vfs; i++) {
+		STAILQ_FOREACH(filter, &bp->pf.vf_info[i].filter, next) {
+			bnxt_hwrm_clear_filter(bp, filter);
+		}
+	}
 }
 
 void bnxt_free_filter_mem(struct bnxt *bp)
drivers/net/bnxt/bnxt_filter.h +1 -0
index 353b7f7..613b2ee 100644
@@ -68,6 +68,7 @@ struct bnxt_filter_info {
 };
 
 struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp);
+struct bnxt_filter_info *bnxt_alloc_vf_filter(struct bnxt *bp, uint16_t vf);
 void bnxt_init_filters(struct bnxt *bp);
 void bnxt_free_all_filters(struct bnxt *bp);
 void bnxt_free_filter_mem(struct bnxt *bp);
drivers/net/bnxt/rte_pmd_bnxt.c +76 -0

79 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.h +18 -0
index 0987c0f..a523a95 100644
@@ -250,4 +250,22 @@ int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id);
  */
 int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
 				      uint64_t *count);
+
+/**
+ * Programs the MAC address for the function specified
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param mac_addr
+ *    The MAC address to be programmed in the filter.
+ * @param vf_id
+ *    VF on which to get.
+ * @return
+ *   - Positive Non-zero value - Error code from HWRM
+ *   - (-EINVAL) invalid vf_id specified.
+ *   - (-ENOTSUP) Ethernet device is not a PF
+ *   - (-ENOMEM) on an allocation failure
+ */
+int rte_pmd_bnxt_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
+				uint32_t vf_id);
 #endif /* _PMD_BNXT_H_ */
drivers/net/bnxt/rte_pmd_bnxt_version.map +1 -0
index c68c125..e3cc7bc 100644
@@ -13,6 +13,7 @@ DPDK_17.08 {
 	rte_pmd_bnxt_get_vf_stats;
 	rte_pmd_bnxt_reset_vf_stats;
 	rte_pmd_bnxt_get_vf_tx_drop_count;
+	rte_pmd_bnxt_mac_addr_add;
 
 	local: *;
 };
Signature · 1 line
2.10.1 (Apple Git-78)
#126 lore raw

PATCH v4 24/26 net/bnxt: add code to configure a default VF VLAN

In reply to Ajit Khaparde

This patch adds code to insert a default VF VLAN.
Also track the current default VLAN per vnic for the VF. When setting the default VLAN, avoid setting it to the current value.

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Add a protection against application calling the API for different vendor's port_id
- update testpmd to use these vendor specific APIs

---
 app/test-pmd/cmdline.c                    |  5 ++++
 drivers/net/bnxt/bnxt.h                   |  2 +-
 drivers/net/bnxt/bnxt_hwrm.c              | 39 +++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h              |  2 ++
 drivers/net/bnxt/rte_pmd_bnxt.c           | 38 ++++++++++++++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt.h           | 20 ++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map |  1 +
 7 files changed, 106 insertions(+), 1 deletion(-)
app/test-pmd/cmdline.c +5 -0
index f49d83b..ff623c1 100644
@@ -11334,6 +11334,11 @@ cmd_set_vf_vlan_insert_parsed(
 		ret = rte_pmd_i40e_set_vf_vlan_insert(res->port_id, res->vf_id,
 			res->vlan_id);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_set_vf_vlan_insert(res->port_id, res->vf_id,
+			res->vlan_id);
+#endif
 
 	switch (ret) {
 	case 0:
drivers/net/bnxt/bnxt.h +1 -1
index c1f9095..54428ba 100644
@@ -103,8 +103,8 @@ struct bnxt_child_vf_info {
 	uint32_t		func_cfg_flags;
 	uint32_t		l2_rx_mask;
 	uint16_t		fid;
-	uint16_t		dflt_vlan;
 	uint16_t		max_tx_rate;
+	uint16_t		dflt_vlan;
 	uint16_t		vlan_count;
 	uint8_t			mac_spoof_en;
 	uint8_t			vlan_spoof_en;
drivers/net/bnxt/bnxt_hwrm.c +39 -0
index 721e652..bf0526d 100644
@@ -2069,6 +2069,27 @@ static void reserve_resources_from_vf(struct bnxt *bp,
 	bp->max_ring_grps -= rte_le_to_cpu_16(resp->max_hw_ring_grps);
 }
 
+int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf)
+{
+	struct hwrm_func_qcfg_input req = {0};
+	struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
+	int rc;
+
+	/* Check for zero MAC address */
+	HWRM_PREP(req, FUNC_QCFG, -1, resp);
+	req.fid = rte_cpu_to_le_16(bp->pf.vf_info[vf].fid);
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+	if (rc) {
+		RTE_LOG(ERR, PMD, "hwrm_func_qcfg failed rc:%d\n", rc);
+		return -1;
+	} else if (resp->error_code) {
+		rc = rte_le_to_cpu_16(resp->error_code);
+		RTE_LOG(ERR, PMD, "hwrm_func_qcfg error %d\n", rc);
+		return -1;
+	}
+	return rte_le_to_cpu_16(resp->vlan);
+}
+
 static int update_pf_resource_max(struct bnxt *bp)
 {
 	struct hwrm_func_qcfg_input req = {0};
@@ -2423,6 +2444,24 @@ int bnxt_hwrm_func_bw_cfg(struct bnxt *bp, uint16_t vf,
 	return rc;
 }
 
+int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf)
+{
+	struct hwrm_func_cfg_input req = {0};
+	struct hwrm_func_cfg_output *resp = bp->hwrm_cmd_resp_addr;
+	int rc = 0;
+
+	HWRM_PREP(req, FUNC_CFG, -1, resp);
+	req.flags = rte_cpu_to_le_32(bp->pf.vf_info[vf].func_cfg_flags);
+	req.fid = rte_cpu_to_le_16(bp->pf.vf_info[vf].fid);
+	req.enables |= rte_cpu_to_le_32(HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_VLAN);
+	req.dflt_vlan = rte_cpu_to_le_16(bp->pf.vf_info[vf].dflt_vlan);
+
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+	HWRM_CHECK_RESULT;
+
+	return rc;
+}
+
 int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
 			      void *encaped, size_t ec_size)
 {
drivers/net/bnxt/bnxt_hwrm.h +2 -0
index 01e72fa..33d2885 100644
@@ -128,8 +128,10 @@ int bnxt_hwrm_func_vf_mac(struct bnxt *bp, uint16_t vf,
 int bnxt_hwrm_pf_evb_mode(struct bnxt *bp);
 int bnxt_hwrm_func_bw_cfg(struct bnxt *bp, uint16_t vf,
 			uint16_t max_bw, uint16_t enables);
+int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf);
 int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf,
 				       struct ether_addr *mac);
+int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf);
 int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port,
 				uint8_t tunnel_type);
 int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, uint16_t port,
drivers/net/bnxt/rte_pmd_bnxt.c +38 -0
index 40a3c8c..2ecd445 100644
@@ -644,3 +644,41 @@ int rte_pmd_bnxt_mac_addr_add(uint8_t port, struct ether_addr *addr,
 exit:
 	return rc;
 }
+
+int
+rte_pmd_bnxt_set_vf_vlan_insert(uint8_t port, uint16_t vf,
+		uint16_t vlan_id)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct bnxt *bp;
+	int rc;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	if (!is_bnxt_supported(dev))
+		return -ENOTSUP;
+
+	rte_eth_dev_info_get(port, &dev_info);
+	bp = (struct bnxt *)dev->data->dev_private;
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	if (!BNXT_PF(bp)) {
+		RTE_LOG(ERR, PMD,
+			"Attempt to set VF %d vlan insert on non-PF port %d!\n",
+			vf, port);
+		return -ENOTSUP;
+	}
+
+	bp->pf.vf_info[vf].dflt_vlan = vlan_id;
+	if (bnxt_hwrm_func_qcfg_current_vf_vlan(bp, vf) ==
+	    bp->pf.vf_info[vf].dflt_vlan)
+		return 0;
+
+	rc = bnxt_hwrm_set_vf_vlan(bp, vf);
+
+	return rc;
+}
drivers/net/bnxt/rte_pmd_bnxt.h +20 -0
index a523a95..2144601 100644
@@ -92,6 +92,26 @@ int
 rte_pmd_bnxt_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
 
 /**
+ * Enable/Disable vf vlan insert
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param vlan_id
+ *    0 - Disable VF's vlan insert.
+ *    n - Enable; n is inserted as the vlan id.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int
+rte_pmd_bnxt_set_vf_vlan_insert(uint8_t port, uint16_t vf,
+		uint16_t vlan_id);
+
+/**
  * Enable/Disable hardware VF VLAN filtering by an Ethernet device of
  * received VLAN packets tagged with a given VLAN Tag Identifier.
  *
drivers/net/bnxt/rte_pmd_bnxt_version.map +1 -0
index e3cc7bc..9433a1e 100644
@@ -14,6 +14,7 @@ DPDK_17.08 {
 	rte_pmd_bnxt_reset_vf_stats;
 	rte_pmd_bnxt_get_vf_tx_drop_count;
 	rte_pmd_bnxt_mac_addr_add;
+	rte_pmd_bnxt_set_vf_vlan_insert;
 
 	local: *;
 };
Signature · 1 line
2.10.1 (Apple Git-78)
#127 lore raw

PATCH v4 25/26 net/bnxt: add support to set VF rxmode

In reply to Ajit Khaparde

This patch adds support to configure the VF L2 Rx settings. The per VF setting is maintained in bnxt_child_vf_info.l2_rx_mask

--
v1->v2: regroup related patches and incorporate other review comments

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- Add a protection against application calling the API for different vendor's port_id
- update testpmd to use these vendor specific APIs

---
 app/test-pmd/cmdline.c                    | 15 +++++++--
 drivers/net/bnxt/bnxt_hwrm.c              | 24 ++++++++++++--
 drivers/net/bnxt/bnxt_hwrm.h              |  2 ++
 drivers/net/bnxt/bnxt_rxq.c               | 13 ++++++--
 drivers/net/bnxt/bnxt_vnic.h              |  5 +++
 drivers/net/bnxt/rte_pmd_bnxt.c           | 54 +++++++++++++++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt.h           | 19 +++++++++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map |  1 +
 8 files changed, 124 insertions(+), 9 deletions(-)
app/test-pmd/cmdline.c +12 -3
index ff623c1..28ff7cf 100644
@@ -6802,7 +6802,7 @@ cmd_set_vf_rxmode_parsed(void *parsed_result,
 		       __attribute__((unused)) struct cmdline *cl,
 		       __attribute__((unused)) void *data)
 {
-	int ret;
+	int ret = -ENOTSUP;
 	uint16_t rx_mode = 0;
 	struct cmd_set_vf_rxmode *res = parsed_result;
 
@@ -6818,7 +6818,16 @@ cmd_set_vf_rxmode_parsed(void *parsed_result,
 			rx_mode |= ETH_VMDQ_ACCEPT_MULTICAST;
 	}
 
-	ret = rte_pmd_ixgbe_set_vf_rxmode(res->port_id, res->vf_id, rx_mode, (uint8_t)is_on);
+#ifdef RTE_LIBRTE_IXGBE_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_ixgbe_set_vf_rxmode(res->port_id, res->vf_id,
+						  rx_mode, (uint8_t)is_on);
+#endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+	if (ret == -ENOTSUP)
+		ret = rte_pmd_bnxt_set_vf_rxmode(res->port_id, res->vf_id,
+						 rx_mode, (uint8_t)is_on);
+#endif
 	if (ret < 0)
 		printf("bad VF receive mode parameter, return code = %d \n",
 		ret);
@@ -13786,9 +13795,9 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_set_macsec_offload_off,
 	(cmdline_parse_inst_t *)&cmd_set_macsec_sc,
 	(cmdline_parse_inst_t *)&cmd_set_macsec_sa,
-	(cmdline_parse_inst_t *)&cmd_set_vf_rxmode,
 	(cmdline_parse_inst_t *)&cmd_set_vf_traffic,
 #endif
+	(cmdline_parse_inst_t *)&cmd_set_vf_rxmode,
 	(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
 	(cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
 	(cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
drivers/net/bnxt/bnxt_hwrm.c +21 -3
index bf0526d..6d98d5a 100644
@@ -229,23 +229,29 @@ int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp,
 	/* FIXME add multicast flag, when multicast adding options is supported
 	 * by ethtool.
 	 */
+	if (vnic->flags & BNXT_VNIC_INFO_BCAST)
+		mask = HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST;
+	if (vnic->flags & BNXT_VNIC_INFO_UNTAGGED)
+		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN;
 	if (vnic->flags & BNXT_VNIC_INFO_PROMISC)
-		mask = HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS;
+		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS;
 	if (vnic->flags & BNXT_VNIC_INFO_ALLMULTI)
 		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST;
+	if (vnic->flags & BNXT_VNIC_INFO_MCAST)
+		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST;
 	if (vnic->mc_addr_cnt) {
 		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST;
 		req.num_mc_entries = rte_cpu_to_le_32(vnic->mc_addr_cnt);
 		req.mc_tbl_addr = rte_cpu_to_le_64(vnic->mc_list_dma_addr);
 	}
-	req.mask = rte_cpu_to_le_32(HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST |
-				    mask);
 	if (vlan_count && vlan_table) {
 		mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLANONLY;
 		req.vlan_tag_tbl_addr = rte_cpu_to_le_16(
 			 rte_mem_virt2phy(vlan_table));
 		req.num_vlan_tags = rte_cpu_to_le_32((uint32_t)vlan_count);
 	}
+	req.mask = rte_cpu_to_le_32(HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST |
+				    mask);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
 
@@ -2317,6 +2323,18 @@ int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf)
 	return rc;
 }
 
+void vf_vnic_set_rxmask_cb(struct bnxt_vnic_info *vnic, void *flagp)
+{
+	uint32_t *flag = flagp;
+
+	vnic->flags = *flag;
+}
+
+int bnxt_set_rx_mask_no_vlan(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+{
+	return bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+}
+
 int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp)
 {
 	int rc = 0;
drivers/net/bnxt/bnxt_hwrm.h +2 -0
index 33d2885..a603dda 100644
@@ -143,6 +143,8 @@ 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);
+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_hwrm_func_vf_vnic_query_and_config(struct bnxt *bp, uint16_t vf,
 	void (*vnic_cb)(struct bnxt_vnic_info *, void *), void *cbdata,
drivers/net/bnxt/bnxt_rxq.c +10 -3
index d8b970e..0793820 100644
@@ -76,6 +76,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 			rc = -ENOMEM;
 			goto err_out;
 		}
+		vnic->flags |= BNXT_VNIC_INFO_BCAST;
 		STAILQ_INSERT_TAIL(&bp->ff_pool[0], vnic, next);
 		bp->nr_vnics++;
 
@@ -120,6 +121,9 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 		}
 		/* For each pool, allocate MACVLAN CFA rule & VNIC */
 		if (!pools) {
+			pools = RTE_MIN(bp->max_vnics,
+			    RTE_MIN(bp->max_l2_ctx,
+			     RTE_MIN(bp->max_rsscos_ctx, ETH_64_POOLS)));
 			RTE_LOG(ERR, PMD,
 				"VMDq pool not set, defaulted to 64\n");
 			pools = ETH_64_POOLS;
@@ -137,6 +141,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 				rc = -ENOMEM;
 				goto err_out;
 			}
+			vnic->flags |= BNXT_VNIC_INFO_BCAST;
 			STAILQ_INSERT_TAIL(&bp->ff_pool[i], vnic, next);
 			bp->nr_vnics++;
 
@@ -177,6 +182,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 		rc = -ENOMEM;
 		goto err_out;
 	}
+	vnic->flags |= BNXT_VNIC_INFO_BCAST;
 	/* Partition the rx queues for the single pool */
 	for (i = 0; i < bp->rx_cp_nr_rings; i++) {
 		rxq = bp->eth_dev->data->rx_queues[i];
@@ -295,7 +301,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	int rc = 0;
 
 	if (!nb_desc || nb_desc > MAX_RX_DESC_CNT) {
-		RTE_LOG(ERR, PMD, "nb_desc %d is invalid", nb_desc);
+		RTE_LOG(ERR, PMD, "nb_desc %d is invalid\n", nb_desc);
 		rc = -EINVAL;
 		goto out;
 	}
@@ -308,7 +314,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	rxq = rte_zmalloc_socket("bnxt_rx_queue", sizeof(struct bnxt_rx_queue),
 				 RTE_CACHE_LINE_SIZE, socket_id);
 	if (!rxq) {
-		RTE_LOG(ERR, PMD, "bnxt_rx_queue allocation failed!");
+		RTE_LOG(ERR, PMD, "bnxt_rx_queue allocation failed!\n");
 		rc = -ENOMEM;
 		goto out;
 	}
@@ -333,7 +339,8 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	/* Allocate RX ring hardware descriptors */
 	if (bnxt_alloc_rings(bp, queue_idx, NULL, rxq->rx_ring, rxq->cp_ring,
 			"rxr")) {
-		RTE_LOG(ERR, PMD, "ring_dma_zone_reserve for rx_ring failed!");
+		RTE_LOG(ERR, PMD,
+			"ring_dma_zone_reserve for rx_ring failed!\n");
 		bnxt_rx_queue_release_op(rxq);
 		rc = -ENOMEM;
 		goto out;
drivers/net/bnxt/bnxt_vnic.h +5 -0
index 0d50224..993f221 100644
@@ -64,6 +64,11 @@ struct bnxt_vnic_info {
 	uint32_t	flags;
 #define BNXT_VNIC_INFO_PROMISC			(1 << 0)
 #define BNXT_VNIC_INFO_ALLMULTI			(1 << 1)
+#define BNXT_VNIC_INFO_BCAST			(1 << 2)
+#define BNXT_VNIC_INFO_UCAST			(1 << 3)
+#define BNXT_VNIC_INFO_MCAST			(1 << 4)
+#define BNXT_VNIC_INFO_TAGGED			(1 << 5)
+#define BNXT_VNIC_INFO_UNTAGGED			(1 << 6)
 
 	uint16_t	cos_rule;
 	uint16_t	lb_rule;
drivers/net/bnxt/rte_pmd_bnxt.c +54 -0

60 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.h +19 -0
index 2144601..db9ce77 100644
@@ -237,6 +237,25 @@ int rte_pmd_bnxt_reset_vf_stats(uint8_t port,
  */
 int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
 
+/**
+ * Set RX L2 Filtering mode of a VF of an Ethernet device.
+ *
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @param rx_mask
+ *    The RX mode mask
+ * @param on
+ *    1 - Enable a VF RX mode.
+ *    0 - Disable a VF RX mode.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_bnxt_set_vf_rxmode(uint8_t port, uint16_t vf,
+				uint16_t rx_mask, uint8_t on);
 
 /**
  * Returns the number of default RX queues on a VF
drivers/net/bnxt/rte_pmd_bnxt_version.map +1 -0
index 9433a1e..f61c736 100644
@@ -15,6 +15,7 @@ DPDK_17.08 {
 	rte_pmd_bnxt_get_vf_tx_drop_count;
 	rte_pmd_bnxt_mac_addr_add;
 	rte_pmd_bnxt_set_vf_vlan_insert;
+	rte_pmd_bnxt_set_vf_rxmode;
 
 	local: *;
 };
Signature · 1 line
2.10.1 (Apple Git-78)
#128 lore raw

PATCH v4 26/26 doc: update release notes

In reply to Ajit Khaparde

Update release doc briefly describing updates to bnxt PMD.

v1->v2:
- Rebasing to next-net tree
- Use doc in the patch subject line

---
 doc/guides/rel_notes/release_17_08.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)
doc/guides/rel_notes/release_17_08.rst +10 -0
index 7f12120..7bf6d25 100644
@@ -56,6 +56,16 @@ New Features
   TX and RX path reworked to improve performance.  Also reduced latency
   for slow traffic.
 
+* **Updated bnxt PMD.**
+
+  Major enhancements include:
+  * Support MTU modification.
+  * Support LRO.
+  * Support VLAN filter and strip functionality.
+  * Other enhancements to add support for more dev_ops.
+  * Add PMD specific APIs mainly to control VF from PF.
+  * Update HWRM version to 1.7.7
+
 
 Resolved Issues
 ---------------
Signature · 1 line
2.10.1 (Apple Git-78)
#129 lore raw
In reply to Ajit Khaparde
Quoted 37 lines · Ajit Khaparde

This patchset amongst other changes adds support few more dev_ops, updates HWRM to version 1.7.7, switches to polling stats from the hardware, support for Jumbo MTU, LRO etc..

v1->v2:
- Grouped in the end, it also has PMD specific APIs to control VF from PF.
- I have updated the release notes and the features file wherever possible.

v2->v3:
- Rebasing to next-net tree
- Use net/bnxt instead of just bnxt in patch subject
- update testpmd to use the vendor specific APIs
- Addressed other review comments as appropriate

v3->v4:
- fix a rebase error

--

net/bnxt: update to new HWRM version
net/bnxt: code reorg to properly allocate resources for PF/VF net/bnxt: handle VF/PF initialization appropriately net/bnxt: support lack of huge pages
net/bnxt: add additonal HWRM debug info to error messages net/bnxt: add tunneling support
net/bnxt: add support for xstats get/reset
net/bnxt: add support for VLAN filter and strip net/bnxt: add support for set multicast addr list and MAC addr set
doc: update bnxt.ini to document Allmulticast mode net/bnxt: add support to get fw version
net/bnxt: add support to set MTU
net/bnxt: add support for LRO
net/bnxt: add rxq/txq info_get
net/bnxt: add code to support VLAN pvid
net/bnxt: reorg the query stats code
doc: update default.ini to add LED support
net/bnxt: add support for led on/off

Quoted 8 lines

net/bnxt: add support for tx loopback, set vf mac and queues drop net/bnxt: add support for set VF QOS and MAC anti spoof net/bnxt: add support to get and clear VF specific stats net/bnxt: add code to determine the Rx status of VF net/bnxt: add support to add a VF MAC address net/bnxt: add code to configure a default VF VLAN net/bnxt: add support to set VF rxmode
doc: update release notes

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