From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EC640A057C; Thu, 26 Mar 2020 08:23:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3C7E81C0B2; Thu, 26 Mar 2020 08:23:35 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id EF1941C069 for ; Thu, 26 Mar 2020 08:23:26 +0100 (CET) IronPort-SDR: vAlWHYwVcvKc8v4UxYMpgrRZvtHGgzgME43YVC2yX1NrmPzc0TsP89TefIiwfc60TlagjDJqfX oX2bTFUc5EWA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2020 00:23:26 -0700 IronPort-SDR: qdw67QDR5lVfgCXyInW0Yd711kLZBjY/T0qyh9BvMEmToR5lFeX1FhjvilGiAYTn3v7SNyDZCi OeDS/0g8wIqA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,307,1580803200"; d="scan'208";a="293555599" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.119.213]) by FMSMGA003.fm.intel.com with ESMTP; 26 Mar 2020 00:23:24 -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: Thu, 26 Mar 2020 15:15:21 +0800 Message-Id: <20200326071525.4088-4-haiyue.wang@intel.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200326071525.4088-1-haiyue.wang@intel.com> References: <20200309141437.11800-1-haiyue.wang@intel.com> <20200326071525.4088-1-haiyue.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 3/7] net/ice: acquire and disable the DCF capability 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" Since the DCF (Device Config Function) controls the flow setting of other VFs by the mailbox with PF, for security, it needs to acquire the DCF capability from PF when starts, and disable it when exits. Signed-off-by: Haiyue Wang Acked-by: Qi Zhang --- drivers/net/ice/ice_dcf.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 0a99cceb1..6ea68feb9 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -227,7 +227,7 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw) int err, i; caps = VIRTCHNL_VF_OFFLOAD_WB_ON_ITR | VIRTCHNL_VF_OFFLOAD_RX_POLLING | - VIRTCHNL_VF_CAP_ADV_LINK_SPEED | + VIRTCHNL_VF_CAP_ADV_LINK_SPEED | VIRTCHNL_VF_CAP_DCF | VF_BASE_MODE_OFFLOADS; err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_GET_VF_RESOURCES, @@ -264,6 +264,30 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw) return 0; } +static int +ice_dcf_mode_disable(struct ice_dcf_hw *hw) +{ + int err; + + err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_DCF_DISABLE, + NULL, 0); + if (err) { + PMD_DRV_LOG(ERR, "Failed to send msg OP_DCF_DISABLE"); + return err; + } + + err = ice_dcf_recv_cmd_rsp_no_irq(hw, VIRTCHNL_OP_DCF_DISABLE, + hw->arq_buf, ICE_DCF_AQ_BUF_SZ, NULL); + if (err) { + PMD_DRV_LOG(ERR, + "Failed to get response of OP_DCF_DISABLE %d", + err); + return -1; + } + + return 0; +} + static int ice_dcf_check_reset_done(struct ice_dcf_hw *hw) { @@ -467,6 +491,7 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) rte_intr_callback_unregister(intr_handle, ice_dcf_dev_interrupt_handler, hw); + ice_dcf_mode_disable(hw); iavf_shutdown_adminq(&hw->avf); rte_free(hw->arq_buf); -- 2.26.0