DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] net/qede: add flush support to rte flow ops
@ 2020-04-25  6:13 Rasesh Mody
  2020-04-25  6:13 ` [dpdk-dev] [PATCH 2/2] net/qede: add support for get FW version Rasesh Mody
  0 siblings, 1 reply; 3+ messages in thread
From: Rasesh Mody @ 2020-04-25  6:13 UTC (permalink / raw)
  To: dev, jerinj, ferruh.yigit; +Cc: Rasesh Mody, GR-Everest-DPDK-Dev, Igor Russkikh

This patch adds suppot to flush the RTE FLOWs.

Signed-off-by: Rasesh Mody <rmody@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
---
 drivers/net/qede/qede_filter.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c
index b7ad59ad6..da8cac1c5 100644
--- a/drivers/net/qede/qede_filter.c
+++ b/drivers/net/qede/qede_filter.c
@@ -1486,10 +1486,32 @@ qede_flow_destroy(struct rte_eth_dev *eth_dev,
 	return rc;
 }
 
+static int
+qede_flow_flush(struct rte_eth_dev *eth_dev,
+		struct rte_flow_error *error)
+{
+	struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
+	struct qede_arfs_entry *tmp = NULL;
+	int rc = 0;
+
+	while (!SLIST_EMPTY(&qdev->arfs_info.arfs_list_head)) {
+		tmp = SLIST_FIRST(&qdev->arfs_info.arfs_list_head);
+
+		rc = qede_config_arfs_filter(eth_dev, tmp, false);
+		if (rc < 0)
+			rte_flow_error_set(error, rc,
+					   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+					   "Failed to flush flow filter");
+	}
+
+	return rc;
+}
+
 const struct rte_flow_ops qede_flow_ops = {
 	.validate = qede_flow_validate,
 	.create = qede_flow_create,
 	.destroy = qede_flow_destroy,
+	.flush = qede_flow_flush,
 };
 
 int qede_dev_filter_ctrl(struct rte_eth_dev *eth_dev,
-- 
2.18.0


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

* [dpdk-dev] [PATCH 2/2] net/qede: add support for get FW version
  2020-04-25  6:13 [dpdk-dev] [PATCH 1/2] net/qede: add flush support to rte flow ops Rasesh Mody
@ 2020-04-25  6:13 ` Rasesh Mody
  2020-05-03 16:30   ` Jerin Jacob
  0 siblings, 1 reply; 3+ messages in thread
From: Rasesh Mody @ 2020-04-25  6:13 UTC (permalink / raw)
  To: dev, jerinj, ferruh.yigit
  Cc: Rasesh Mody, GR-Everest-DPDK-Dev, Yash Sharma, Igor Russkikh

Add support for get firmware version operation.

Get and dump multi boot image (MBI) version as part of get
firmware version string along with Management fimrware (MFW) version.
Use qede_fw_version_get() for PMD info logs.

Signed-off-by: Yash Sharma <ysharma@marvell.com>
Signed-off-by: Rasesh Mody <rmody@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
---
---
 drivers/net/qede/base/ecore_mcp.c     | 37 +++++++++++
 drivers/net/qede/base/ecore_mcp_api.h | 12 ++++
 drivers/net/qede/qede_ethdev.c        | 96 ++++++++++++++++++---------
 drivers/net/qede/qede_if.h            |  9 +++
 drivers/net/qede/qede_main.c          |  3 +
 5 files changed, 126 insertions(+), 31 deletions(-)

diff --git a/drivers/net/qede/base/ecore_mcp.c b/drivers/net/qede/base/ecore_mcp.c
index 7518765a0..4dc22acd4 100644
--- a/drivers/net/qede/base/ecore_mcp.c
+++ b/drivers/net/qede/base/ecore_mcp.c
@@ -2245,6 +2245,43 @@ enum _ecore_status_t ecore_mcp_get_mfw_ver(struct ecore_hwfn *p_hwfn,
 	return ECORE_SUCCESS;
 }
 
+int ecore_mcp_get_mbi_ver(struct ecore_hwfn *p_hwfn,
+			  struct ecore_ptt *p_ptt, u32 *p_mbi_ver)
+{
+	u32 nvm_cfg_addr, nvm_cfg1_offset, mbi_ver_addr;
+
+#ifndef ASIC_ONLY
+	if (CHIP_REV_IS_EMUL(p_hwfn->p_dev) && !ecore_mcp_is_init(p_hwfn)) {
+		DP_INFO(p_hwfn, "Emulation: Can't get MBI version\n");
+		return -EOPNOTSUPP;
+	}
+#endif
+
+	if (IS_VF(p_hwfn->p_dev))
+		return -EINVAL;
+
+	/* Read the address of the nvm_cfg */
+	nvm_cfg_addr = ecore_rd(p_hwfn, p_ptt, MISC_REG_GEN_PURP_CR0);
+	if (!nvm_cfg_addr) {
+		DP_NOTICE(p_hwfn, false, "Shared memory not initialized\n");
+		return -EINVAL;
+	}
+
+	/* Read the offset of nvm_cfg1 */
+	nvm_cfg1_offset = ecore_rd(p_hwfn, p_ptt, nvm_cfg_addr + 4);
+
+	mbi_ver_addr = MCP_REG_SCRATCH + nvm_cfg1_offset +
+	    offsetof(struct nvm_cfg1, glob) + offsetof(struct nvm_cfg1_glob,
+						       mbi_version);
+	*p_mbi_ver =
+	    ecore_rd(p_hwfn, p_ptt,
+		     mbi_ver_addr) & (NVM_CFG1_GLOB_MBI_VERSION_0_MASK |
+				      NVM_CFG1_GLOB_MBI_VERSION_1_MASK |
+				      NVM_CFG1_GLOB_MBI_VERSION_2_MASK);
+
+	return 0;
+}
+
 enum _ecore_status_t ecore_mcp_get_media_type(struct ecore_hwfn *p_hwfn,
 					      struct ecore_ptt *p_ptt,
 					      u32 *p_media_type)
diff --git a/drivers/net/qede/base/ecore_mcp_api.h b/drivers/net/qede/base/ecore_mcp_api.h
index 7327074fd..b9ff0cd5d 100644
--- a/drivers/net/qede/base/ecore_mcp_api.h
+++ b/drivers/net/qede/base/ecore_mcp_api.h
@@ -587,6 +587,18 @@ enum _ecore_status_t ecore_mcp_get_mfw_ver(struct ecore_hwfn *p_hwfn,
 					   u32 *p_mfw_ver,
 					   u32 *p_running_bundle_id);
 
+/**
+ * @brief Get the MBI version value
+ *
+ * @param p_hwfn
+ * @param p_ptt
+ * @param p_mbi_ver - A pointer to a variable to be filled with the MBI version.
+ *
+ * @return int - 0 - operation was successful.
+ */
+int ecore_mcp_get_mbi_ver(struct ecore_hwfn *p_hwfn,
+			  struct ecore_ptt *p_ptt, u32 *p_mbi_ver);
+
 /**
  * @brief Get media type value of the port.
  *
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 19d2e9619..3005495b4 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -232,6 +232,58 @@ static const struct rte_qede_xstats_name_off qede_rxq_xstats_strings[] = {
 		offsetof(struct qede_rx_queue, rx_alloc_errors)}
 };
 
+/* Get FW version string based on fw_size */
+static int
+qede_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size)
+{
+	struct qede_dev *qdev = dev->data->dev_private;
+	struct ecore_dev *edev = &qdev->edev;
+	struct qed_dev_info *info = &qdev->dev_info.common;
+	static char ver_str[QEDE_PMD_DRV_VER_STR_SIZE];
+	size_t size;
+
+	if (fw_ver == NULL)
+		return 0;
+
+	if (IS_PF(edev))
+		snprintf(ver_str, QEDE_PMD_DRV_VER_STR_SIZE, "%s",
+			 QEDE_PMD_FW_VERSION);
+	else
+		snprintf(ver_str, QEDE_PMD_DRV_VER_STR_SIZE, "%d.%d.%d.%d",
+			 info->fw_major, info->fw_minor,
+			 info->fw_rev, info->fw_eng);
+	size = strlen(ver_str);
+	if (size + 1 <= fw_size) /* Add 1 byte for "\0" */
+		strlcpy(fw_ver, ver_str, fw_size);
+	else
+		return (size + 1);
+
+	snprintf(ver_str + size, (QEDE_PMD_DRV_VER_STR_SIZE - size),
+		 " MFW: %d.%d.%d.%d",
+		 GET_MFW_FIELD(info->mfw_rev, QED_MFW_VERSION_3),
+		 GET_MFW_FIELD(info->mfw_rev, QED_MFW_VERSION_2),
+		 GET_MFW_FIELD(info->mfw_rev, QED_MFW_VERSION_1),
+		 GET_MFW_FIELD(info->mfw_rev, QED_MFW_VERSION_0));
+	size = strlen(ver_str);
+	if (size + 1 <= fw_size)
+		strlcpy(fw_ver, ver_str, fw_size);
+
+	if (fw_size <= 32)
+		goto out;
+
+	snprintf(ver_str + size, (QEDE_PMD_DRV_VER_STR_SIZE - size),
+		 " MBI: %d.%d.%d",
+		 GET_MFW_FIELD(info->mbi_version, QED_MBI_VERSION_2),
+		 GET_MFW_FIELD(info->mbi_version, QED_MBI_VERSION_1),
+		 GET_MFW_FIELD(info->mbi_version, QED_MBI_VERSION_0));
+	size = strlen(ver_str);
+	if (size + 1 <= fw_size)
+		strlcpy(fw_ver, ver_str, fw_size);
+
+out:
+	return 0;
+}
+
 static void qede_interrupt_action(struct ecore_hwfn *p_hwfn)
 {
 	ecore_int_sp_dpc((osal_int_ptr_t)(p_hwfn));
@@ -274,47 +326,27 @@ qede_alloc_etherdev(struct qede_dev *qdev, struct qed_dev_eth_info *info)
 	qdev->ops = qed_ops;
 }
 
-static void qede_print_adapter_info(struct qede_dev *qdev)
+static void qede_print_adapter_info(struct rte_eth_dev *dev)
 {
+	struct qede_dev *qdev = dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
-	struct qed_dev_info *info = &qdev->dev_info.common;
 	static char ver_str[QEDE_PMD_DRV_VER_STR_SIZE];
 
 	DP_INFO(edev, "**************************************************\n");
-	DP_INFO(edev, " DPDK version\t\t\t: %s\n", rte_version());
-	DP_INFO(edev, " Chip details\t\t\t: %s %c%d\n",
+	DP_INFO(edev, " %-20s: %s\n", "DPDK version", rte_version());
+	DP_INFO(edev, " %-20s: %s %c%d\n", "Chip details",
 		  ECORE_IS_BB(edev) ? "BB" : "AH",
 		  'A' + edev->chip_rev,
 		  (int)edev->chip_metal);
 	snprintf(ver_str, QEDE_PMD_DRV_VER_STR_SIZE, "%s",
 		 QEDE_PMD_DRV_VERSION);
-	DP_INFO(edev, " Driver version\t\t\t: %s\n", ver_str);
-
+	DP_INFO(edev, " %-20s: %s\n", "Driver version", ver_str);
 	snprintf(ver_str, QEDE_PMD_DRV_VER_STR_SIZE, "%s",
 		 QEDE_PMD_BASE_VERSION);
-	DP_INFO(edev, " Base version\t\t\t: %s\n", ver_str);
-
-	if (!IS_VF(edev))
-		snprintf(ver_str, QEDE_PMD_DRV_VER_STR_SIZE, "%s",
-			 QEDE_PMD_FW_VERSION);
-	else
-		snprintf(ver_str, QEDE_PMD_DRV_VER_STR_SIZE, "%d.%d.%d.%d",
-			 info->fw_major, info->fw_minor,
-			 info->fw_rev, info->fw_eng);
-	DP_INFO(edev, " Firmware version\t\t\t: %s\n", ver_str);
-
-	snprintf(ver_str, MCP_DRV_VER_STR_SIZE,
-		 "%d.%d.%d.%d",
-		 (info->mfw_rev & QED_MFW_VERSION_3_MASK) >>
-		 QED_MFW_VERSION_3_OFFSET,
-		 (info->mfw_rev & QED_MFW_VERSION_2_MASK) >>
-		 QED_MFW_VERSION_2_OFFSET,
-		 (info->mfw_rev & QED_MFW_VERSION_1_MASK) >>
-		 QED_MFW_VERSION_1_OFFSET,
-		 (info->mfw_rev & QED_MFW_VERSION_0_MASK) >>
-		 QED_MFW_VERSION_0_OFFSET);
-	DP_INFO(edev, " Management Firmware version\t: %s\n", ver_str);
-	DP_INFO(edev, " Firmware file\t\t\t: %s\n", qede_fw_file);
+	DP_INFO(edev, " %-20s: %s\n", "Base version", ver_str);
+	qede_fw_version_get(dev, ver_str, sizeof(ver_str));
+	DP_INFO(edev, " %-20s: %s\n", "Firmware version", ver_str);
+	DP_INFO(edev, " %-20s: %s\n", "Firmware file", qede_fw_file);
 	DP_INFO(edev, "**************************************************\n");
 }
 
@@ -2351,6 +2383,7 @@ static const struct eth_dev_ops qede_eth_dev_ops = {
 	.filter_ctrl = qede_dev_filter_ctrl,
 	.udp_tunnel_port_add = qede_udp_dst_port_add,
 	.udp_tunnel_port_del = qede_udp_dst_port_del,
+	.fw_version_get = qede_fw_version_get,
 };
 
 static const struct eth_dev_ops qede_eth_vf_dev_ops = {
@@ -2391,6 +2424,7 @@ static const struct eth_dev_ops qede_eth_vf_dev_ops = {
 	.mac_addr_add = qede_mac_addr_add,
 	.mac_addr_remove = qede_mac_addr_remove,
 	.mac_addr_set = qede_mac_addr_set,
+	.fw_version_get = qede_fw_version_get,
 };
 
 static void qede_update_pf_params(struct ecore_dev *edev)
@@ -2544,7 +2578,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
 	qede_alloc_etherdev(adapter, &dev_info);
 
 	if (do_once) {
-		qede_print_adapter_info(adapter);
+		qede_print_adapter_info(eth_dev);
 		do_once = false;
 	}
 
@@ -2652,7 +2686,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
 
 err:
 	if (do_once) {
-		qede_print_adapter_info(adapter);
+		qede_print_adapter_info(eth_dev);
 		do_once = false;
 	}
 	return rc;
diff --git a/drivers/net/qede/qede_if.h b/drivers/net/qede/qede_if.h
index 02feaba16..858cd51d5 100644
--- a/drivers/net/qede/qede_if.h
+++ b/drivers/net/qede/qede_if.h
@@ -45,6 +45,15 @@ struct qed_dev_info {
 
 	bool smart_an;
 
+	/* MBI version */
+	uint32_t mbi_version;
+#define QED_MBI_VERSION_0_MASK          0x000000FF
+#define QED_MBI_VERSION_0_OFFSET        0
+#define QED_MBI_VERSION_1_MASK          0x0000FF00
+#define QED_MBI_VERSION_1_OFFSET        8
+#define QED_MBI_VERSION_2_MASK          0x00FF0000
+#define QED_MBI_VERSION_2_OFFSET        16
+
 	/* Out param for qede */
 	bool vxlan_enable;
 	bool gre_enable;
diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index 4eb79d0fb..257646e73 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -390,6 +390,9 @@ qed_fill_dev_info(struct ecore_dev *edev, struct qed_dev_info *dev_info)
 			ecore_mcp_get_mfw_ver(ECORE_LEADING_HWFN(edev), ptt,
 					      &dev_info->mfw_rev, NULL);
 
+			ecore_mcp_get_mbi_ver(ECORE_LEADING_HWFN(edev), ptt,
+					      &dev_info->mbi_version);
+
 			ecore_mcp_get_flash_size(ECORE_LEADING_HWFN(edev), ptt,
 						 &dev_info->flash_size);
 
-- 
2.18.1


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

* Re: [dpdk-dev] [PATCH 2/2] net/qede: add support for get FW version
  2020-04-25  6:13 ` [dpdk-dev] [PATCH 2/2] net/qede: add support for get FW version Rasesh Mody
