DPDK patches and discussions
 help / color / Atom feed
From: Haiyue Wang <haiyue.wang@intel.com>
To: dev@dpdk.org, xiaolong.ye@intel.com, qi.z.zhang@intel.com,
	qiming.yang@intel.com, beilei.xing@intel.com
Cc: wei.zhao1@intel.com, Haiyue Wang <haiyue.wang@intel.com>
Subject: [dpdk-dev] [PATCH v3 4/7] net/ice: handle the AdminQ command by DCF
Date: Mon, 16 Mar 2020 13:52:52 +0800
Message-ID: <20200316055255.19685-5-haiyue.wang@intel.com> (raw)
In-Reply-To: <20200316055255.19685-1-haiyue.wang@intel.com>

The DCF (Device Config Function) splits the AdminQ command into two
parts: one is the descriptor of AdminQ command, the other is the buffer
of AdminQ command (the descriptor has BUF flag set). When both of them
are received by the PF, the PF will handle them as one command.

And also, the filled descriptor and buffer of the response will be sent
back to DCF one by one through the virtchnl from PF.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
 drivers/net/ice/ice_dcf.c | 65 +++++++++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h |  4 ++-
 2 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index ab5bc7424..89bc14774 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -396,6 +396,71 @@ ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
 	return err;
 }
 
+int
+ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,
+		    void *buf, uint16_t buf_size)
+{
+	struct dcf_virtchnl_cmd desc_cmd, buff_cmd;
+	struct ice_dcf_hw *hw = dcf_hw;
+	int err = 0;
+	int i = 0;
+
+	if ((buf && !buf_size) || (!buf && buf_size) ||
+	    buf_size > ICE_DCF_AQ_BUF_SZ)
+		return -EINVAL;
+
+	desc_cmd.v_op = VIRTCHNL_OP_DCF_CMD_DESC;
+	desc_cmd.req_msglen = sizeof(*desc);
+	desc_cmd.req_msg = (uint8_t *)desc;
+	desc_cmd.rsp_buflen = sizeof(*desc);
+	desc_cmd.rsp_msgbuf = (uint8_t *)desc;
+
+	if (buf == NULL)
+		return ice_dcf_execute_virtchnl_cmd(hw, &desc_cmd);
+
+	desc->flags |= rte_cpu_to_le_16(ICE_AQ_FLAG_BUF);
+
+	buff_cmd.v_op = VIRTCHNL_OP_DCF_CMD_BUFF;
+	buff_cmd.req_msglen = buf_size;
+	buff_cmd.req_msg = buf;
+	buff_cmd.rsp_buflen = buf_size;
+	buff_cmd.rsp_msgbuf = buf;
+
+	rte_spinlock_lock(&hw->vc_cmd_send_lock);
+	ice_dcf_vc_cmd_set(hw, &desc_cmd);
+	ice_dcf_vc_cmd_set(hw, &buff_cmd);
+
+	if (ice_dcf_vc_cmd_send(hw, &desc_cmd) ||
+	    ice_dcf_vc_cmd_send(hw, &buff_cmd)) {
+		err = -1;
+		PMD_DRV_LOG(ERR, "fail to send OP_DCF_CMD_DESC/BUFF");
+		goto ret;
+	}
+
+	do {
+		if ((!desc_cmd.pending && !buff_cmd.pending) ||
+		    (!desc_cmd.pending && desc_cmd.v_ret != IAVF_SUCCESS) ||
+		    (!buff_cmd.pending && buff_cmd.v_ret != IAVF_SUCCESS))
+			break;
+
+		rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME);
+	} while (i++ < ICE_DCF_ARQ_MAX_RETRIES);
+
+	if (desc_cmd.v_ret != IAVF_SUCCESS || buff_cmd.v_ret != IAVF_SUCCESS) {
+		err = -1;
+		PMD_DRV_LOG(ERR,
+			    "No response (%d times) or return failure (desc: %d / buff: %d)",
+			    i, desc_cmd.v_ret, buff_cmd.v_ret);
+	}
+
+ret:
+	ice_dcf_aq_cmd_clear(hw, &desc_cmd);
+	ice_dcf_aq_cmd_clear(hw, &buff_cmd);
+	rte_spinlock_unlock(&hw->vc_cmd_send_lock);
+
+	return err;
+}
+
 int
 ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 {
diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h
index f44c09db2..99bd53b02 100644
--- a/drivers/net/ice/ice_dcf.h
+++ b/drivers/net/ice/ice_dcf.h
@@ -11,6 +11,7 @@
 #include <iavf_adminq_cmd.h>
 #include <iavf_type.h>
 
+#include "base/ice_type.h"
 #include "ice_logs.h"
 
 struct dcf_virtchnl_cmd {
@@ -45,7 +46,8 @@ struct ice_dcf_hw {
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
 				 struct dcf_virtchnl_cmd *cmd);
-
+int ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,
+			void *buf, uint16_t buf_size);
 int ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw);
 void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw);
 
