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 9E44CA0A0C; Thu, 15 Jul 2021 12:33:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4F8644014D; Thu, 15 Jul 2021 12:33:14 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 3F7D140143; Thu, 15 Jul 2021 12:33:12 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10045"; a="232343731" X-IronPort-AV: E=Sophos;i="5.84,240,1620716400"; d="scan'208";a="232343731" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2021 03:33:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,240,1620716400"; d="scan'208";a="652751828" Received: from dpdk-xuting-second.sh.intel.com ([10.67.116.193]) by fmsmga006.fm.intel.com with ESMTP; 15 Jul 2021 03:33:09 -0700 From: Ting Xu To: dev@dpdk.org Cc: qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com, Ting Xu , stable@dpdk.org Date: Thu, 15 Jul 2021 18:36:06 +0800 Message-Id: <20210715103606.13551-1-ting.xu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210715020811.15577-1-ting.xu@intel.com> References: <20210715020811.15577-1-ting.xu@intel.com> Subject: [dpdk-dev] [PATCH v2] net/iavf: fix wrong bandwidth unit in TM capability querying 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 Sender: "dev" In IAVF node TM capability querying, the unit of bandwidth is Kbps, which is not correct according to TM specification. Change the unit to Byte per second. Refine some unclear comments as well. Fixes: 44d0a720a538 ("net/iavf: query QoS capabilities and set queue TC mapping") Cc: stable@dpdk.org Signed-off-by: Ting Xu --- drivers/net/iavf/iavf_tm.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/net/iavf/iavf_tm.c b/drivers/net/iavf/iavf_tm.c index 558021014e..3c80276ff3 100644 --- a/drivers/net/iavf/iavf_tm.c +++ b/drivers/net/iavf/iavf_tm.c @@ -469,9 +469,9 @@ iavf_tm_capabilities_get(struct rte_eth_dev *dev, cap->shaper_private_n_max = cap->n_nodes_max; cap->shaper_private_dual_rate_n_max = 0; cap->shaper_private_rate_min = 0; - /* GBps */ + /* Bytes per second */ cap->shaper_private_rate_max = - vf->link_speed * 1000 / IAVF_BITS_PER_BYTE; + (uint64_t)vf->link_speed * 1000000 / IAVF_BITS_PER_BYTE; cap->shaper_private_packet_mode_supported = 0; cap->shaper_private_byte_mode_supported = 1; cap->shaper_shared_n_max = 0; @@ -544,9 +544,9 @@ iavf_level_capabilities_get(struct rte_eth_dev *dev, cap->nonleaf.shaper_private_supported = true; cap->nonleaf.shaper_private_dual_rate_supported = false; cap->nonleaf.shaper_private_rate_min = 0; - /* GBps */ + /* Bytes per second */ cap->nonleaf.shaper_private_rate_max = - vf->link_speed * 1000 / IAVF_BITS_PER_BYTE; + (uint64_t)vf->link_speed * 1000000 / IAVF_BITS_PER_BYTE; cap->nonleaf.shaper_private_packet_mode_supported = 0; cap->nonleaf.shaper_private_byte_mode_supported = 1; cap->nonleaf.shaper_shared_n_max = 0; @@ -573,9 +573,9 @@ iavf_level_capabilities_get(struct rte_eth_dev *dev, cap->leaf.shaper_private_supported = false; cap->leaf.shaper_private_dual_rate_supported = false; cap->leaf.shaper_private_rate_min = 0; - /* GBps */ + /* Bytes per second */ cap->leaf.shaper_private_rate_max = - vf->link_speed * 1000 / IAVF_BITS_PER_BYTE; + (uint64_t)vf->link_speed * 1000000 / IAVF_BITS_PER_BYTE; cap->leaf.shaper_private_packet_mode_supported = 0; cap->leaf.shaper_private_byte_mode_supported = 1; cap->leaf.shaper_shared_n_max = 0; @@ -632,8 +632,11 @@ iavf_node_capabilities_get(struct rte_eth_dev *dev, cap->shaper_private_supported = true; cap->shaper_private_dual_rate_supported = false; - cap->shaper_private_rate_min = tc_cap.shaper.committed; - cap->shaper_private_rate_max = tc_cap.shaper.peak; + /* Bytes per second */ + cap->shaper_private_rate_min = + (uint64_t)tc_cap.shaper.committed * 1000 / IAVF_BITS_PER_BYTE; + cap->shaper_private_rate_max = + (uint64_t)tc_cap.shaper.peak * 1000 / IAVF_BITS_PER_BYTE; cap->shaper_shared_n_max = 0; cap->nonleaf.sched_n_children_max = vf->num_queue_pairs; cap->nonleaf.sched_sp_n_priorities_max = 1; -- 2.17.1