From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0043.outbound.protection.outlook.com [104.47.1.43]) by dpdk.org (Postfix) with ESMTP id E0C971BA92 for ; Fri, 22 Jun 2018 12:40:48 +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=A5BajBalTHJCVzNCproHnEv8GazsGWh63Z9wGu/1Uyk=; b=ZxDFTvU8KrQytpgku6ArN0uMl4jyaNs8GkUKOkppKr4dVc6yzEg2yQXsUlNJUIYuveWUYLlCNXnyUHEN/DWo1DlbGyo8Ov5M86+bt7f1QBpXmvayuOxkx3L2lBhdOcl/MQmypzZF00ksy83NR0YTCge6c350lejwI5qTGKf5rq0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=akhil.goyal@nxp.com; Received: from [10.232.134.144] (14.142.187.166) by HE1PR04MB1388.eurprd04.prod.outlook.com (2a01:111:e400:535b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.19; Fri, 22 Jun 2018 10:40:45 +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> From: Akhil Goyal Message-ID: Date: Fri, 22 Jun 2018 16:10:31 +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: <2601191342CEEE43887BDE71AB977258C0C40347@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: BM1PR01CA0110.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::26) To HE1PR04MB1388.eurprd04.prod.outlook.com (2a01:111:e400:535b::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dabb55de-eddc-41d3-ad26-08d5d82c9cfa X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:HE1PR04MB1388; X-Microsoft-Exchange-Diagnostics: 1; HE1PR04MB1388; 3:uQFlAQEyUXSsWxUPtDCt98PkBq/QDekcEDtl54o86DUOAOHdBLKmwW7ricBn0zCFQOQXnp06QKDXLvnhNqzObeTjJ30EjA5V4p4Lp3G5KIDPHImMGGcZz35L3ofjdD+HrArLLJDkN3x750A+BgbZ5Qlg9Xni7VF33l/iBUKL6YlxP/nmi4Wqf+0SYSOj+U14L2wGCdg62iL0lXxahyc0H6r15NrSS9BESZG5JaDE0Z+508VHxLq7Wv8dDmICx5HY; 25:DHiWmg5EjiccSeVLddXMqw0SGSNHszr2yA4bOz49+CobZPuzTgoKX5adB2eQcHepCejYRK1QUKVfvx0WvqYjiTbG1iMCmKuqYNTnnwL0/X3H9hy+Wupu+VuEPZ3k8lEE8v2PcJ5TSsuv9KmHh/k6jdDeiOAhRqAS7vL+uJ0nHhsADIYtNETDJYKBLzFaEsB/L6IWQpVKOP6wur/PDQy3IJEnMp9E4P8pA6RNE9tyykcDWrZzPIp4V6ugLnODcGWHxmpl4QCKlRMrVC7r8kNcwgdSaucMiTLADafW95ebIcWwY+lQX3o4V30St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EnzCbwARmq/L3g8+mIbBv8QBatqcQhm8BtIc0NErrKkF9GrsCCz12fDS6JzRS5/FHzVAsmGuRwoUBOwPzWPuJ88oDKXzBY6Dmg7h7fij6unAGvCRK9ql+LRwoZyeMDVic8cfEWypWWH3Fv/ANZao/i+W/Kkn/Bxo5g= 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)(5005006)(8121501046)(10201501046)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:HE1PR04MB1388; BCL:0; PCL:0; RULEID:; SRVR:HE1PR04MB1388; X-Forefront-PRVS: 071156160B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(6049001)(396003)(366004)(39860400002)(376002)(39380400002)(346002)(199004)(189003)(13464003)(6246003)(16526019)(77096007)(16576012)(26005)(59450400001)(53546011)(186003)(316002)(58126008)(110136005)(97736004)(66066001)(2616005)(956004)(446003)(6486002)(11346002)(6116002)(486006)(2906002)(50466002)(64126003)(44832011)(476003)(386003)(31686004)(55236004)(93886005)(76176011)(68736007)(478600001)(229853002)(23676004)(47776003)(6666003)(105586002)(106356001)(52146003)(2486003)(86362001)(4326008)(3260700006)(25786009)(81156014)(65826007)(305945005)(53936002)(2501003)(230700001)(36756003)(5009440100003)(8676002)(7736002)(67846002)(3846002)(31696002)(81166006)(5660300001)(65806001)(8936002)(65956001)(52116002)(110426005)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR04MB1388; H:[10.232.134.144]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjA0TUIxMzg4OzIzOnVja3dEZW01QXhKbGRLeU1yM1lDSGdEL0Rs?= =?utf-8?B?N1o3aVZWVHJtZXVQdXJEaVFDbUJTaHFBUTlZK1B4bFhtRFd2SnJoRWJOMkdZ?= =?utf-8?B?VlJONy9DMi9KTkh6WXRjZXZkcWROclhmZnYvSEdrbkZDYUZhTDZjKytpbTRl?= =?utf-8?B?a25rdWcwbW5NY2kwMklDVGxKNlJ1SWZET2JsVzdNS0NyeWpDUUMyRXgvbzV0?= =?utf-8?B?WElnMTIwblloL3hXMlA3QXN1WHg2S2xvWHlNNlRmbGovVXdiSk01amEzUnlk?= =?utf-8?B?WGFrMEF2NGJUbjBwL0JJbDVpK1paTHpoQTFIcFZYNTRKWXpxbXRJd3BoSGFQ?= =?utf-8?B?SHNRZWhWY2ZFTmFibFN2cmNPYURYejMwMGF6SUFoZFplOEpOS0FoY2FMYnRX?= =?utf-8?B?R0JSL0RlQUd3UjdDOWZGdHBzSkRoU0tUOVpqSEFDZFR0NWxSRkhsbWxFRGwz?= =?utf-8?B?a2hJd0tULzY3dzVpSXBXVkt0VmRLcWdTanpzS2dhY2FEOTVmcmw1RTRRT3FY?= =?utf-8?B?ODZCVVRPbGRjcDlkMm9NVGdGbFJzbkRsOUtKclBud3cvMGg4STc4TTNTcWYx?= =?utf-8?B?UVRmZFJlMlFHNEhpTVpkUlJUUldKUEtpckYwUzdnOVQxY0psU2l4L25MTnph?= =?utf-8?B?bVo5ejFNVTlHL3c3MzhqeXA4d3lBandwK3M3YTB6WEFPMXh4QkNGUTl4MDlX?= =?utf-8?B?cmdVamFYeUQ3dElVRHZPMk9tc284Yk9tM0hJQm9PZ2tvYnJiME5ITGJVVDk4?= =?utf-8?B?SE53S3pCMUFiUnpZWkZhTjNPYnM3VWJtYU04YU9OS2JYUEF6d1lqblpWMlBs?= =?utf-8?B?dWZKVmJCU01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hQ6RnvbJSzv+gWF6FkmD2lWigUQ5iexnQUVSLgb/vC1UOABH7UH60HPr6WStrvtR9o0MQQLzVKDyTRgjA== X-Microsoft-Exchange-Diagnostics: 1; HE1PR04MB1388; 6:7u+r8zkX6zkf9/BDOAZHlPzOC51sGKEnQ/ihyNuHZf8DjR+oJxg8t2dyArWHnMcKRyPgLvA1CMTYdeC2DpNss1UUWtujZeFnekxxzDWogM0NwhDx2+9STyQIwCvwN5LjwYR9mzdl4XE726803G0fRmpLTssEfG2A8T5tlyKU4vZbBNGb/E+6a5wPhd01wad/jc3OdVlIgN0cb84GsiOL6/Wbp+FU9JILHmtunCL0bhbs2ibGXWoXvTSc5d19uBnVlUYNbljR93GIrBqnkAIy3I/7Gmfn0/fj7e1njXS75QbBF+s0vcRp5Xo+HwcxAamicOAm8tVKs2p6sDPl62jFOTHNY7KTl/l4PgL5t2coeuf3MWjHRbNj6oAkb87qCkFjaWQYRJ+Grn5hr3ft/nKnL9AaEI4PED8JQW3WWR3Q+ytVJ1+/UiyD5yBVOtM+ugL3odnW59rXMCxXrSmsk/pa/A==; 5:shYHWzzYLq9mj7OAJlRN5ZL/J96IgT+asgO7NuOezVML59KDhROet3JABNpU4E++avAoDF8uQVlKR/JKvqI+o4wQQ0tA+STd+P7suHuZ8sloS2CnF4QwBcx+RRAeW8SjJBDoeLh93CQhhkXJOmmuiaQhk8DJds0c2xpPdv5Sc8A=; 24:cZcH69g1rZ8ugDVFSVSueQFp5N+yeEUaTUTbXeeyQQ63DKDVRgp+q+T/N64X6zLPVV2IuSI1ESul0/Q9LjqZrrwGneoTyXSjJiK0pU3aYwI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR04MB1388; 7:7OgrY9C9BdVeiUNUybOOjZZphhkRN8tZnsG16q1KbvRQBzjVg07TeyQLnz04GHE3UZWbuqJHXuj79Qwswns7rY8y5whZg5V1Zg2LQkkLFzBAzO98vQxMcmQ9BJoEkxcCGKUXYGMKbim+7gVQjRLqYFTBLhdtOLYfHdJHqgheLstxqDSCBM0MnIERipxSz8c9AbTYO1EekAU4cUbZ/DOvSgOulFKJmaQixMQuYnc677yxX4UlA+/mKYhR3bJjz4Er X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2018 10:40:45.8261 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dabb55de-eddc-41d3-ad26-08d5d82c9cfa X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB1388 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: Fri, 22 Jun 2018 10:40:49 -0000 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. -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