[3/3] examples/ipsec-secgw: remove usage of internal structure

Message ID 20190715095623.579-4-marcinx.a.zapolski@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series examples: remove usage of internal structures |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Marcin Zapolski July 15, 2019, 9:56 a.m. UTC
  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(-)
  

Comments

Bruce Richardson July 15, 2019, 2:51 p.m. UTC | #1
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>
  

Patch

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,