@ 2020-05-03 16:30   ` Jerin Jacob
  0 siblings, 0 replies; 3+ messages in thread
From: Jerin Jacob @ 2020-05-03 16:30 UTC (permalink / raw)
  To: Rasesh Mody
  Cc: dpdk-dev, Jerin Jacob, Ferruh Yigit, GR-Everest-DPDK-Dev,
	Yash Sharma, Igor Russkikh

On Sat, Apr 25, 2020 at 11:44 AM Rasesh Mody <rmody@marvell.com> wrote:
>
> Add support for get firmware version operation.
>
> Get and dump multi boot image (MBI) version as part of get
> firmware version string along with Management fimrware (MFW) version.
> Use qede_fw_version_get() for PMD info logs.
>
> Signed-off-by: Yash Sharma <ysharma@marvell.com>
> Signed-off-by: Rasesh Mody <rmody@marvell.com>
> Signed-off-by: Igor Russkikh <irusskikh@marvell.com>

Series applied to dpdk-next-net-mrvl/master. Thanks.

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

end of thread, other threads:[~2020-05-03 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-25  6:13 [dpdk-dev] [PATCH 1/2] net/qede: add flush support to rte flow ops Rasesh Mody
2020-04-25  6:13 ` [dpdk-dev] [PATCH 2/2] net/qede: add support for get FW version Rasesh Mody
2020-05-03 16:30   ` Jerin Jacob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).