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 0340AA2EDB for ; Mon, 30 Sep 2019 15:51:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C1D061BE96; Mon, 30 Sep 2019 15:50:43 +0200 (CEST) Received: from huawei.com (szxga04-in.huawei.com [45.249.212.190]) by dpdk.org (Postfix) with ESMTP id 284694CA7 for ; Mon, 30 Sep 2019 15:50:41 +0200 (CEST) Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C9F2BEA6EDE5FF08ABD9 for ; Mon, 30 Sep 2019 21:50:39 +0800 (CST) Received: from tester.localdomain (10.175.119.39) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Mon, 30 Sep 2019 21:50:31 +0800 From: Xiaoyun wang To: CC: , , , , , , , Xiaoyun wang Date: Mon, 30 Sep 2019 22:00:57 +0800 Message-ID: <6acc3c19963cd2ea85d394102bd5d3a5f3aed0b7.1569850827.git.cloud.wangxiaoyun@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.119.39] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v3 19/19] net/hinic: add support for getting rxq or txq info 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" This patch adds support for getting rxq or txq info. Signed-off-by: Xiaoyun wang --- drivers/net/hinic/hinic_pmd_ethdev.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index 765e661..1361a99 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -53,6 +53,11 @@ #define HINIC_MIN_RX_BUF_SIZE 1024 #define HINIC_MAX_UC_MAC_ADDRS 128 #define HINIC_MAX_MC_MAC_ADDRS 2048 + +#define HINIC_DEFAULT_BURST_SIZE 32 +#define HINIC_DEFAULT_NB_QUEUES 1 +#define HINIC_DEFAULT_RING_SIZE 1024 + /* * vlan_id is a 12 bit number. * The VFTA array is actually a 4096 bit array, 128 of 32bit elements. @@ -753,6 +758,14 @@ static void hinic_get_speed_capa(struct rte_eth_dev *dev, uint32_t *speed_capa) info->rx_desc_lim = hinic_rx_desc_lim; info->tx_desc_lim = hinic_tx_desc_lim; + /* Driver-preferred Rx/Tx parameters */ + info->default_rxportconf.burst_size = HINIC_DEFAULT_BURST_SIZE; + info->default_txportconf.burst_size = HINIC_DEFAULT_BURST_SIZE; + info->default_rxportconf.nb_queues = HINIC_DEFAULT_NB_QUEUES; + info->default_txportconf.nb_queues = HINIC_DEFAULT_NB_QUEUES; + info->default_rxportconf.ring_size = HINIC_DEFAULT_RING_SIZE; + info->default_txportconf.ring_size = HINIC_DEFAULT_RING_SIZE; + return 0; } @@ -2157,6 +2170,23 @@ static int hinic_dev_xstats_get(struct rte_eth_dev *dev, return count; } +static void hinic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_rxq_info *qinfo) +{ + struct hinic_rxq *rxq = dev->data->rx_queues[queue_id]; + + qinfo->mp = rxq->mb_pool; + qinfo->nb_desc = rxq->q_depth; +} + +static void hinic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_txq_info *qinfo) +{ + struct hinic_txq *txq = dev->data->tx_queues[queue_id]; + + qinfo->nb_desc = txq->q_depth; +} + /** * DPDK callback to retrieve names of extended device statistics * @@ -2873,6 +2903,8 @@ static void hinic_dev_close(struct rte_eth_dev *dev) .xstats_get = hinic_dev_xstats_get, .xstats_reset = hinic_dev_xstats_reset, .xstats_get_names = hinic_dev_xstats_get_names, + .rxq_info_get = hinic_rxq_info_get, + .txq_info_get = hinic_txq_info_get, .mac_addr_set = hinic_set_mac_addr, .mac_addr_remove = hinic_mac_addr_remove, .mac_addr_add = hinic_mac_addr_add, @@ -2906,6 +2938,8 @@ static void hinic_dev_close(struct rte_eth_dev *dev) .xstats_get = hinic_dev_xstats_get, .xstats_reset = hinic_dev_xstats_reset, .xstats_get_names = hinic_dev_xstats_get_names, + .rxq_info_get = hinic_rxq_info_get, + .txq_info_get = hinic_txq_info_get, .mac_addr_set = hinic_set_mac_addr, .mac_addr_remove = hinic_mac_addr_remove, .mac_addr_add = hinic_mac_addr_add, -- 1.8.3.1