From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20040.outbound.protection.outlook.com [40.107.2.40]) by dpdk.org (Postfix) with ESMTP id 13FE61C399 for ; Thu, 5 Jul 2018 11:03:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=caeLB739x4nr/KPWq9TAM34TdBayGcBCPZasKSM6w/U=; b=SzTdiLxeBFtkIVqsSycbjLeK9q5MCqwROJk8R66wRjjnTubQnMgLIGISa9NqORFk571LANunYPGZRmxIG/CqAIayLXWUSdjMT/aQ8JI7AUcajLz7ijfEwJEllYXWYzhA8qsun0dTej0FeOFKeYDvEHKnT3xV7x6lQIJ7UrpqvEw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=akhil.goyal@nxp.com; Received: from [10.232.134.144] (14.142.187.166) by VI1PR04MB1392.eurprd04.prod.outlook.com (2a01:111:e400:5348::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.26; Thu, 5 Jul 2018 09:03:39 +0000 To: "Ananyev, Konstantin" , "dev@dpdk.org" Cc: "Nicolau, Radu" References: <1528208163-31560-1-git-send-email-konstantin.ananyev@intel.com> <1528208163-31560-2-git-send-email-konstantin.ananyev@intel.com> <36d2a552-e043-7451-ed66-70d13f0f6fe6@nxp.com> <2601191342CEEE43887BDE71AB977258C0C4009C@irsmsx105.ger.corp.intel.com> <2ff9fe7a-3965-ca79-e5e3-9890cc6ce49d@nxp.com> <2601191342CEEE43887BDE71AB977258C0C40347@irsmsx105.ger.corp.intel.com> <2601191342CEEE43887BDE71AB977258C0C406CF@irsmsx105.ger.corp.intel.com> From: Akhil Goyal Message-ID: Date: Thu, 5 Jul 2018 14:33:25 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <2601191342CEEE43887BDE71AB977258C0C406CF@irsmsx105.ger.corp.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BM1PR0101CA0044.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::30) To VI1PR04MB1392.eurprd04.prod.outlook.com (2a01:111:e400:5348::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c8bc4b68-e5a3-4727-cd1c-08d5e256336a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(48565401081)(5600053)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB1392; X-Microsoft-Exchange-Diagnostics: 1; VI1PR04MB1392; 3:/5mvCoAULt7smkh4nYshhWIZb2z1qkZ2Xy6jZcNj8Lvc/tU3zEm9R7yFNH7kiaWVT5t9FeNFJGZO4A5f46AuQ+lAyXD70H53iEVLNYMD4no9ZgylP3/OJWSjV8ObfRINidb2VfXEMJy68w1DMvJ/RTV0POaaCCbBOXdUr7/gJJpOpY7CuAumuaACCCIGX12W31E19P23voFv/jJ/A7XhHW5GUySFOhcykRoG6WuHTOOPtZ4qB8mMb/ci3q1YB00O; 25:AB+BsCxPTPsK/SDgcMpw2ZSDatDsPFaGu8ZSZRbmfI7BAj8xl1uhtU+BO45teW5tQ4BfUpxGvtH4zjQ7jTMdJ5iabb1CxPsHpCmJNV1LTECIvprhXlWOO8vrrHzICxwKJJMyeOuA6F7HJakCNLIAh0wi0BQ5lueOzq9L8oU2JZC7dpnyQDju93Yj0aydtVHMI8FGNz6IRaPq3GvBPAC54mKOq/Nk+jZlDLFuwkYFOL7EDiT6YReNkjGQYV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xKHTAPRvm7revOx/GjZ4EP1bqX81hDJOBUJzvbh7nMISCPflc/6W7gMbUd6d1Y/opo38J9qTYg5eh4Ly50hcBgx0NQ/mEYhXZ0CF92Irj/sET87jkWNv1bt7xDj1UXhQmE00eqLS4aPbmZ8ibR16ImGZ4b1nU932n5KSoPwt1WYjx86ocTk9YITri2GyUNHVpLQY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:VI1PR04MB1392; BCL:0; PCL:0; RULEID:; SRVR:VI1PR04MB1392; X-Forefront-PRVS: 0724FCD4CD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(136003)(396003)(376002)(39860400002)(346002)(366004)(189003)(199004)(13464003)(316002)(16576012)(6486002)(3846002)(6116002)(14444005)(36756003)(81166006)(81156014)(8676002)(52116002)(5660300001)(53936002)(65826007)(486006)(110136005)(86362001)(6666003)(31696002)(58126008)(2616005)(229853002)(476003)(44832011)(31686004)(93886005)(8936002)(305945005)(50466002)(11346002)(446003)(230700001)(956004)(7736002)(478600001)(5009440100003)(67846002)(97736004)(6246003)(64126003)(25786009)(3260700006)(105586002)(2906002)(2486003)(52146003)(23676004)(2501003)(76176011)(26005)(386003)(16526019)(4326008)(47776003)(68736007)(65806001)(53546011)(106356001)(55236004)(65956001)(66066001)(186003)(77096007)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB1392; H:[10.232.134.144]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUjA0TUIxMzkyOzIzOkpxN3ZLVmVMc0ZZZVJQSDM3MlNKL3FxcnNX?= =?utf-8?B?ZVlnMURINEhoODVUOWxmNWdhWkVnRU1sbzNiTm52T1N3UUpnMTQrNGZBTTQz?= =?utf-8?B?Z0NYVnNXVmNoRDBiTkhUWUlCQTgwWng0RkNyWFUvTmxoczF1VHhublcrSE12?= =?utf-8?B?MTBwSWc2U1ZsMXNzZWg2MFF3QjVNdWd5TUJqVXlraW40S2p2citIdG1TZ0Z5?= =?utf-8?B?YnlUenpiSTcxTlFQN3IvMGdKYXdNQmd6akVoUzhScFBlMDVzUFF4T0hpZVM2?= =?utf-8?B?M3hrQmVZeXA4QnBvMTA2U3dUejEraEJPYzlyaW5xb3pGL0VGSXRvRU8xMTl4?= =?utf-8?B?WW5IbEZyUE40RFcyVm5ZRTVveUVBR2tNNlU2RGhVRGpqbkZDeHZha3p4aDN3?= =?utf-8?B?YlN1cTBodU1tUkpoNktMZmFkeHV3RGVob1E5WEtHSHRuT0N5aVhnek5DRitv?= =?utf-8?B?Wmc5SEp3WFZVWCtCNXl3cTRiQlFyL2NjUlAwRFJvQjlJS282T1M3Y0RrZVg2?= =?utf-8?B?blk3Mi8wUnJiSVdheTVmUWtCVnhrT1VGNDVGNmZaQVBEL3RmZnlmZTFESFVJ?= =?utf-8?B?Q0tnS0NoRjBNaXAyMmxWMVVmR1A2TTVuUkcxbGViNVFWTFhoZCtnYzlZQU0w?= =?utf-8?B?dG1DTHl4Y251T0ZkNGxIcy9nMlVYbEtiV0hheFkzc1Z5elFISEVRYlo0QlBk?= =?utf-8?B?SkxsbFlwaDNjdTExNnp2ay9TK3BGQlZyanJJdFlrcWhlT1IxQ0ZxcERtZFM0?= =?utf-8?B?TDlDTFd4USt5Y3l4ZXEzNGduRkJsREF2MFpoeGUzYlkxSlNKMlVyb3FncTVt?= =?utf-8?B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ERwN1JqdDhXRjZD?= =?utf-8?B?Z3Rva1NTNklEZDdpbmUweVlSa2FXMnc5cEVheElZYlJUbGxSQ0c1NXBic3dF?= =?utf-8?B?ZXNMeHhhNGxMVjdKV2twT1hRWjMwU0JCb25mczV1U2lQSnNORjFtSHA4Q3BP?= =?utf-8?B?OXB6Q1B6djFDMjc0Ny9XZEgwa3BhZ2lidnp2MTR6Nm5IMlF1UGVrTTBHbHgr?= =?utf-8?B?cndnQ3pkTURoNFo3V0syM2w4Y0llQzFJdmpOdlVqUWgySi84UFIrWXMrei82?= =?utf-8?B?aFh0MVVCckxxN2lGUFF0TFBMQStHcDdBdU9FZVd3L2R1bWdUcFk1bDlXeVo2?= =?utf-8?B?UmxJaG1nZG01THBlamFuQllxQnZRSlJWYVVHMitqRmhYVGh3L0NlakZMY0tm?= =?utf-8?B?d2drbStLY0JsWnYxKzhoNzI4YTRuVU5mZGt0RENMVUVNUWdRQUNxaHYvOWNQ?= =?utf-8?Q?a281EtRTJrsvLXvNOrILJvN5JlBNrElkrDBJcgBElo=3D?= X-Microsoft-Antispam-Message-Info: T+We5rF0T+TyF4mzzgmdwVDl0tzZir6B8z7RVFvha07KDwTCVGtLpH8QQengknk2AZxL2GSudve6Y053bjNF/xivimsDxkXR+X2QARmnMg4zq3SDRqoACg4ko2L+kp396VDjdhBbSBVR9UGkFYAoZ1JeKxJeOxGxXkOhzKhCSuX5Gq5+dEYFeo12S41x5W7uNp9cUNArzLRGVColOItS0xluRMvmY4bb/jLqPpGWq9Km37rjg0F5O90cNbe8/BhDhMpnatGfvNGfG+FcA3OFnd+4wyAI+qxGOUNshb08q2elxWO8/K3+BjU7CJFa6Fk4uZRyLe7K3D2NHA/a9LY8fNhNGX4pdNy5gnIYfU/pOqo= X-Microsoft-Exchange-Diagnostics: 1; VI1PR04MB1392; 6:yYn+k0EzWEXmJ7enbsysmz143/T/rerBfQ5GcTS/kpEIQpsruJCyZBSunz3NobFOL+L2alq03dgwhX9LXmY8yll3ef7jk8R60LHA98DAImZjkNBDB3sTkjdM3no5gZDIdmds4kWyGkhm2G8QJZMWJrFP9tfrFdmgcSpCX8HH7FhekRyFVWiHIi8KuWtE8M68r3Q7ifZcPNyoufncZOWJQm4Si7lJsPVAjBZcJGAU9a3q9Fw0eQNPsyG5NylLUYKMvMqMMOPOzPqKyZ/nOocfyLH9PJPwrRaaSHSFixIMXOSoFGYSk7tyxIKuwZJDSlon3Cer9wTDlZYVu/qErdQQatUZnaApsPx8/QEK9xZbskw0VGRW7wxho204DYC5AywM15v0xCQ/ACvi+X94rYV2J+iREiF31UOiwBa+/eNm98hhFI7zjMiInA0iS9oYDwCsDhJbCHTRIMFdv05vG1l7Fg==; 5:enm5iGWtxpZoTrbrj/8e+MfhWG6dbQa8YrQ5Sc6qw49Jv2iMfUvgLR786G/zWcu1LHNltmV2BU60Ez9nNxv50yUwKVPamuiWVwyo0NfO5fBeTmn4tPZOwafUH9ig7VmITTf5iIecyEftDHbKxRftqYJdPUEjOv+XIPKT1nFhHRE=; 24:Xs3u2Wq+cfsWIje4PJoFMsvaS0p2Z8e0AbyCcrm9xMZ01YtvIxXWmzJY8nDy2OPY+T1BBFnoTnG1zs3BB6AryC1vD1mSiSFH57OjNhv0MY0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR04MB1392; 7:NEae1zp0blQJ4i2oMO5Ll4vPdxQwXvPFOeg2mPrKRr1UZl2S+SE6cgsjrFmuzwdkrASnzrxHo/jnb1U6E1Bvik8/kqj7S0oCoJ6GcarBCoiezvPMEy16rDb5tmDJJI6ZRuB4GQKAd4rOrFbEXgh5fr+64n0ne1jENLXsWSH3m1ZRykUm8vexi3MJBLZhjZMymtl401ispSG8Lp8lqWes3hOr8fnT9qLvBDh5QpPFxhh8FrnIjDcXEYfJ0Bc3aZzk X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2018 09:03:39.2838 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8bc4b68-e5a3-4727-cd1c-08d5e256336a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB1392 Subject: Re: [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: fix portmask option parsing 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, 05 Jul 2018 09:03:42 -0000 Hi Konstantin, On 6/22/2018 5:21 PM, Ananyev, Konstantin wrote: > >> -----Original Message----- >> From: Akhil Goyal [mailto:akhil.goyal@nxp.com] >> Sent: Friday, June 22, 2018 11:41 AM >> To: Ananyev, Konstantin ; dev@dpdk.org >> Cc: Nicolau, Radu >> Subject: Re: [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: fix portmask option parsing >> >> >> >> On 6/22/2018 3:40 PM, Ananyev, Konstantin wrote: >>>> -----Original Message----- >>>> From: Akhil Goyal [mailto:akhil.goyal@nxp.com] >>>> Sent: Friday, June 22, 2018 11:01 AM >>>> To: Ananyev, Konstantin ; dev@dpdk.org >>>> Cc: Nicolau, Radu >>>> Subject: Re: [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: fix portmask option parsing >>>> >>>> Hi Konstantin, >>>> >>>> On 6/21/2018 8:32 PM, Ananyev, Konstantin wrote: >>>> >>>>> Hi Akhil, >>>>> >>>>>> -----Original Message----- >>>>>> From: Akhil Goyal [mailto:akhil.goyal@nxp.com] >>>>>> Sent: Thursday, June 21, 2018 2:49 PM >>>>>> To: Ananyev, Konstantin ; dev@dpdk.org >>>>>> Cc: Nicolau, Radu >>>>>> Subject: Re: [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: fix portmask option parsing >>>>>> >>>>>> Hi Konstantin, >>>>>> >>>>>> On 6/5/2018 7:46 PM, Konstantin Ananyev wrote: >>>>>>> parse_portmask() returns both portmask value and possible error code >>>>>>> as 32-bit integer. That causes some confusion for callers. >>>>>>> Split error code and portmask value into two distinct variables. >>>>>>> Also allows to run the app with unprotected_port_mask == 0. >>>>>> This would also allow cryptodev_mask == 0 to work well which should not be the case. >>>>>> >>>>>>> Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application") >>>>>>> >>>>>>> Signed-off-by: Konstantin Ananyev >>>>>>> --- >>>>>>> examples/ipsec-secgw/ipsec-secgw.c | 29 +++++++++++++++-------------- >>>>>>> 1 file changed, 15 insertions(+), 14 deletions(-) >>>>>>> >>>>>>> diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c >>>>>>> index fafb41161..5d7071657 100644 >>>>>>> --- a/examples/ipsec-secgw/ipsec-secgw.c >>>>>>> +++ b/examples/ipsec-secgw/ipsec-secgw.c >>>>>>> @@ -972,20 +972,19 @@ print_usage(const char *prgname) >>>>>>> } >>>>>>> >>>>>>> static int32_t >>>>>>> -parse_portmask(const char *portmask) >>>>>>> +parse_portmask(const char *portmask, uint32_t *pmv) >>>>>>> { >>>>>>> - char *end = NULL; >>>>>>> + char *end; >>>>>>> unsigned long pm; >>>>>>> >>>>>>> /* parse hexadecimal string */ >>>>>>> + errno = 0; >>>>>>> pm = strtoul(portmask, &end, 16); >>>>>>> - if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0')) >>>>>>> + if (errno != 0 || *end != '\0' || pm > UINT32_MAX) >>>>>>> return -1; >>>>>>> >>>>>>> - if ((pm == 0) && errno) >>>>>>> - return -1; >>>>>>> - >>>>>>> - return pm; >>>>>>> + *pmv = pm; >>>>>>> + return 0; >>>>>>> } >>>>>>> >>>>>>> static int32_t >>>>>>> @@ -1063,6 +1062,7 @@ parse_args(int32_t argc, char **argv) >>>>>>> int32_t opt, ret; >>>>>>> char **argvopt; >>>>>>> int32_t option_index; >>>>>>> + uint32_t v; >>>>>>> char *prgname = argv[0]; >>>>>>> int32_t f_present = 0; >>>>>>> >>>>>>> @@ -1073,8 +1073,8 @@ parse_args(int32_t argc, char **argv) >>>>>>> >>>>>>> switch (opt) { >>>>>>> case 'p': >>>>>>> - enabled_port_mask = parse_portmask(optarg); >>>>>>> - if (enabled_port_mask == 0) { >>>>>>> + ret = parse_portmask(optarg, &enabled_port_mask); >>>>>>> + if (ret < 0 || enabled_port_mask == 0) { >>>>>>> printf("invalid portmask\n"); >>>>>>> print_usage(prgname); >>>>>>> return -1; >>>>>>> @@ -1085,8 +1085,8 @@ parse_args(int32_t argc, char **argv) >>>>>>> promiscuous_on = 1; >>>>>>> break; >>>>>>> case 'u': >>>>>>> - unprotected_port_mask = parse_portmask(optarg); >>>>>>> - if (unprotected_port_mask == 0) { >>>>>>> + ret = parse_portmask(optarg, &unprotected_port_mask); >>>>>>> + if (ret < 0) { >>>>>>> printf("invalid unprotected portmask\n"); >>>>>>> print_usage(prgname); >>>>>>> return -1; >>>>>>> @@ -1147,15 +1147,16 @@ parse_args(int32_t argc, char **argv) >>>>>>> single_sa_idx); >>>>>>> break; >>>>>>> case CMD_LINE_OPT_CRYPTODEV_MASK_NUM: >>>>>>> - ret = parse_portmask(optarg); >>>>>>> + ret = parse_portmask(optarg, &v); >>>>>> I think there is no need for v, enabled_cryptodev_mask can be used instead. >>>>> Right now - it can't as enabled_cryptodevmask is uint64_t. >>>>> To do what you suggesting we have either downgrade enabled_cryptodevmask 32-bits, >>>>> or upgrade enabled_port_mask to 64-bit and change parse_portmask() to accept 64-bit parameter. >>>> I am ok with any of the case. >>>> >>>>>>> if (ret == -1) { >>>>>> enabled_cryptodev_mask should not be 0 and should be checked here. >>>>> Could you explain a bit more why enabled_cryptodevmask==0 is not allowed? >>>> By default, the value of enabled_cryptodevmask is UINT64_MAX, which means all crypto >>>> devices are enabled, and if it is marked as 0, then all get disabled which is not >>>> correct as we need atleast 1 crypto device in ipsec application. >>> Might be user would like to run app with inline ipsec only, >>> or have app to work in bypass mode only (no encrypt/decrypt) at all. >>> Why that should be considered as a problem? >>> Konstantin >> Agreed with your point. But in case of inline ipsec, user may not be initializing the crypto device either. >> >> So the cryptodev_mask option would be redundant in that case and it may not give that parameter. > It is still not clear to me why you'd like to prohibit cryptodev_mask==0? > Would anything will be broken? > Konstantin Sorry for delayed response. I missed this one somehow. Nothing is broken, but it looks very redundant in case of inline modes, and it is not a valid value in case of other modes. > >> -Akhil >> >>>> So if the user doesn't >>>> want to give the cryptodev_mask then he may skip that parameter, but if it is giving, >>>> then it cannot be 0. >>>> >>>>> Konstantin >>>>> >>>>> >>>> -Akhil >