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 933EFA0508; Wed, 13 Apr 2022 10:13:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B4C504285C; Wed, 13 Apr 2022 10:11:52 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 5B48E4285C for ; Wed, 13 Apr 2022 10:11:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649837511; x=1681373511; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7TAsBqQ3YNcnG1Z7KL7RLjVjf3ECygbjVKiDqccpqxU=; b=GxQRXtgPW5ZwEKnynRz0H3cZMhBTCkRKsNpEeWIv3j2Ir9X3scCx5IQl JAJ7j337yJjYPEEudx2wlfA0JVNDyrKVxe9sGtI9cpowu7z1P6Fkvfau4 zXBvSF0rMNSG92XBp696qg4FEifyzWtowN6A3iXgKrpxqoxYIDRvE8UH/ g8qaqwHBJ5Wvuw6Wp3dBIuzna3xOquYFVGORrscyrqbeU8/Ud/BNhI/cS 1nqvoZuLD1gPJM73liXuW2D4ji86OLHXJojKoiXEqsgnP3a5VjU/4hoMr 9WH5RMSK0qEsTzWlwnt0ciMhs9AWEGCe5i9crsl9AeKbUdjM3BPQKV8aX g==; X-IronPort-AV: E=McAfee;i="6400,9594,10315"; a="287630105" X-IronPort-AV: E=Sophos;i="5.90,256,1643702400"; d="scan'208";a="287630105" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2022 01:11:50 -0700 X-IronPort-AV: E=Sophos;i="5.90,256,1643702400"; d="scan'208";a="526847878" Received: from intel-cd-odc-kevin.cd.intel.com ([10.240.178.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2022 01:11:48 -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 v2 26/33] net/ice: add DCF request queues function Date: Wed, 13 Apr 2022 16:09:25 +0000 Message-Id: <20220413160932.2074781-27-kevinx.liu@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220413160932.2074781-1-kevinx.liu@intel.com> References: <20220407105706.18889-1-kevinx.liu@intel.com> <20220413160932.2074781-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