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 AA60BA0501; Fri, 8 Apr 2022 13:13:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5679C4067E; Fri, 8 Apr 2022 13:13:32 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id E714E4003F for ; Fri, 8 Apr 2022 13:13:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649416411; x=1680952411; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=zkHHH1FaPKaot8mFbKPBYUPehR2AspuTmN/8zBCrQOc=; b=isR1xrqIuhLaWy+Fpr0MfVbHwdMZPESgVZzRID7zSLEPMzIY1lWBINaa B60JmcUDJ/Y7O18zlLCPKRXjGXKcX43TfZ1Ot5Hwo6kedkep7efiaQTmM vDWft1AVzzZjKihsqoZKML7aZtZd286llY8qw/ZQuFcHNbX68ObZgE7Yr XqfSb339jYPTjgJSTL8dhLmgW+0pql7SxMgYWwxJ/JXSpLN7SRYDoCceF afnCPqlUGlo45UNdy0MBHHJokYK943VW3NXR0AiXHvKnO17emRUFzQEbf Z/z/pKVcgWoDEJ6iJFQWY3OYBDbwfDTAm5aZGCtr57cSZ5fmw3G+UJ8wL Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10310"; a="261745243" X-IronPort-AV: E=Sophos;i="5.90,244,1643702400"; d="scan'208";a="261745243" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2022 04:13:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,244,1643702400"; d="scan'208";a="659451205" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by orsmga004.jf.intel.com with ESMTP; 08 Apr 2022 04:13:27 -0700 From: Qi Zhang To: qiming.yang@intel.com, wenjun1.wu@intel.com Cc: dev@dpdk.org, Qi Zhang Subject: [PATCH] net/ice: optimize max queue number calculation Date: Fri, 8 Apr 2022 19:17:05 +0800 Message-Id: <20220408111705.2629973-1-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 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 Remove the limitation that max queue pair number must be 2^n. With this patch, even on a 8 ports device, the max queue pair number increased from 128 to 254. Signed-off-by: Qi Zhang --- drivers/net/ice/ice_ethdev.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 73e550f5fb..03e6ed97fc 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -819,10 +819,26 @@ ice_vsi_config_tc_queue_mapping(struct ice_vsi *vsi, return -ENOTSUP; } - vsi->nb_qps = RTE_MIN(vsi->nb_qps, ICE_MAX_Q_PER_TC); - fls = (vsi->nb_qps == 0) ? 0 : rte_fls_u32(vsi->nb_qps) - 1; - /* Adjust the queue number to actual queues that can be applied */ - vsi->nb_qps = (vsi->nb_qps == 0) ? 0 : 0x1 << fls; + /* vector 0 is reserved and 1 vector for ctrl vsi */ + if (vsi->adapter->hw.func_caps.common_cap.num_msix_vectors < 2) + vsi->nb_qps = 0; + else + vsi->nb_qps = RTE_MIN( + (uint16_t)vsi->adapter->hw.func_caps.common_cap.num_msix_vectors - 2, + RTE_MIN(vsi->nb_qps, ICE_MAX_Q_PER_TC)); + + /* nb_qps(hex) -> fls */ + /* 0000 -> 0 */ + /* 0001 -> 0 */ + /* 0002 -> 1 */ + /* 0003 ~ 0004 -> 2 */ + /* 0005 ~ 0008 -> 3 */ + /* 0009 ~ 0010 -> 4 */ + /* 0011 ~ 0020 -> 5 */ + /* 0021 ~ 0040 -> 6 */ + /* 0041 ~ 0080 -> 7 */ + /* 0081 ~ 0100 -> 8 */ + fls = (vsi->nb_qps == 0) ? 0 : rte_fls_u32(vsi->nb_qps - 1); qp_idx = 0; /* Set tc and queue mapping with VSI */ -- 2.26.2