From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0076.outbound.protection.outlook.com [104.47.32.76]) by dpdk.org (Postfix) with ESMTP id 2318314E8 for ; Wed, 13 Dec 2017 12:38:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=gqX27bHJVMA98w1ZvO8I6xTsNQ7poUVRo7/LysBdr1M=; b=bVhenlcC40SIVKYZURBxDoxR3y+72AabIb+7sWvsTvEXEgsm4Ewm3zhp5O+IgZX+qqMMYvb7/Wk1NK/UyV4z3A8OPfrKumLAxcDFzbUGHGAP944y5jzJ1mNWEGUuvUO8K7tksxtkfyVkyGi8poQ6+GCqwRZ+JRgE5f3WqUUphWU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from hyd1ajoseph-dt.caveonetworks.com (115.113.156.2) by MWHPR0701MB3643.namprd07.prod.outlook.com (2603:10b6:301:7d::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Wed, 13 Dec 2017 11:38:31 +0000 Cc: anoob.joseph@caviumnetworks.com, Sergio Gonzalez Monroy , Radu Nicolau , dev@dpdk.org To: Nelio Laranjeiro References: <5d3fdd0c05d5f8afd3f8e38ca03eaf25187d5c98.1513000931.git.nelio.laranjeiro@6wind.com> <5777791b-3dd6-f746-aa37-d572c108f042@caviumnetworks.com> <20171212134456.4x3uaus2poovddlf@laranjeiro-vm.dev.6wind.com> <20171212143800.ggdtdfnbknttr45g@laranjeiro-vm.dev.6wind.com> <047cadcf-13dc-5368-4ad5-a27ff25c42f8@caviumnetworks.com> <20171213100237.uvpbg2qewhxqgaln@laranjeiro-vm.dev.6wind.com> From: Anoob Joseph Message-ID: <817bec1f-4bff-ebdc-07b4-f8f24ec2084a@caviumnetworks.com> Date: Wed, 13 Dec 2017 17:08:19 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20171213100237.uvpbg2qewhxqgaln@laranjeiro-vm.dev.6wind.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: CY4PR2201CA0037.namprd22.prod.outlook.com (2603:10b6:910:3e::26) To MWHPR0701MB3643.namprd07.prod.outlook.com (2603:10b6:301:7d::36) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4426a829-2731-4ce4-1136-08d5421e0a3b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307); SRVR:MWHPR0701MB3643; X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3643; 3:HmI6WN733rV6awOQxK203E91zq1niooNH+l7Pu2Y3R2cTkYJLCyoLBEOqGoy4Uzzg47sjIlsaeA8Xpp/vpEIKz+eo1741wI9S521+WZCrr/D81noTwRu+RdfLhfi0HR8WeA/vp4dpV7rzTf8LSkeYyTLmX3xufbrcC0lqDLJcU/ebZ9jHfPZLaFJubCuZH+K4bWlId2CEEznDCCsI2v1HX3K7h+gKo6FmjxI0is7/WDY2838b4Yv3dZWOr5g01RF; 25:wVLO/lesXgJxptsLlvDUdDkAwb7YNLem/B06K59nHdhZuAsWmuh07PZQc8ymhxSTe0ykTFO2QuagPpo0u3I7piqk0bQDFnuAinzoRIrjqUBACul6VpMO47a4ic7D3x5THsQLaocXZOx/HwwELAeqxD46G4T7TkbIJ05+XbzFC5F/U0QiRd4+khO7Q+hTjikAVwwPDLhd2eKAc1LKcN21GjlKbTsaz11r++DcSfaZu/oOB9URpXX+s9gZuw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0SxahWPIkdyW0r3PDsP48RNjzy15lApZMqaeJAbLu+HlBHDU9DVkFQXE0Xbhsj4vjrCmNQyCGDsaIZaxGguWQUUoyaQ/kOvx2dzRIfu35hKmwhSASZLxdL6XVplyUmnC+DUg86OsPFeqMwb+20E5O5UkrRUo6UTvK11R3yGj3jhjDlILS5MWXbj3PpUTgvD4hu7EHdOxHpd9aeSQPGAOjcha4vciTbHhCmCg36sbtr0oE4EYCc10Dz+6aBhJmyHrt+tKKld8k0pAWkLkZQD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(3002001)(93006095)(3231023)(10201501046)(6041248)(20161123555025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123562025)(6072148)(201708071742011); SRVR:MWHPR0701MB3643; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MWHPR0701MB3643; X-Forefront-PRVS: 052017CAF1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(346002)(52314003)(189003)(199004)(24454002)(105586002)(93886005)(6116002)(7736002)(97736004)(64126003)(3846002)(6246003)(305945005)(386003)(65806001)(50466002)(53546011)(6506007)(65956001)(68736007)(47776003)(69596002)(2906002)(66066001)(36756003)(230700001)(52116002)(31696002)(54906003)(72206003)(58126008)(478600001)(316002)(16526018)(5660300001)(76176011)(2950100002)(23676004)(52146003)(2486003)(229853002)(4326008)(31686004)(42882006)(67846002)(59450400001)(83506002)(53416004)(65826007)(25786009)(106356001)(81156014)(8936002)(81166006)(6486002)(53936002)(55236003)(6666003)(6512007)(6916009)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR0701MB3643; H:hyd1ajoseph-dt.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium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NDr4nWCPTsDZFIup85U4r4dAHKijE0dK7lnZzdMavXFICInonUNoOZcBgCtyzHMFyzpo6fuhK+87kyzcuIkAi/yDljnRsdpCxHGaJGlzaBnG7V3T0t3gDbETG4SlN+ol4Vz19BR1TpP5ZpxpN0LR4xTcn7uu0Nk7IjfYZSni4qfP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2017 11:38:31.2294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4426a829-2731-4ce4-1136-08d5421e0a3b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0701MB3643 Subject: Re: [dpdk-dev] [PATCH v3 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: Wed, 13 Dec 2017 11:38:35 -0000 Hi Nelio, On 12/13/2017 03:32 PM, Nelio Laranjeiro wrote: > Hi Anoob, > > On Wed, Dec 13, 2017 at 12:11:18PM +0530, Anoob Joseph wrote: >> Hi Nelio, >> >> >> On 12/12/2017 08:08 PM, Nelio Laranjeiro wrote: >>> Hi Anoob, >>> >>> On Tue, Dec 12, 2017 at 07:34:31PM +0530, Anoob Joseph wrote: >>>> Hi Nelio, >>>> >>>> >>>> On 12/12/2017 07:14 PM, Nelio Laranjeiro wrote: >>>>> Hi Anoob, >>>>> >>>>> On Tue, Dec 12, 2017 at 06:13:08PM +0530, Anoob Joseph wrote: >>>>>> Hi Nelio, >>>>>> >>>>>> >>>>>> On 12/11/2017 07:34 PM, Nelio Laranjeiro wrote: >>>>>>> Mellanox INNOVA NIC needs to have final target queue actions to perform >>>>>>> inline crypto. >>>>>>> >>>>>>> Signed-off-by: Nelio Laranjeiro >>>>>>> >>>>>>> --- >>>>>>> >>>>>>> Changes in v3: >>>>>>> >>>>>>> * removed PASSTHRU test for ingress. >>>>>>> * removed check on configured queues for the queue action. >>>>>>> >>>>>>> Changes in v2: >>>>>>> >>>>>>> * Test the rule by PASSTHRU/RSS/QUEUE and apply the first one validated. >>>>>>> --- >>>>>>> examples/ipsec-secgw/ipsec.c | 57 ++++++++++++++++++++++++++++++++++++++++++-- >>>>>>> examples/ipsec-secgw/ipsec.h | 2 +- >>>>>>> 2 files changed, 56 insertions(+), 3 deletions(-) >>>>>>> >>>>>>> diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c >>>>>>> index 17bd7620d..1b8b251c8 100644 >>>>>>> --- a/examples/ipsec-secgw/ipsec.c >>>>>>> +++ b/examples/ipsec-secgw/ipsec.c >>>>>>> @@ -142,6 +142,7 @@ 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; >>>>>>> + int ret = 0; >>>>>>> sa->sec_session = rte_security_session_create(ctx, >>>>>>> &sess_conf, ipsec_ctx->session_pool); >>>>>>> @@ -201,15 +202,67 @@ 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->attr.egress = (sa->direction == >>>>>>> RTE_SECURITY_IPSEC_SA_DIR_EGRESS); >>>>>>> sa->attr.ingress = (sa->direction == >>>>>>> RTE_SECURITY_IPSEC_SA_DIR_INGRESS); >>>>>>> + if (sa->attr.ingress) { >>>>>>> + 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->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]) >>>>>>> + action_rss.local.queue[j++] = i; >>>>>>> + action_rss.local.num = j; >>>>>>> + action_rss.local.rss_conf = &rss_conf; >>>>>>> + ret = rte_flow_validate(sa->portid, &sa->attr, >>>>>>> + sa->pattern, sa->action, >>>>>>> + &err); >>>>>>> + if (!ret) >>>>>>> + goto flow_create; >>>>>>> + /* Try Queue. */ >>>>>>> + sa->action[1].type = RTE_FLOW_ACTION_TYPE_QUEUE; >>>>>>> + sa->action[1].conf = >>>>>>> + &(struct rte_flow_action_queue){ >>>>>>> + .index = 0, >>>>>>> + }; >>>>>>> + ret = rte_flow_validate(sa->portid, &sa->attr, >>>>>>> + sa->pattern, sa->action, >>>>>>> + &err); >>>>>>> + if (ret) >>>>>>> + goto flow_create_failure; >>>>>>> + } else { >>>>>>> + sa->action[1].type = >>>>>>> + RTE_FLOW_ACTION_TYPE_PASSTHRU; >>>>>>> + sa->action[2].type = RTE_FLOW_ACTION_TYPE_END; >>>>>> We would need flow validate here also. And, for egress, the application will >>>>>> be able to set metadata (set_pkt_metadata API) per packet. So flow may not >>>>>> be required for such cases. But if the flow create fails, the session create >>>>>> would also fail. It might be better if we check whether the PMD would need >>>>>> metadata (part of the sec_cap->ol_flags). >>>>> Seems what you are describing is outside of this scope which is only >>>>> related to correctly implement the generic flow API with terminal >>>>> actions. >>>> Since SECURITY+PASSTHRU won't be terminal, this code segment might be >>>> misleading. >>> Well, I don't mind adding an extra verification even if the create >>> should fail if the validate fails, as there is no other option it >>> is just like adding another if statement considering the validate() >>> cannot guarantee the flow will be created(), other errors like ENOMEM >>> are still possible in the creation stage. >> Good point. I was thinking of a scenario when flow for egress itself would >> be optional. >>>>> I'll suggest to add it in another patch. >>>>> >>>>> Anyway, the flow validate is useful in the ingress to select the best >>>>> behavior RSS/Queue, if the flow validate may fail, the flow create >>>>> should also fail for the same reasons. >>>>> >>>>>> If the driver doesn't need metadata and the flow create fails, then >>>>>> the create session should fail. Any thoughts? >>>>> How the create_session() can fail without having all the informations >>>>> (pattern, metadata, ...) the application wants to offload? >>>> Is flow mandatory for the egress traffic? My understanding is, it's not. >>>> "set_pkt_metadata" API gives application the ability to do the lookup and >>>> pass the info along with the packet. In such cases, flow creation is not >>>> necessary. >>> Some NIC need to apply a flow rule for Egress and they don't need >>> metadata for the packet. >> Understood. In that case, what I proposed could be a separate patch. The >> ingress path is proper with this patch, but we can keep egress open for >> improvements. > What do you mean with "keep egrees open for improvements"? In egress side, this set of flow actions won't be having any terminating action. And addition of PASSTHRU won't be required, as it will be implicit. Creating flow for egress would allow hardware to perform the SA lookup. But we cannot remove the lookup in application, as it's the SA which has the information whether the packet need to be completely offloaded. Once this lookup is done, this information could be communicated to hardware using the set_pkt_metadata. This will eliminate the second lookup in the hardware. So the flow could be optional. The current patch assumes flow is mandatory for egress as well. For Cavium hardware, egress side flow is not required and we will be using "set_pkt_metadata" API. May be Radu can give his thoughts on this. > >>>> I do agree that this is outside the scope of this patch, but I was just >>>> curious about the behavior since you touched the topic. >>>>>>> + } >>>>>>> +flow_create: >>>>>>> sa->flow = rte_flow_create(sa->portid, >>>>>>> &sa->attr, sa->pattern, sa->action, &err); >>>>>>> if (sa->flow == NULL) { >>>>>>> +flow_create_failure: >>>>>>> RTE_LOG(ERR, IPSEC, >>>>>>> "Failed to create ipsec flow msg: %s\n", >>>>>>> err.message); >>>>>>> diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h >>>>>>> index 775b316ff..3c367d392 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 (3) >>>>>>> struct rte_flow_item pattern[MAX_RTE_FLOW_PATTERN]; >>>>>>> struct rte_flow_action action[MAX_RTE_FLOW_ACTIONS]; >>>>>>> struct rte_flow_attr attr; >>>>> Thanks, >>> Regards, >>>