DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
* [dpdk-dev] [PATCH 0/3] examples: remove usage of internal structures
@ 2019-07-15  9:56 Marcin Zapolski
  2019-07-15  9:56 ` [dpdk-dev] [PATCH 1/3] examples/l3fwd*: remove references to rte_eth_devices Marcin Zapolski
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Marcin Zapolski @ 2019-07-15  9:56 UTC (permalink / raw)
  To: dev; +Cc: Marcin Zapolski

Some example applications have references to rte_eth_dev structure,
which is not a part of public API. These patches replace them with
calls to API functions.

Marcin Zapolski (3):
  examples/l3fwd*: remove references to rte_eth_devices
  examples/ip_fragmentation: remove usage of internal struct
  examples/ipsec-secgw: remove usage of internal structure

 examples/ip_fragmentation/main.c                | 2 +-
 examples/ipsec-secgw/ipsec.c                    | 9 ++++-----
 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 +-----
 7 files changed, 10 insertions(+), 32 deletions(-)

-- 
2.17.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [PATCH 1/3] examples/l3fwd*: remove references to rte_eth_devices
  2019-07-15  9:56 [dpdk-dev] [PATCH 0/3] examples: remove usage of internal structures Marcin Zapolski
@ 2019-07-15  9:56 ` 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
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Marcin Zapolski @ 2019-07-15  9:56 UTC (permalink / raw)
  To: dev; +Cc: Marcin Zapolski

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.

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

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [PATCH 2/3] examples/ip_fragmentation: remove usage of internal struct
  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  9:56 ` Marcin Zapolski
  2019-07-15 14:39   ` Bruce Richardson
  2019-07-15  9:56 ` [dpdk-dev] [PATCH 3/3] examples/ipsec-secgw: remove usage of internal structure Marcin Zapolski
  2019-07-17  7:58 ` [dpdk-dev] [v2 0/3] examples: fix use of internal struct Marcin Zapolski
  3 siblings, 1 reply; 13+ messages in thread
From: Marcin Zapolski @ 2019-07-15  9:56 UTC (permalink / raw)
  To: dev; +Cc: Marcin Zapolski

Modify ip_fragmentation example app to use rte_eth_info_get instead
of global rte_eth_devices structure.

Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
---
 examples/ip_fragmentation/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 85c0100f7..a2a14e827 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -989,7 +989,7 @@ main(int argc, char **argv)
 			if (rte_lcore_is_enabled(lcore_id) == 0)
 				continue;
 
-			if (queueid >= rte_eth_devices[portid].data->nb_tx_queues)
+			if (queueid >= dev_info.nb_tx_queues)
 				break;
 
 			socket = (int) rte_lcore_to_socket_id(lcore_id);
-- 
2.17.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [PATCH 3/3] examples/ipsec-secgw: remove usage of internal structure
  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  9:56 ` [dpdk-dev] [PATCH 2/3] examples/ip_fragmentation: remove usage of internal struct Marcin Zapolski
@ 2019-07-15  9:56 ` 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
  3 siblings, 1 reply; 13+ messages in thread
From: Marcin Zapolski @ 2019-07-15  9:56 UTC (permalink / raw)
  To: dev; +Cc: Marcin Zapolski

Modify ipsec-secgw example app to use rte_eth_dev_info_get instead of
rte_eth_dev.

Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
---
 examples/ipsec-secgw/ipsec.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 7b8533077..7d3f5f736 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -186,23 +186,22 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa)
 					.rss_key = rss_key,
 					.rss_key_len = 40,
 				};
-				struct rte_eth_dev *eth_dev;
+				struct rte_eth_dev_info dev_info;
 				uint16_t queue[RTE_MAX_QUEUES_PER_PORT];
 				struct rte_flow_action_rss action_rss;
 				unsigned int i;
 				unsigned int j;
 
