From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id CF9EA29D6 for ; Thu, 23 Nov 2017 16:12:36 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id x63so17170799wmf.4 for ; Thu, 23 Nov 2017 07:12:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=4BHo1PZwcE28niUdcnfAI2qXz+6THpVOPYemzF828DY=; b=YLKcmdxGuNBlat7dx4uGwXA96NuCO25xgleW7rIMTuJhlmWZ1Sct1/xnnBx3PFkx5/ SLi4h6gJbekVogXmGMfUQsMmGe5zTkeEBp/Yhvy/2CelZIfl6e0qkdPm34M31Md+MPKs kmviTLzQ64SbYgPtnXP+T/FdZY4oqMypQ3fG6722xYUxFDuEM+MlzWBHrNCtST7yNRMH mU3t7BI13zeHQV3ABF3irSy4tk/HExIK8bVqfxFdByph6W0GNydPoCWFK3tm2M6VR/7Y KPtazczVxKGusiDU4yuHJPILlgW1Bj8C80bQAstjuElM+pb+SOUcPkDK4oj2ymgBd+dH s8Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=4BHo1PZwcE28niUdcnfAI2qXz+6THpVOPYemzF828DY=; b=YQ+iM9jRnQ4jKxctu2MfakfzPBQme14ZhXJEyxlf/JqcLE85uHdh2hKQVDwM+geIbe QRDpcvqRHFElhdHgKlgoUQASPVdaNW17tv4IsUqTBYPnr7RbI/pD+HIehkXjHMRMbHlR iYXmDacgmcQYlRlWC1Jq3i6cynsIOgVDA+n0nfI06x8vGUi5fb9lzMSZG1/l6YEKLN3T QJG3s/VjSqFvQ/gkt7liJPYT7Q3RdQXxWrnYPRUxPdGkRlULnBK1GiLEe6XhBnvFZgwn 59GQgYOl7Xo9qH4ZS/AkfveW/gE7EWhuBivYXHMG4tvfCXVBPBlF9WdlLyz1jFbxH+JB P/1A== X-Gm-Message-State: AJaThX622dgoSLQoWSKB9H4bPSdqMcjQRcboCm+c6Awri+Id4M0kkFzo fuf5cqlyZobGQvnPMPrKu4KTzxLKUw== X-Google-Smtp-Source: AGs4zMamYmcQ0OhGfAutq2adzn4rhJB60TsUdHSu49s5bL0xUEEWyi9SECXmEk8d9rcuf3zZGUnuog== X-Received: by 10.80.203.68 with SMTP id h4mr34760903edi.54.1511449956606; Thu, 23 Nov 2017 07:12:36 -0800 (PST) Received: from laranjeiro-vm.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id i61sm13667463edc.32.2017.11.23.07.12.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Nov 2017 07:12:36 -0800 (PST) From: Nelio Laranjeiro To: Sergio Gonzalez Monroy , Radu Nicolau Cc: dev@dpdk.org Date: Thu, 23 Nov 2017 16:12:19 +0100 Message-Id: <6ac80a2be156911ee35c894924a02f04c43f49fc.1511449894.git.nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: add target queues in flow actions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Nov 2017 15:12:37 -0000 Mellanox INNOVA NIC needs to have final target queue actions to perform inline crypto. Signed-off-by: Nelio Laranjeiro --- examples/ipsec-secgw/ipsec.c | 27 ++++++++++++++++++++++++++- examples/ipsec-secgw/ipsec.h | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index 17bd7620d..e967f88b3 100644 --- a/examples/ipsec-secgw/ipsec.c +++ b/examples/ipsec-secgw/ipsec.c @@ -142,6 +142,22 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa) rte_eth_dev_get_sec_ctx( sa->portid); const struct rte_security_capability *sec_cap; + uint8_t rss_key[40]; + struct rte_eth_rss_conf rss_conf = { + .rss_key = rss_key, + .rss_key_len = 40, + }; + struct rte_eth_dev *eth_dev; + union { + struct rte_flow_action_rss rss; + struct { + const struct rte_eth_rss_conf *rss_conf; + uint16_t num; + uint16_t queue[RTE_MAX_QUEUES_PER_PORT]; + } local; + } action_rss; + unsigned int i; + unsigned int j; sa->sec_session = rte_security_session_create(ctx, &sess_conf, ipsec_ctx->session_pool); @@ -201,7 +217,16 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa) sa->action[0].type = RTE_FLOW_ACTION_TYPE_SECURITY; sa->action[0].conf = sa->sec_session; - sa->action[1].type = RTE_FLOW_ACTION_TYPE_END; + 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]) + action_rss.local.queue[j++] = i; + action_rss.local.num = j; + action_rss.local.rss_conf = &rss_conf; + sa->action[2].type = RTE_FLOW_ACTION_TYPE_END; sa->attr.egress = (sa->direction == RTE_SECURITY_IPSEC_SA_DIR_EGRESS); diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h index 775b316ff..82ffc1c6d 100644 --- a/examples/ipsec-secgw/ipsec.h +++ b/examples/ipsec-secgw/ipsec.h @@ -133,7 +133,7 @@ struct ipsec_sa { uint32_t ol_flags; #define MAX_RTE_FLOW_PATTERN (4) -#define MAX_RTE_FLOW_ACTIONS (2) +#define MAX_RTE_FLOW_ACTIONS (4) struct rte_flow_item pattern[MAX_RTE_FLOW_PATTERN]; struct rte_flow_action action[MAX_RTE_FLOW_ACTIONS]; struct rte_flow_attr attr; -- 2.11.0