From: Mingxia Liu <mingxia.liu@intel.com>
To: dev@dpdk.org, beilei.xing@intel.com, yuying.zhang@intel.com
Cc: Mingxia Liu <mingxia.liu@intel.com>,
Xiao Wang <xiao.w.wang@intel.com>,
Junfeng Guo <junfeng.guo@intel.com>
Subject: [PATCH v2 2/5] net/cpfl: update device initialization for hairpin queue
Date: Tue, 14 Feb 2023 11:38:49 +0000 [thread overview]
Message-ID: <20230214113852.3341607-3-mingxia.liu@intel.com> (raw)
In-Reply-To: <20230214113852.3341607-1-mingxia.liu@intel.com>
This patch update device initialization for hairpin queue.
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
---
drivers/common/idpf/idpf_common_device.c | 51 ++++++++++++++++
drivers/common/idpf/idpf_common_device.h | 2 +
drivers/common/idpf/idpf_common_virtchnl.c | 28 +++++++++
drivers/common/idpf/idpf_common_virtchnl.h | 3 +
drivers/common/idpf/version.map | 2 +
drivers/net/cpfl/cpfl_ethdev.c | 68 +++++++++++++++++++++-
6 files changed, 153 insertions(+), 1 deletion(-)
diff --git a/drivers/common/idpf/idpf_common_device.c b/drivers/common/idpf/idpf_common_device.c
index 5475a3e52c..2d968884c6 100644
--- a/drivers/common/idpf/idpf_common_device.c
+++ b/drivers/common/idpf/idpf_common_device.c
@@ -362,6 +362,57 @@ idpf_adapter_init(struct idpf_adapter *adapter)
return ret;
}
+int
+idpf_adapter_common_init(struct idpf_adapter *adapter)
+{
+ struct idpf_hw *hw = &adapter->hw;
+ int ret;
+
+ idpf_reset_pf(hw);
+ ret = idpf_check_pf_reset_done(hw);
+ if (ret != 0) {
+ DRV_LOG(ERR, "IDPF is still resetting");
+ goto err_check_reset;
+ }
+
+ ret = idpf_init_mbx(hw);
+ if (ret != 0) {
+ DRV_LOG(ERR, "Failed to init mailbox");
+ goto err_check_reset;
+ }
+
+ adapter->mbx_resp = rte_zmalloc("idpf_adapter_mbx_resp",
+ IDPF_DFLT_MBX_BUF_SIZE, 0);
+ if (adapter->mbx_resp == NULL) {
+ DRV_LOG(ERR, "Failed to allocate idpf_adapter_mbx_resp memory");
+ ret = -ENOMEM;
+ goto err_mbx_resp;
+ }
+
+ ret = idpf_vc_api_version_check(adapter);
+ if (ret != 0) {
+ DRV_LOG(ERR, "Failed to check api version");
+ goto err_check_api;
+ }
+
+ ret = idpf_get_pkt_type(adapter);
+ if (ret != 0) {
+ DRV_LOG(ERR, "Failed to set ptype table");
+ goto err_check_api;
+ }
+
+ return 0;
+
+err_check_api:
+ rte_free(adapter->mbx_resp);
+ adapter->mbx_resp = NULL;
+err_mbx_resp:
+ idpf_ctlq_deinit(hw);
+err_check_reset:
+ return ret;
+}
+
+
int
idpf_adapter_deinit(struct idpf_adapter *adapter)
{
diff --git a/drivers/common/idpf/idpf_common_device.h b/drivers/common/idpf/idpf_common_device.h
index 364a60221a..185c88fcd2 100644
--- a/drivers/common/idpf/idpf_common_device.h
+++ b/drivers/common/idpf/idpf_common_device.h
@@ -183,6 +183,8 @@ atomic_set_cmd(struct idpf_adapter *adapter, uint32_t ops)
__rte_internal
int idpf_adapter_init(struct idpf_adapter *adapter);
__rte_internal
+int idpf_adapter_common_init(struct idpf_adapter *adapter);
+__rte_internal
int idpf_adapter_deinit(struct idpf_adapter *adapter);
__rte_internal
int idpf_vport_init(struct idpf_vport *vport,
diff --git a/drivers/common/idpf/idpf_common_virtchnl.c b/drivers/common/idpf/idpf_common_virtchnl.c
index 99d9efbb7c..7fa0074293 100644
--- a/drivers/common/idpf/idpf_common_virtchnl.c
+++ b/drivers/common/idpf/idpf_common_virtchnl.c
@@ -338,6 +338,34 @@ idpf_vc_caps_get(struct idpf_adapter *adapter)
return 0;
}
+int idpf_vc_caps_get_by_info(struct idpf_adapter *adapter,
+ struct virtchnl2_get_capabilities *caps_info)
+{
+ struct virtchnl2_get_capabilities caps_msg;
+ struct idpf_cmd_info args;
+ int err;
+
+ memset(&caps_msg, 0, sizeof(struct virtchnl2_get_capabilities));
+ rte_memcpy(&caps_msg, caps_info, sizeof(caps_msg));
+
+ args.ops = VIRTCHNL2_OP_GET_CAPS;
+ args.in_args = (uint8_t *)&caps_msg;
+ args.in_args_size = sizeof(caps_msg);
+ args.out_buffer = adapter->mbx_resp;
+ args.out_size = IDPF_DFLT_MBX_BUF_SIZE;
+
+ err = idpf_vc_cmd_execute(adapter, &args);
+ if (err != 0) {
+ DRV_LOG(ERR,
+ "Failed to execute command of VIRTCHNL2_OP_GET_CAPS");
+ return err;
+ }
+
+ rte_memcpy(&adapter->caps, args.out_buffer, sizeof(caps_msg));
+
+ return 0;
+}
+
int
idpf_vc_vport_create(struct idpf_vport *vport,
struct virtchnl2_create_vport *create_vport_info)
diff --git a/drivers/common/idpf/idpf_common_virtchnl.h b/drivers/common/idpf/idpf_common_virtchnl.h
index d479d93c8e..6f46bef673 100644
--- a/drivers/common/idpf/idpf_common_virtchnl.h
+++ b/drivers/common/idpf/idpf_common_virtchnl.h
@@ -64,4 +64,7 @@ int idpf_vc_ctlq_recv(struct idpf_ctlq_info *cq, u16 *num_q_msg,
__rte_internal
int idpf_vc_ctlq_post_rx_buffs(struct idpf_hw *hw, struct idpf_ctlq_info *cq,
u16 *buff_count, struct idpf_dma_mem **buffs);
+__rte_internal
+int idpf_vc_caps_get_by_info(struct idpf_adapter *adapter,
+ struct virtchnl2_get_capabilities *caps_info);
#endif /* _IDPF_COMMON_VIRTCHNL_H_ */
diff --git a/drivers/common/idpf/version.map b/drivers/common/idpf/version.map
index 70334a1b03..c021669fd2 100644
--- a/drivers/common/idpf/version.map
+++ b/drivers/common/idpf/version.map
@@ -2,6 +2,7 @@ INTERNAL {
global:
idpf_adapter_deinit;
+ idpf_adapter_common_init;
idpf_adapter_init;
idpf_dp_prep_pkts;
@@ -37,6 +38,7 @@ INTERNAL {
idpf_vc_api_version_check;
idpf_vc_caps_get;
+ idpf_vc_caps_get_by_info;
idpf_vc_cmd_execute;
idpf_vc_ctlq_post_rx_buffs;
idpf_vc_ctlq_recv;
diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index f799707ea7..acc6180ca4 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -1154,6 +1154,72 @@ cpfl_dev_alarm_handler(void *param)
rte_eal_alarm_set(CPFL_ALARM_INTERVAL, cpfl_dev_alarm_handler, adapter);
}
+static int
+cpfl_get_caps(struct idpf_adapter *adapter)
+{
+ struct virtchnl2_get_capabilities caps_msg = {0};
+
+ caps_msg.csum_caps =
+ VIRTCHNL2_CAP_TX_CSUM_L3_IPV4 |
+ VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_TCP |
+ VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_UDP |
+ VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_SCTP |
+ VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_TCP |
+ VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_UDP |
+ VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_SCTP |
+ VIRTCHNL2_CAP_TX_CSUM_GENERIC |
+ VIRTCHNL2_CAP_RX_CSUM_L3_IPV4 |
+ VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_TCP |
+ VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_UDP |
+ VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_SCTP |
+ VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_TCP |
+ VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_UDP |
+ VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_SCTP |
+ VIRTCHNL2_CAP_RX_CSUM_GENERIC;
+
+ caps_msg.rss_caps =
+ VIRTCHNL2_CAP_RSS_IPV4_TCP |
+ VIRTCHNL2_CAP_RSS_IPV4_UDP |
+ VIRTCHNL2_CAP_RSS_IPV4_SCTP |
+ VIRTCHNL2_CAP_RSS_IPV4_OTHER |
+ VIRTCHNL2_CAP_RSS_IPV6_TCP |
+ VIRTCHNL2_CAP_RSS_IPV6_UDP |
+ VIRTCHNL2_CAP_RSS_IPV6_SCTP |
+ VIRTCHNL2_CAP_RSS_IPV6_OTHER |
+ VIRTCHNL2_CAP_RSS_IPV4_AH |
+ VIRTCHNL2_CAP_RSS_IPV4_ESP |
+ VIRTCHNL2_CAP_RSS_IPV4_AH_ESP |
+ VIRTCHNL2_CAP_RSS_IPV6_AH |
+ VIRTCHNL2_CAP_RSS_IPV6_ESP |
+ VIRTCHNL2_CAP_RSS_IPV6_AH_ESP;
+
+ caps_msg.other_caps = VIRTCHNL2_CAP_WB_ON_ITR |
+ VIRTCHNL2_CAP_PTP |
+ VIRTCHNL2_CAP_RX_FLEX_DESC;
+
+ return idpf_vc_caps_get_by_info(adapter, &caps_msg);
+}
+
+static int
+cpfl_adapter_init(struct idpf_adapter *adapter)
+{
+ int ret = 0;
+
+ ret = idpf_adapter_common_init(adapter);
+ if (ret != 0) {
+ PMD_DRV_LOG(ERR, "Failed to init idpf common adapter");
+ return ret;
+ }
+
+ ret = cpfl_get_caps(adapter);
+ if (ret != 0) {
+ PMD_DRV_LOG(ERR, "Failed to get capabilities");
+ return ret;
+ }
+
+ return ret;
+}
+
static int
cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adapter)
{
@@ -1170,7 +1236,7 @@ cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *a
strncpy(adapter->name, pci_dev->device.name, PCI_PRI_STR_SIZE);
- ret = idpf_adapter_init(base);
+ ret = cpfl_adapter_init(base);
if (ret != 0) {
PMD_INIT_LOG(ERR, "Failed to init adapter");
goto err_adapter_init;
--
2.25.1
next prev parent reply other threads:[~2023-02-14 12:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 13:06 [PATCH 0/1] add port to port feature for CPFL PMD Mingxia Liu
2023-01-18 13:06 ` [PATCH 1/1] net/cpfl: add port to port feature Mingxia Liu
2023-02-13 3:30 ` Xing, Beilei
2023-02-14 11:38 ` [PATCH v2 0/5] " Mingxia Liu
2023-02-14 11:38 ` [PATCH v2 1/5] net/cpfl: add some structure for hairpin queue Mingxia Liu
2023-02-14 11:38 ` Mingxia Liu [this message]
2023-02-14 11:38 ` [PATCH v2 3/5] net/cpfl: add hairpin queue enable and setup Mingxia Liu
2023-02-14 11:38 ` [PATCH v2 4/5] net/cpfl: support hairpin queue start and stop Mingxia Liu
2023-02-14 11:38 ` [PATCH v2 5/5] net/cpfl: adjust RSS LUT to exclude hairpin queue Mingxia Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230214113852.3341607-3-mingxia.liu@intel.com \
--to=mingxia.liu@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=junfeng.guo@intel.com \
--cc=xiao.w.wang@intel.com \
--cc=yuying.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).