DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jingjing Wu <jingjing.wu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v3 7/9] i40e: get_dcb_info ops implement
Date: Sat, 31 Oct 2015 23:57:29 +0800	[thread overview]
Message-ID: <1446307051-29283-8-git-send-email-jingjing.wu@intel.com> (raw)
In-Reply-To: <1446307051-29283-1-git-send-email-jingjing.wu@intel.com>

This patch implements the get_dcb_info ops in i40e driver.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ce4efb2..480dd57 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -247,6 +247,8 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
 				enum rte_filter_type filter_type,
 				enum rte_filter_op filter_op,
 				void *arg);
+static int i40e_dev_get_dcb_info(struct rte_eth_dev *dev,
+				  struct rte_eth_dcb_info *dcb_info);
 static void i40e_configure_registers(struct i40e_hw *hw);
 static void i40e_hw_init(struct i40e_hw *hw);
 static int i40e_config_qinq(struct i40e_hw *hw, struct i40e_vsi *vsi);
@@ -320,6 +322,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.timesync_disable             = i40e_timesync_disable,
 	.timesync_read_rx_timestamp   = i40e_timesync_read_rx_timestamp,
 	.timesync_read_tx_timestamp   = i40e_timesync_read_tx_timestamp,
+	.get_dcb_info                 = i40e_dev_get_dcb_info,
 };
 
 static struct eth_driver rte_i40e_pmd = {
@@ -7016,3 +7019,42 @@ i40e_dcb_setup(struct rte_eth_dev *dev)
 	}
 	return 0;
 }
