From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0080.outbound.protection.outlook.com [104.47.42.80]) by dpdk.org (Postfix) with ESMTP id 1BDC07D4E for ; Thu, 7 Sep 2017 11:37:34 +0200 (CEST) Received: from CY4PR03CA0081.namprd03.prod.outlook.com (10.171.242.150) by BN3PR03MB2260.namprd03.prod.outlook.com (10.166.74.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Thu, 7 Sep 2017 09:37:30 +0000 Received: from BL2FFO11FD049.protection.gbl (2a01:111:f400:7c09::169) by CY4PR03CA0081.outlook.office365.com (2603:10b6:910:4d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12 via Frontend Transport; Thu, 7 Sep 2017 09:37:30 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; cisco.com; dkim=none (message not signed) header.d=none;cisco.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD049.mail.protection.outlook.com (10.173.161.211) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1385.11 via Frontend Transport; Thu, 7 Sep 2017 09:37:24 +0000 Received: from [10.232.40.183] ([10.232.40.183]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v879bEWM007854; Thu, 7 Sep 2017 02:37:16 -0700 To: "David Harton (dharton)" , "thomas@monjalon.net" , "ferruh.yigit@intel.com" , "ajit.khaparde@broadcom.com" , "John Daley (johndale)" , "konstantin.ananyev@intel.com" , "jingjing.wu@intel.com" , "beilei.xing@intel.com" , "jing.d.chen@intel.com" , "adrien.mazarguil@6wind.com" , "nelio.laranjeiro@6wind.com" , "alejandro.lucero@netronome.com" , "rasesh.mody@cavium.com" , "harish.patil@cavium.com" , "skhare@vmware.com" , "yliu@fridaylinux.org" , "maxime.coquelin@redhat.com" References: <20170825134717.18376-1-dharton@cisco.com> <20170901023628.21308-1-dharton@cisco.com> CC: "dev@dpdk.org" From: Hemant Agrawal Message-ID: Date: Thu, 7 Sep 2017 15:07:13 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131492506499832938; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39860400002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(377454003)(189002)(199003)(24454002)(13464003)(305945005)(2906002)(31696002)(77096006)(86362001)(33646002)(53546010)(6666003)(104016004)(47776003)(65956001)(2950100002)(7416002)(5660300001)(64126003)(230700001)(50986999)(65826007)(65806001)(76176999)(106466001)(54356999)(229853002)(50466002)(2201001)(68736007)(83506001)(97736004)(23746002)(39060400002)(8676002)(4001350100001)(93886005)(105606002)(36756003)(189998001)(31686004)(4326008)(498600001)(626005)(85426001)(2501003)(356003)(8936002)(53936002)(81156014)(6246003)(81166006)(921003)(491001)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2260; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD049; 1:CYf7PjKGoDUuBrf7808LLjYmSfMfjD4mlvMbrkxd3Ie78PJKop24asnRBqXDn2etm0ObnSbqEZY/Ex/8tMtDT4yZzd/HxkDko3EqtbE5nURgfGHWURNM6q5wH7yqtu+S X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e5720316-f069-4db3-5c6a-08d4f5d40f03 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN3PR03MB2260; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2260; 3:QSdV1lG8hTRu7lZBL9DbcH/sYzPqBGhoS1Zn1Tskh5MQG6SMbO4Q1peZrzC9CxPyRpaeyiv5Bbn5Cf+jY8Asnrgwi2DElANKJ4qz8uYb1zngh0bhCRxRH2xGjaPvHu0XlC22WE/uhpDbRiPiYYAPRXgDgUbJaNRxw1hm2ig0jb+oi+ngYVQx4xdXUO9w3FK/eDdDb30fAC9QnmOX0DhPdjZJWqAAgXAoY1mLhAo6O9Gbkwwa7sRkkuYHAqP60SPpItpG6TtDQebp7eIQipaygkVXe/ahiDp7i7UezLf/GZ/ZJUkDdhLa/b4GvCh4BvGW8sy+6+T9ieRKUWO1FqRYZm2v2BSzhNb93TDVBs+UOW8=; 25:gSVZ0eTKSvI3WN8cTIwSfDGeKEBjsW1+qYJSOddhReX4RcnL/dFPaxCq1g5wR5PzGQY1eywGG5jF8jW7dialxjkPpBPoOeAIjAxKFDQ/aSNSpNOf1XlLJlcD4rXkueuE5iP6Ix5iS2OKm3HgOT+7EXLBsH7gwy1vQxSINBHbU1rp59PTpvaYS3gHXOHGSzOHq0DuBQiezwNar5D1ExVxrFT+746/Q34xCT2WoQe6wpiAsqIAkKESMmFfwslbRZ/F6+bTan0Qrqx943Hl0WI7YvKON+R1n8gR8rTfaftFFTj54e+CdY1pmFUvkJe8OZP0q5cBMbCiPBfvt1vl2NbQiw== X-MS-TrafficTypeDiagnostic: BN3PR03MB2260: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2260; 31:9xdA72gJV59rPkIZzTBu5IFZVWDx8CWTR0eL+bHV/QJJtY1EXmvhaHVxtQeAiJ9VWDyCiEwLn4MtKDHHuMmVuDMFt5dId6COVfmRFe+o3hoJ7zd69oJ68j5e8aZl5ZFmYe+/0XkOuRSq9vslq0BD1Bh6SMo0k/D0M7vL9CCmKPtztKKKKGsF9q0qlJtjmKjWhtxxqq4Ay8mjdtYgIk2XxaQlVkePZo46Odqm9X9qnTU=; 4:S+Oyx1EcFa3GXJXp1m0ii866pOwSjBJSvgu4rbIyCAsEszEfdiF/nMY+xxbY4aocVHVsf1n1YAXelPmLGOZrB6uTHvAlF8T5A90EHXZRvb2eYRVnmwr3GvBv7j13Pn9RzNsOoEgyuQbX49ZT9B8yRl8gcPR7q7cVSkJZcb+SBHvLu/BdaA0vfxf7mydCD/qWMnsFccuuvPUzmN9CzmgVHABIr7mEE0OCOVxOFJQ2h4Y0lJEe/E/Jm4GhxYuw1A0nemFKCG8dENyAnZwVGgOK7siIc4WOFMEJSmdFKV8E+6Qf3oyWpNBm+GSqiIBKnLWCWfx7rEf95UHNPoeljT0xEQ== X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(95692535739014); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(6055026)(6096035)(20161123565025)(20161123556025)(20161123563025)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123561025)(20161123559100)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR03MB2260; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR03MB2260; X-Forefront-PRVS: 04238CD941 X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; BN3PR03MB2260; 23:4X19WMB22+yvCBGIs6wzu8Inxbt9kpdOyq7d5?= =?Windows-1252?Q?wzeJo1e8r5ULlWCkPasLYaDoyTzBVmHUTDWcqlIdPCebS86E8Qp7RV0P?= =?Windows-1252?Q?6DoR+tPRcc/J4bHfP6SQDJYShB4gyY0sOPTYXnhdqwOcSUGDG6TiQCsn?= =?Windows-1252?Q?q/fWndtFoU4WhXT+rusHa7awGdce92ouESj4NxPz5NfY2EhK8llPpnwx?= =?Windows-1252?Q?Vh5u3safnVhweNliQkKmWKK4aXqYr/ckbylDqR5lygBy0vy6ZgQWebaW?= =?Windows-1252?Q?A3BsD88j6eyRFUN4b+T34kS2SpzaZteuDiw+qNjClIASL+1fwf3IKO5a?= =?Windows-1252?Q?xqz6CvXULtun71425zFjAaQHQ6VkO/NX54HMgEeF9UK1/6Jm+htE2Tm7?= =?Windows-1252?Q?vzPzOtpwXA32xu7DCtX32cpJ3Rn1ozAp0THilwC7I6r7x/rGmQFDoKyf?= =?Windows-1252?Q?3dPuh2Dy8oFLvcFaUIKZom1qKIoPD8HlOtZ8+d1nxDUlMpzqaG6xFgjH?= =?Windows-1252?Q?xc6YM2oVLaa5X7ePLH6PD1jI/eYLLkeorqLqIUcS7LRFPlRBLBKzGEUN?= =?Windows-1252?Q?C3VO1Cok05a/MS2OBfiFJfTjsUM3s2jWuw+aQRyzVxE59/Oc8Mp1rmS8?= =?Windows-1252?Q?5xuGBZ/TEgE9KfyeEffjAdWxZZQ8eZZnBTdxgMQja8fmtjsbsBAiGNcx?= =?Windows-1252?Q?xpmrvx4ZPXJa0O9bJss1iclhu0y1oSqotcrn9RFApgLpT+htyXN0wd6Z?= =?Windows-1252?Q?B5Ab5hE3Px9V0egwkqEy/LjBxcCJpAJFzhPz1dhUpaT75tchmendfJHr?= =?Windows-1252?Q?tItKgmKT2CazSNhgsSPI7VY+zTqjtzyvkWQM8uzg47Q3Vu6OBIBqIQWY?= =?Windows-1252?Q?GRUNNjVmZf327H2i1+ygeLYWTCpuhLu14zZp9qZNLtJuv0OD1kUYcl+g?= =?Windows-1252?Q?RWsKKuOtdvkXyWp6aR0/WhQp3Q6Zv4BM38KpFYIVCWXgG0Y8i0+uZCL4?= =?Windows-1252?Q?EMGo40Y86bIyNqe8K7ECDWNlw3rDru0VHaj5TFLCl5jmtcIYaXG0jN49?= =?Windows-1252?Q?We00OnzBZ/ow+lLmqOwjc8dduI4yyvZtwk2RcumCh4j5ADrNp36CLKrE?= =?Windows-1252?Q?OK7PqhHjFUtUgfbUucvLdaqMyJ4eQCsmsqGzl/cJGyHQkdN+ZzyzgIUm?= =?Windows-1252?Q?ycx0EkMJU7SZmz14jDga2av1bdnTQ1wzeBcKLty7vkgebX3k35YuSfB+?= =?Windows-1252?Q?1AAYi9NomRql6hGxnu53UsCHsRpEVS8KYJ2GgKTZ7CAjB5lOqAOU8pQF?= =?Windows-1252?Q?feiKAwljQgFQUBKGZoF9SQagaLnR0Uxdyxv4N1g6EpQgTr8F5oy2512q?= =?Windows-1252?Q?YQ2tizEkbgrIf19259D3T77uD3QQA/eEO8AqT7PkW+6suAl97nF/iBTb?= =?Windows-1252?Q?RYBvppzBa0iQFcAXVxmIJCklBHF2bkZhUVRotBykGFIwVN+RrJn6CNKS?= =?Windows-1252?Q?41NOFwu2w3AQ0/VMPEklm9OCeilEJY7jxHjNs0ct4vBbL9E6N2hDLPE6?= =?Windows-1252?Q?8VuFGknuyN6sralRkl2aMUFstO1wVFem0ObdJNwdvku+YCwsHVvnEIiD?= =?Windows-1252?B?UT09?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2260; 6:1hFrSuYof/rq5/cVjn8en00nm26fFher4B4WdEIkHD5Od9xCYybUm+WeHxVG1v+DC162clZOQC+1mI1/YaGNUyrxMsJJKWTs7M3iwf7hhCyA53OhwZcDM0bpU0ZnyKGV9EWC+OG8pkyW4ZMcg48cDQ5a9uB4vVgN6xFtUSps4THT8tq47SXxS2uHf36gZCYlXkjyzAx5SNrtp6shV2MX4j7kOtjQtufmNvxFGbBXPWAQoC5soFQMCNeSX8rH3BaQBKrHR+CyHLsTSJMNY0h7rNGJlCEzqRgzLiU+Eotu3/LzDO+9Pq8YxSAriZCwzQIAOeKjzg0qdYXUrOdLD3tM8A==; 5:h6WXD2P5GuBOHizfgNgYGGCxhCyiGqU8+dlpRT0S64RCyqKesR8NDJyqkcPYlox40C4xDspXAtmR/qOi7Z9A1T0UPJbFN47xW+EK3JSWSVg+SYDmEqWQkf2nuPjPWBavH28f/WmWFR0EiRql7NBYfw==; 24:o1Plm4PK+w7MjHJTuGh8hdorQiVCHD0UQBrNB3hDBP5hPMCfMYmw9gIVZjvZS3CLQLKxV+gG4HYEy6OzNEdQi5ODeRLL+BT1szqZQq+lWXg=; 7:uWRMt2fNFOqh8VvyYLfwVOpMUOowAk1uZURcNk5TupQS2F612EpSllCYLNdLqA8Bc6mjhO1JlaZ+ORz3fgJ9jld8ekHWQVIRgbgODsMkQf+BuMvsdhr9RwaPyrf+SZVDgdqyE6sndOT93XBoSYMthzu1xIFCNBrwBXcXLSaV1XwS4505EqFA8OF6bf3UfQm0oB0mSBnn/U1pWrfHo8k5yicuqaBaDsS9BncOy+3xKZ0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2017 09:37:24.5701 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB2260 Subject: Re: [dpdk-dev] [PATCH v4] ethdev: allow returning error on VLAN offload configuration 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, 07 Sep 2017 09:37:34 -0000 On 9/1/2017 6:24 PM, David Harton (dharton) wrote: > > >> -----Original Message----- >> From: Hemant Agrawal [mailto:hemant.agrawal@nxp.com] >> Sent: Friday, September 01, 2017 3:41 AM >> Subject: Re: [PATCH v4] ethdev: allow returning error on VLAN offload >> configuration >> >> On 9/1/2017 8:06 AM, David Harton wrote: >>> Some devices may not support or fail setting VLAN offload >>> configuration based on dynamic circurmstances so the >>> vlan_offload_set_t vector is modified to return an int so the caller >>> can determine success or not. >>> >>> rte_eth_dev_set_vlan_offload is updated to return the value provided >>> by the vector when called along with restoring the original offload >>> configs on failure. >>> >>> Existing vlan_offload_set_t vectors are modified to return an int. >>> Majority of cases return 0 but a few that actually can fail now return >>> their failure codes. >>> >>> Finally, a vlan_offload_set_t vector is added to virtio to facilitate >>> dynamically turning VLAN strip on or off. >>> >>> Signed-off-by: David Harton >>> --- .... >>> diff --git a/lib/librte_ether/rte_ethdev.c >> b/lib/librte_ether/rte_ethdev.c >>> index 0597641..05e52b8 100644 >>> --- a/lib/librte_ether/rte_ethdev.c >>> +++ b/lib/librte_ether/rte_ethdev.c >>> @@ -2048,29 +2048,35 @@ struct rte_eth_dev * >>> struct rte_eth_dev *dev; >>> int ret = 0; >>> int mask = 0; >>> - int cur, org = 0; >>> + int cur, orig = 0; >>> + uint8_t orig_strip, orig_filter, orig_extend; >>> >>> RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); >>> dev = &rte_eth_devices[port_id]; >>> >>> + /* save original values in case of failure */ >>> + orig_strip = dev->data->dev_conf.rxmode.hw_vlan_strip; >>> + orig_filter = dev->data->dev_conf.rxmode.hw_vlan_filter; >>> + orig_extend = dev->data->dev_conf.rxmode.hw_vlan_extend; >>> + >>> /*check which option changed by application*/ >>> cur = !!(offload_mask & ETH_VLAN_STRIP_OFFLOAD); >>> - org = !!(dev->data->dev_conf.rxmode.hw_vlan_strip); >>> - if (cur != org) { >>> + orig = !!(dev->data->dev_conf.rxmode.hw_vlan_strip); >>> + if (cur != orig) { >>> dev->data->dev_conf.rxmode.hw_vlan_strip = (uint8_t)cur; >>> mask |= ETH_VLAN_STRIP_MASK; >>> } >>> >>> cur = !!(offload_mask & ETH_VLAN_FILTER_OFFLOAD); >>> - org = !!(dev->data->dev_conf.rxmode.hw_vlan_filter); >>> - if (cur != org) { >>> + orig = !!(dev->data->dev_conf.rxmode.hw_vlan_filter); >>> + if (cur != orig) { >>> dev->data->dev_conf.rxmode.hw_vlan_filter = (uint8_t)cur; >>> mask |= ETH_VLAN_FILTER_MASK; >>> } >>> >>> cur = !!(offload_mask & ETH_VLAN_EXTEND_OFFLOAD); >>> - org = !!(dev->data->dev_conf.rxmode.hw_vlan_extend); >>> - if (cur != org) { >>> + orig = !!(dev->data->dev_conf.rxmode.hw_vlan_extend); >>> + if (cur != orig) { >>> dev->data->dev_conf.rxmode.hw_vlan_extend = (uint8_t)cur; >>> mask |= ETH_VLAN_EXTEND_MASK; >>> } >>> @@ -2080,7 +2086,13 @@ struct rte_eth_dev * >>> return ret; >>> >>> RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP); >>> - (*dev->dev_ops->vlan_offload_set)(dev, mask); >>> + ret = (*dev->dev_ops->vlan_offload_set)(dev, mask); >>> + if (ret) { >>> + /* hit an error restore original values */ >>> + dev->data->dev_conf.rxmode.hw_vlan_strip = orig_strip; >>> + dev->data->dev_conf.rxmode.hw_vlan_filter = orig_filter; >>> + dev->data->dev_conf.rxmode.hw_vlan_extend = orig_extend; >>> + } >>> >> Currently vlan offload is combining three functions: >> strip, filter and extend. >> >> Not all PMDs in DPDK support all of three. >> Should not the error we extended to reflect, which of the VLAN offload >> is not supported? > > There are many examples of APIs that not all PMDs support. > There are also other APIs that manipulate many attributes but do > not communicate which attribute fails on set. > Solving these issues I believe it outside the scope of this change > and it requires a larger community discussion. > > This proposed change at least adheres to the existing paradigm. I agree that solving this issue is outside the scope of this patch. However this patch may leave the drivers in incorrect state. Earlier this API was not returning error or failing. With this change, the driver may want to implement the error handling if 2nd or 3rd attribute failed. Note that you are also assuming and reverting back to the original condition. The change is fine w.r.t dpaa2 driver.