-- 
2.25.1


  parent reply index

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09 14:14 [dpdk-dev] [PATCH v1 0/4] add Intel DCF PMD support Haiyue Wang
2020-03-09 14:14 ` [dpdk-dev] [PATCH v1 1/4] net/iavf: stop the PCI probe in DCF mode Haiyue Wang
2020-03-09 15:38   ` Ye Xiaolong
2020-03-10  2:19     ` Wang, Haiyue
2020-03-10  3:37       ` Ye Xiaolong
2020-03-10  4:26         ` Wang, Haiyue
2020-03-23  1:50   ` Wu, Jingjing
2020-03-23  1:55     ` Wang, Haiyue
2020-03-09 14:14 ` [dpdk-dev] [PATCH v1 2/4] net/ice: export the DDP definition symbols Haiyue Wang
2020-03-09 16:25   ` Ye Xiaolong
2020-03-09 14:14 ` [dpdk-dev] [PATCH v1 3/4] net/ice: add the DCF framework Haiyue Wang
2020-03-10  4:17   ` Ye Xiaolong
2020-03-10  5:09     ` Wang, Haiyue
2020-03-10  5:23       ` Ye Xiaolong
2020-03-09 14:14 ` [dpdk-dev] [PATCH v1 4/4] doc: add release notes for Intel ice PMD Haiyue Wang
2020-03-09 15:22   ` Ye Xiaolong
2020-03-10  2:16     ` Wang, Haiyue
2020-03-09 15:36 ` [dpdk-dev] [PATCH v1 0/4] add Intel DCF PMD support David Marchand
2020-03-09 16:20   ` Ye Xiaolong
2020-03-09 17:57     ` Thomas Monjalon
2020-03-09 19:34       ` Kevin Traynor
2020-03-10  2:00         ` Wang, Haiyue
2020-03-10  7:48           ` Thomas Monjalon
2020-03-10  9:36             ` Ferruh Yigit
2020-03-10 14:11               ` Aaron Conole
2020-03-10 14:09   ` Aaron Conole
2020-03-10  6:50 ` [dpdk-dev] [PATCH v2 0/7] " Haiyue Wang
2020-03-10  6:50   ` [dpdk-dev] [PATCH v2 1/7] net/iavf: stop the PCI probe in DCF mode Haiyue Wang
2020-03-13  5:27     ` Ye Xiaolong
2020-03-10  6:50   ` [dpdk-dev] [PATCH v2 2/7] net/ice: add the DCF hardware initialization Haiyue Wang
2020-03-10  6:50   ` [dpdk-dev] [PATCH v2 3/7] net/ice: initiate to acquire the DCF capability Haiyue Wang
2020-03-13  5:51     ` Ye Xiaolong
2020-03-13  6:19       ` Wang, Haiyue
2020-03-13  6:04     ` Ye Xiaolong
2020-03-13  6:10       ` Wang, Haiyue
2020-03-10  6:50   ` [dpdk-dev] [PATCH v2 4/7] net/ice: handle the AdminQ command by DCF Haiyue Wang
2020-03-10  6:50   ` [dpdk-dev] [PATCH v2 5/7] net/ice: export the DDP definition symbols Haiyue Wang
2020-03-10  6:50   ` [dpdk-dev] [PATCH v2 6/7] net/ice: handle the PF initialization by DCF Haiyue Wang
2020-03-13  7:59     ` Ye Xiaolong
2020-03-13  8:03       ` Ye Xiaolong
2020-03-16  4:52       ` Wang, Haiyue
2020-03-13 14:06     ` Ye Xiaolong
2020-03-13 14:11       ` Wang, Haiyue
2020-03-10  6:50   ` [dpdk-dev] [PATCH v2 7/7] net/ice: get the VF hardware index in DCF Haiyue Wang
2020-03-13  7:01     ` Ye Xiaolong
2020-03-16  5:58       ` Wang, Haiyue
2020-03-13 16:19   ` [dpdk-dev] [PATCH v2 0/7] add Intel DCF PMD support Stillwell Jr, Paul M
2020-03-13 16:25     ` Wang, Haiyue
2020-03-13 16:50       ` Stillwell Jr, Paul M
2020-03-13 17:05         ` Wang, Haiyue
2020-03-13 17:47           ` Stillwell Jr, Paul M
2020-03-14  1:57             ` Wang, Haiyue
2020-03-15  1:49     ` Zhang, Qi Z
2020-03-16 18:54       ` Stillwell Jr, Paul M
2020-03-17  2:35         ` Wang, Haiyue
2020-03-16  5:52 ` [dpdk-dev] [PATCH v3 " Haiyue Wang
2020-03-16  5:52   ` [dpdk-dev] [PATCH v3 1/7] net/iavf: stop the PCI probe in DCF mode Haiyue Wang
2020-03-16  5:52   ` [dpdk-dev] [PATCH v3 2/7] net/ice: add the DCF hardware initialization Haiyue Wang
2020-03-16  5:52   ` [dpdk-dev] [PATCH v3 3/7] net/ice: acquire and disable the DCF capability Haiyue Wang
2020-03-16  5:52   ` Haiyue Wang [this message]
2020-03-16  5:52   ` [dpdk-dev] [PATCH v3 5/7] net/ice: export the DDP definition symbols Haiyue Wang
2020-03-16  5:52   ` [dpdk-dev] [PATCH v3 6/7] net/ice: handle the PF initialization by DCF Haiyue Wang
2020-03-16  5:52   ` [dpdk-dev] [PATCH v3 7/7] net/ice: get the VF hardware index in DCF Haiyue Wang
2020-03-26  3:03 ` [dpdk-dev] [PATCH v4 0/7] add Intel DCF PMD support Haiyue Wang
2020-03-26  3:03   ` [dpdk-dev] [PATCH v4 1/7] net/iavf: stop the PCI probe in DCF mode Haiyue Wang
2020-03-26  3:28     ` Wu, Jingjing
2020-03-26  3:03   ` [dpdk-dev] [PATCH v4 2/7] net/ice: add the DCF hardware initialization Haiyue Wang
2020-03-26  3:03   ` [dpdk-dev] [PATCH v4 3/7] net/ice: acquire and disable the DCF capability Haiyue Wang
2020-03-26  3:03   ` [dpdk-dev] [PATCH v4 4/7] net/ice: handle the AdminQ command by DCF Haiyue Wang
2020-03-26  3:03   ` [dpdk-dev] [PATCH v4 5/7] net/ice: export the DDP definition symbols Haiyue Wang
2020-03-26  3:03   ` [dpdk-dev] [PATCH v4 6/7] net/ice: handle the PF initialization by DCF Haiyue Wang
2020-03-26  3:03   ` [dpdk-dev] [PATCH v4 7/7] net/ice: get the VF hardware index in DCF Haiyue Wang
2020-03-26  4:11   ` [dpdk-dev] [PATCH v4 0/7] add Intel DCF PMD support Zhang, Qi Z
2020-03-26  5:05   ` Ye Xiaolong
2020-03-26  5:26     ` Wang, Haiyue
2020-03-26  7:15 ` [dpdk-dev] [PATCH v5 " Haiyue Wang
2020-03-26  7:15   ` [dpdk-dev] [PATCH v5 1/7] net/iavf: stop the PCI probe in DCF mode Haiyue Wang
2020-03-26  7:15   ` [dpdk-dev] [PATCH v5 2/7] net/ice: add the DCF hardware initialization Haiyue Wang
2020-03-26  7:15   ` [dpdk-dev] [PATCH v5 3/7] net/ice: acquire and disable the DCF capability Haiyue Wang
2020-03-26  7:15   ` [dpdk-dev] [PATCH v5 4/7] net/ice: handle the AdminQ command by DCF Haiyue Wang
2020-03-26  7:15   ` [dpdk-dev] [PATCH v5 5/7] net/ice: export the DDP definition symbols Haiyue Wang
2020-03-26  7:15   ` [dpdk-dev] [PATCH v5 6/7] net/ice: handle the PF initialization by DCF Haiyue Wang
2020-03-26  7:15   ` [dpdk-dev] [PATCH v5 7/7] net/ice: get the VF hardware index in DCF Haiyue Wang
2020-03-27  2:56 ` [dpdk-dev] [PATCH v6 0/7] add Intel DCF PMD support Haiyue Wang
2020-03-27  2:56   ` [dpdk-dev] [PATCH v6 1/7] net/iavf: stop the PCI probe in DCF mode Haiyue Wang
2020-03-27  2:56   ` [dpdk-dev] [PATCH v6 2/7] net/ice: add the DCF hardware initialization Haiyue Wang
2020-03-31  8:50     ` Ferruh Yigit
2020-03-31 12:17       ` Wang, Haiyue
2020-03-27  2:56   ` [dpdk-dev] [PATCH v6 3/7] net/ice: acquire and disable the DCF capability Haiyue Wang
2020-03-27  2:56   ` [dpdk-dev] [PATCH v6 4/7] net/ice: handle the AdminQ command by DCF Haiyue Wang
2020-03-27  2:56   ` [dpdk-dev] [PATCH v6 5/7] net/ice: export the DDP definition symbols Haiyue Wang
2020-03-27  2:56   ` [dpdk-dev] [PATCH v6 6/7] net/ice: handle the PF initialization by DCF Haiyue Wang
2020-03-27  2:56   ` [dpdk-dev] [PATCH v6 7/7] net/ice: get the VF hardware index in DCF Haiyue Wang
2020-03-27 15:26   ` [dpdk-dev] [PATCH v6 0/7] add Intel DCF PMD support Ye Xiaolong

Reply instructions:

You may reply publically 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=20200316055255.19685-5-haiyue.wang@intel.com \
    --to=haiyue.wang@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=wei.zhao1@intel.com \
    --cc=xiaolong.ye@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

DPDK patches and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox