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>,
	nelio.laranjeiro@6wind.com,
	Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [v2 3/3] examples/ipsec-secgw: fix use of internal struct
Date: Wed, 17 Jul 2019 09:58:06 +0200	[thread overview]
Message-ID: <20190717075806.2320-4-marcinx.a.zapolski@intel.com> (raw)
In-Reply-To: <20190717075806.2320-1-marcinx.a.zapolski@intel.com>

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


  parent reply	other threads:[~2019-07-17  7:59 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   ` [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 [this message]
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-4-marcinx.a.zapolski@intel.com \
    --to=marcinx.a.zapolski@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=nelio.laranjeiro@6wind.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).