+				rte_eth_dev_info_get(sa->portid, &dev_info);
 				sa->action[2].type = RTE_FLOW_ACTION_TYPE_END;
 				/* Try RSS. */
 				sa->action[1].type = RTE_FLOW_ACTION_TYPE_RSS;
 				sa->action[1].conf = &action_rss;
-				eth_dev = ctx->device;
 				rte_eth_dev_rss_hash_conf_get(sa->portid,
 							      &rss_conf);
 				for (i = 0, j = 0;
-				     i < eth_dev->data->nb_rx_queues; ++i)
-					if (eth_dev->data->rx_queues[i])
-						queue[j++] = i;
+				     i < dev_info.nb_rx_queues; ++i)
+					queue[j++] = i;
 				action_rss = (struct rte_flow_action_rss){
 					.types = rss_conf.rss_hf,
 					.key_len = rss_conf.rss_key_len,
-- 
2.17.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH 2/3] examples/ip_fragmentation: remove usage of internal struct
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Bruce Richardson @ 2019-07-15 14:39 UTC (permalink / raw)
  To: Marcin Zapolski; +Cc: dev

On Mon, Jul 15, 2019 at 11:56:22AM +0200, Marcin Zapolski wrote:
> Modify ip_fragmentation example app to use rte_eth_info_get instead
> of global rte_eth_devices structure.
> 
> Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
> ---
>  examples/ip_fragmentation/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
> index 85c0100f7..a2a14e827 100644
> --- a/examples/ip_fragmentation/main.c
> +++ b/examples/ip_fragmentation/main.c
> @@ -989,7 +989,7 @@ main(int argc, char **argv)
>  			if (rte_lcore_is_enabled(lcore_id) == 0)
>  				continue;
>  
> -			if (queueid >= rte_eth_devices[portid].data->nb_tx_queues)
> +			if (queueid >= dev_info.nb_tx_queues)
>  				break;
>  
>  			socket = (int) rte_lcore_to_socket_id(lcore_id);
> -- 

LGTM.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH 2/3] examples/ip_fragmentation: remove usage of internal struct
  2019-07-15 14:39   ` Bruce Richardson
@ 2019-07-15 14:45     ` Bruce Richardson
  0 siblings, 0 replies; 13+ messages in thread
From: Bruce Richardson @ 2019-07-15 14:45 UTC (permalink / raw)
  To: Marcin Zapolski; +Cc: dev

On Mon, Jul 15, 2019 at 03:39:56PM +0100, Bruce Richardson wrote:
> On Mon, Jul 15, 2019 at 11:56:22AM +0200, Marcin Zapolski wrote:
> > Modify ip_fragmentation example app to use rte_eth_info_get instead
> > of global rte_eth_devices structure.
> > 
> > Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
> > ---
> >  examples/ip_fragmentation/main.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
> > index 85c0100f7..a2a14e827 100644
> > --- a/examples/ip_fragmentation/main.c
> > +++ b/examples/ip_fragmentation/main.c
> > @@ -989,7 +989,7 @@ main(int argc, char **argv)
> >  			if (rte_lcore_is_enabled(lcore_id) == 0)
> >  				continue;
> >  
> > -			if (queueid >= rte_eth_devices[portid].data->nb_tx_queues)
> > +			if (queueid >= dev_info.nb_tx_queues)
> >  				break;
> >  
> >  			socket = (int) rte_lcore_to_socket_id(lcore_id);
> > -- 
> 
> LGTM.
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Forgot one minor comment. Suggest reword title to be "fix use of internal
struct" and add fixes line below to commit body.

Fixes: 9758b956dcf4 ("examples/ip_fragmentation: fix Tx queues init")


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH 3/3] examples/ipsec-secgw: remove usage of internal structure
  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
  0 siblings, 0 replies; 13+ messages in thread
From: Bruce Richardson @ 2019-07-15 14:51 UTC (permalink / raw)
  To: Marcin Zapolski; +Cc: dev

