All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pawel Wodkowski <pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH v3 2/2] tespmd: fix DCB in SRIOV mode support
Date: Tue, 17 Feb 2015 17:19:46 +0100	[thread overview]
Message-ID: <1424189986-26219-3-git-send-email-pawelx.wodkowski@intel.com> (raw)
In-Reply-To: <1424189986-26219-1-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

This patch incorporate fixes to support DCB in SRIOV mode for testpmd.

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 app/test-pmd/cmdline.c |  4 ++--
 app/test-pmd/testpmd.c | 39 +++++++++++++++++++++++++++++----------
 app/test-pmd/testpmd.h | 10 ----------
 3 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 4beb404..eb9877e 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1942,9 +1942,9 @@ cmd_config_dcb_parsed(void *parsed_result,
 
 	/* DCB in VT mode */
 	if (!strncmp(res->vt_en, "on",2))
-		dcb_conf.dcb_mode = DCB_VT_ENABLED;
+		dcb_conf.vt_en = 1;
 	else
-		dcb_conf.dcb_mode = DCB_ENABLED;
+		dcb_conf.vt_en = 0;
 
 	if (!strncmp(res->pfc_en, "on",2)) {
 		dcb_conf.pfc_en = 1;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 773b8af..9b12c25 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1743,7 +1743,8 @@ const uint16_t vlan_tags[] = {
 };
 
 static  int
-get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf)
+get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf,
+	uint16_t sriov)
 {
         uint8_t i;
 
@@ -1751,7 +1752,7 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf)
  	 * Builds up the correct configuration for dcb+vt based on the vlan tags array
  	 * given above, and the number of traffic classes available for use.
  	 */
-	if (dcb_conf->dcb_mode == DCB_VT_ENABLED) {
+	if (dcb_conf->vt_en == 1) {
 		struct rte_eth_vmdq_dcb_conf vmdq_rx_conf;
 		struct rte_eth_vmdq_dcb_tx_conf vmdq_tx_conf;
 
@@ -1768,9 +1769,17 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct dcb_config *dcb_conf)
 			vmdq_rx_conf.pool_map[i].vlan_id = vlan_tags[ i ];
 			vmdq_rx_conf.pool_map[i].pools = 1 << (i % vmdq_rx_conf.nb_queue_pools);
 		}
-		for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
-			vmdq_rx_conf.dcb_queue[i] = i;
-			vmdq_tx_conf.dcb_queue[i] = i;
+
+		if (sriov == 0) {
+			for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
+				vmdq_rx_conf.dcb_queue[i] = i;
+				vmdq_tx_conf.dcb_queue[i] = i;
+			}
+		} else {
+			for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
+				vmdq_rx_conf.dcb_queue[i] = i % dcb_conf->num_tcs;
+				vmdq_tx_conf.dcb_queue[i] = i % dcb_conf->num_tcs;
+			}
 		}
 
 		/*set DCB mode of RX and TX of multiple queues*/
@@ -1828,22 +1837,32 @@ init_port_dcb_config(portid_t pid,struct dcb_config *dcb_conf)
 	uint16_t nb_vlan;
 	uint16_t i;
 
-	/* rxq and txq configuration in dcb mode */
-	nb_rxq = 128;
-	nb_txq = 128;
 	rx_free_thresh = 64;
 
+	rte_port = &ports[pid];
 	memset(&port_conf,0,sizeof(struct rte_eth_conf));
 	/* Enter DCB configuration status */
 	dcb_config = 1;
 
 	nb_vlan = sizeof( vlan_tags )/sizeof( vlan_tags[ 0 ]);
 	/*set configuration of DCB in vt mode and DCB in non-vt mode*/
