From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9EB3EA00C3; Tue, 19 Apr 2022 09:49:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A1E4341156; Tue, 19 Apr 2022 09:48:23 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 477834068E for ; Tue, 19 Apr 2022 09:48:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650354501; x=1681890501; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7TAsBqQ3YNcnG1Z7KL7RLjVjf3ECygbjVKiDqccpqxU=; b=cq+mWvuwvzcfeJHKya9No74P/m3E6Doe253ueUxPs7NGS177JoBrhu0k Lb/RzpdakIMKQfOmz0uwLVs7NxkCpV0BsiL/B+KQYwHzx1k6RdvqwWhyf CFNk19WJgWt/Nzt8kkSPHLjA3vUi5ljSTG7QQ6FJRDgbx1AI0s3yRc8Cs 9K0m92na7R/gfP8oevgUJ6pykBZgKYAjCh9KrZpp2SvLQwVVOfYKtjQyX HJIcEZgO4NMrwzIcKYm/nKoJdYDWn4gyQGMbeSRK/B6CFJ6I/SMj61ZjL B61Qm3XI25DItM9mEoYSCryICpZ6Cj9dEGYFOq+q+bfS6QaWakUjPPFzN Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10321"; a="244288729" X-IronPort-AV: E=Sophos;i="5.90,272,1643702400"; d="scan'208";a="244288729" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2022 00:48:20 -0700 X-IronPort-AV: E=Sophos;i="5.90,272,1643702400"; d="scan'208";a="575971921" Received: from intel-cd-odc-kevin.cd.intel.com ([10.240.178.195]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2022 00:48:17 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Kevin Liu Subject: [PATCH v4 15/23] net/ice: add DCF request queues function Date: Tue, 19 Apr 2022 15:46:06 +0000 Message-Id: <20220419154614.476154-16-kevinx.liu@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220419154614.476154-1-kevinx.liu@intel.com> References: <20220413171030.2231163-1-kevinx.liu@intel.com> <20220419154614.476154-1-kevinx.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Steve Yang Add a new virtchnl function to request additional queues from PF. Current default queue pairs number is 16. In order to support up to 256 queue pairs DCF port, enable this request queues function. Signed-off-by: Steve Yang Signed-off-by: Kevin Liu --- drivers/net/ice/ice_dcf.c | 98 +++++++++++++++++++++++++++++++++------ drivers/net/ice/ice_dcf.h | 1 + 2 files changed, 86 insertions(+), 13 deletions(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 1415f26ac3..6aeafa6681 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -257,7 +257,7 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw) VIRTCHNL_VF_CAP_ADV_LINK_SPEED | VIRTCHNL_VF_CAP_DCF | VIRTCHNL_VF_OFFLOAD_VLAN_V2 | VF_BASE_MODE_OFFLOADS | VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC | - VIRTCHNL_VF_OFFLOAD_QOS; + VIRTCHNL_VF_OFFLOAD_QOS | VIRTCHNL_VF_OFFLOAD_REQ_QUEUES; err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_GET_VF_RESOURCES, (uint8_t *)&caps, sizeof(caps)); @@ -468,18 +468,38 @@ ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw, goto ret; } - do { - if (!cmd->pending) - break; - - rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME); - } while (i++ < ICE_DCF_ARQ_MAX_RETRIES); - - if (cmd->v_ret != IAVF_SUCCESS) { - err = -1; - PMD_DRV_LOG(ERR, - "No response (%d times) or return failure (%d) for cmd %d", - i, cmd->v_ret, cmd->v_op); + switch (cmd->v_op) { + case VIRTCHNL_OP_REQUEST_QUEUES: + err = ice_dcf_recv_cmd_rsp_no_irq(hw, + VIRTCHNL_OP_REQUEST_QUEUES, + cmd->rsp_msgbuf, + cmd->rsp_buflen, + NULL); + if (err != IAVF_SUCCESS || !hw->resetting) { + err = -1; + PMD_DRV_LOG(ERR, + "Failed to get response of " + "VIRTCHNL_OP_REQUEST_QUEUES %d", + err); + } + break; + default: + /* For other virtchnl ops in running time, + * wait for the cmd done flag. + */ + do { + if (!cmd->pending) + break; + rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME); + } while (i++ < ICE_DCF_ARQ_MAX_RETRIES); + + if (cmd->v_ret != IAVF_SUCCESS) { + err = -1; + PMD_DRV_LOG(ERR, + "No response (%d times) or " + "return failure (%d) for cmd %d", + i, cmd->v_ret, cmd->v_op); + } } ret: @@ -1011,6 +1031,58 @@ ice_dcf_configure_queues(struct ice_dcf_hw *hw) return err; } +int +ice_dcf_request_queues(struct ice_dcf_hw *hw, uint16_t num) +{ + struct virtchnl_vf_res_request vfres; + struct dcf_virtchnl_cmd args; + uint16_t num_queue_pairs; + int err; + + if (!(hw->vf_res->vf_cap_flags & + VIRTCHNL_VF_OFFLOAD_REQ_QUEUES)) { + PMD_DRV_LOG(ERR, "request queues not supported"); + return -1; + } + + if (num == 0) { + PMD_DRV_LOG(ERR, "queue number cannot be zero"); + return -1; + } + vfres.num_queue_pairs = num; + + memset(&args, 0, sizeof(args)); + args.v_op = VIRTCHNL_OP_REQUEST_QUEUES; + + args.req_msg = (u8 *)&vfres; + args.req_msglen = sizeof(vfres); + + args.rsp_msgbuf = hw->arq_buf; + args.rsp_msglen = ICE_DCF_AQ_BUF_SZ; + args.rsp_buflen = ICE_DCF_AQ_BUF_SZ; + + /* + * disable interrupt to avoid the admin queue message to be read + * before iavf_read_msg_from_pf. + */ + rte_intr_disable(hw->eth_dev->intr_handle); + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + rte_intr_enable(hw->eth_dev->intr_handle); + if (err) { + PMD_DRV_LOG(ERR, "fail to execute command OP_REQUEST_QUEUES"); + return err; + } + + /* request additional queues failed, return available number */ + num_queue_pairs = ((struct virtchnl_vf_res_request *) + args.rsp_msgbuf)->num_queue_pairs; + PMD_DRV_LOG(ERR, + "request queues failed, only %u queues available", + num_queue_pairs); + + return -1; +} + int ice_dcf_config_irq_map(struct ice_dcf_hw *hw) { diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index 8cf17e7700..99498e2184 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -127,6 +127,7 @@ int ice_dcf_configure_rss_key(struct ice_dcf_hw *hw); int ice_dcf_configure_rss_lut(struct ice_dcf_hw *hw); int ice_dcf_init_rss(struct ice_dcf_hw *hw); int ice_dcf_configure_queues(struct ice_dcf_hw *hw); +int ice_dcf_request_queues(struct ice_dcf_hw *hw, uint16_t num); int ice_dcf_config_irq_map(struct ice_dcf_hw *hw); int ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on); int ice_dcf_disable_queues(struct ice_dcf_hw *hw); -- 2.33.1