On Mon, Jul 15, 2019 at 11:56:23AM +0200, Marcin Zapolski wrote:
> Modify ipsec-secgw example app to use rte_eth_dev_info_get instead of
> rte_eth_dev.
> 
> Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
> ---

Reword title to be "fix use of ..." and include:

Fixes: a4677f78368b ("examples/ipsec-secgw: add target queues in flow actions")
Cc: nelio.laranjeiro@6wind.com

With that addition patch looks ok to me.

Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH 1/3] examples/l3fwd*: remove references to rte_eth_devices
  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
  0 siblings, 0 replies; 13+ messages in thread
From: Bruce Richardson @ 2019-07-15 15:03 UTC (permalink / raw)
  To: Marcin Zapolski; +Cc: dev

On Mon, Jul 15, 2019 at 11:56:21AM +0200, Marcin Zapolski wrote:
> 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.
> 
> Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>

As with the other patches, please treat this as a bug-fix and include a
fixes line for each app fixed. Apps should not be using internal DPDK data
structures directly.

/Bruce

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [v2 0/3] examples: fix use of internal struct
  2019-07-15  9:56 [dpdk-dev] [PATCH 0/3] examples: remove usage of internal structures Marcin Zapolski
                   ` (2 preceding siblings ...)
  2019-07-15  9:56 ` [dpdk-dev] [PATCH 3/3] examples/ipsec-secgw: remove usage of internal structure Marcin Zapolski
@ 2019-07-17  7:58 ` Marcin Zapolski
  2019-07-17  7:58   ` [dpdk-dev] [v2 1/3] examples/l3fwd*: " Marcin Zapolski
                     ` (3 more replies)
  3 siblings, 4 replies; 13+ messages in thread
From: Marcin Zapolski @ 2019-07-17  7:58 UTC (permalink / raw)
  To: dev; +Cc: Marcin Zapolski

Some example applications have references to rte_eth_dev structure,
which is not a part of public API. These patches replace them with
calls to API functions.

v2:
* adjust commit titles
* add fixlines for the original commits

Marcin Zapolski (3):
  examples/l3fwd*: fix use of internal struct
  examples/ip_fragmentation: fix use of internal struct
  examples/ipsec-secgw: fix use of internal struct

 examples/ip_fragmentation/main.c                | 2 +-
 examples/ipsec-secgw/ipsec.c                    | 9 ++++-----
 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 +-----
 7 files changed, 10 insertions(+), 32 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [v2 1/3] examples/l3fwd*: fix use of internal struct
  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
  2019-07-17  7:58   ` [dpdk-dev] [v2 2/3] examples/ip_fragmentation: " Marcin Zapolski
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Marcin Zapolski @ 2019-07-17  7:58 UTC (permalink / raw)
  To: dev; +Cc: Marcin Zapolski, shahafs

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [v2 2/3] examples/ip_fragmentation: fix use of internal struct
  2019-07-17  7:58 ` [dpdk-dev] [v2 0/3] examples: fix use of internal struct Marcin Zapolski
  2019-07-17  7:58   ` [dpdk-dev] [v2 1/3] examples/l3fwd*: " Marcin Zapolski
@ 2019-07-17  7:58   ` " 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
  3 siblings, 0 replies; 13+ messages in thread
From: Marcin Zapolski @ 2019-07-17  7:58 UTC (permalink / raw)
  To: dev; +Cc: Marcin Zapolski, alialnu, Bruce Richardson

Modify ip_fragmentation example app to use rte_eth_info_get instead
of global rte_eth_devices structure.
Apps should not be using internal DPDK data structures directly.

Fixes: 9758b956dcf4 ("examples/ip_fragmentation: fix Tx queues init")
Cc: alialnu@mellanox.com

Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/ip_fragmentation/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 85c0100f7..a2a14e827 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -989,7 +989,7 @@ main(int argc, char **argv)
 			if (rte_lcore_is_enabled(lcore_id) == 0)
 				continue;
 
-			if (queueid >= rte_eth_devices[portid].data->nb_tx_queues)
+			if (queueid >= dev_info.nb_tx_queues)
 				break;
 
 			socket = (int) rte_lcore_to_socket_id(lcore_id);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [v2 3/3] examples/ipsec-secgw: fix use of internal struct
  2019-07-17  7:58 ` [dpdk-dev] [v2 0/3] examples: fix use of internal struct Marcin Zapolski
  2019-07-17  7:58   ` [dpdk-dev] [v2 1/3] examples/l3fwd*: " Marcin Zapolski
  2019-07-17  7:58   ` [dpdk-dev] [v2 2/3] examples/ip_fragmentation: " Marcin Zapolski
@ 2019-07-17  7:58   ` " Marcin Zapolski
  2019-07-18 20:42   ` [dpdk-dev] [v2 0/3] examples: " Thomas Monjalon
  3 siblings, 0 replies; 13+ messages in thread
From: Marcin Zapolski @ 2019-07-17  7:58 UTC (permalink / raw)
  To: dev; +Cc: Marcin Zapolski, nelio.laranjeiro, Bruce Richardson

Modify ipsec-secgw example app to use rte_eth_dev_info_get instead of
rte_eth_dev.
Apps should not be using internal DPDK data structures directly.

Fixes: a4677f78368b ("examples/ipsec-secgw: add target queues in flow actions")
Cc: nelio.laranjeiro@6wind.com

Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 examples/ipsec-secgw/ipsec.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 7b8533077..7d3f5f736 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -186,23 +186,22 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa)
 					.rss_key = rss_key,
 					.rss_key_len = 40,
 				};
-				struct rte_eth_dev *eth_dev;
+				struct rte_eth_dev_info dev_info;
 				uint16_t queue[RTE_MAX_QUEUES_PER_PORT];
 				struct rte_flow_action_rss action_rss;
 				unsigned int i;
 				unsigned int j;
 
+				rte_eth_dev_info_get(sa->portid, &dev_info);
 				sa->action[2].type = RTE_FLOW_ACTION_TYPE_END;
 				/* Try RSS. */
 				sa->action[1].type = RTE_FLOW_ACTION_TYPE_RSS;
 				sa->action[1].conf = &action_rss;
-				eth_dev = ctx->device;
 				rte_eth_dev_rss_hash_conf_get(sa->portid,
 							      &rss_conf);
 				for (i = 0, j = 0;
-				     i < eth_dev->data->nb_rx_queues; ++i)
-					if (eth_dev->data->rx_queues[i])
-						queue[j++] = i;
+				     i < dev_info.nb_rx_queues; ++i)
+					queue[j++] = i;
 				action_rss = (struct rte_flow_action_rss){
 					.types = rss_conf.rss_hf,
 					.key_len = rss_conf.rss_key_len,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [v2 0/3] examples: fix use of internal struct
  2019-07-17  7:58 ` [dpdk-dev] [v2 0/3] examples: fix use of internal struct Marcin Zapolski
                     ` (2 preceding siblings ...)
  2019-07-17  7:58   ` [dpdk-dev] [v2 3/3] examples/ipsec-secgw: " Marcin Zapolski
@ 2019-07-18 20:42   ` " Thomas Monjalon
  3 siblings, 0 replies; 13+ messages in thread
From: Thomas Monjalon @ 2019-07-18 20:42 UTC (permalink / raw)
  To: Marcin Zapolski; +Cc: dev

> Marcin Zapolski (3):
>   examples/l3fwd*: fix use of internal struct
>   examples/ip_fragmentation: fix use of internal struct
>   examples/ipsec-secgw: fix use of internal struct

Applied, thanks



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, back to index

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` [dpdk-dev] [v2 1/3] examples/l3fwd*: " Marcin Zapolski
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

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org
	public-inbox-index dpdk-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git