From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, HK_RANDOM_FROM,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3E78C43331 for ; Fri, 27 Mar 2020 03:05:21 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 4B54220787 for ; Fri, 27 Mar 2020 03:05:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B54220787 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 49B0D1C0B2; Fri, 27 Mar 2020 04:04:59 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 288B81C08E for ; Fri, 27 Mar 2020 04:04:49 +0100 (CET) IronPort-SDR: Y/2h00/kXh7H8OuIL/Z7hXhES6qHAexMpzGVNsDGRr9ePKiSeFYYsnu43LuXSTHNDNKQT+hxXG PtGl4Yyba9Rw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2020 20:04:49 -0700 IronPort-SDR: SdDAs6mT0enXdyolaiVDbr3pL0uXqTSSXvn2+9XqVTqaj+MBDn005TFbT8eAaKWktPMNr+AWdn mt+T64l+LjIA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,310,1580803200"; d="scan'208";a="420949785" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.119.213]) by orsmga005.jf.intel.com with ESMTP; 26 Mar 2020 20:04:47 -0700 From: Haiyue Wang To: dev@dpdk.org, xiaolong.ye@intel.com, qi.z.zhang@intel.com, jingjing.wu@intel.com, qiming.yang@intel.com, beilei.xing@intel.com Cc: wei.zhao1@intel.com, Haiyue Wang Date: Fri, 27 Mar 2020 10:56:38 +0800 Message-Id: <20200327025641.31008-5-haiyue.wang@intel.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200327025641.31008-1-haiyue.wang@intel.com> References: <20200309141437.11800-1-haiyue.wang@intel.com> <20200327025641.31008-1-haiyue.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v6 4/7] net/ice: handle the AdminQ command by DCF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Qi Zhang --- 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 6ea68feb9..baef5b8dc 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 #include +#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.26.0