DPDK patches and discussions
 help / color / mirror / Atom feed
From: Fan Zhang <roy.fan.zhang@intel.com>
To: dev@dpdk.org
Cc: pablo.de.lara.guarch@intel.com
Subject: [dpdk-dev] [PATCH] examples/ipsec_secgw: fix security session
Date: Tue, 23 Jan 2018 12:32:11 +0000	[thread overview]
Message-ID: <20180123123211.43797-1-roy.fan.zhang@intel.com> (raw)

Fixes: 3da37f682173 ("examples/ipsec_secgw: create session mempools for ethdevs")

Some NICs do not have the rte_security context, this patch fixes the segment fault
caused by this.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 examples/ipsec-secgw/ipsec-secgw.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 3a28fcceb..c67f79db9 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1384,10 +1384,16 @@ cryptodevs_init(void)
 			max_sess_sz = sess_sz;
 	}
 	for (port_id = 0; port_id < rte_eth_dev_count(); port_id++) {
+		void *sec_ctx;
+
 		if ((enabled_port_mask & (1 << port_id)) == 0)
 			continue;
-		sess_sz = rte_security_session_get_size(
-				rte_eth_dev_get_sec_ctx(port_id));
+
+		sec_ctx = rte_eth_dev_get_sec_ctx(port_id);
+		if (sec_ctx == NULL)
+			continue;
+
+		sess_sz = rte_security_session_get_size(sec_ctx);
 		if (sess_sz > max_sess_sz)
 			max_sess_sz = sess_sz;
 	}
-- 
2.13.6

             reply	other threads:[~2018-01-23 12:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 12:32 Fan Zhang [this message]
2018-01-23 15:04 ` Nicolau, Radu
2018-01-23 15:28   ` De Lara Guarch, Pablo

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=20180123123211.43797-1-roy.fan.zhang@intel.com \
    --to=roy.fan.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=pablo.de.lara.guarch@intel.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).