-	retval = get_eth_dcb_conf(&port_conf, dcb_conf);
+	retval = get_eth_dcb_conf(&port_conf, dcb_conf, rte_port->dev_info.max_vfs);
+
+	/* rxq and txq configuration in dcb mode */
+	nb_rxq = rte_port->dev_info.max_rx_queues;
+	nb_txq = rte_port->dev_info.max_tx_queues;
+
+	if (rte_port->dev_info.max_vfs) {
+		if (port_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB)
+			nb_rxq /= port_conf.rx_adv_conf.vmdq_dcb_conf.nb_queue_pools;
+
+		if (port_conf.txmode.mq_mode == ETH_MQ_TX_VMDQ_DCB)
+			nb_txq /= port_conf.tx_adv_conf.vmdq_dcb_tx_conf.nb_queue_pools;
+	}
+
 	if (retval < 0)
 		return retval;
 
-	rte_port = &ports[pid];
 	memcpy(&rte_port->dev_conf, &port_conf,sizeof(struct rte_eth_conf));
 
 	rte_port->rx_conf.rx_thresh = rx_thresh;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 8f5e6c7..695e893 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -227,20 +227,10 @@ struct fwd_config {
 	portid_t   nb_fwd_ports;    /**< Nb. of ports involved. */
 };
 
