From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0066.outbound.protection.outlook.com [104.47.37.66]) by dpdk.org (Postfix) with ESMTP id 10D217CB9 for ; Wed, 24 May 2017 13:28:32 +0200 (CEST) Received: from MWHPR03CA0001.namprd03.prod.outlook.com (10.175.133.139) by BY1PR0301MB0903.namprd03.prod.outlook.com (10.160.195.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Wed, 24 May 2017 11:28:28 +0000 Received: from BN1BFFO11FD044.protection.gbl (2a01:111:f400:7c10::1:159) by MWHPR03CA0001.outlook.office365.com (2603:10b6:300:117::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9 via Frontend Transport; Wed, 24 May 2017 11:28:27 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; intel.com; dkim=none (message not signed) header.d=none;intel.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 BN1BFFO11FD044.mail.protection.outlook.com (10.58.144.107) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1075.5 via Frontend Transport; Wed, 24 May 2017 11:28:26 +0000 Received: from [127.0.0.1] (B10814-12.ap.freescale.net [10.232.133.65]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v4OBSIVn026548; Wed, 24 May 2017 04:28:22 -0700 To: Cristian Dumitrescu , References: <1488589820-206947-2-git-send-email-cristian.dumitrescu@intel.com> <1495213972-109148-1-git-send-email-cristian.dumitrescu@intel.com> <1495213972-109148-3-git-send-email-cristian.dumitrescu@intel.com> CC: , , , From: Hemant Agrawal Message-ID: <6d78246a-b633-e57c-0a6a-39a49e44f529@nxp.com> Date: Wed, 24 May 2017 16:58:17 +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: <1495213972-109148-3-git-send-email-cristian.dumitrescu@intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131400989070905081; (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)(39840400002)(39860400002)(39380400002)(39850400002)(39450400003)(39410400002)(39400400002)(2980300002)(1110001)(1109001)(3190300001)(339900001)(199003)(377454003)(189002)(24454002)(54534003)(9170700003)(305945005)(6246003)(8656002)(53946003)(16200700003)(54906002)(498600001)(23676002)(4001350100001)(229853002)(6306002)(86362001)(356003)(53936002)(50466002)(53376002)(64126003)(120886001)(33646002)(85426001)(104016004)(83506001)(53546009)(50986999)(966005)(31696002)(65956001)(38730400002)(47776003)(65806001)(189998001)(5660300001)(81166006)(4326008)(8936002)(7126002)(7246003)(65826007)(77096006)(551984002)(36756003)(2906002)(2870700001)(6666003)(76176999)(54356999)(31686004)(8676002)(2950100002)(106466001)(105606002)(559001)(569005); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0301MB0903; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD044; 1:dMcI5YdQCtK2VxqrneIZVsBp90mNzzrVAPNduOoSysQTQL4874K9G0BLf7MOtpVwgtJVr/LWBDvwq8YRgCe6UNkcXKlWbMOjy/ZjqhUeNwzKeUXybSBqcyUlZGVJKrcCKDmwE9peoezwJzIK5l2Ivf4teLuZUFXHozk7/SGzXX6vgwHHQ9UGG9d0si+XyzxJPCOfszQMnQq2+2wBc0tIfktNSqj6VWCnCGIHybc9b+Yisqfb82F6Se3Hi0IumE7Xt+i2uBZqrYRCYyAVLWhjsF6b4HsBiELjJsjNWCq3DE9QOfRprLrBKkfz/HBM3wVXdjKJ3b5rxnZSnI0SCwWIahDP0Bw/GZesg/mB0biDQDEm0Rfa6nbqns/ArjpbTXzp6cEscT2ge6Rg7SH/+0MxOn1HBmjjjR7NI5dhWVwyodgTC7ioYOsnvQQBeistGDkkNYQwOWHffXSEKiWySFNug0Z8tkbsDraoQX2nx+hU6LrYceUwxwu0lv91wbjeEgJOo4d8/9aga4RPLNSrkQoQsGQFUw77yMQM6yFT9A7eFa39rrzGXw5j3+uZDtS1Cw8uBhL13tYZ0F/8NM6LATlNlDnfaCxp9YxIAlpSv9dS9dM= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY1PR0301MB0903: X-MS-Office365-Filtering-Correlation-Id: 96ab105b-4068-4dab-6d98-08d4a297ff29 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BY1PR0301MB0903; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB0903; 3:z1jZgnatl8WLAwjlWj1e9JwMOUfU+gtVlqTjaKy39lltxHqzsWrXYKyPNL8LE6wVL3fdRdVWJbQbjJm9RqfhWyYuWo5JNFY4X/npr2kUOTqa+K9ozGPm6I3Uc+faZ2+FSOPKl6QxwJyuxqdrVVuzusRIRG0IIZ3hbCI3LTPSvoBMBqgHg2M4Fo7q4jAfX6xy/HxSO4F/jRVxeQLWtDJ3WXJ8EFpYZ5Jp0MgLK4Mn2rGCfxA52Aq7p9u0lcxacLqc+Zdz4Ns4sd0pPm1NZb8UjqJ8nczghScFi5G6kwFqdAUc7lZkASZ2AeD7sF+yDNplBo7+bf6Eylb3EyTXA8c8TiE573NU3jrcDAKw+3OOz4ZHrvrYZV6Uhh8pZiLrLe1o23/3kqdoYe47BC/eljjunNgz8HgFlPRzE+EnIYYtL5PZIkJ+/Cq5dMMr093HziE+; 25:HQEVECk3z5PwnOSBiHN5LlsMNMq4ZJHQc0vhUTtJxXsU3OH+HPHDuLtkLIRZYpk18FvCcmQTuZ5PgIz4Inervxnx+OZQhLJsqJHH0gWGRLWwgRHcVyqyNHqXcG/Y30azXutBzkePIzIgG6QehFcd9xbp5Fqrjrj4gT771rIYC/GelW6HPj1TnJ6ayBaIzSv4BYFivpMsK5vUKoNtuTih1ZSy8YngApsIuv8RXBZn4irtbspadI0v1iq9yUzYFdJqo+RijSxfYxaPijfMzj1aD4PIdAdetEJYlOjoF2LngJ6lTluJQ11RkY/4LBagiarOz0+Wt1tyZnea8Mo9hw3EpB7Jgo4U8SntFBbZUzCcgCThfGagNDMfzrel2ri07aN5xxQ1u3f2VR19MBe5uVc/hQjMPF/w/uBz7lWxjezCtW06M/HQ5WU+YEoW6TLRpRg4a0w2Wrlcf3P+CXPcc13/di6ifG54FQ53M4Az8IVV5kM= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB0903; 31:sRGJ9Z6mlO4tQGU7Moo50QtoxAVCq8JbXWM1WV5VmSYNZXLal2nuoJ4ZV8rsKX57nth8PQK+ZPz3qJ6uoPpUHiw2qqVQ1Suk/MVruxDy1LKWexPGj/nN36mz2nfscQUeV3Q5QDf8NiQAa2qACfCBhbDhH9btxlo3YaTKSKNmE5vikYasmGw+bY008zosIk4lXwdQ1gj0m4pm7xPWdrvUbuvewEAcpDLRTW7vTrmqW9RTU0LRjHuIam2JX7oHRZZjwPncFyl7bF0RluFeSu5w6g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397)(131327999870524)(185117386973197)(21532816269658)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(8121501046)(5005006)(13018025)(13016025)(10201501046)(3002001)(93006095)(93001095)(6055026)(6096035)(20161123556025)(20161123561025)(20161123563025)(20161123559100)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123565025); SRVR:BY1PR0301MB0903; BCL:0; PCL:0; RULEID:(400006); SRVR:BY1PR0301MB0903; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTFQUjAzMDFNQjA5MDM7NDpsUks5cXNGSlZ6WWt5dWpwV01mRjJqNURB?= =?utf-8?B?emNjencwUG5DQjJTbzRQWG1wQm5DbU5oY3JnWUlJR2d6Smx2VGoyUGlmOEo2?= =?utf-8?B?dGJIQ0pGNTJncjduRTRNRThhWHMyMWNqcCtub0Q4WU1CQVNYeVhNakF5N1FM?= =?utf-8?B?U3dESjRGZXkxbFdFbkduQU54USswK2FpaTJiRzI3OEpBZ0dEcXpoMU52ZG5R?= =?utf-8?B?QjhUNm84NFZzQmt5c1FkZUtJUW9qcDV2YUtYMy9yV29tRmpLN1NpUk5BUkQ0?= =?utf-8?B?NDVJazFQM3BWZU5IMGpUMzRnWXRvZGh0MzZDblhOK3hPcTUvSlhQcDRVaGNH?= =?utf-8?B?UlVITHVqY21rU3gvRHRJN2IxZzl5YlY3OFdaSmlUUmNxRWFBZzNZM1FBUWRn?= =?utf-8?B?NlFpVU5GU2VOUVcvUWtqc0RGRDlFQXorY0R6eUVUL1FERDB5Z3ZpVll0Sy9P?= =?utf-8?B?YTFqbmJmckRpTGkvQStFS2tyZ29kUUVsUGkzd3hGVnRjMWtsL24wZllmQUp2?= =?utf-8?B?YW1ZTUphK1kzTVZ4TFl1cVVZYS93cm5oV3Z3UkJ6N040ZWR4YnQweWh6ZlZU?= =?utf-8?B?SkdhNE1vY1p0dXN6Nmo2R2IrRnNZQXVkVWFrcExsbE5KZ090U1J4dGthUEI3?= =?utf-8?B?ZE9NckF6U2xxQk83NEFGT3FRcXplRElLVk5OeFE4T3lQc0dwVUp0cmJqdFlW?= =?utf-8?B?SlNOSXdWejh2SEQ0dlQyMlo4Y0pIdml2ZVNiaklVUEVzOU1WWXpWKzRmWE5T?= =?utf-8?B?NTZhVkNpa2ZKZTFXOXE1SUkxZEsyRDIzTXlyN1FHZVlhdEdtZ25iRzBpOWh5?= =?utf-8?B?WjRoTTZvOVBGN1ZqeldybHVxcGZOQ2ZJS29DZG5tdWRZM2kyL0I0SjZMUXVZ?= =?utf-8?B?bXI5QUNBQWFjTWhmbUprYVFJc1JPeXRNRzlad3NWYStGY1pPSEF1Rm5SVlhR?= =?utf-8?B?RkpjeE1JK3gzSGNOeEI0akVzZ0FnMTF4QlhZZ3Q4VDZ5ZnpLejVvaE40eXFi?= =?utf-8?B?MnRIL3FGTFR0QVpma3JkNjBvTCt4c2wyaStmd3FEaFpNWWVKUEhPc3NPaTR4?= =?utf-8?B?TXdWR3hMdUF1emJIdGY3dFJQZ3E4b3J3S2hCb1hicGxsbkFTSW5hUzdkMGll?= =?utf-8?B?VC9oekk3VmV3MG9HaG1WRG4wWnRzMU5ZRGcyRXplUTFzaVJXeGlhNm1PL0Zo?= =?utf-8?B?ZzdJZGFJQUp2bzhFR3B0OFluTzVLdFJGQXZNWGhKZkltTHczRXdQamphRk16?= =?utf-8?B?b2U0bnVVaS96anRrOGtsb1VVN1B2OVEyRStBdVZmdWVsOUZieC9KT3lrRmNl?= =?utf-8?B?bWlhbE5QaXF2aExHZFVJamw5U3o0cW1mUzZsRTJmZXd2ckJqWFlkOTlOMkxv?= =?utf-8?B?c1pMUWt0bXdEOGlvelJ3eUxaR1FReU4xQ2Y2c3ljajVMUVBTbWpGL0o2djVP?= =?utf-8?Q?eK5btDU=3D?= X-Forefront-PRVS: 031763BCAF X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTFQUjAzMDFNQjA5MDM7MjM6Z3VIVEZTSENkL0hRUXJFR3Z5cjFnRnBv?= =?utf-8?B?Y2JDbTVCUXhIM1huSTZIN0Y2YVJTbUZyTjFFbTlRalNDaW95T1B0WVU4MFFM?= =?utf-8?B?eUhiUDRUbTZEYklIaERjaElRd1A0ZGM0ZDh3aGluMHBBSSt1amZCdE1rU0cv?= =?utf-8?B?am5UQ09xYkVhV2JRbkJpV3luZENzRzlnMzZLOEdmd3I0ZUlzWjhkQ2szVkNI?= =?utf-8?B?VWYwTzZubDM1b0psNEJRcEJQZ1JKUG5INnFmYlFvTEFLOEpRNFRwclJwUTRQ?= =?utf-8?B?WTRSMkJ1NHA0N0R1aFVvMlNJeldpNjJhL0V4aFZSL3VvVDVGMnR1ZGlIUDNk?= =?utf-8?B?eHc1cXprK1RTdVhaNjBreTcrZWFXTWNCZ3ZsZk5yMEJWTEhVaVlJSXc2TGli?= =?utf-8?B?eUFkZnhJNzVSMC9MWW1RUGdwbE5lM1hRcHRYcGRBSFVHODgwQlJVS0Z6cm13?= =?utf-8?B?YnZLNmJYZldYTWV0ZkpqOGd6bks4aHY2Yk5Lek1TNlY2ZHMrdTJ5d1dnYlQv?= =?utf-8?B?TjFpd3FVVnozbHlxR2hxRkV3Q2tVb2R4cGtVZzdoMjZqQSs2ZUx5THdScnRR?= =?utf-8?B?YkZqQ2N4ZWdFNW9RcEhYdUpIY3Bma1ZnbnllTkx6UEp5WVczcXJiU1JDejJy?= =?utf-8?B?bjIwYzViNTNBZHRDVjdTQkhEYm1KM2dGdzhtYlhGZThEZ0gzdWxWY3pVU3Fu?= =?utf-8?B?bncyRkVGRVJwK1JvSk1SZHhnL0pVc3FPdXRpS2VDcms2KzF6cU01N1VjMS9S?= =?utf-8?B?Mk1zVU5oSEJpMXl4R1dJc2k2ek1GMktZSVpsbHdiako2Mlc2ekxFUFpTcnRw?= =?utf-8?B?b3hWMmJWYk9qMnZrd0J4TWdiQ09wbUpMZzEvdldYM05keTRTMWtRUVhnVGxH?= =?utf-8?B?NVBUTjZpcGhkMGp6b2ltY3M2OUplckNiNXZaaU9sUVdHcEFYR1N5Nk55WW9i?= =?utf-8?B?ekdnQlRvSTdVWU1rdUw5bytaSk1OZ2hqMCtXNmJJR2FJVlBYTnoyQktnVHJK?= =?utf-8?B?c2NwUWp1ZWtid0JETXZpcU1GTkNHMld0L0hIcHFleS9SRDREN3k5RzRYL09J?= =?utf-8?B?ZFhzdVJNenE2dVltOGlUaFUxdzJUN2tRTEdxd1VRWmJEKzN4bklTeW5QOTF1?= =?utf-8?B?bUFOWURpQjM1MWJtQ0tja290M0IwRzNUU2JCOHpyKzBBUnlFTzY2cHRZYW9h?= =?utf-8?B?MjlPM0tNV011OCtRR1ByeTN3Vy9uZ0dra2l6b29kZ25WdjZ1alF4YjVQeE5k?= =?utf-8?B?RTFzNGdVTjlHdFIyQmZKTjBLSXo2eEJJMkJXMTVSU2VHc2cvNFhPdTB6eExO?= =?utf-8?B?MzlzQ28vbEFtSWJ0ZmhJSXVzNW5NV3JNZExQclNVVi8rcmwzQ2tBdElFTm1P?= =?utf-8?B?Sy9tL3lDTEN2TDJKN0xVVEVEQ2NuVnVGeS90d09EamE5NUVJNGZOUHRtUFBE?= =?utf-8?B?Y0xFNUNpNkJDbWNwdUFDSmltTmplR3FBOVZHVTM3RmgrSlRVa1U4Q3pjcmxT?= =?utf-8?B?czNTZ09xN2ovZ2Npa0w0Y1YwbTVZZkRheXRtU2hqNlpRQTNnWlZWWE93bnpN?= =?utf-8?B?eUJtV0JQVDdmMlNnenJWNXFSdHMvYXlySThRRGJQTWo2cnVYVm1RWUxiRTBP?= =?utf-8?B?MGoremN4WGw5R0czNEkzSHRzLzBRYjNxVzNIWlNsR0VLQU5JN3oxVEI0SSta?= =?utf-8?B?b21wZm1xdDJlUFVWQ1hrTTR5a3lNODZCQU1HbG9PSzVWQlJhSDZDQjJsbTgx?= =?utf-8?B?OUpKT3BJUWNIaDE1ZkFvQ3Q2djd0ZEFndmw5VnZ3ci8yMHp3bVAxQXhZV00y?= =?utf-8?B?eTFBdElZdmNoQ1B4Yng0UndWZ3kzZ1lEdVpFZXZqVytvV3J4ckRVVXRtM1ZY?= =?utf-8?B?L1VZL1M3dHc0Um1IL2hPNmdBUjVzVlRIWGZIL0JORUFqTnpjOUI3NjFvd2VJ?= =?utf-8?B?WEJUYnpOUUw0RHIvL29FbUZJV2VzM1B5VHF6dWc0V2ZTbWJ6SGd6cDFZWGxr?= =?utf-8?B?YnE3STZ1b3ZEWGdVT1ZSTEphcG96SlVDNjNDbDE3YlFHVGR6dVNOSnpyWlZz?= =?utf-8?B?Q21sN25JTjBYeXVKMUpOQ0hIOW5kbXFCNU1UZk14STFwcHpObkV4SElwUGZ4?= =?utf-8?B?Vnc4V1NzNGFZaHZ0c1BGNzluQzN1bFdtLytZcFc3SGRRRnFWZFFWR0YvNGls?= =?utf-8?B?SlZxOERtSDZrL0s3L250cnc3MTRITjBFSnNkVmQzYWo0Uk1vUlFycHVOTTRk?= =?utf-8?B?ZUtZbmJuNjFORnR1T3BVSVZWZ3UwaWJDdXJFWHZLRmtCdnh5cHV1ODlQVVFU?= =?utf-8?Q?Yc9D6ZLWukFZnrrBaFGffQVfsiiiKzIFn5cHb2D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB0903; 6:beXOudNqoZkSchavsLAcuijUJcsQGdprLwbD4WLSNHY1aYovX44pqAaShBBM01Q285icnZsCA4tmeIq08orTiGZsukb/FdzZ/etsduEVoZrOq6eHMqm0c6OUJG2oR9FWJqQrBwKtia6jlidyb7AojbEV75t8x9uMt/Ykp/ajcb18W6+MEoCPqOX7+xvh9H37aV0pLbAO6nW3pL20hDmBFGYkTib7r2vw3odMXB22725ALz58RXTtiQRXlLJ/+PYiF2mfgBEIVWKF9pECVkM72CHQrIGr8zlq+OoSnPZx/Rql5ZgennoAK9GiQRJQzqlRbfZ3AREqeUOlms9T6WNmkU9KW/4pvysErSAqgVGeglEvnEBrcv0gLqfapfkofCM7XWgii3l5XKvoF7Z6NkanGnz87wVhy9cj1iKTyzg6s6MptrWGmN1ikw7rThRddBDiUx85exnS2Pvnv3uYpAeocUGd+xHDn+8dtW9ntQC3vamaV58YJrJWw8IJpFfXE3UoqcuDN92EaKGybL9MTs/lDQ==; 5:8Ndg5IFxq8g2bpvpdDCLUpOG1UAlFmjGrEeji+Hq0VYy7XccaY/MsW7t8Hdmf7YCmoNRis/kxNaK9t+LVSxob5SW5uB4Q2ni6lbk618+9NyNUbpi/mVtqPeKfb9oR+V73+LrPGS+6fgKSOLpSOzQT08ubpz2JevqFROpuFxjWkTv0ROOpzkOSe12qbi4ExPV; 24:g/dGPClyhj1/wz2kNdYGdtWFBCy5+IRzDlsArp9OjKbvqrfTpc1Ja9K3qKCz0vQuV4/Sb0OeM+v4g0Mn4NAERDB3ouGJXzmb0gF7bMR4qFw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB0903; 7:B71E6T6iOTorQ/MH4vh6U/6j40XZbwNzoN4YsW1D+rcbCoxkQPuQIh7s1VoEoKyrhUXK19l3w0iRQK09fR2WoAeH9Wl39ZlihE8EK+RXPtFmHhwej/RZSc2PNiU8Vfn9TYZCg5FDN5b1C6F3KGIEHHGrNP1X4/zNPEy7RFycPyAypcWdkJl9jp8DWQoFmc8VIZ+GlaBMLFXNNOIiYoH+LzkiU5IBnlWyWvw0wIyFzAayfyie8yPYmGtBiRPmES4gsk8FIldNJWkP0h8GnvhMvHU69VpUDedNXjgYUhwDMbDT8U8Fj+/LVDrpY9TPInRTy9Nh84PgHYeTFEqJpyIOew== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2017 11:28:26.7785 (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: BY1PR0301MB0903 Subject: Re: [dpdk-dev] [PATCH v4 2/2] ethdev: add traffic management API 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, 24 May 2017 11:28:33 -0000 On 5/19/2017 10:42 PM, Cristian Dumitrescu wrote: > This patch introduces the generic ethdev API for the traffic manager > capability, which includes: hierarchical scheduling, traffic shaping, > congestion management, packet marking. > > Main features: > - Exposed as ethdev plugin capability (similar to rte_flow) > - Capability query API per port, per level and per node > - Scheduling algorithms: Strict Priority (SP), Weighed Fair Queuing (WFQ) > - Traffic shaping: single/dual rate, private (per node) and shared (by > multiple nodes) shapers > - Congestion management for hierarchy leaf nodes: algorithms of tail drop, > head drop, WRED; private (per node) and shared (by multiple nodes) WRED > contexts > - Packet marking: IEEE 802.1q (VLAN DEI), IETF RFC 3168 (IPv4/IPv6 ECN for > TCP and SCTP), IETF RFC 2597 (IPv4 / IPv6 DSCP) > > Signed-off-by: Cristian Dumitrescu > --- > Changes in v4: > - Implemented feedback from Hemant [6] > - Capability API: Reworked the port, level and node capability API > data structure to remove confusion due to "summary across all > nodes" approach, which made it unclear whether a particular > capability is supported by all nodes or by at least one node. > - Capability API: Added flags for "all nodes have identical > capability set" > - Suspended state: documented the required behavior in Doxygen > description > - Implemented feedback from Jerin [7] > - Node add: added level parameter (see new API function: > rte_tm_node_add_check_level()) > - RTE_TM_ETH_FRAMING_OVERHEAD, RTE_TM_ETH_FRAMING_OVERHEAD_FCS: > documented their usage in their Doxygen description > - Capability API: for each function, mention the related > capability field (Doxygen @see) > - stats_mask, capability_mask: document the enum flags used to > build each mask (Doxygen @see) > - Rename rte_tm_get_leaf_nodes() to > rte_tm_get_number_of_leaf_nodes() > - Doxygen: add @param[in, out] to the description of all API funcs > - Doxygen: fix hooks in doc/api/doxy-api-index.md > - Rename rte_tm_hierarchy_set() to rte_tm_hierarchy_commit(), improved > Doxygen description > - Node add, node delete: improved Doxygen description > - Fixed incorrect design assumption that packet-based weight mode for WFQ > is identical to WRR. As result, removed all references to WRR support. > Renamed the "scheduling mode" node parameters to "wfq_weight_mode". > > Changes in v3: > - Implemented feedback from Jerin [5] > - Changed naming convention: scheddev -> tm > - Improvements on the capability API: > - Specification of marking capabilities per color > - WFQ/WRR groups: sp_n_children_max -> > wfq_wrr_n_children_per_group_max, added wfq_wrr_n_groups_max, > improved description of both, improved description of > wfq_wrr_weight_max > - Dynamic updates: added KEEP_LEVEL and CHANGE_LEVEL for parent > update > - Enforced/documented restrictions for root node (node_add() and > update()) > - Enforced/documented shaper profile restrictions on PIR: PIR != 0, > PIR >= CIR > - Turned repetitive code in rte_tm.c into macro > - Removed dependency on rte_red.h file (added RED params to rte_tm.h) > - Color: removed "e_" from color names enum > - Fixed small Doxygen style issues > > Changes in v2: > - Implemented feedback from Hemant [4] > - Improvements on the capability API > - Added capability API for hierarchy level > - Merged stats capability into the capability API > - Added dynamic updates > - Added non-leaf/leaf union to the node capability structure > - Renamed sp_priority_min to sp_n_priorities_max, added > clarifications > - Fixed description for sp_n_children_max > - Clarified and enforced rule on node ID range for leaf and non-leaf nodes > - Added API functions to get node type (i.e. leaf/non-leaf): > get_leaf_nodes(), node_type_get() > - Added clarification for the root node: its creation, parent, role > - Macro NODE_ID_NULL as root node's parent > - Description of the node_add() and node_parent_update() API funcs > - Added clarification for the first time add vs. subsequent updates rule > - Cleaned up the description for the node_add() function > - Statistics API improvements > - Merged stats capability into the capability API > - Added API function node_stats_update() > - Added more stats per packet color > - Added more error types > - Fixed small Doxygen style issues > > Changes in v1 (since RFC [1]): > - Implemented as ethdev plugin (similar to rte_flow) as opposed to more > monolithic additions to ethdev itself > - Implemented feedback from Jerin [2] and Hemant [3]. Implemented all the > suggested items with only one exception, see the long list below, > hopefully nothing was forgotten. > - The item not done (hopefully for a good reason): driver-generated > object IDs. IMO the choice to have application-generated object IDs > adds marginal complexity to the driver (search ID function > required), but it provides huge simplification for the application. > The app does not need to worry about building & managing tree-like > structure for storing driver-generated object IDs, the app can use > its own convention for node IDs depending on the specific hierarchy > that it needs. Trivial example: identify all level-2 nodes with IDs > like 100, 200, 300, … and the level-3 nodes based on their level-2 > parents: 110, 120, 130, 140, …, 210, 220, 230, 240, …, 310, 320, > 330, … and level-4 nodes based on their level-3 parents: 111, 112, > 113, 114, …, 121, 122, 123, 124, …). Moreover, see the change log > for the other related simplification that was implemented: leaf > nodes now have predefined IDs that are the same with their Ethernet > TX queue ID ( therefore no translation is required for leaf nodes). > - Capability API. Done per port and per node as well. > - Dual rate shapers > - Added configuration of private shaper (per node) directly from the > shaper profile as part of node API (no shaper ID needed for private > shapers), while the shared shapers are configured outside of the node > API using shaper profile and communicated to the node using shared > shaper ID. So there is no configuration overhead for shared shapers if > the app does not use any of them. > - Leaf nodes now have predefined IDs that are the same with their Ethernet > TX queue ID (therefore no translation is required for leaf nodes). This > is also used to differentiate between a leaf node and a non-leaf node. > - Domain-specific errors to give a precise indication of the error cause > (same as done by rte_flow) > - Packet marking API > - Packet length optional adjustment for shapers, positive (e.g. for adding > Ethernet framing overhead of 20 bytes) or negative (e.g. for rate > limiting based on IP packet bytes) > > [1] RFC: http://dpdk.org/ml/archives/dev/2016-November/050956.html > [2] Jerin’s feedback on RFC: http://www.dpdk.org/ml/archives/dev/2017-January/054484.html > [3] Hemant’s feedback on RFC: http://www.dpdk.org/ml/archives/dev/2017-January/054866.html > [4] Hemant's feedback on v1: http://www.dpdk.org/ml/archives/dev/2017-February/058033.html > [5] Jerin's feedback on v1: http://www.dpdk.org/ml/archives/dev/2017-March/058895.html > [6] Hemant's feedback on v3: http://www.dpdk.org/ml/archives/dev/2017-March/062354.html > [7] Jerin's feedback on v3: http://www.dpdk.org/ml/archives/dev/2017-April/063429.html > > MAINTAINERS | 4 + > lib/librte_ether/Makefile | 5 +- > lib/librte_ether/rte_ether_version.map | 30 + > lib/librte_ether/rte_tm.c | 448 ++++++++ > lib/librte_ether/rte_tm.h | 1923 ++++++++++++++++++++++++++++++++ > lib/librte_ether/rte_tm_driver.h | 373 +++++++ > 6 files changed, 2782 insertions(+), 1 deletion(-) > create mode 100644 lib/librte_ether/rte_tm.c > create mode 100644 lib/librte_ether/rte_tm.h > create mode 100644 lib/librte_ether/rte_tm_driver.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index afb4cab..cdaf2ac 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -240,6 +240,10 @@ Flow API > M: Adrien Mazarguil > F: lib/librte_ether/rte_flow* > > +Traffic Management API > +M: Cristian Dumitrescu > +F: lib/librte_ether/rte_tm* > + > Crypto API > M: Declan Doherty > F: lib/librte_cryptodev/ > diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile > index 93fdde1..db692ae 100644 > --- a/lib/librte_ether/Makefile > +++ b/lib/librte_ether/Makefile > @@ -1,6 +1,6 @@ > # BSD LICENSE > # > -# Copyright(c) 2010-2016 Intel Corporation. All rights reserved. > +# Copyright(c) 2010-2017 Intel Corporation. All rights reserved. > # All rights reserved. > # > # Redistribution and use in source and binary forms, with or without > @@ -45,6 +45,7 @@ LIBABIVER := 6 > > SRCS-y += rte_ethdev.c > SRCS-y += rte_flow.c > +SRCS-y += rte_tm.c > > # > # Export include files > @@ -56,5 +57,7 @@ SYMLINK-y-include += rte_eth_ctrl.h > SYMLINK-y-include += rte_dev_info.h > SYMLINK-y-include += rte_flow.h > SYMLINK-y-include += rte_flow_driver.h > +SYMLINK-y-include += rte_tm.h > +SYMLINK-y-include += rte_tm_driver.h > > include $(RTE_SDK)/mk/rte.lib.mk > diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map > index ff056e8..7f39904 100644 > --- a/lib/librte_ether/rte_ether_version.map > +++ b/lib/librte_ether/rte_ether_version.map > @@ -161,4 +161,34 @@ DPDK_17.08 { > global: > > rte_eth_dev_tm_ops_get; > + rte_tm_get_leaf_nodes; > + rte_tm_node_type_get; > + rte_tm_capabilities_get; > + rte_tm_level_capabilities_get; > + rte_tm_node_capabilities_get; > + rte_tm_wred_profile_add; > + rte_tm_wred_profile_delete; > + rte_tm_shared_wred_context_add_update; > + rte_tm_shared_wred_context_delete; > + rte_tm_shaper_profile_add; > + rte_tm_shaper_profile_delete; > + rte_tm_shared_shaper_add_update; > + rte_tm_shared_shaper_delete; > + rte_tm_node_add; > + rte_tm_node_delete; > + rte_tm_node_suspend; > + rte_tm_node_resume; > + rte_tm_hierarchy_commit; > + rte_tm_node_parent_update; > + rte_tm_node_shaper_update; > + rte_tm_node_shared_shaper_update; > + rte_tm_node_stats_update; > + rte_tm_node_wfq_weight_mode_update; > + rte_tm_node_cman_update; > + rte_tm_node_wred_context_update; > + rte_tm_node_shared_wred_context_update; > + rte_tm_node_stats_read; > + rte_tm_mark_vlan_dei; > + rte_tm_mark_ip_ecn; > + rte_tm_mark_ip_dscp; > } DPDK_17.05 > diff --git a/lib/librte_ether/rte_tm.c b/lib/librte_ether/rte_tm.c > new file mode 100644 > index 0000000..2617a1a > --- /dev/null > +++ b/lib/librte_ether/rte_tm.c > @@ -0,0 +1,448 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2017 Intel Corporation. All rights reserved. > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * * Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in > + * the documentation and/or other materials provided with the > + * distribution. > + * * Neither the name of Intel Corporation nor the names of its > + * contributors may be used to endorse or promote products derived > + * from this software without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#include > + > +#include > +#include "rte_ethdev.h" > +#include "rte_tm_driver.h" > +#include "rte_tm.h" > + > +/* Get generic traffic manager operations structure from a port. */ > +const struct rte_tm_ops * > +rte_tm_ops_get(uint8_t port_id, struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + const struct rte_tm_ops *ops; > + > + if (!rte_eth_dev_is_valid_port(port_id)) { > + rte_tm_error_set(error, > + ENODEV, > + RTE_TM_ERROR_TYPE_UNSPECIFIED, > + NULL, > + rte_strerror(ENODEV)); > + return NULL; > + } > + > + if ((dev->dev_ops->tm_ops_get == NULL) || > + (dev->dev_ops->tm_ops_get(dev, &ops) != 0) || > + (ops == NULL)) { > + rte_tm_error_set(error, > + ENOSYS, > + RTE_TM_ERROR_TYPE_UNSPECIFIED, > + NULL, > + rte_strerror(ENOSYS)); > + return NULL; > + } > + > + return ops; > +} > + > +#define RTE_TM_FUNC(port_id, func) \ > +({ \ > + const struct rte_tm_ops *ops = \ > + rte_tm_ops_get(port_id, error); \ > + if (ops == NULL) \ > + return -rte_errno; \ > + \ > + if (ops->func == NULL) \ > + return -rte_tm_error_set(error, \ > + ENOSYS, \ > + RTE_TM_ERROR_TYPE_UNSPECIFIED, \ > + NULL, \ > + rte_strerror(ENOSYS)); \ > + \ > + ops->func; \ > +}) > + > +/* Get number of leaf nodes */ > +int > +rte_tm_get_number_of_leaf_nodes(uint8_t port_id, > + uint32_t *n_leaf_nodes, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + const struct rte_tm_ops *ops = > + rte_tm_ops_get(port_id, error); > + > + if (ops == NULL) > + return -rte_errno; > + > + if (n_leaf_nodes == NULL) { > + rte_tm_error_set(error, > + EINVAL, > + RTE_TM_ERROR_TYPE_UNSPECIFIED, > + NULL, > + rte_strerror(EINVAL)); > + return -rte_errno; > + } > + > + *n_leaf_nodes = dev->data->nb_tx_queues; > + return 0; > +} > + > +/* Check node type (leaf or non-leaf) */ > +int > +rte_tm_node_type_get(uint8_t port_id, > + uint32_t node_id, > + int *is_leaf, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_type_get)(dev, > + node_id, is_leaf, error); > +} > + > +/* Get node level */ > +int > +rte_tm_node_level_get(uint8_t port_id, > + uint32_t node_id, > + uint32_t *level_id, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_level_get)(dev, > + node_id, level_id, error); > +} > + > +/* Get capabilities */ > +int rte_tm_capabilities_get(uint8_t port_id, > + struct rte_tm_capabilities *cap, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, capabilities_get)(dev, > + cap, error); > +} > + > +/* Get level capabilities */ > +int rte_tm_level_capabilities_get(uint8_t port_id, > + uint32_t level_id, > + struct rte_tm_level_capabilities *cap, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, level_capabilities_get)(dev, > + level_id, cap, error); > +} > + > +/* Get node capabilities */ > +int rte_tm_node_capabilities_get(uint8_t port_id, > + uint32_t node_id, > + struct rte_tm_node_capabilities *cap, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_capabilities_get)(dev, > + node_id, cap, error); > +} > + > +/* Add WRED profile */ > +int rte_tm_wred_profile_add(uint8_t port_id, > + uint32_t wred_profile_id, > + struct rte_tm_wred_params *profile, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, wred_profile_add)(dev, > + wred_profile_id, profile, error); > +} > + > +/* Delete WRED profile */ > +int rte_tm_wred_profile_delete(uint8_t port_id, > + uint32_t wred_profile_id, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, wred_profile_delete)(dev, > + wred_profile_id, error); > +} > + > +/* Add/update shared WRED context */ > +int rte_tm_shared_wred_context_add_update(uint8_t port_id, > + uint32_t shared_wred_context_id, > + uint32_t wred_profile_id, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, shared_wred_context_add_update)(dev, > + shared_wred_context_id, wred_profile_id, error); > +} > + > +/* Delete shared WRED context */ > +int rte_tm_shared_wred_context_delete(uint8_t port_id, > + uint32_t shared_wred_context_id, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, shared_wred_context_delete)(dev, > + shared_wred_context_id, error); > +} > + > +/* Add shaper profile */ > +int rte_tm_shaper_profile_add(uint8_t port_id, > + uint32_t shaper_profile_id, > + struct rte_tm_shaper_params *profile, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, shaper_profile_add)(dev, > + shaper_profile_id, profile, error); > +} > + > +/* Delete WRED profile */ > +int rte_tm_shaper_profile_delete(uint8_t port_id, > + uint32_t shaper_profile_id, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, shaper_profile_delete)(dev, > + shaper_profile_id, error); > +} > + > +/* Add shared shaper */ > +int rte_tm_shared_shaper_add_update(uint8_t port_id, > + uint32_t shared_shaper_id, > + uint32_t shaper_profile_id, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, shared_shaper_add_update)(dev, > + shared_shaper_id, shaper_profile_id, error); > +} > + > +/* Delete shared shaper */ > +int rte_tm_shared_shaper_delete(uint8_t port_id, > + uint32_t shared_shaper_id, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, shared_shaper_delete)(dev, > + shared_shaper_id, error); > +} > + > +/* Add node to port traffic manager hierarchy */ > +int rte_tm_node_add(uint8_t port_id, > + uint32_t node_id, > + uint32_t parent_node_id, > + uint32_t priority, > + uint32_t weight, > + struct rte_tm_node_params *params, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_add)(dev, > + node_id, parent_node_id, priority, weight, params, error); > +} > + > +/* Delete node from traffic manager hierarchy */ > +int rte_tm_node_delete(uint8_t port_id, > + uint32_t node_id, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_delete)(dev, > + node_id, error); > +} > + > +/* Suspend node */ > +int rte_tm_node_suspend(uint8_t port_id, > + uint32_t node_id, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_suspend)(dev, > + node_id, error); > +} > + > +/* Resume node */ > +int rte_tm_node_resume(uint8_t port_id, > + uint32_t node_id, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_resume)(dev, > + node_id, error); > +} > + > +/* Commit the initial port traffic manager hierarchy */ > +int rte_tm_hierarchy_commit(uint8_t port_id, > + int clear_on_fail, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, hierarchy_commit)(dev, > + clear_on_fail, error); > +} > + > +/* Update node parent */ > +int rte_tm_node_parent_update(uint8_t port_id, > + uint32_t node_id, > + uint32_t parent_node_id, > + uint32_t priority, > + uint32_t weight, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_parent_update)(dev, > + node_id, parent_node_id, priority, weight, error); > +} > + > +/* Update node private shaper */ > +int rte_tm_node_shaper_update(uint8_t port_id, > + uint32_t node_id, > + uint32_t shaper_profile_id, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_shaper_update)(dev, > + node_id, shaper_profile_id, error); > +} > + > +/* Update node shared shapers */ > +int rte_tm_node_shared_shaper_update(uint8_t port_id, > + uint32_t node_id, > + uint32_t shared_shaper_id, > + int add, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_shared_shaper_update)(dev, > + node_id, shared_shaper_id, add, error); > +} > + > +/* Update node stats */ > +int rte_tm_node_stats_update(uint8_t port_id, > + uint32_t node_id, > + uint64_t stats_mask, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_stats_update)(dev, > + node_id, stats_mask, error); > +} > + > +/* Update WFQ weight mode */ > +int rte_tm_node_wfq_weight_mode_update(uint8_t port_id, > + uint32_t node_id, > + int *wfq_weight_mode, > + uint32_t n_sp_priorities, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_wfq_weight_mode_update)(dev, > + node_id, wfq_weight_mode, n_sp_priorities, error); > +} > + > +/* Update node congestion management mode */ > +int rte_tm_node_cman_update(uint8_t port_id, > + uint32_t node_id, > + enum rte_tm_cman_mode cman, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_cman_update)(dev, > + node_id, cman, error); > +} > + > +/* Update node private WRED context */ > +int rte_tm_node_wred_context_update(uint8_t port_id, > + uint32_t node_id, > + uint32_t wred_profile_id, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_wred_context_update)(dev, > + node_id, wred_profile_id, error); > +} > + > +/* Update node shared WRED context */ > +int rte_tm_node_shared_wred_context_update(uint8_t port_id, > + uint32_t node_id, > + uint32_t shared_wred_context_id, > + int add, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_shared_wred_context_update)(dev, > + node_id, shared_wred_context_id, add, error); > +} > + > +/* Read and/or clear stats counters for specific node */ > +int rte_tm_node_stats_read(uint8_t port_id, > + uint32_t node_id, > + struct rte_tm_node_stats *stats, > + uint64_t *stats_mask, > + int clear, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, node_stats_read)(dev, > + node_id, stats, stats_mask, clear, error); > +} > + > +/* Packet marking - VLAN DEI */ > +int rte_tm_mark_vlan_dei(uint8_t port_id, > + int mark_green, > + int mark_yellow, > + int mark_red, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, mark_vlan_dei)(dev, > + mark_green, mark_yellow, mark_red, error); > +} > + > +/* Packet marking - IPv4/IPv6 ECN */ > +int rte_tm_mark_ip_ecn(uint8_t port_id, > + int mark_green, > + int mark_yellow, > + int mark_red, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, mark_ip_ecn)(dev, > + mark_green, mark_yellow, mark_red, error); > +} > + > +/* Packet marking - IPv4/IPv6 DSCP */ > +int rte_tm_mark_ip_dscp(uint8_t port_id, > + int mark_green, > + int mark_yellow, > + int mark_red, > + struct rte_tm_error *error) > +{ > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > + return RTE_TM_FUNC(port_id, mark_ip_dscp)(dev, > + mark_green, mark_yellow, mark_red, error); > +} > diff --git a/lib/librte_ether/rte_tm.h b/lib/librte_ether/rte_tm.h > new file mode 100644 > index 0000000..22167c2 > --- /dev/null > +++ b/lib/librte_ether/rte_tm.h > @@ -0,0 +1,1923 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2017 Intel Corporation. All rights reserved. > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * * Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in > + * the documentation and/or other materials provided with the > + * distribution. > + * * Neither the name of Intel Corporation nor the names of its > + * contributors may be used to endorse or promote products derived > + * from this software without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#ifndef __INCLUDE_RTE_TM_H__ > +#define __INCLUDE_RTE_TM_H__ > + > +/** > + * @file > + * RTE Generic Traffic Manager API > + * > + * This interface provides the ability to configure the traffic manager in a > + * generic way. It includes features such as: hierarchical scheduling, > + * traffic shaping, congestion management, packet marking, etc. > + */ > + > +#include > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +/** > + * Ethernet framing overhead. > + * > + * Overhead fields per Ethernet frame: > + * 1. Preamble: 7 bytes; > + * 2. Start of Frame Delimiter (SFD): 1 byte; > + * 3. Inter-Frame Gap (IFG): 12 bytes. > + * > + * One of the typical values for the *pkt_length_adjust* field of the shaper > + * profile. > + * > + * @see struct rte_tm_shaper_params > + * > + */ > +#define RTE_TM_ETH_FRAMING_OVERHEAD 20 > + > +/** > + * Ethernet framing overhead including the Frame Check Sequence (FCS) field. > + * Useful when FCS is generated and added at the end of the Ethernet frame on > + * TX side without any SW intervention. > + * > + * One of the typical values for the pkt_length_adjust field of the shaper > + * profile. > + * > + * @see struct rte_tm_shaper_params > + */ > +#define RTE_TM_ETH_FRAMING_OVERHEAD_FCS 24 > + > +/**< Invalid WRED profile ID */ > +#define RTE_TM_WRED_PROFILE_ID_NONE UINT32_MAX > + > +/**< Invalid shaper profile ID */ > +#define RTE_TM_SHAPER_PROFILE_ID_NONE UINT32_MAX > + > +/**< Node ID for the parent of the root node */ > +#define RTE_TM_NODE_ID_NULL UINT32_MAX > + > +/** > + * Color > + */ > +enum rte_tm_color { > + RTE_TM_GREEN = 0, /**< Green */ > + RTE_TM_YELLOW, /**< Yellow */ > + RTE_TM_RED, /**< Red */ > + RTE_TM_COLORS /**< Number of colors */ > +}; > + > +/** > + * Node statistics counter type > + */ > +enum rte_tm_stats_type { > + /**< Number of packets scheduled from current node. */ > + RTE_TM_STATS_N_PKTS = 1 << 0, > + > + /**< Number of bytes scheduled from current node. */ > + RTE_TM_STATS_N_BYTES = 1 << 1, > + > + /**< Number of green packets dropped by current leaf node. */ > + RTE_TM_STATS_N_PKTS_GREEN_DROPPED = 1 << 2, > + > + /**< Number of yellow packets dropped by current leaf node. */ > + RTE_TM_STATS_N_PKTS_YELLOW_DROPPED = 1 << 3, > + > + /**< Number of red packets dropped by current leaf node. */ > + RTE_TM_STATS_N_PKTS_RED_DROPPED = 1 << 4, > + > + /**< Number of green bytes dropped by current leaf node. */ > + RTE_TM_STATS_N_BYTES_GREEN_DROPPED = 1 << 5, > + > + /**< Number of yellow bytes dropped by current leaf node. */ > + RTE_TM_STATS_N_BYTES_YELLOW_DROPPED = 1 << 6, > + > + /**< Number of red bytes dropped by current leaf node. */ > + RTE_TM_STATS_N_BYTES_RED_DROPPED = 1 << 7, > + > + /**< Number of packets currently waiting in the packet queue of current > + * leaf node. > + */ > + RTE_TM_STATS_N_PKTS_QUEUED = 1 << 8, > + > + /**< Number of bytes currently waiting in the packet queue of current > + * leaf node. > + */ > + RTE_TM_STATS_N_BYTES_QUEUED = 1 << 9, > +}; > + > +/** > + * Node statistics counters > + */ > +struct rte_tm_node_stats { > + /**< Number of packets scheduled from current node. */ > + uint64_t n_pkts; > + > + /**< Number of bytes scheduled from current node. */ > + uint64_t n_bytes; > + > + /**< Statistics counters for leaf nodes only. */ > + struct { > + /**< Number of packets dropped by current leaf node per each > + * color. > + */ > + uint64_t n_pkts_dropped[RTE_TM_COLORS]; > + > + /**< Number of bytes dropped by current leaf node per each > + * color. > + */ > + uint64_t n_bytes_dropped[RTE_TM_COLORS]; > + > + /**< Number of packets currently waiting in the packet queue of > + * current leaf node. > + */ > + uint64_t n_pkts_queued; > + > + /**< Number of bytes currently waiting in the packet queue of > + * current leaf node. > + */ > + uint64_t n_bytes_queued; > + } leaf; > +}; > + > +/** > + * Traffic manager dynamic updates > + */ > +enum rte_tm_dynamic_update_type { > + /**< Dynamic parent node update. The new parent node is located on same > + * hierarchy level as the former parent node. Consequently, the node > + * whose parent is changed preserves its hierarchy level. > + */ > + RTE_TM_UPDATE_NODE_PARENT_KEEP_LEVEL = 1 << 0, > + > + /**< Dynamic parent node update. The new parent node is located on > + * different hierarchy level than the former parent node. Consequently, > + * the node whose parent is changed also changes its hierarchy level. > + */ > + RTE_TM_UPDATE_NODE_PARENT_CHANGE_LEVEL = 1 << 1, > + > + /**< Dynamic node add/delete. */ > + RTE_TM_UPDATE_NODE_ADD_DELETE = 1 << 2, > + > + /**< Suspend/resume nodes. */ > + RTE_TM_UPDATE_NODE_SUSPEND_RESUME = 1 << 3, > + > + /**< Dynamic switch between byte-based and packet-based WFQ weights. */ > + RTE_TM_UPDATE_NODE_WFQ_WEIGHT_MODE = 1 << 4, > + > + /**< Dynamic update on number of SP priorities. */ > + RTE_TM_UPDATE_NODE_N_SP_PRIORITIES = 1 << 5, > + > + /**< Dynamic update of congestion management mode for leaf nodes. */ > + RTE_TM_UPDATE_NODE_CMAN = 1 << 6, > + > + /**< Dynamic update of the set of enabled stats counter types. */ > + RTE_TM_UPDATE_NODE_STATS = 1 << 7, > +}; > + > +/** > + * Traffic manager capabilities > + */ > +struct rte_tm_capabilities { > + /**< Maximum number of nodes. */ > + uint32_t n_nodes_max; > + > + /**< Maximum number of levels (i.e. number of nodes connecting the root > + * node with any leaf node, including the root and the leaf). > + */ > + uint32_t n_levels_max; > + > + /**< When non-zero, this flag indicates that all the non-leaf nodes > + * (with the exception of the root node) have identical capability set. > + */ > + int non_leaf_nodes_identical; > + > + /**< When non-zero, this flag indicates that all the leaf nodes have > + * identical capability set. > + */ > + int leaf_nodes_identical; > + > + /**< Maximum number of shapers, either private or shared. In case the > + * implementation does not share any resources between private and > + * shared shapers, it is typically equal to the sum of > + * *shaper_private_n_max* and *shaper_shared_n_max*. > + */ > + uint32_t shaper_n_max; > + > + /**< Maximum number of private shapers. Indicates the maximum number of > + * nodes that can concurrently have their private shaper enabled. > + */ > + uint32_t shaper_private_n_max; > + > + /**< Maximum number of private shapers that support dual rate shaping. > + * Indicates the maximum number of nodes that can concurrently have > + * their private shaper enabled with dual rate support. Only valid when > + * private shapers are supported. The value of zero indicates that dual > + * rate shaping is not available for private shapers. The maximum value > + * is *shaper_private_n_max*. > + */ > + int shaper_private_dual_rate_n_max; > + > + /**< Minimum committed/peak rate (bytes per second) for any private > + * shaper. Valid only when private shapers are supported. > + */ > + uint64_t shaper_private_rate_min; > + > + /**< Maximum committed/peak rate (bytes per second) for any private > + * shaper. Valid only when private shapers are supported. > + */ > + uint64_t shaper_private_rate_max; > + > + /**< Maximum number of shared shapers. The value of zero indicates that > + * shared shapers are not supported. > + */ > + uint32_t shaper_shared_n_max; > + > + /**< Maximum number of nodes that can share the same shared shaper. > + * Only valid when shared shapers are supported. > + */ > + uint32_t shaper_shared_n_nodes_per_shaper_max; > + > + /**< Maximum number of shared shapers a node can be part of. This > + * parameter indicates that there is at least one node that can be > + * configured with this many shared shapers, which might not be true for > + * all the nodes. Only valid when shared shapers are supported, in which > + * case it ranges from 1 to *shaper_shared_n_max*. > + */ > + uint32_t shaper_shared_n_shapers_per_node_max; > + > + /**< Maximum number of shared shapers that can be configured with dual > + * rate shaping. The value of zero indicates that dual rate shaping > + * support is not available for shared shapers. > + */ > + uint32_t shaper_shared_dual_rate_n_max; > + > + /**< Minimum committed/peak rate (bytes per second) for any shared > + * shaper. Only valid when shared shapers are supported. > + */ > + uint64_t shaper_shared_rate_min; > + > + /**< Maximum committed/peak rate (bytes per second) for any shared > + * shaper. Only valid when shared shapers are supported. > + */ > + uint64_t shaper_shared_rate_max; > + > + /**< Minimum value allowed for packet length adjustment for any private > + * or shared shaper. > + */ > + int shaper_pkt_length_adjust_min; > + > + /**< Maximum value allowed for packet length adjustment for any private > + * or shared shaper. > + */ > + int shaper_pkt_length_adjust_max; > + > + /**< Maximum number of children nodes. This parameter indicates that > + * there is at least one non-leaf node that can be configured with this > + * many children nodes, which might not be true for all the non-leaf > + * nodes. > + */ > + uint32_t sched_n_children_max; > + > + /**< Maximum number of supported priority levels. This parameter > + * indicates that there is at least one non-leaf node that can be > + * configured with this many priority levels for managing its children > + * nodes, which might not be true for all the non-leaf nodes. The value > + * of zero is invalid. The value of 1 indicates that only priority 0 is > + * supported, which essentially means that Strict Priority (SP) > + * algorithm is not supported. > + */ > + uint32_t sched_sp_n_priorities_max; > + > + /**< Maximum number of sibling nodes that can have the same priority at > + * any given time, i.e. maximum size of the WFQ sibling node group. This > + * parameter indicates there is at least one non-leaf node that meets > + * this condition, which might not be true for all the non-leaf nodes. > + * The value of zero is invalid. The value of 1 indicates that WFQ > + * algorithm is not supported. The maximum value is > + * *sched_n_children_max*. > + */ > + uint32_t sched_wfq_n_children_per_group_max; > + > + /**< Maximum number of priority levels that can have more than one child > + * node at any given time, i.e. maximum number of WFQ sibling node > + * groups that have two or more members. This parameter indicates there > + * is at least one non-leaf node that meets this condition, which might > + * not be true for all the non-leaf nodes. The value of zero states that > + * WFQ algorithm is not supported. The value of 1 indicates that > + * (*sched_sp_n_priorities_max* - 1) priority levels have at most one > + * child node, so there can be only one priority level with two or > + * more sibling nodes making up a WFQ group. The maximum value is: > + * min(floor(*sched_n_children_max* / 2), *sched_sp_n_priorities_max*). > + */ > + uint32_t sched_wfq_n_groups_max; > + > + /**< Maximum WFQ weight. The value of 1 indicates that all sibling nodes > + * with same priority have the same WFQ weight, so WFQ is reduced to FQ. > + */ > + uint32_t sched_wfq_weight_max; > + > + /**< Head drop algorithm support. When non-zero, this parameter > + * indicates that there is at least one leaf node that supports the head > + * drop algorithm, which might not be true for all the leaf nodes. > + */ > + int cman_head_drop_supported; > + > + /**< Maximum number of WRED contexts, either private or shared. In case > + * the implementation does not share any resources between private and > + * shared WRED contexts, it is typically equal to the sum of > + * *cman_wred_context_private_n_max* and > + * *cman_wred_context_shared_n_max*. > + */ > + uint32_t cman_wred_context_n_max; > + > + /**< Maximum number of private WRED contexts. Indicates the maximum > + * number of leaf nodes that can concurrently have their private WRED > + * context enabled. > + */ > + uint32_t cman_wred_context_private_n_max; > + > + /**< Maximum number of shared WRED contexts. The value of zero > + * indicates that shared WRED contexts are not supported. > + */ > + uint32_t cman_wred_context_shared_n_max; > + > + /**< Maximum number of leaf nodes that can share the same WRED context. > + * Only valid when shared WRED contexts are supported. > + */ > + uint32_t cman_wred_context_shared_n_nodes_per_context_max; > + > + /**< Maximum number of shared WRED contexts a leaf node can be part of. > + * This parameter indicates that there is at least one leaf node that > + * can be configured with this many shared WRED contexts, which might > + * not be true for all the leaf nodes. Only valid when shared WRED > + * contexts are supported, in which case it ranges from 1 to > + * *cman_wred_context_shared_n_max*. > + */ > + uint32_t cman_wred_context_shared_n_contexts_per_node_max; > + > + /**< Support for VLAN DEI packet marking (per color). */ > + int mark_vlan_dei_supported[RTE_TM_COLORS]; > + > + /**< Support for IPv4/IPv6 ECN marking of TCP packets (per color). */ > + int mark_ip_ecn_tcp_supported[RTE_TM_COLORS]; > + > + /**< Support for IPv4/IPv6 ECN marking of SCTP packets (per color). */ > + int mark_ip_ecn_sctp_supported[RTE_TM_COLORS]; > + > + /**< Support for IPv4/IPv6 DSCP packet marking (per color). */ > + int mark_ip_dscp_supported[RTE_TM_COLORS]; > + > + /**< Set of supported dynamic update operations. > + * @see enum rte_tm_dynamic_update_type > + */ > + uint64_t dynamic_update_mask; > + > + /**< Set of supported statistics counter types. > + * @see enum rte_tm_stats_type > + */ > + uint64_t stats_mask; > +}; > + > +/** > + * Traffic manager level capabilities > + */ > +struct rte_tm_level_capabilities { > + /**< Maximum number of nodes for the current hierarchy level. */ > + uint32_t n_nodes_max; > + > + /**< Maximum number of non-leaf nodes for the current hierarchy level. > + * The value of 0 indicates that current level only supports leaf > + * nodes. The maximum value is *n_nodes_max*. > + */ > + uint32_t n_nodes_nonleaf_max; > + > + /**< Maximum number of leaf nodes for the current hierarchy level. The > + * value of 0 indicates that current level only supports non-leaf > + * nodes. The maximum value is *n_nodes_max*. > + */ > + uint32_t n_nodes_leaf_max; > + > + /**< When non-zero, this flag indicates that all the non-leaf nodes on > + * this level have identical capability set. Valid only when > + * *n_nodes_nonleaf_max* is non-zero. > + */ > + int non_leaf_nodes_identical; > + > + /**< When non-zero, this flag indicates that all the leaf nodes on this > + * level have identical capability set. Valid only when > + * *n_nodes_leaf_max* is non-zero. > + */ > + int leaf_nodes_identical; > + > + union { > + /**< Items valid only for the non-leaf nodes on this level. */ > + struct { > + /**< Private shaper support. When non-zero, it indicates > + * there is at least one non-leaf node on this level > + * with private shaper support, which may not be the > + * case for all the non-leaf nodes on this level. > + */ > + int shaper_private_supported; > + > + /**< Dual rate support for private shaper. Valid only > + * when private shaper is supported for the non-leaf > + * nodes on the current level. When non-zero, it > + * indicates there is at least one non-leaf node on this > + * level with dual rate private shaper support, which > + * may not be the case for all the non-leaf nodes on > + * this level. > + */ > + int shaper_private_dual_rate_supported; > + > + /**< Minimum committed/peak rate (bytes per second) for > + * private shapers of the non-leaf nodes of this level. > + * Valid only when private shaper is supported on this > + * level. > + */ > + uint64_t shaper_private_rate_min; > + > + /**< Maximum committed/peak rate (bytes per second) for > + * private shapers of the non-leaf nodes on this level. > + * Valid only when private shaper is supported on this > + * level. > + */ > + uint64_t shaper_private_rate_max; > + > + /**< Maximum number of shared shapers that any non-leaf > + * node on this level can be part of. The value of zero > + * indicates that shared shapers are not supported by > + * the non-leaf nodes on this level. When non-zero, it > + * indicates there is at least one non-leaf node on this > + * level that meets this condition, which may not be the > + * case for all the non-leaf nodes on this level. > + */ > + uint32_t shaper_shared_n_max; > + > + /**< Maximum number of children nodes. This parameter > + * indicates that there is at least one non-leaf node on > + * this level that can be configured with this many > + * children nodes, which might not be true for all the > + * non-leaf nodes on this level. > + */ > + uint32_t sched_n_children_max; > + > + /**< Maximum number of supported priority levels. This > + * parameter indicates that there is at least one > + * non-leaf node on this level that can be configured > + * with this many priority levels for managing its > + * children nodes, which might not be true for all the > + * non-leaf nodes on this level. The value of zero is > + * invalid. The value of 1 indicates that only priority > + * 0 is supported, which essentially means that Strict > + * Priority (SP) algorithm is not supported on this > + * level. > + */ > + uint32_t sched_sp_n_priorities_max; > + > + /**< Maximum number of sibling nodes that can have the > + * same priority at any given time, i.e. maximum size of > + * the WFQ sibling node group. This parameter indicates > + * there is at least one non-leaf node on this level > + * that meets this condition, which may not be true for > + * all the non-leaf nodes on this level. The value of > + * zero is invalid. The value of 1 indicates that WFQ > + * algorithm is not supported on this level. The maximum > + * value is *sched_n_children_max*. > + */ > + uint32_t sched_wfq_n_children_per_group_max; > + > + /**< Maximum number of priority levels that can have > + * more than one child node at any given time, i.e. > + * maximum number of WFQ sibling node groups that > + * have two or more members. This parameter indicates > + * there is at least one non-leaf node on this level > + * that meets this condition, which might not be true > + * for all the non-leaf nodes. The value of zero states > + * that WFQ algorithm is not supported on this level. > + * The value of 1 indicates that > + * (*sched_sp_n_priorities_max* - 1) priority levels on > + * this level have at most one child node, so there can > + * be only one priority level with two or more sibling > + * nodes making up a WFQ group on this level. The > + * maximum value is: > + * min(floor(*sched_n_children_max* / 2), > + * *sched_sp_n_priorities_max*). > + */ > + uint32_t sched_wfq_n_groups_max; > + > + /**< Maximum WFQ weight. The value of 1 indicates that > + * all sibling nodes on this level with same priority > + * have the same WFQ weight, so on this level WFQ is > + * reduced to FQ. > + */ > + uint32_t sched_wfq_weight_max; > + > + /**< Mask of statistics counter types supported by the > + * non-leaf nodes on this level. Every supported > + * statistics counter type is supported by at least one > + * non-leaf node on this level, which may not be true > + * for all the non-leaf nodes on this level. > + * @see enum rte_tm_stats_type > + */ > + uint64_t stats_mask; > + } nonleaf; > + > + /**< Items valid only for the leaf nodes on this level. */ > + struct { > + /**< Private shaper support. When non-zero, it indicates > + * there is at least one leaf node on this level with > + * private shaper support, which may not be the case for > + * all the leaf nodes on this level. > + */ > + int shaper_private_supported; > + > + /**< Dual rate support for private shaper. Valid only > + * when private shaper is supported for the leaf nodes > + * on this level. When non-zero, it indicates there is > + * at least one leaf node on this level with dual rate > + * private shaper support, which may not be the case for > + * all the leaf nodes on this level. > + */ > + int shaper_private_dual_rate_supported; > + > + /**< Minimum committed/peak rate (bytes per second) for > + * private shapers of the leaf nodes of this level. > + * Valid only when private shaper is supported for the > + * leaf nodes on this level. > + */ > + uint64_t shaper_private_rate_min; > + > + /**< Maximum committed/peak rate (bytes per second) for > + * private shapers of the leaf nodes on this level. > + * Valid only when private shaper is supported for the > + * leaf nodes on this level. > + */ > + uint64_t shaper_private_rate_max; > + > + /**< Maximum number of shared shapers that any leaf node > + * on this level can be part of. The value of zero > + * indicates that shared shapers are not supported by > + * the leaf nodes on this level. When non-zero, it > + * indicates there is at least one leaf node on this > + * level that meets this condition, which may not be the > + * case for all the leaf nodes on this level. > + */ > + uint32_t shaper_shared_n_max; > + > + /**< Head drop algorithm support. When non-zero, this > + * parameter indicates that there is at least one leaf > + * node on this level that supports the head drop > + * algorithm, which might not be true for all the leaf > + * nodes on this level. > + */ > + int cman_head_drop_supported; > + > + /**< Private WRED context support. When non-zero, it > + * indicates there is at least one node on this level > + * with private WRED context support, which may not be > + * true for all the leaf nodes on this level. */ > + int cman_wred_context_private_supported; > + > + /**< Maximum number of shared WRED contexts that any > + * leaf node on this level can be part of. The value of > + * zero indicates that shared WRED contexts are not > + * supported by the leaf nodes on this level. When > + * non-zero, it indicates there is at least one leaf > + * node on this level that meets this condition, which > + * may not be the case for all the leaf nodes on this > + * level. > + */ > + uint32_t cman_wred_context_shared_n_max; > + > + /**< Mask of statistics counter types supported by the > + * leaf nodes on this level. Every supported statistics > + * counter type is supported by at least one leaf node > + * on this level, which may not be true for all the leaf > + * nodes on this level. > + * @see enum rte_tm_stats_type > + */ > + uint64_t stats_mask; > + } leaf; > + }; > +}; > + > +/** > + * Traffic manager node capabilities > + */ > +struct rte_tm_node_capabilities { > + /**< Private shaper support for the current node. */ > + int shaper_private_supported; > + > + /**< Dual rate shaping support for private shaper of current node. > + * Valid only when private shaper is supported by the current node. > + */ > + int shaper_private_dual_rate_supported; > + > + /**< Minimum committed/peak rate (bytes per second) for private > + * shaper of current node. Valid only when private shaper is supported > + * by the current node. > + */ > + uint64_t shaper_private_rate_min; > + > + /**< Maximum committed/peak rate (bytes per second) for private > + * shaper of current node. Valid only when private shaper is supported > + * by the current node. > + */ > + uint64_t shaper_private_rate_max; > + > + /**< Maximum number of shared shapers the current node can be part of. > + * The value of zero indicates that shared shapers are not supported by > + * the current node. > + */ > + uint32_t shaper_shared_n_max; > + > + union { > + /**< Items valid only for non-leaf nodes. */ > + struct { > + /**< Maximum number of children nodes. */ > + uint32_t sched_n_children_max; > + > + /**< Maximum number of supported priority levels. The > + * value of zero is invalid. The value of 1 indicates > + * that only priority 0 is supported, which essentially > + * means that Strict Priority (SP) algorithm is not > + * supported. > + */ > + uint32_t sched_sp_n_priorities_max; > + > + /**< Maximum number of sibling nodes that can have the > + * same priority at any given time, i.e. maximum size > + * of the WFQ sibling node group. The value of zero > + * is invalid. The value of 1 indicates that WFQ > + * algorithm is not supported. The maximum value is > + * *sched_n_children_max*. > + */ > + uint32_t sched_wfq_n_children_per_group_max; > + > + /**< Maximum number of priority levels that can have > + * more than one child node at any given time, i.e. > + * maximum number of WFQ sibling node groups that have > + * two or more members. The value of zero states that > + * WFQ algorithm is not supported. The value of 1 > + * indicates that (*sched_sp_n_priorities_max* - 1) > + * priority levels have at most one child node, so there > + * can be only one priority level with two or more > + * sibling nodes making up a WFQ group. The maximum > + * value is: min(floor(*sched_n_children_max* / 2), > + * *sched_sp_n_priorities_max*). > + */ > + uint32_t sched_wfq_n_groups_max; > + > + /**< Maximum WFQ weight. The value of 1 indicates that > + * all sibling nodes with same priority have the same > + * WFQ weight, so WFQ is reduced to FQ. > + */ > + uint32_t sched_wfq_weight_max; > + } nonleaf; > + > + /**< Items valid only for leaf nodes. */ > + struct { > + /**< Head drop algorithm support for current node. */ > + int cman_head_drop_supported; > + > + /**< Private WRED context support for current node. */ > + int cman_wred_context_private_supported; > + > + /**< Maximum number of shared WRED contexts the current > + * node can be part of. The value of zero indicates that > + * shared WRED contexts are not supported by the current > + * node. > + */ > + uint32_t cman_wred_context_shared_n_max; > + } leaf; > + }; > + > + /**< Mask of statistics counter types supported by the current node. > + * @see enum rte_tm_stats_type > + */ > + uint64_t stats_mask; > +}; > + > +/** > + * Congestion management (CMAN) mode > + * > + * This is used for controlling the admission of packets into a packet queue or > + * group of packet queues on congestion. On request of writing a new packet > + * into the current queue while the queue is full, the *tail drop* algorithm > + * drops the new packet while leaving the queue unmodified, as opposed to *head > + * drop* algorithm, which drops the packet at the head of the queue (the oldest > + * packet waiting in the queue) and admits the new packet at the tail of the > + * queue. > + * > + * The *Random Early Detection (RED)* algorithm works by proactively dropping > + * more and more input packets as the queue occupancy builds up. When the queue > + * is full or almost full, RED effectively works as *tail drop*. The *Weighted > + * RED* algorithm uses a separate set of RED thresholds for each packet color. > + */ > +enum rte_tm_cman_mode { > + RTE_TM_CMAN_TAIL_DROP = 0, /**< Tail drop */ > + RTE_TM_CMAN_HEAD_DROP, /**< Head drop */ > + RTE_TM_CMAN_WRED, /**< Weighted Random Early Detection (WRED) */ > +}; > + > +/** > + * Random Early Detection (RED) profile > + */ > +struct rte_tm_red_params { > + /**< Minimum queue threshold */ > + uint16_t min_th; > + > + /**< Maximum queue threshold */ > + uint16_t max_th; > + > + /**< Inverse of packet marking probability maximum value (maxp), i.e. > + * maxp_inv = 1 / maxp > + */ > + uint16_t maxp_inv; > + > + /**< Negated log2 of queue weight (wq), i.e. wq = 1 / (2 ^ wq_log2) */ > + uint16_t wq_log2; > +}; > + > +/** > + * Weighted RED (WRED) profile > + * > + * Multiple WRED contexts can share the same WRED profile. Each leaf node with > + * WRED enabled as its congestion management mode has zero or one private WRED > + * context (only one leaf node using it) and/or zero, one or several shared > + * WRED contexts (multiple leaf nodes use the same WRED context). A private > + * WRED context is used to perform congestion management for a single leaf > + * node, while a shared WRED context is used to perform congestion management > + * for a group of leaf nodes. > + */ > +struct rte_tm_wred_params { > + /**< One set of RED parameters per packet color */ > + struct rte_tm_red_params red_params[RTE_TM_COLORS]; > +}; > + > +/** > + * Token bucket > + */ > +struct rte_tm_token_bucket { > + /**< Token bucket rate (bytes per second) */ > + uint64_t rate; > + > + /**< Token bucket size (bytes), a.k.a. max burst size */ > + uint64_t size; > +}; > + > +/** > + * Shaper (rate limiter) profile > + * > + * Multiple shaper instances can share the same shaper profile. Each node has > + * zero or one private shaper (only one node using it) and/or zero, one or > + * several shared shapers (multiple nodes use the same shaper instance). > + * A private shaper is used to perform traffic shaping for a single node, while > + * a shared shaper is used to perform traffic shaping for a group of nodes. > + * > + * Single rate shapers use a single token bucket. A single rate shaper can be > + * configured by setting the rate of the committed bucket to zero, which > + * effectively disables this bucket. The peak bucket is used to limit the rate > + * and the burst size for the current shaper. > + * > + * Dual rate shapers use both the committed and the peak token buckets. The > + * rate of the peak bucket has to be bigger than zero, as well as greater than > + * or equal to the rate of the committed bucket. > + */ > +struct rte_tm_shaper_params { > + /**< Committed token bucket */ > + struct rte_tm_token_bucket committed; > + > + /**< Peak token bucket */ > + struct rte_tm_token_bucket peak; > + > + /**< Signed value to be added to the length of each packet for the > + * purpose of shaping. Can be used to correct the packet length with > + * the framing overhead bytes that are also consumed on the wire (e.g. > + * RTE_TM_ETH_FRAMING_OVERHEAD_FCS). > + */ > + int32_t pkt_length_adjust; > +}; > + > +/** > + * Node parameters > + * > + * Each non-leaf node has multiple inputs (its children nodes) and single output > + * (which is input to its parent node). It arbitrates its inputs using Strict > + * Priority (SP) and Weighted Fair Queuing (WFQ) algorithms to schedule input > + * packets to its output while observing its shaping (rate limiting) > + * constraints. > + * > + * Algorithms such as Weighted Round Robin (WRR), Byte-level WRR, Deficit WRR > + * (DWRR), etc. are considered approximations of the WFQ ideal and are > + * assimilated to WFQ, although an associated implementation-dependent trade-off > + * on accuracy, performance and resource usage might exist. > + * > + * Children nodes with different priorities are scheduled using the SP algorithm > + * based on their priority, with zero (0) as the highest priority. Children with > + * the same priority are scheduled using the WFQ algorithm according to their > + * weights. The WFQ weight of a given child node is relative to the sum of the > + * weights of all its sibling nodes that have the same priority, with one (1) as > + * the lowest weight. For each SP priority, the WFQ weight mode can be set as > + * either byte-based or packet-based. > + * > + * Each leaf node sits on top of a TX queue of the current Ethernet port. Hence, > + * the leaf nodes are predefined, with their node IDs set to 0 .. (N-1), where N > + * is the number of TX queues configured for the current Ethernet port. The > + * non-leaf nodes have their IDs generated by the application. > + */ > +struct rte_tm_node_params { > + /**< Shaper profile for the private shaper. The absence of the private > + * shaper for the current node is indicated by setting this parameter > + * to RTE_TM_SHAPER_PROFILE_ID_NONE. > + */ > + uint32_t shaper_profile_id; > + > + /**< User allocated array of valid shared shaper IDs. */ > + uint32_t *shared_shaper_id; > + > + /**< Number of shared shaper IDs in the *shared_shaper_id* array. */ > + uint32_t n_shared_shapers; > + > + union { > + /**< Parameters only valid for non-leaf nodes. */ > + struct { > + /**< WFQ weight mode for each SP priority. When NULL, it > + * indicates that WFQ is to be used for all priorities. > + * When non-NULL, it points to a pre-allocated array of > + * *n_sp_priorities* values, with non-zero value for > + * byte-mode and zero for packet-mode. > + */ > + int *wfq_weight_mode; > + > + /**< Number of SP priorities. */ > + uint32_t n_sp_priorities; > + } nonleaf; > + > + /**< Parameters only valid for leaf nodes. */ > + struct { > + /**< Congestion management mode */ > + enum rte_tm_cman_mode cman; > + > + /**< WRED parameters (only valid when *cman* is set to > + * WRED). > + */ > + struct { > + /**< WRED profile for private WRED context. The > + * absence of a private WRED context for the > + * current leaf node is indicated by value > + * RTE_TM_WRED_PROFILE_ID_NONE. > + */ > + uint32_t wred_profile_id; > + > + /**< User allocated array of shared WRED context > + * IDs. When set to NULL, it indicates that the > + * current leaf node should not currently be > + * part of any shared WRED contexts. > + */ > + uint32_t *shared_wred_context_id; > + > + /**< Number of elements in the > + * *shared_wred_context_id* array. Only valid > + * when *shared_wred_context_id* is non-NULL, > + * in which case it should be non-zero. > + */ > + uint32_t n_shared_wred_contexts; > + } wred; > + } leaf; > + }; > + > + /**< Mask of statistics counter types to be enabled for this node. This > + * needs to be a subset of the statistics counter types available for > + * the current node. Any statistics counter type not included in this > + * set is to be disabled for the current node. > + * @see enum rte_tm_stats_type > + */ > + uint64_t stats_mask; > +}; > + > +/** > + * Verbose error types. > + * > + * Most of them provide the type of the object referenced by struct > + * rte_tm_error::cause. > + */ > +enum rte_tm_error_type { > + RTE_TM_ERROR_TYPE_NONE, /**< No error. */ > + RTE_TM_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */ > + RTE_TM_ERROR_TYPE_CAPABILITIES, > + RTE_TM_ERROR_TYPE_LEVEL_ID, > + RTE_TM_ERROR_TYPE_WRED_PROFILE, > + RTE_TM_ERROR_TYPE_WRED_PROFILE_GREEN, > + RTE_TM_ERROR_TYPE_WRED_PROFILE_YELLOW, > + RTE_TM_ERROR_TYPE_WRED_PROFILE_RED, > + RTE_TM_ERROR_TYPE_WRED_PROFILE_ID, > + RTE_TM_ERROR_TYPE_SHARED_WRED_CONTEXT_ID, > + RTE_TM_ERROR_TYPE_SHAPER_PROFILE, > + RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_RATE, > + RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_SIZE, > + RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE, > + RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE, > + RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN, > + RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID, > + RTE_TM_ERROR_TYPE_SHARED_SHAPER_ID, > + RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID, > + RTE_TM_ERROR_TYPE_NODE_PRIORITY, > + RTE_TM_ERROR_TYPE_NODE_WEIGHT, > + RTE_TM_ERROR_TYPE_NODE_PARAMS, > + RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID, > + RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_SHAPER_ID, > + RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS, > + RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE, > + RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES, > + RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN, > + RTE_TM_ERROR_TYPE_NODE_PARAMS_WRED_PROFILE_ID, > + RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_WRED_CONTEXT_ID, > + RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_WRED_CONTEXTS, > + RTE_TM_ERROR_TYPE_NODE_PARAMS_STATS, > + RTE_TM_ERROR_TYPE_NODE_ID, > +}; > + > +/** > + * Verbose error structure definition. > + * > + * This object is normally allocated by applications and set by PMDs, the > + * message points to a constant string which does not need to be freed by > + * the application, however its pointer can be considered valid only as long > + * as its associated DPDK port remains configured. Closing the underlying > + * device or unloading the PMD invalidates it. > + * > + * Both cause and message may be NULL regardless of the error type. > + */ > +struct rte_tm_error { > + enum rte_tm_error_type type; /**< Cause field and error type. */ > + const void *cause; /**< Object responsible for the error. */ > + const char *message; /**< Human-readable error message. */ > +}; > + > +/** > + * Traffic manager get number of leaf nodes > + * > + * Each leaf node sits on on top of a TX queue of the current Ethernet port. > + * Therefore, the set of leaf nodes is predefined, their number is always equal > + * to N (where N is the number of TX queues configured for the current port) > + * and their IDs are 0 .. (N-1). > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[out] n_leaf_nodes > + * Number of leaf nodes for the current port. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_get_number_of_leaf_nodes(uint8_t port_id, > + uint32_t *n_leaf_nodes, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node type (i.e. leaf or non-leaf) get > + * > + * The leaf nodes have predefined IDs in the range of 0 .. (N-1), where N is > + * the number of TX queues of the current Ethernet port. The non-leaf nodes > + * have their IDs generated by the application outside of the above range, > + * which is reserved for leaf nodes. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID value. Needs to be valid. > + * @param[out] is_leaf > + * Set to non-zero value when node is leaf and to zero otherwise (non-leaf). > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_node_type_get(uint8_t port_id, > + uint32_t node_id, > + int *is_leaf, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node level get > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID value. Needs to be valid. > + * @param[out] level_id > + * Node level ID. Needs to be non-NULL. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_node_level_get(uint8_t port_id, > + uint32_t node_id, > + uint32_t *level_id, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager capabilities get > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[out] cap > + * Traffic manager capabilities. Needs to be pre-allocated and valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_capabilities_get(uint8_t port_id, > + struct rte_tm_capabilities *cap, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager level capabilities get > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] level_id > + * The hierarchy level identifier. The value of 0 identifies the level of the > + * root node. > + * @param[out] cap > + * Traffic manager level capabilities. Needs to be pre-allocated and valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_level_capabilities_get(uint8_t port_id, > + uint32_t level_id, > + struct rte_tm_level_capabilities *cap, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node capabilities get > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be valid. > + * @param[out] cap > + * Traffic manager node capabilities. Needs to be pre-allocated and valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_node_capabilities_get(uint8_t port_id, > + uint32_t node_id, > + struct rte_tm_node_capabilities *cap, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager WRED profile add > + * > + * Create a new WRED profile with ID set to *wred_profile_id*. The new profile > + * is used to create one or several WRED contexts. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] wred_profile_id > + * WRED profile ID for the new profile. Needs to be unused. > + * @param[in] profile > + * WRED profile parameters. Needs to be pre-allocated and valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_wred_profile_add(uint8_t port_id, > + uint32_t wred_profile_id, > + struct rte_tm_wred_params *profile, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager WRED profile delete > + * > + * Delete an existing WRED profile. This operation fails when there is > + * currently at least one user (i.e. WRED context) of this WRED profile. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] wred_profile_id > + * WRED profile ID. Needs to be the valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_wred_profile_delete(uint8_t port_id, > + uint32_t wred_profile_id, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager shared WRED context add or update > + * > + * When *shared_wred_context_id* is invalid, a new WRED context with this ID is > + * created by using the WRED profile identified by *wred_profile_id*. > + * > + * When *shared_wred_context_id* is valid, this WRED context is no longer using > + * the profile previously assigned to it and is updated to use the profile > + * identified by *wred_profile_id*. > + * > + * A valid shared WRED context can be assigned to several hierarchy leaf nodes > + * configured to use WRED as the congestion management mode. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] shared_wred_context_id > + * Shared WRED context ID > + * @param[in] wred_profile_id > + * WRED profile ID. Needs to be the valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_shared_wred_context_add_update(uint8_t port_id, > + uint32_t shared_wred_context_id, > + uint32_t wred_profile_id, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager shared WRED context delete > + * > + * Delete an existing shared WRED context. This operation fails when there is > + * currently at least one user (i.e. hierarchy leaf node) of this shared WRED > + * context. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] shared_wred_context_id > + * Shared WRED context ID. Needs to be the valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_shared_wred_context_delete(uint8_t port_id, > + uint32_t shared_wred_context_id, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager shaper profile add > + * > + * Create a new shaper profile with ID set to *shaper_profile_id*. The new > + * shaper profile is used to create one or several shapers. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] shaper_profile_id > + * Shaper profile ID for the new profile. Needs to be unused. > + * @param[in] profile > + * Shaper profile parameters. Needs to be pre-allocated and valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_shaper_profile_add(uint8_t port_id, > + uint32_t shaper_profile_id, > + struct rte_tm_shaper_params *profile, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager shaper profile delete > + * > + * Delete an existing shaper profile. This operation fails when there is > + * currently at least one user (i.e. shaper) of this shaper profile. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] shaper_profile_id > + * Shaper profile ID. Needs to be the valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_shaper_profile_delete(uint8_t port_id, > + uint32_t shaper_profile_id, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager shared shaper add or update > + * > + * When *shared_shaper_id* is not a valid shared shaper ID, a new shared shaper > + * with this ID is created using the shaper profile identified by > + * *shaper_profile_id*. > + * > + * When *shared_shaper_id* is a valid shared shaper ID, this shared shaper is > + * no longer using the shaper profile previously assigned to it and is updated > + * to use the shaper profile identified by *shaper_profile_id*. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] shared_shaper_id > + * Shared shaper ID > + * @param[in] shaper_profile_id > + * Shaper profile ID. Needs to be the valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_shared_shaper_add_update(uint8_t port_id, > + uint32_t shared_shaper_id, > + uint32_t shaper_profile_id, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager shared shaper delete > + * > + * Delete an existing shared shaper. This operation fails when there is > + * currently at least one user (i.e. hierarchy node) of this shared shaper. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] shared_shaper_id > + * Shared shaper ID. Needs to be the valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_shared_shaper_delete(uint8_t port_id, > + uint32_t shared_shaper_id, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node add > + * > + * Create new node and connect it as child of an existing node. The new node is > + * further identified by *node_id*, which needs to be unused by any of the > + * existing nodes. The parent node is identified by *parent_node_id*, which > + * needs to be the valid ID of an existing non-leaf node. The parent node is > + * going to use the provided SP *priority* and WFQ *weight* to schedule its new > + * child node. > + * > + * This function has to be called for both leaf and non-leaf nodes. In the case > + * of leaf nodes (i.e. *node_id* is within the range of 0 .. (N-1), with N as > + * the number of configured TX queues of the current port), the leaf node is > + * configured rather than created (as the set of leaf nodes is predefined) and > + * it is also connected as child of an existing node. > + * > + * The first node that is added becomes the root node and all the nodes that > + * are subsequently added have to be added as descendants of the root node. The > + * parent of the root node has to be specified as RTE_TM_NODE_ID_NULL and there > + * can only be one node with this parent ID (i.e. the root node). Further > + * restrictions for root node: needs to be non-leaf, its private shaper profile > + * needs to be valid and single rate, cannot use any shared shapers. > + * > + * When called before rte_tm_hierarchy_commit() invocation, this function is > + * typically used to define the initial start-up hierarchy for the port. > + * Provided that dynamic hierarchy updates are supported by the current port (as > + * advertised in the port capability set), this function can be also called > + * after the rte_tm_hierarchy_commit() invocation. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be unused by any of the existing nodes. > + * @param[in] parent_node_id > + * Parent node ID. Needs to be the valid. > + * @param[in] priority > + * Node priority. The highest node priority is zero. Used by the SP algorithm > + * running on the parent of the current node for scheduling this child node. > + * @param[in] weight > + * Node weight. The node weight is relative to the weight sum of all siblings > + * that have the same priority. The lowest weight is one. Used by the WFQ > + * algorithm running on the parent of the current node for scheduling this > + * child node. > + * @param[in] params > + * Node parameters. Needs to be pre-allocated and valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + * > + * @see rte_tm_hierarchy_commit() > + * @see RTE_TM_UPDATE_NODE_ADD_DELETE > + */ > +int > +rte_tm_node_add(uint8_t port_id, > + uint32_t node_id, > + uint32_t parent_node_id, > + uint32_t priority, > + uint32_t weight, > + struct rte_tm_node_params *params, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node add with node level check > + * > + * Simple rte_tm_node_add() wrapper that also checks the node level. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be unused by any of the existing nodes. > + * @param[in] parent_node_id > + * Parent node ID. Needs to be the valid. > + * @param[in] priority > + * Node priority. The highest node priority is zero. Used by the SP algorithm > + * running on the parent of the current node for scheduling this child node. > + * @param[in] weight > + * Node weight. The node weight is relative to the weight sum of all siblings > + * that have the same priority. The lowest weight is one. Used by the WFQ > + * algorithm running on the parent of the current node for scheduling this > + * child node. > + * @param[in] level_id > + * Level ID that should be met by this node. > + * @param[in] params > + * Node parameters. Needs to be pre-allocated and valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +static inline int > +rte_tm_node_add_check_level(uint8_t port_id, > + uint32_t node_id, > + uint32_t parent_node_id, > + uint32_t priority, > + uint32_t weight, > + uint32_t level_id, > + struct rte_tm_node_params *params, > + struct rte_tm_error *error) > +{ > + uint32_t lid; > + int status; > + > + status = rte_tm_node_add(port_id, node_id, > + parent_node_id, priority, weight, params, error); > + if (status) > + return status; > + > + status = rte_tm_node_level_get(port_id, node_id, &lid, error); > + if (status) > + return status; > + > + if (lid != level_id){ > + if (error){ > + error->type = RTE_TM_ERROR_TYPE_LEVEL_ID; > + error->cause = NULL; > + error->message = rte_strerror(EINVAL); > + } > + rte_errno = EINVAL; > + return -EINVAL; > + } > + > + return 0; > +} > + > +/** > + * Traffic manager node delete > + * > + * Delete an existing node. This operation fails when this node currently has > + * at least one user (i.e. child node). > + * > + * When called before rte_tm_hierarchy_commit() invocation, this function is > + * typically used to define the initial start-up hierarchy for the port. > + * Provided that dynamic hierarchy updates are supported by the current port (as > + * advertised in the port capability set), this function can be also called > + * after the rte_tm_hierarchy_commit() invocation. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + * > + * @see RTE_TM_UPDATE_NODE_ADD_DELETE > + */ > +int > +rte_tm_node_delete(uint8_t port_id, > + uint32_t node_id, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node suspend > + * > + * Suspend an existing node. While the node is in suspended state, no packet is > + * scheduled from this node and its descendants. The node exits the suspended > + * state through the node resume operation. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + * > + * @see rte_tm_node_resume() > + * @see RTE_TM_UPDATE_NODE_SUSPEND_RESUME > + */ > +int > +rte_tm_node_suspend(uint8_t port_id, > + uint32_t node_id, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node resume > + * > + * Resume an existing node that is currently in suspended state. The node > + * entered the suspended state as result of a previous node suspend operation. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be valid. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + * > + * @see rte_tm_node_suspend() > + * @see RTE_TM_UPDATE_NODE_SUSPEND_RESUME > + */ > +int > +rte_tm_node_resume(uint8_t port_id, > + uint32_t node_id, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager hierarchy commit > + * > + * This function is called during the port initialization phase (before the > + * Ethernet port is started) to freeze the start-up hierarchy. > + * > + * This function typically performs the following steps: > + * a) It validates the start-up hierarchy that was previously defined for the > + * current port through successive rte_tm_node_add() invocations; > + * b) Assuming successful validation, it performs all the necessary port > + * specific configuration operations to install the specified hierarchy on > + * the current port, with immediate effect once the port is started. > + * > + * This function fails when the currently configured hierarchy is not supported > + * by the Ethernet port, in which case the user can abort or try out another > + * hierarchy configuration (e.g. a hierarchy with less leaf nodes), which can be > + * build from scratch (when *clear_on_fail* is enabled) or by modifying the > + * existing hierarchy configuration (when *clear_on_fail* is disabled). > + * > + * Note that this function can still fail due to other causes (e.g. not enough > + * memory available in the system, etc), even though the specified hierarchy is > + * supported in principle by the current port. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] clear_on_fail > + * On function call failure, hierarchy is cleared when this parameter is > + * non-zero and preserved when this parameter is equal to zero. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + * > + * @see rte_tm_node_add() > + * @see rte_tm_node_delete() > + */ > +int > +rte_tm_hierarchy_commit(uint8_t port_id, > + int clear_on_fail, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node parent update > + * > + * Restriction for root node: its parent cannot be changed. > + * > + * This function can only be called after the rte_tm_hierarchy_commit() > + * invocation. Its success depends on the port support for this operation, as > + * advertised through the port capability set. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be valid. > + * @param[in] parent_node_id > + * Node ID for the new parent. Needs to be valid. > + * @param[in] priority > + * Node priority. The highest node priority is zero. Used by the SP algorithm > + * running on the parent of the current node for scheduling this child node. > + * @param[in] weight > + * Node weight. The node weight is relative to the weight sum of all siblings > + * that have the same priority. The lowest weight is zero. Used by the WFQ > + * algorithm running on the parent of the current node for scheduling this > + * child node. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + * > + * @see RTE_TM_UPDATE_NODE_PARENT_KEEP_LEVEL > + * @see RTE_TM_UPDATE_NODE_PARENT_CHANGE_LEVEL > + */ > +int > +rte_tm_node_parent_update(uint8_t port_id, > + uint32_t node_id, > + uint32_t parent_node_id, > + uint32_t priority, > + uint32_t weight, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node private shaper update > + * > + * Restriction for the root node: its private shaper profile needs to be valid > + * and single rate. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be valid. > + * @param[in] shaper_profile_id > + * Shaper profile ID for the private shaper of the current node. Needs to be > + * either valid shaper profile ID or RTE_TM_SHAPER_PROFILE_ID_NONE, with > + * the latter disabling the private shaper of the current node. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_node_shaper_update(uint8_t port_id, > + uint32_t node_id, > + uint32_t shaper_profile_id, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node shared shapers update > + * > + * Restriction for root node: cannot use any shared rate shapers. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be valid. > + * @param[in] shared_shaper_id > + * Shared shaper ID. Needs to be valid. > + * @param[in] add > + * Set to non-zero value to add this shared shaper to current node or to zero > + * to delete this shared shaper from current node. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_node_shared_shaper_update(uint8_t port_id, > + uint32_t node_id, > + uint32_t shared_shaper_id, > + int add, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node enabled statistics counters update > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be valid. > + * @param[in] stats_mask > + * Mask of statistics counter types to be enabled for the current node. This > + * needs to be a subset of the statistics counter types available for the > + * current node. Any statistics counter type not included in this set is to > + * be disabled for the current node. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + * > + * @see enum rte_tm_stats_type > + * @see RTE_TM_UPDATE_NODE_STATS > + */ > +int > +rte_tm_node_stats_update(uint8_t port_id, > + uint32_t node_id, > + uint64_t stats_mask, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node WFQ weight mode update > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be valid leaf node ID. > + * @param[in] wfq_weight_mode > + * WFQ weight mode for each SP priority. When NULL, it indicates that WFQ is > + * to be used for all priorities. When non-NULL, it points to a pre-allocated > + * array of *n_sp_priorities* values, with non-zero value for byte-mode and > + * zero for packet-mode. > + * @param[in] n_sp_priorities > + * Number of SP priorities. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + * > + * @see RTE_TM_UPDATE_NODE_WFQ_WEIGHT_MODE > + * @see RTE_TM_UPDATE_NODE_N_SP_PRIORITIES > + */ > +int > +rte_tm_node_wfq_weight_mode_update(uint8_t port_id, > + uint32_t node_id, > + int *wfq_weight_mode, > + uint32_t n_sp_priorities, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node congestion management mode update > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be valid leaf node ID. > + * @param[in] cman > + * Congestion management mode. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + * > + * @see RTE_TM_UPDATE_NODE_CMAN > + */ > +int > +rte_tm_node_cman_update(uint8_t port_id, > + uint32_t node_id, > + enum rte_tm_cman_mode cman, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node private WRED context update > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be valid leaf node ID. > + * @param[in] wred_profile_id > + * WRED profile ID for the private WRED context of the current node. Needs to > + * be either valid WRED profile ID or RTE_TM_WRED_PROFILE_ID_NONE, with the > + * latter disabling the private WRED context of the current node. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_node_wred_context_update(uint8_t port_id, > + uint32_t node_id, > + uint32_t wred_profile_id, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node shared WRED context update > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be valid leaf node ID. > + * @param[in] shared_wred_context_id > + * Shared WRED context ID. Needs to be valid. > + * @param[in] add > + * Set to non-zero value to add this shared WRED context to current node or > + * to zero to delete this shared WRED context from current node. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +int > +rte_tm_node_shared_wred_context_update(uint8_t port_id, > + uint32_t node_id, > + uint32_t shared_wred_context_id, > + int add, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager node statistics counters read > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] node_id > + * Node ID. Needs to be valid. > + * @param[out] stats > + * When non-NULL, it contains the current value for the statistics counters > + * enabled for the current node. > + * @param[out] stats_mask > + * When non-NULL, it contains the mask of statistics counter types that are > + * currently enabled for this node, indicating which of the counters > + * retrieved with the *stats* structure are valid. > + * @param[in] clear > + * When this parameter has a non-zero value, the statistics counters are > + * cleared (i.e. set to zero) immediately after they have been read, > + * otherwise the statistics counters are left untouched. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + * > + * @see enum rte_tm_stats_type > + */ > +int > +rte_tm_node_stats_read(uint8_t port_id, > + uint32_t node_id, > + struct rte_tm_node_stats *stats, > + uint64_t *stats_mask, > + int clear, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager packet marking - VLAN DEI (IEEE 802.1Q) > + * > + * IEEE 802.1p maps the traffic class to the VLAN Priority Code Point (PCP) > + * field (3 bits), while IEEE 802.1q maps the drop priority to the VLAN Drop > + * Eligible Indicator (DEI) field (1 bit), which was previously named Canonical > + * Format Indicator (CFI). > + * > + * All VLAN frames of a given color get their DEI bit set if marking is enabled > + * for this color; otherwise, their DEI bit is left as is (either set or not). > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] mark_green > + * Set to non-zero value to enable marking of green packets and to zero to > + * disable it. > + * @param[in] mark_yellow > + * Set to non-zero value to enable marking of yellow packets and to zero to > + * disable it. > + * @param[in] mark_red > + * Set to non-zero value to enable marking of red packets and to zero to > + * disable it. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + * > + * @see struct rte_tm_capabilities::mark_vlan_dei_supported > + */ > +int > +rte_tm_mark_vlan_dei(uint8_t port_id, > + int mark_green, > + int mark_yellow, > + int mark_red, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager packet marking - IPv4 / IPv6 ECN (IETF RFC 3168) > + * > + * IETF RFCs 2474 and 3168 reorganize the IPv4 Type of Service (TOS) field > + * (8 bits) and the IPv6 Traffic Class (TC) field (8 bits) into Differentiated > + * Services Codepoint (DSCP) field (6 bits) and Explicit Congestion > + * Notification (ECN) field (2 bits). The DSCP field is typically used to > + * encode the traffic class and/or drop priority (RFC 2597), while the ECN > + * field is used by RFC 3168 to implement a congestion notification mechanism > + * to be leveraged by transport layer protocols such as TCP and SCTP that have > + * congestion control mechanisms. > + * > + * When congestion is experienced, as alternative to dropping the packet, > + * routers can change the ECN field of input packets from 2'b01 or 2'b10 > + * (values indicating that source endpoint is ECN-capable) to 2'b11 (meaning > + * that congestion is experienced). The destination endpoint can use the > + * ECN-Echo (ECE) TCP flag to relay the congestion indication back to the > + * source endpoint, which acknowledges it back to the destination endpoint with > + * the Congestion Window Reduced (CWR) TCP flag. > + * > + * All IPv4/IPv6 packets of a given color with ECN set to 2’b01 or 2’b10 > + * carrying TCP or SCTP have their ECN set to 2’b11 if the marking feature is > + * enabled for the current color, otherwise the ECN field is left as is. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] mark_green > + * Set to non-zero value to enable marking of green packets and to zero to > + * disable it. > + * @param[in] mark_yellow > + * Set to non-zero value to enable marking of yellow packets and to zero to > + * disable it. > + * @param[in] mark_red > + * Set to non-zero value to enable marking of red packets and to zero to > + * disable it. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + * > + * @see struct rte_tm_capabilities::mark_ip_ecn_tcp_supported > + * @see struct rte_tm_capabilities::mark_ip_ecn_sctp_supported > + */ > +int > +rte_tm_mark_ip_ecn(uint8_t port_id, > + int mark_green, > + int mark_yellow, > + int mark_red, > + struct rte_tm_error *error); > + > +/** > + * Traffic manager packet marking - IPv4 / IPv6 DSCP (IETF RFC 2597) > + * > + * IETF RFC 2597 maps the traffic class and the drop priority to the IPv4/IPv6 > + * Differentiated Services Codepoint (DSCP) field (6 bits). Here are the DSCP > + * values proposed by this RFC: > + * > + * Class 1 Class 2 Class 3 Class 4 > + * +----------+----------+----------+----------+ > + * Low Drop Prec | 001010 | 010010 | 011010 | 100010 | > + * Medium Drop Prec | 001100 | 010100 | 011100 | 100100 | > + * High Drop Prec | 001110 | 010110 | 011110 | 100110 | > + * +----------+----------+----------+----------+ > + * > + * There are 4 traffic classes (classes 1 .. 4) encoded by DSCP bits 1 and 2, > + * as well as 3 drop priorities (low/medium/high) encoded by DSCP bits 3 and 4. > + * > + * All IPv4/IPv6 packets have their color marked into DSCP bits 3 and 4 as > + * follows: green mapped to Low Drop Precedence (2’b01), yellow to Medium > + * (2’b10) and red to High (2’b11). Marking needs to be explicitly enabled > + * for each color; when not enabled for a given color, the DSCP field of all > + * packets with that color is left as is. > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] mark_green > + * Set to non-zero value to enable marking of green packets and to zero to > + * disable it. > + * @param[in] mark_yellow > + * Set to non-zero value to enable marking of yellow packets and to zero to > + * disable it. > + * @param[in] mark_red > + * Set to non-zero value to enable marking of red packets and to zero to > + * disable it. > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + * > + * @see struct rte_tm_capabilities::mark_ip_dscp_supported > + */ > +int > +rte_tm_mark_ip_dscp(uint8_t port_id, > + int mark_green, > + int mark_yellow, > + int mark_red, > + struct rte_tm_error *error); > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* __INCLUDE_RTE_TM_H__ */ > diff --git a/lib/librte_ether/rte_tm_driver.h b/lib/librte_ether/rte_tm_driver.h > new file mode 100644 > index 0000000..c25f102 > --- /dev/null > +++ b/lib/librte_ether/rte_tm_driver.h > @@ -0,0 +1,373 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2017 Intel Corporation. All rights reserved. > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * * Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in > + * the documentation and/or other materials provided with the > + * distribution. > + * * Neither the name of Intel Corporation nor the names of its > + * contributors may be used to endorse or promote products derived > + * from this software without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#ifndef __INCLUDE_RTE_TM_DRIVER_H__ > +#define __INCLUDE_RTE_TM_DRIVER_H__ > + > +/** > + * @file > + * RTE Generic Traffic Manager API (Driver Side) > + * > + * This file provides implementation helpers for internal use by PMDs, they > + * are not intended to be exposed to applications and are not subject to ABI > + * versioning. > + */ > + > +#include > + > +#include > +#include "rte_ethdev.h" > +#include "rte_tm.h" > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +typedef int (*rte_tm_node_type_get_t)(struct rte_eth_dev *dev, > + uint32_t node_id, > + int *is_leaf, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node type get */ > + > +typedef int (*rte_tm_node_level_get_t)(struct rte_eth_dev *dev, > + uint32_t node_id, > + uint32_t *level_id, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node level get */ > + > +typedef int (*rte_tm_capabilities_get_t)(struct rte_eth_dev *dev, > + struct rte_tm_capabilities *cap, > + struct rte_tm_error *error); > +/**< @internal Traffic manager capabilities get */ > + > +typedef int (*rte_tm_level_capabilities_get_t)(struct rte_eth_dev *dev, > + uint32_t level_id, > + struct rte_tm_level_capabilities *cap, > + struct rte_tm_error *error); > +/**< @internal Traffic manager level capabilities get */ > + > +typedef int (*rte_tm_node_capabilities_get_t)(struct rte_eth_dev *dev, > + uint32_t node_id, > + struct rte_tm_node_capabilities *cap, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node capabilities get */ > + > +typedef int (*rte_tm_wred_profile_add_t)(struct rte_eth_dev *dev, > + uint32_t wred_profile_id, > + struct rte_tm_wred_params *profile, > + struct rte_tm_error *error); > +/**< @internal Traffic manager WRED profile add */ > + > +typedef int (*rte_tm_wred_profile_delete_t)(struct rte_eth_dev *dev, > + uint32_t wred_profile_id, > + struct rte_tm_error *error); > +/**< @internal Traffic manager WRED profile delete */ > + > +typedef int (*rte_tm_shared_wred_context_add_update_t)( > + struct rte_eth_dev *dev, > + uint32_t shared_wred_context_id, > + uint32_t wred_profile_id, > + struct rte_tm_error *error); > +/**< @internal Traffic manager shared WRED context add */ > + > +typedef int (*rte_tm_shared_wred_context_delete_t)( > + struct rte_eth_dev *dev, > + uint32_t shared_wred_context_id, > + struct rte_tm_error *error); > +/**< @internal Traffic manager shared WRED context delete */ > + > +typedef int (*rte_tm_shaper_profile_add_t)(struct rte_eth_dev *dev, > + uint32_t shaper_profile_id, > + struct rte_tm_shaper_params *profile, > + struct rte_tm_error *error); > +/**< @internal Traffic manager shaper profile add */ > + > +typedef int (*rte_tm_shaper_profile_delete_t)(struct rte_eth_dev *dev, > + uint32_t shaper_profile_id, > + struct rte_tm_error *error); > +/**< @internal Traffic manager shaper profile delete */ > + > +typedef int (*rte_tm_shared_shaper_add_update_t)(struct rte_eth_dev *dev, > + uint32_t shared_shaper_id, > + uint32_t shaper_profile_id, > + struct rte_tm_error *error); > +/**< @internal Traffic manager shared shaper add/update */ > + > +typedef int (*rte_tm_shared_shaper_delete_t)(struct rte_eth_dev *dev, > + uint32_t shared_shaper_id, > + struct rte_tm_error *error); > +/**< @internal Traffic manager shared shaper delete */ > + > +typedef int (*rte_tm_node_add_t)(struct rte_eth_dev *dev, > + uint32_t node_id, > + uint32_t parent_node_id, > + uint32_t priority, > + uint32_t weight, > + struct rte_tm_node_params *params, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node add */ > + > +typedef int (*rte_tm_node_delete_t)(struct rte_eth_dev *dev, > + uint32_t node_id, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node delete */ > + > +typedef int (*rte_tm_node_suspend_t)(struct rte_eth_dev *dev, > + uint32_t node_id, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node suspend */ > + > +typedef int (*rte_tm_node_resume_t)(struct rte_eth_dev *dev, > + uint32_t node_id, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node resume */ > + > +typedef int (*rte_tm_hierarchy_commit_t)(struct rte_eth_dev *dev, > + int clear_on_fail, > + struct rte_tm_error *error); > +/**< @internal Traffic manager hierarchy commit */ > + > +typedef int (*rte_tm_node_parent_update_t)(struct rte_eth_dev *dev, > + uint32_t node_id, > + uint32_t parent_node_id, > + uint32_t priority, > + uint32_t weight, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node parent update */ > + > +typedef int (*rte_tm_node_shaper_update_t)(struct rte_eth_dev *dev, > + uint32_t node_id, > + uint32_t shaper_profile_id, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node shaper update */ > + > +typedef int (*rte_tm_node_shared_shaper_update_t)(struct rte_eth_dev *dev, > + uint32_t node_id, > + uint32_t shared_shaper_id, > + int32_t add, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node shaper update */ > + > +typedef int (*rte_tm_node_stats_update_t)(struct rte_eth_dev *dev, > + uint32_t node_id, > + uint64_t stats_mask, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node stats update */ > + > +typedef int (*rte_tm_node_wfq_weight_mode_update_t)( > + struct rte_eth_dev *dev, > + uint32_t node_id, > + int *wfq_weigth_mode, > + uint32_t n_sp_priorities, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node WFQ weight mode update */ > + > +typedef int (*rte_tm_node_cman_update_t)(struct rte_eth_dev *dev, > + uint32_t node_id, > + enum rte_tm_cman_mode cman, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node congestion management mode update */ > + > +typedef int (*rte_tm_node_wred_context_update_t)( > + struct rte_eth_dev *dev, > + uint32_t node_id, > + uint32_t wred_profile_id, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node WRED context update */ > + > +typedef int (*rte_tm_node_shared_wred_context_update_t)( > + struct rte_eth_dev *dev, > + uint32_t node_id, > + uint32_t shared_wred_context_id, > + int add, > + struct rte_tm_error *error); > +/**< @internal Traffic manager node WRED context update */ > + > +typedef int (*rte_tm_node_stats_read_t)(struct rte_eth_dev *dev, > + uint32_t node_id, > + struct rte_tm_node_stats *stats, > + uint64_t *stats_mask, > + int clear, > + struct rte_tm_error *error); > +/**< @internal Traffic manager read stats counters for specific node */ > + > +typedef int (*rte_tm_mark_vlan_dei_t)(struct rte_eth_dev *dev, > + int mark_green, > + int mark_yellow, > + int mark_red, > + struct rte_tm_error *error); > +/**< @internal Traffic manager packet marking - VLAN DEI */ > + > +typedef int (*rte_tm_mark_ip_ecn_t)(struct rte_eth_dev *dev, > + int mark_green, > + int mark_yellow, > + int mark_red, > + struct rte_tm_error *error); > +/**< @internal Traffic manager packet marking - IPv4/IPv6 ECN */ > + > +typedef int (*rte_tm_mark_ip_dscp_t)(struct rte_eth_dev *dev, > + int mark_green, > + int mark_yellow, > + int mark_red, > + struct rte_tm_error *error); > +/**< @internal Traffic manager packet marking - IPv4/IPv6 DSCP */ > + > +struct rte_tm_ops { > + /** Traffic manager node type get */ > + rte_tm_node_type_get_t node_type_get; > + /** Traffic manager node level get */ > + rte_tm_node_level_get_t node_level_get; > + > + /** Traffic manager capabilities_get */ > + rte_tm_capabilities_get_t capabilities_get; > + /** Traffic manager level capabilities_get */ > + rte_tm_level_capabilities_get_t level_capabilities_get; > + /** Traffic manager node capabilities get */ > + rte_tm_node_capabilities_get_t node_capabilities_get; > + > + /** Traffic manager WRED profile add */ > + rte_tm_wred_profile_add_t wred_profile_add; > + /** Traffic manager WRED profile delete */ > + rte_tm_wred_profile_delete_t wred_profile_delete; > + /** Traffic manager shared WRED context add/update */ > + rte_tm_shared_wred_context_add_update_t > + shared_wred_context_add_update; > + /** Traffic manager shared WRED context delete */ > + rte_tm_shared_wred_context_delete_t > + shared_wred_context_delete; > + > + /** Traffic manager shaper profile add */ > + rte_tm_shaper_profile_add_t shaper_profile_add; > + /** Traffic manager shaper profile delete */ > + rte_tm_shaper_profile_delete_t shaper_profile_delete; > + /** Traffic manager shared shaper add/update */ > + rte_tm_shared_shaper_add_update_t shared_shaper_add_update; > + /** Traffic manager shared shaper delete */ > + rte_tm_shared_shaper_delete_t shared_shaper_delete; > + > + /** Traffic manager node add */ > + rte_tm_node_add_t node_add; > + /** Traffic manager node delete */ > + rte_tm_node_delete_t node_delete; > + /** Traffic manager node suspend */ > + rte_tm_node_suspend_t node_suspend; > + /** Traffic manager node resume */ > + rte_tm_node_resume_t node_resume; > + /** Traffic manager hierarchy commit */ > + rte_tm_hierarchy_commit_t hierarchy_commit; > + > + /** Traffic manager node parent update */ > + rte_tm_node_parent_update_t node_parent_update; > + /** Traffic manager node shaper update */ > + rte_tm_node_shaper_update_t node_shaper_update; > + /** Traffic manager node shared shaper update */ > + rte_tm_node_shared_shaper_update_t node_shared_shaper_update; > + /** Traffic manager node stats update */ > + rte_tm_node_stats_update_t node_stats_update; > + /** Traffic manager node WFQ weight mode update */ > + rte_tm_node_wfq_weight_mode_update_t node_wfq_weight_mode_update; > + /** Traffic manager node congestion management mode update */ > + rte_tm_node_cman_update_t node_cman_update; > + /** Traffic manager node WRED context update */ > + rte_tm_node_wred_context_update_t node_wred_context_update; > + /** Traffic manager node shared WRED context update */ > + rte_tm_node_shared_wred_context_update_t > + node_shared_wred_context_update; > + /** Traffic manager read statistics counters for current node */ > + rte_tm_node_stats_read_t node_stats_read; > + > + /** Traffic manager packet marking - VLAN DEI */ > + rte_tm_mark_vlan_dei_t mark_vlan_dei; > + /** Traffic manager packet marking - IPv4/IPv6 ECN */ > + rte_tm_mark_ip_ecn_t mark_ip_ecn; > + /** Traffic manager packet marking - IPv4/IPv6 DSCP */ > + rte_tm_mark_ip_dscp_t mark_ip_dscp; > +}; > + > +/** > + * Initialize generic error structure. > + * > + * This function also sets rte_errno to a given value. > + * > + * @param[out] error > + * Pointer to error structure (may be NULL). > + * @param[in] code > + * Related error code (rte_errno). > + * @param[in] type > + * Cause field and error type. > + * @param[in] cause > + * Object responsible for the error. > + * @param[in] message > + * Human-readable error message. > + * > + * @return > + * Error code. > + */ > +static inline int > +rte_tm_error_set(struct rte_tm_error *error, > + int code, > + enum rte_tm_error_type type, > + const void *cause, > + const char *message) > +{ > + if (error) { > + *error = (struct rte_tm_error){ > + .type = type, > + .cause = cause, > + .message = message, > + }; > + } > + rte_errno = code; > + return code; > +} > + > +/** > + * Get generic traffic manager operations structure from a port > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[out] error > + * Error details > + * > + * @return > + * The traffic manager operations structure associated with port_id on > + * success, NULL otherwise. > + */ > +const struct rte_tm_ops * > +rte_tm_ops_get(uint8_t port_id, struct rte_tm_error *error); > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* __INCLUDE_RTE_TM_DRIVER_H__ */ > Acked-by: Hemant Agrawal