dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Marcin Zapolski <marcinx.a.zapolski@intel.com>
To: dev@dpdk.org
Cc: Marcin Zapolski <marcinx.a.zapolski@intel.com>, shahafs@mellanox.com
Subject: [dpdk-dev] [v2 1/3] examples/l3fwd*: fix use of internal struct
Date: Wed, 17 Jul 2019 09:58:04 +0200	[thread overview]
Message-ID: <20190717075806.2320-2-marcinx.a.zapolski@intel.com> (raw)
In-Reply-To: <20190717075806.2320-1-marcinx.a.zapolski@intel.com>

Modify l3fwd and related example apps to use locally defined port_conf
instead of global rte_eth_devices which is not a part of public API.
Apps should not be using internal DPDK data structures directly.

Fixes: 1ef9600b2d20 ("examples/l3fwd: convert to ethdev offloads API")
Fixes: ba8c103d2455 ("examples/l3fwd-acl: convert to new ethdev offloads API")
Fixes: 40df1d7a695d ("examples/l3fwd-power: convert to new ethdev offloads API")
Fixes: 43fc038262b8 ("examples/l3fwd-vf: convert to new ethdev offloads API")
Fixes: 373149c631fe ("examples/performance-thread: convert to new offloads API")
Cc: shahafs@mellanox.com

Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
---
 examples/l3fwd-acl/main.c                       | 6 +-----
 examples/l3fwd-power/main.c                     | 6 +-----
 examples/l3fwd-vf/main.c                        | 7 +------
 examples/l3fwd/main.c                           | 6 +-----
 examples/performance-thread/l3fwd-thread/main.c | 6 +-----
 5 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index 09b7c3850..0c44df767 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -2022,14 +2022,10 @@ main(int argc, char **argv)
 		fflush(stdout);
 		/* init RX queues */
 		for (queue = 0; queue < qconf->n_rx_queue; ++queue) {
-			struct rte_eth_dev *dev;
-			struct rte_eth_conf *conf;
 			struct rte_eth_rxconf rxq_conf;
 
 			portid = qconf->rx_queue_list[queue].port_id;
 			queueid = qconf->rx_queue_list[queue].queue_id;
-			dev = &rte_eth_devices[portid];
-			conf = &dev->data->dev_conf;
 
 			if (numa_on)
 				socketid = (uint8_t)
@@ -2042,7 +2038,7 @@ main(int argc, char **argv)
 
 			rte_eth_dev_info_get(portid, &dev_info);
 			rxq_conf = dev_info.default_rxconf;
-			rxq_conf.offloads = conf->rxmode.offloads;
+			rxq_conf.offloads = port_conf.rxmode.offloads;
 			ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd,
 					socketid, &rxq_conf,
 					pktmbuf_pool[socketid]);
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 99c1208ce..7ac4cbe87 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -2378,13 +2378,9 @@ main(int argc, char **argv)
 		/* init RX queues */
 		for(queue = 0; queue < qconf->n_rx_queue; ++queue) {
 			struct rte_eth_rxconf rxq_conf;
-			struct rte_eth_dev *dev;
-			struct rte_eth_conf *conf;
 
 			portid = qconf->rx_queue_list[queue].port_id;
 			queueid = qconf->rx_queue_list[queue].queue_id;
-			dev = &rte_eth_devices[portid];
-			conf = &dev->data->dev_conf;
 
 			if (numa_on)
 				socketid = \
@@ -2397,7 +2393,7 @@ main(int argc, char **argv)
 
 			rte_eth_dev_info_get(portid, &dev_info);
 			rxq_conf = dev_info.default_rxconf;
-			rxq_conf.offloads = conf->rxmode.offloads;
+			rxq_conf.offloads = port_conf.rxmode.offloads;
 			ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd,
 				socketid, &rxq_conf,
 				pktmbuf_pool[socketid]);
diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c
index 1432f8969..572e74cf5 100644
--- a/examples/l3fwd-vf/main.c
+++ b/examples/l3fwd-vf/main.c
@@ -1022,13 +1022,8 @@ main(int argc, char **argv)
 		fflush(stdout);
 		/* init RX queues */
 		for(queue = 0; queue < qconf->n_rx_queue; ++queue) {
-			struct rte_eth_dev *dev;
-			struct rte_eth_conf *conf;
-
 			portid = qconf->rx_queue_list[queue].port_id;
 			queueid = qconf->rx_queue_list[queue].queue_id;
-			dev = &rte_eth_devices[portid];
-			conf = &dev->data->dev_conf;
 
 			if (numa_on)
 				socketid = (uint8_t)rte_lcore_to_socket_id(lcore_id);
@@ -1040,7 +1035,7 @@ main(int argc, char **argv)
 
 			rte_eth_dev_info_get(portid, &dev_info);
 			rxq_conf = dev_info.default_rxconf;
-			rxq_conf.offloads = conf->rxmode.offloads;
+			rxq_conf.offloads = port_conf.rxmode.offloads;
 			ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd,
 						socketid, &rxq_conf,
 						pktmbuf_pool[socketid]);
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 570693b32..3800bad19 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -971,14 +971,10 @@ main(int argc, char **argv)
 		fflush(stdout);
 		/* init RX queues */
 		for(queue = 0; queue < qconf->n_rx_queue; ++queue) {
-			struct rte_eth_dev *dev;
-			struct rte_eth_conf *conf;
 			struct rte_eth_rxconf rxq_conf;
 
 			portid = qconf->rx_queue_list[queue].port_id;
 			queueid = qconf->rx_queue_list[queue].queue_id;
-			dev = &rte_eth_devices[portid];
-			conf = &dev->data->dev_conf;
 
 			if (numa_on)
 				socketid =
@@ -991,7 +987,7 @@ main(int argc, char **argv)
 
 			rte_eth_dev_info_get(portid, &dev_info);
 			rxq_conf = dev_info.default_rxconf;
-			rxq_conf.offloads = conf->rxmode.offloads;
+			rxq_conf.offloads = port_conf.rxmode.offloads;
 			if (!per_port_pool)
 				ret = rte_eth_rx_queue_setup(portid, queueid,
 						nb_rxd, socketid,
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index dd468958a..0121c71cb 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -3645,14 +3645,10 @@ main(int argc, char **argv)
 
 		/* init RX queues */
 		for (queue = 0; queue < rx_thread[i].n_rx_queue; ++queue) {
-			struct rte_eth_dev *dev;
-			struct rte_eth_conf *conf;
 			struct rte_eth_rxconf rxq_conf;
 
 			portid = rx_thread[i].rx_queue_list[queue].port_id;
 			queueid = rx_thread[i].rx_queue_list[queue].queue_id;
-			dev = &rte_eth_devices[portid];
-			conf = &dev->data->dev_conf;
 
 			if (numa_on)
 				socketid = (uint8_t)rte_lcore_to_socket_id(lcore_id);
@@ -3664,7 +3660,7 @@ main(int argc, char **argv)
 
 			rte_eth_dev_info_get(portid, &dev_info);
 			rxq_conf = dev_info.default_rxconf;
-			rxq_conf.offloads = conf->rxmode.offloads;
+			rxq_conf.offloads = port_conf.rxmode.offloads;
 			ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd,
 					socketid,
 					&rxq_conf,
-- 
2.17.1


  reply	other threads:[~2019-07-17  7:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15  9:56 [dpdk-dev] [PATCH 0/3] examples: remove usage of internal structures Marcin Zapolski
2019-07-15  9:56 ` [dpdk-dev] [PATCH 1/3] examples/l3fwd*: remove references to rte_eth_devices Marcin Zapolski
2019-07-15 15:03   ` Bruce Richardson
2019-07-15  9:56 ` [dpdk-dev] [PATCH 2/3] examples/ip_fragmentation: remove usage of internal struct Marcin Zapolski
2019-07-15 14:39   ` Bruce Richardson
2019-07-15 14:45     ` Bruce Richardson
2019-07-15  9:56 ` [dpdk-dev] [PATCH 3/3] examples/ipsec-secgw: remove usage of internal structure Marcin Zapolski
2019-07-15 14:51   ` Bruce Richardson
2019-07-17  7:58 ` [dpdk-dev] [v2 0/3] examples: fix use of internal struct Marcin Zapolski
2019-07-17  7:58   ` Marcin Zapolski [this message]
2019-07-17  7:58   ` [dpdk-dev] [v2 2/3] examples/ip_fragmentation: " Marcin Zapolski
2019-07-17  7:58   ` [dpdk-dev] [v2 3/3] examples/ipsec-secgw: " Marcin Zapolski
2019-07-18 20:42   ` [dpdk-dev] [v2 0/3] examples: " 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=20190717075806.2320-2-marcinx.a.zapolski@intel.com \
    --to=marcinx.a.zapolski@intel.com \
    --cc=dev@dpdk.org \
    --cc=shahafs@mellanox.com \
    /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).