+
+static int
+i40e_dev_get_dcb_info(struct rte_eth_dev *dev,
+		      struct rte_eth_dcb_info *dcb_info)
+{
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct i40e_vsi *vsi = pf->main_vsi;
+	struct i40e_dcbx_config *dcb_cfg = &hw->local_dcbx_config;
+	uint16_t bsf, tc_mapping;
+	int i;
+
+	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_DCB_FLAG)
+		dcb_info->nb_tcs = rte_bsf32(vsi->enabled_tc + 1);
+	else
+		dcb_info->nb_tcs = 1;
+	for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
+		dcb_info->prio_tc[i] = dcb_cfg->etscfg.prioritytable[i];
+	for (i = 0; i < dcb_info->nb_tcs; i++)
+		dcb_info->tc_bws[i] = dcb_cfg->etscfg.tcbwtable[i];
+
+	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
+		if (vsi->enabled_tc & (1 << i)) {
+			tc_mapping = rte_le_to_cpu_16(vsi->info.tc_mapping[i]);
+			/* only main vsi support multi TCs */
+			dcb_info->tc_queue.tc_rxq[0][i].base =
+				(tc_mapping & I40E_AQ_VSI_TC_QUE_OFFSET_MASK) >>
+				I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT;
+			dcb_info->tc_queue.tc_txq[0][i].base =
+				dcb_info->tc_queue.tc_rxq[0][i].base;
+			bsf = (tc_mapping & I40E_AQ_VSI_TC_QUE_NUMBER_MASK) >>
+				I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT;
+			dcb_info->tc_queue.tc_rxq[0][i].nb_queue = 1 << bsf;
+			dcb_info->tc_queue.tc_txq[0][i].nb_queue =
+				dcb_info->tc_queue.tc_rxq[0][i].nb_queue;
+		}
+	}
+	return 0;
+}
-- 
2.4.0

  parent reply	other threads:[~2015-10-31 15:57 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-24  6:03 [dpdk-dev] [PATCH 0/8] enable DCB feature on Intel XL710/X710 NIC Jingjing Wu
2015-09-24  6:03 ` [dpdk-dev] [PATCH 1/8] ethdev: rename dcb_queue to dcb_tc in dcb config struct Jingjing Wu
2015-09-24  6:03 ` [dpdk-dev] [PATCH 2/8] ethdev: move the multi-queue checking to specific drivers Jingjing Wu
2015-09-24  6:03 ` [dpdk-dev] [PATCH 3/8] i40e: enable DCB feature on FVL Jingjing Wu
2015-09-24  6:03 ` [dpdk-dev] [PATCH 4/8] ixgbe: enable DCB+RSS multi-queue mode Jingjing Wu
2015-09-24  6:03 ` [dpdk-dev] [PATCH 5/8] ethdev: new API to get dcb related information Jingjing Wu
2015-09-24  6:03 ` [dpdk-dev] [PATCH 6/8] ixgbe: get_dcb_info ops implement Jingjing Wu
2015-09-24  6:03 ` [dpdk-dev] [PATCH 7/8] i40e: " Jingjing Wu
2015-10-22  7:10   ` Liu, Jijiang
2015-10-26  7:38     ` Wu, Jingjing
2015-09-24  6:03 ` [dpdk-dev] [PATCH 8/8] app/testpmd: set up DCB forwarding based on traffic class Jingjing Wu
2015-10-28  1:46   ` Liu, Jijiang
2015-10-28  2:04     ` Wu, Jingjing
2015-10-29  8:53 ` [dpdk-dev] [PATCH v2 00/10] enable DCB feature on Intel XL710/X710 NIC Jingjing Wu
2015-10-29  8:53   ` [dpdk-dev] [PATCH v2 01/10] ethdev: rename dcb_queue to dcb_tc in dcb config struct Jingjing Wu
2015-10-30 10:22     ` Thomas Monjalon
2015-10-29  8:53   ` [dpdk-dev] [PATCH v2 02/10] ethdev: move the multi-queue checking to specific drivers Jingjing Wu
2015-10-29  8:53   ` [dpdk-dev] [PATCH v2 03/10] i40e: enable DCB feature on FVL Jingjing Wu
2015-10-29  8:53   ` [dpdk-dev] [PATCH v2 04/10] ixgbe: enable DCB+RSS multi-queue mode Jingjing Wu
2015-10-29  8:53   ` [dpdk-dev] [PATCH v2 05/10] ethdev: new API to get dcb related information Jingjing Wu
2015-10-30 11:16     ` Thomas Monjalon
2015-10-29  8:53   ` [dpdk-dev] [PATCH v2 06/10] ixgbe: get_dcb_info ops implement Jingjing Wu
2015-10-29  8:53   ` [dpdk-dev] [PATCH v2 07/10] i40e: " Jingjing Wu
2015-10-29  8:53   ` [dpdk-dev] [PATCH v2 08/10] app/testpmd: set up DCB forwarding based on traffic class Jingjing Wu
2015-10-29  8:53   ` [dpdk-dev] [PATCH v2 09/10] app/testpmd: add command to display DCB info Jingjing Wu
2015-10-29  8:53   ` [dpdk-dev] [PATCH v2 10/10] doc: update testpmd guide and release note Jingjing Wu
2015-10-30 10:26     ` Thomas Monjalon
2015-10-30  1:29   ` [dpdk-dev] [PATCH v2 00/10] enable DCB feature on Intel XL710/X710 NIC Liu, Jijiang
2015-10-30  2:21   ` Zhang, Helin
2015-10-31 15:57   ` [dpdk-dev] [PATCH v3 0/9] " Jingjing Wu
2015-10-31 15:57     ` [dpdk-dev] [PATCH v3 1/9] ethdev: rename dcb_queue to dcb_tc in dcb config struct Jingjing Wu
2015-10-31 15:57     ` [dpdk-dev] [PATCH v3 2/9] ethdev: move the multi-queue checking to specific drivers Jingjing Wu
2015-10-31 15:57     ` [dpdk-dev] [PATCH v3 3/9] i40e: enable DCB feature on FVL Jingjing Wu
2015-10-31 15:57     ` [dpdk-dev] [PATCH v3 4/9] ixgbe: enable DCB+RSS multi-queue mode Jingjing Wu
2015-10-31 15:57     ` [dpdk-dev] [PATCH v3 5/9] ethdev: new API to get dcb related information Jingjing Wu
2015-10-31 15:57     ` [dpdk-dev] [PATCH v3 6/9] ixgbe: get_dcb_info ops implement Jingjing Wu
2015-10-31 15:57     ` Jingjing Wu [this message]
2015-10-31 15:57     ` [dpdk-dev] [PATCH v3 8/9] app/testpmd: set up DCB forwarding based on traffic class Jingjing Wu
2015-10-31 15:57     ` [dpdk-dev] [PATCH v3 9/9] app/testpmd: add command to display DCB info Jingjing Wu
2015-11-01 13:53     ` [dpdk-dev] [PATCH v3 0/9] enable DCB feature on Intel XL710/X710 NIC Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446307051-29283-8-git-send-email-jingjing.wu@intel.com \
    --to=jingjing.wu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).