-/**
- * DCB mode enable
- */
-enum dcb_mode_enable
-{
-	DCB_VT_ENABLED,
-	DCB_ENABLED
-};
-
 /*
  * DCB general config info
  */
 struct dcb_config {
-	enum dcb_mode_enable dcb_mode;
 	uint8_t vt_en;
 	enum rte_eth_nb_tcs num_tcs;
 	uint8_t pfc_en;
-- 
1.9.1

  parent reply	other threads:[~2015-02-17 16:19 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29 11:50 [PATCH 0/2] new headroom stats library and example application Pawel Wodkowski
     [not found] ` <1422532206-10662-1-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-01-29 11:50   ` [PATCH 1/2] librte_headroom: New library for checking core/system/app load Pawel Wodkowski
2015-01-29 11:50   ` [PATCH 2/2] examples: introduce new l2fwd-headroom example Pawel Wodkowski
2015-01-29 13:25   ` [PATCH 0/2] new headroom stats library and example application Neil Horman
     [not found]     ` <20150129132522.GA1999-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2015-01-29 17:10       ` Wodkowski, PawelX
     [not found]         ` <F6F2A6264E145F47A18AB6DF8E87425D12B8F749-kPTMFJFq+rFP9JyJpTNKArfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-29 19:13           ` Neil Horman
     [not found]             ` <20150129191326.GF1999-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2015-01-30 10:47               ` Wodkowski, PawelX
     [not found]                 ` <F6F2A6264E145F47A18AB6DF8E87425D12B8FD9E-kPTMFJFq+rFP9JyJpTNKArfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-30 18:02                   ` Neil Horman
2015-02-17 15:37   ` [PATCH v2 " Pawel Wodkowski
     [not found]     ` <1424187473-25853-1-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-17 15:37       ` [PATCH v2 1/2] librte_headroom: New library for checking core/system/app load Pawel Wodkowski
2015-02-17 15:37       ` [PATCH v2 2/2] examples: introduce new l2fwd-headroom example Pawel Wodkowski
2015-02-17 16:19       ` [PATCH v3 0/2] new headroom stats library and example application Pawel Wodkowski
     [not found]         ` <1424189986-26219-1-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-17 16:19           ` [PATCH v3 1/2] pmd: enable DCB in SRIOV Pawel Wodkowski
2015-02-17 16:19           ` Pawel Wodkowski [this message]
2015-02-17 16:33           ` [PATCH v3 0/2] new headroom stats library and example application Wodkowski, PawelX
2015-02-17 16:42           ` [PATCH v4 " Pawel Wodkowski
     [not found]             ` <1424191340-26451-1-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-17 16:42               ` [PATCH v4 1/2] librte_headroom: New library for checking core/system/app load Pawel Wodkowski
     [not found]                 ` <1424191340-26451-2-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-18 13:36                   ` De Lara Guarch, Pablo
2015-02-17 16:42               ` [PATCH v4 2/2] examples: introduce new l2fwd-headroom example Pawel Wodkowski
     [not found]                 ` <1424191340-26451-3-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-18 13:41                   ` De Lara Guarch, Pablo
2015-02-19 12:18               ` [PATCH v5 0/3] new headroom stats library and example application Pawel Wodkowski
     [not found]                 ` <1424348324-29932-1-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-19 12:18                   ` [PATCH v5 1/3] librte_headroom: New library for checking core/system/app load Pawel Wodkowski
     [not found]                     ` <1424348324-29932-2-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-24  1:55                       ` Thomas Monjalon
2015-02-19 12:18                   ` [PATCH v5 2/3] examples: introduce new l2fwd-headroom example Pawel Wodkowski
2015-02-19 12:18                   ` [PATCH v5 3/3] MAINTAINERS: claim responsibility for headroom library and example app Pawel Wodkowski
2015-02-19 14:33                   ` [PATCH v5 0/3] new headroom stats library and example application Neil Horman
     [not found]                     ` <20150219143334.GH24069-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2015-02-20 15:46                       ` Jastrzebski, MichalX K
     [not found]                         ` <60ABE07DBB3A454EB7FAD707B4BB1582138EB174-kPTMFJFq+rHjxeytcECX8bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-23 11:45                           ` Thomas Monjalon
2015-02-23 14:36                             ` Jastrzebski, MichalX K
     [not found]                               ` <60ABE07DBB3A454EB7FAD707B4BB1582138EB996-kPTMFJFq+rHjxeytcECX8bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-23 14:46                                 ` Thomas Monjalon
2015-02-23 15:55                                   ` Jastrzebski, MichalX K
     [not found]                                     ` <60ABE07DBB3A454EB7FAD707B4BB1582138EBA65-kPTMFJFq+rHjxeytcECX8bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-23 16:04                                       ` Thomas Monjalon
2015-02-24  8:44                                         ` Pawel Wodkowski
2015-02-24  9:49                                   ` Jastrzebski, MichalX K
     [not found]                                     ` <60ABE07DBB3A454EB7FAD707B4BB1582138EBD9C-kPTMFJFq+rHjxeytcECX8bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-24 10:00                                       ` Thomas Monjalon
2015-02-24 10:05                                         ` Wodkowski, PawelX
2015-02-24 10:53                                         ` Wodkowski, PawelX
2015-02-24 16:33                   ` [PATCH v6 0/3] new rte_jobstats " Pawel Wodkowski
     [not found]                     ` <1424795605-2779-1-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-24 16:33                       ` [PATCH v6 1/3] librte_jobstats: New library for checking core/system/app load Pawel Wodkowski
     [not found]                         ` <1424795605-2779-2-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-24 21:18                           ` Thomas Monjalon
2015-02-24 16:33                       ` [PATCH v6 2/3] examples: introduce new l2fwd-jobstats example Pawel Wodkowski
     [not found]                         ` <1424795605-2779-3-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-24 19:10                           ` De Lara Guarch, Pablo
     [not found]                             ` <E115CCD9D858EF4F90C690B0DCB4D897272639F7-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-24 19:16                               ` De Lara Guarch, Pablo
     [not found]                                 ` <E115CCD9D858EF4F90C690B0DCB4D89727263A28-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-24 20:08                                   ` Thomas Monjalon
2015-02-24 21:19                           ` Thomas Monjalon
2015-02-24 16:33                       ` [PATCH v6 3/3] MAINTAINERS: claim responsibility for rte_jobstats library and example app Pawel Wodkowski
2015-02-24 20:34                       ` [PATCH v6 0/3] new rte_jobstats library and example application De Lara Guarch, Pablo
     [not found]                         ` <E115CCD9D858EF4F90C690B0DCB4D89727263A8E-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-24 21:25                           ` 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=1424189986-26219-3-git-send-email-pawelx.wodkowski@intel.com \
    --to=pawelx.wodkowski-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.