[dpdk-dev] [v2 07/15] bnxt: Update the bnxt PMD to use the 1.5.1 HWRM API

Ajit Khaparde ajit.khaparde at broadcom.com
Mon Sep 26 19:05:07 CEST 2016


Update the PMD to use the 1.5.1 HWRM API.
Most of the changes in this patch and the following patches are
white spaces and rearrangement of the lines - hopefully a onetime change
owing to the usage of a different autogenerated file.

Other than that, the following fields have been renamed:
1) rx_err_pkts and tx_err_pkts are now rx_discard_pkts and tx_discard_pkts
in struct ctx_hw_stats64
2) the perm_mac_addr field in the response of bnxt_hwrm_func_qcaps has
changed to mac_addr.

v1->v2: split into smaller patches for easier review.

Signed-off-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c           |   6 +-
 drivers/net/bnxt/bnxt_stats.c          |   4 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 249 +++++++++++++++++++--------------
 3 files changed, 149 insertions(+), 110 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 1846955..e10b9cd 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -288,7 +288,7 @@ int bnxt_hwrm_func_qcaps(struct bnxt *bp)
 
 		pf->fw_fid = rte_le_to_cpu_32(resp->fid);
 		pf->port_id = resp->port_id;
-		memcpy(pf->mac_addr, resp->perm_mac_address, ETHER_ADDR_LEN);
+		memcpy(pf->mac_addr, resp->mac_address, ETHER_ADDR_LEN);
 		pf->max_rsscos_ctx = rte_le_to_cpu_16(resp->max_rsscos_ctx);
 		pf->max_cp_rings = rte_le_to_cpu_16(resp->max_cmpl_rings);
 		pf->max_tx_rings = rte_le_to_cpu_16(resp->max_tx_rings);
@@ -301,7 +301,7 @@ int bnxt_hwrm_func_qcaps(struct bnxt *bp)
 		struct bnxt_vf_info *vf = &bp->vf;
 
 		vf->fw_fid = rte_le_to_cpu_32(resp->fid);
-		memcpy(vf->mac_addr, &resp->perm_mac_address, ETHER_ADDR_LEN);
+		memcpy(vf->mac_addr, &resp->mac_address, ETHER_ADDR_LEN);
 		vf->max_rsscos_ctx = rte_le_to_cpu_16(resp->max_rsscos_ctx);
 		vf->max_cp_rings = rte_le_to_cpu_16(resp->max_cmpl_rings);
 		vf->max_tx_rings = rte_le_to_cpu_16(resp->max_tx_rings);
@@ -386,6 +386,8 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 		resp->hwrm_intf_maj, resp->hwrm_intf_min,
 		resp->hwrm_intf_upd,
 		resp->hwrm_fw_maj, resp->hwrm_fw_min, resp->hwrm_fw_bld);
+	RTE_LOG(INFO, PMD, "Driver HWRM version: %d.%d.%d\n",
+		HWRM_VERSION_MAJOR, HWRM_VERSION_MINOR, HWRM_VERSION_UPDATE);
 
 	my_version = HWRM_VERSION_MAJOR << 16;
 	my_version |= HWRM_VERSION_MINOR << 8;
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 6f1c760..40c9cac 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -103,7 +103,7 @@ void bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 		bnxt_stats->ibytes += bnxt_stats->q_ibytes[i];
 		bnxt_stats->imissed += bnxt_stats->q_errors[i];
 		bnxt_stats->ierrors +=
-				rte_le_to_cpu_64(hw_stats->rx_err_pkts);
+				rte_le_to_cpu_64(hw_stats->rx_discard_pkts);
 	}
 
 	for (i = 0; i < bp->tx_cp_nr_rings; i++) {
@@ -130,7 +130,7 @@ void bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 		bnxt_stats->opackets += bnxt_stats->q_opackets[i];
 		bnxt_stats->obytes +=  bnxt_stats->q_obytes[i];
 		bnxt_stats->oerrors += rte_le_to_cpu_64(hw_stats->tx_drop_pkts);
-		bnxt_stats->oerrors += rte_le_to_cpu_64(hw_stats->tx_err_pkts);
+		bnxt_stats->oerrors += rte_le_to_cpu_64(hw_stats->tx_discard_pkts);
 	}
 }
 
diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h
index 5115937..b880dfd 100644
--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
@@ -43,7 +43,7 @@ struct ctx_hw_stats64 {
 	uint64_t rx_mcast_pkts;
 	uint64_t rx_bcast_pkts;
 	uint64_t rx_drop_pkts;
-	uint64_t rx_err_pkts;
+	uint64_t rx_discard_pkts;
 	uint64_t rx_ucast_bytes;
 	uint64_t rx_mcast_bytes;
 	uint64_t rx_bcast_bytes;
@@ -52,7 +52,7 @@ struct ctx_hw_stats64 {
 	uint64_t tx_mcast_pkts;
 	uint64_t tx_bcast_pkts;
 	uint64_t tx_drop_pkts;
-	uint64_t tx_err_pkts;
+	uint64_t tx_discard_pkts;
 	uint64_t tx_ucast_bytes;
 	uint64_t tx_mcast_bytes;
 	uint64_t tx_bcast_bytes;
@@ -61,12 +61,14 @@ struct ctx_hw_stats64 {
 	uint64_t tpa_bytes;
 	uint64_t tpa_events;
 	uint64_t tpa_aborts;
-} ctx_hw_stats64_t;
+} __attribute__((packed));
 
-/* HW Resource Manager Specification 1.2.0 */
+/* HW Resource Manager Specification 1.5.1 */
 #define HWRM_VERSION_MAJOR	1
-#define HWRM_VERSION_MINOR	2
-#define HWRM_VERSION_UPDATE	0
+#define HWRM_VERSION_MINOR	5
+#define HWRM_VERSION_UPDATE	1
+
+#define HWRM_VERSION_STR	"1.5.1"
 
 /*
  * Following is the signature for HWRM message field that indicates not
@@ -2023,179 +2025,214 @@ struct hwrm_func_qcaps_input {
 
 /* Output (80 bytes) */
 struct hwrm_func_qcaps_output {
+	uint16_t error_code;
 	/*
-	 * Pass/Fail or error type Note: receiver to verify the in parameters,
-	 * and fail the call with an error when appropriate
+	 * Pass/Fail or error type Note: receiver to verify the in
+	 * parameters, and fail the call with an error when appropriate
 	 */
-	uint16_t error_code;
-
-	/* This field returns the type of original request. */
 	uint16_t req_type;
-
-	/* This field provides original sequence number of the command. */
+	/* This field returns the type of original request. */
 	uint16_t seq_id;
-
-	/*
-	 * This field is the length of the response in bytes. The last byte of
-	 * the response is a valid flag that will read as '1' when the command
-	 * has been completely written to memory.
-	 */
+	/* This field provides original sequence number of the command. */
 	uint16_t resp_len;
-
 	/*
-	 * FID value. This value is used to identify operations on the PCI bus
-	 * as belonging to a particular PCI function.
+	 * This field is the length of the response in bytes. The last
+	 * byte of the response is a valid flag that will read as '1'
+	 * when the command has been completely written to memory.
 	 */
 	uint16_t fid;
-
 	/*
-	 * Port ID of port that this function is associated with. Valid only for
-	 * the PF. 0xFF... (All Fs) if this function is not associated with any
-	 * port. 0xFF... (All Fs) if this function is called from a VF.
+	 * FID value. This value is used to identify operations on the
+	 * PCI bus as belonging to a particular PCI function.
 	 */
 	uint16_t port_id;
-
+	/*
+	 * Port ID of port that this function is associated with. Valid
+	 * only for the PF. 0xFF... (All Fs) if this function is not
+	 * associated with any port. 0xFF... (All Fs) if this function
+	 * is called from a VF.
+	 */
+	uint32_t flags;
 	/* If 1, then Push mode is supported on this function. */
-	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PUSH_MODE_SUPPORTED   UINT32_C(0x1)
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PUSH_MODE_SUPPORTED	UINT32_C(0x1)
 	/*
-	 * If 1, then the global MSI-X auto-masking is enabled for the device.
+	 * If 1, then the global MSI-X auto-masking is enabled for the
+	 * device.
 	 */
-	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_GLOBAL_MSIX_AUTOMASKING \
-								UINT32_C(0x2)
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_GLOBAL_MSIX_AUTOMASKING	UINT32_C(0x2)
 	/*
-	 * If 1, then the Precision Time Protocol (PTP) processing is supported
-	 * on this function. The HWRM should enable PTP on only a single
-	 * Physical Function (PF) per port.
+	 * If 1, then the Precision Time Protocol (PTP) processing is
+	 * supported on this function. The HWRM should enable PTP on
+	 * only a single Physical Function (PF) per port.
 	 */
-	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED         UINT32_C(0x4)
-	uint32_t flags;
-
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED	UINT32_C(0x4)
 	/*
-	 * This value is current MAC address configured for this function. A
-	 * value of 00-00-00-00-00-00 indicates no MAC address is currently
-	 * configured.
+	 * If 1, then RDMA over Converged Ethernet (RoCE) v1 is
+	 * supported on this function.
 	 */
-	uint8_t perm_mac_address[6];
-
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ROCE_V1_SUPPORTED	UINT32_C(0x8)
 	/*
-	 * The maximum number of RSS/COS contexts that can be allocated to the
-	 * function.
+	 * If 1, then RDMA over Converged Ethernet (RoCE) v2 is
+	 * supported on this function.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ROCE_V2_SUPPORTED	UINT32_C(0x10)
+	/*
+	 * If 1, then control and configuration of WoL magic packet are
+	 * supported on this function.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_WOL_MAGICPKT_SUPPORTED	UINT32_C(0x20)
+	/*
+	 * If 1, then control and configuration of bitmap pattern packet
+	 * are supported on this function.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_WOL_BMP_SUPPORTED	UINT32_C(0x40)
+	/*
+	 * If set to 1, then the control and configuration of rate limit
+	 * of an allocated TX ring on the queried function is supported.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_TX_RING_RL_SUPPORTED	UINT32_C(0x80)
+	/*
+	 * If 1, then control and configuration of minimum and maximum
+	 * bandwidths are supported on the queried function.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_TX_BW_CFG_SUPPORTED	UINT32_C(0x100)
+	/*
+	 * If the query is for a VF, then this flag shall be ignored. If
+	 * this query is for a PF and this flag is set to 1, then the PF
+	 * has the capability to set the rate limits on the TX rings of
+	 * its children VFs. If this query is for a PF and this flag is
+	 * set to 0, then the PF does not have the capability to set the
+	 * rate limits on the TX rings of its children VFs.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_VF_TX_RING_RL_SUPPORTED	UINT32_C(0x200)
+	/*
+	 * If the query is for a VF, then this flag shall be ignored. If
+	 * this query is for a PF and this flag is set to 1, then the PF
+	 * has the capability to set the minimum and/or maximum
+	 * bandwidths for its children VFs. If this query is for a PF
+	 * and this flag is set to 0, then the PF does not have the
+	 * capability to set the minimum or maximum bandwidths for its
+	 * children VFs.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_VF_BW_CFG_SUPPORTED	UINT32_C(0x400)
+	uint8_t mac_address[6];
+	/*
+	 * This value is current MAC address configured for this
+	 * function. A value of 00-00-00-00-00-00 indicates no MAC
+	 * address is currently configured.
 	 */
 	uint16_t max_rsscos_ctx;
-
 	/*
-	 * The maximum number of completion rings that can be allocated to the
-	 * function.
+	 * The maximum number of RSS/COS contexts that can be allocated
+	 * to the function.
 	 */
 	uint16_t max_cmpl_rings;
-
 	/*
-	 * The maximum number of transmit rings that can be allocated to the
-	 * function.
+	 * The maximum number of completion rings that can be allocated
+	 * to the function.
 	 */
 	uint16_t max_tx_rings;
-
 	/*
-	 * The maximum number of receive rings that can be allocated to the
-	 * function.
+	 * The maximum number of transmit rings that can be allocated to
+	 * the function.
 	 */
 	uint16_t max_rx_rings;
-
 	/*
-	 * The maximum number of L2 contexts that can be allocated to the
-	 * function.
+	 * The maximum number of receive rings that can be allocated to
+	 * the function.
 	 */
 	uint16_t max_l2_ctxs;
-
-	/* The maximum number of VNICs that can be allocated to the function. */
+	/*
+	 * The maximum number of L2 contexts that can be allocated to
+	 * the function.
+	 */
 	uint16_t max_vnics;
-
 	/*
-	 * The identifier for the first VF enabled on a PF. This is valid only
-	 * on the PF with SR-IOV enabled. 0xFF... (All Fs) if this command is
-	 * called on a PF with SR-IOV disabled or on a VF.
+	 * The maximum number of VNICs that can be allocated to the
+	 * function.
 	 */
 	uint16_t first_vf_id;
-
 	/*
-	 * The maximum number of VFs that can be allocated to the function. This
-	 * is valid only on the PF with SR-IOV enabled. 0xFF... (All Fs) if this
-	 * command is called on a PF with SR-IOV disabled or on a VF.
+	 * The identifier for the first VF enabled on a PF. This is
+	 * valid only on the PF with SR-IOV enabled. 0xFF... (All Fs) if
+	 * this command is called on a PF with SR-IOV disabled or on a
+	 * VF.
 	 */
 	uint16_t max_vfs;
-
 	/*
-	 * The maximum number of statistic contexts that can be allocated to the
-	 * function.
+	 * The maximum number of VFs that can be allocated to the
+	 * function. This is valid only on the PF with SR-IOV enabled.
+	 * 0xFF... (All Fs) if this command is called on a PF with SR-
+	 * IOV disabled or on a VF.
 	 */
 	uint16_t max_stat_ctx;
-
 	/*
-	 * The maximum number of Encapsulation records that can be offloaded by
-	 * this function.
+	 * The maximum number of statistic contexts that can be
+	 * allocated to the function.
 	 */
 	uint32_t max_encap_records;
-
 	/*
-	 * The maximum number of decapsulation records that can be offloaded by
-	 * this function.
+	 * The maximum number of Encapsulation records that can be
+	 * offloaded by this function.
 	 */
 	uint32_t max_decap_records;
-
 	/*
-	 * The maximum number of Exact Match (EM) flows that can be offloaded by
-	 * this function on the TX side.
+	 * The maximum number of decapsulation records that can be
+	 * offloaded by this function.
 	 */
 	uint32_t max_tx_em_flows;
-
 	/*
-	 * The maximum number of Wildcard Match (WM) flows that can be offloaded
-	 * by this function on the TX side.
+	 * The maximum number of Exact Match (EM) flows that can be
+	 * offloaded by this function on the TX side.
 	 */
 	uint32_t max_tx_wm_flows;
-
 	/*
-	 * The maximum number of Exact Match (EM) flows that can be offloaded by
-	 * this function on the RX side.
+	 * The maximum number of Wildcard Match (WM) flows that can be
+	 * offloaded by this function on the TX side.
 	 */
 	uint32_t max_rx_em_flows;
-
 	/*
-	 * The maximum number of Wildcard Match (WM) flows that can be offloaded
-	 * by this function on the RX side.
+	 * The maximum number of Exact Match (EM) flows that can be
+	 * offloaded by this function on the RX side.
 	 */
 	uint32_t max_rx_wm_flows;
-
 	/*
-	 * The maximum number of multicast filters that can be supported by this
-	 * function on the RX side.
+	 * The maximum number of Wildcard Match (WM) flows that can be
+	 * offloaded by this function on the RX side.
 	 */
 	uint32_t max_mcast_filters;
-
 	/*
-	 * The maximum value of flow_id that can be supported in completion
-	 * records.
+	 * The maximum number of multicast filters that can be supported
+	 * by this function on the RX side.
 	 */
 	uint32_t max_flow_id;
-
 	/*
-	 * The maximum number of HW ring groups that can be supported on this
-	 * function.
+	 * The maximum value of flow_id that can be supported in
+	 * completion records.
 	 */
 	uint32_t max_hw_ring_grps;
-
-	uint8_t unused_0;
-	uint8_t unused_1;
-	uint8_t unused_2;
-
 	/*
-	 * This field is used in Output records to indicate that the output is
-	 * completely written to RAM. This field should be read as '1' to
-	 * indicate that the output has been completely written. When writing a
-	 * command completion or response to an internal processor, the order of
-	 * writes has to be such that this field is written last.
+	 * The maximum number of HW ring groups that can be supported on
+	 * this function.
 	 */
+	uint16_t max_sp_tx_rings;
+	/*
+	 * The maximum number of strict priority transmit rings that can
+	 * be allocated to the function. This number indicates the
+	 * maximum number of TX rings that can be assigned strict
+	 * priorities out of the maximum number of TX rings that can be
+	 * allocated (max_tx_rings) to the function.
+	 */
+	uint8_t unused_0;
 	uint8_t valid;
+	/*
+	 * This field is used in Output records to indicate that the
+	 * output is completely written to RAM. This field should be
+	 * read as '1' to indicate that the output has been completely
+	 * written. When writing a command completion or response to an
+	 * internal processor, the order of writes has to be such that
+	 * this field is written last.
+	 */
 } __attribute__((packed));
 
 /* hwrm_func_reset */
-- 
2.4.3



More information about the dev mailing list