From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0075.outbound.protection.outlook.com [104.47.42.75]) by dpdk.org (Postfix) with ESMTP id 9EB1E9B4F for ; Fri, 26 May 2017 08:52:00 +0200 (CEST) Received: from BLUPR0301CA0029.namprd03.prod.outlook.com (2a01:111:e400:5259::39) by DM2PR0301MB0911.namprd03.prod.outlook.com (2a01:111:e400:501d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9; Fri, 26 May 2017 06:51:58 +0000 Received: from BL2FFO11FD053.protection.gbl (2a01:111:f400:7c09::194) by BLUPR0301CA0029.outlook.office365.com (2a01:111:e400:5259::39) 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; Fri, 26 May 2017 06:51:57 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11FD053.mail.protection.outlook.com (10.173.161.181) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1075.5 via Frontend Transport; Fri, 26 May 2017 06:51:57 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v4Q6pQMf014894; Thu, 25 May 2017 23:51:55 -0700 From: Hemant Agrawal To: CC: , Date: Fri, 26 May 2017 12:21:21 +0530 Message-ID: <1495781485-2236-17-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1495781485-2236-1-git-send-email-hemant.agrawal@nxp.com> References: <1495445969-29199-1-git-send-email-hemant.agrawal@nxp.com> <1495781485-2236-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131402551177799743; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39450400003)(39400400002)(39410400002)(39380400002)(39860400002)(39840400002)(39850400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(9170700003)(48376002)(50466002)(36756003)(6666003)(81156014)(81166006)(8656002)(2950100002)(86362001)(8676002)(6916009)(8936002)(77096006)(50226002)(38730400002)(110136004)(498600001)(356003)(54906002)(53936002)(85426001)(5003940100001)(33646002)(2906002)(47776003)(105606002)(2351001)(189998001)(104016004)(106466001)(50986999)(4326008)(76176999)(69596002)(305945005)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0301MB0911; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD053; 1:6axvGhQXS3k1h/8TsZAvvoq5CYPGRr1BVOxaTawI95/t9wSwstGb2LxrC+ctBWUCb1DTnz5E1VcA8IK6KUSK80IdWaFHlXTUlourMtjKq3jbCIC03mAtLWXAqVzAB5gP5ePsPmdrMFzq+vYPZjS/b2nigNuA7s8pnMKhnaQcpgSD0aFONN3Dfft7rLLTFl/MIAMNZDgeI6D5KIT5dNhkA4Tw2I0agjNuLteHhLikWVOuEQ18xFQbgSl7t8B5Uk3PTM/35aOYZlpkUABJhLEyVeWqSQbTyRDX335J6Oa5R5mWkOZqULHPWMn0N7fyrWOJ7xDzgkBt5+mvEll5IQ6u12lM67D/TuI5DXRsQ/8BjecW/asi24BNrj0BYOPkFWM5ayNJVXMmDHngq6BwjVZ56o/6d4Eo5lUPKI8jjHQRhIZPUX9Qw0U9ntYOnusys+Nc/GGhAdfH0AYdvBrfeh4rzJ/9wTn+favWuGy7x3eSqdOZ0s3CRHwevUYyhnuN4zyA8+8iUIMn0x+u4MU0bJJBUM1CHGw91Mv+NNLnSngrJe6zU17h06p9wTOyXMqQJCriNyeZrvqa5WQ8lXGYuVvxy8l4p+PnjEJ4B4nzsLTy5vQtPC68l77LacjuKVB0xZoBYSNHzUTzSe7nKoOtK4461dVbN1UnasVxnt+1+kcYecQaa6+1ZnVAF5CprfYc/r4QzyyZSbG5lc76+jBM6t19fuEcO2TPIZTYz7FJD8r0d9VWGQ214kun6G6MZ2UPHP1afLQpGhZIHqL0raGA4TkMLw== MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM2PR0301MB0911: X-MS-Office365-Filtering-Correlation-Id: 9262ea4d-42c4-4d27-683f-08d4a403b3ff X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:DM2PR0301MB0911; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0911; 3:7jM0IHylXXfUVrv0Cw0jc8TAnsEqD4bqMKpAGxFMNpF+pASjReiUS+Fz7gJ6eiQ3Ln+g/4UCseHRZ3yOuebwYZdZf9wfqS2guym/iT7MFP23TrupYCUE65oLLottR/X+aXM+nnboDVzixzyIeMQTrr2Q+uZ/3OBISHtdIsUVBoUrJrJB/3jcvtbN3IuLWPBhEzRla6PB8dHCGq78bMrfA/YoXWRf1vOzQnCodLAXycrbd71LAiLqox2XUtaM/A/PYyGse4mbaZ3EG+82Dve39x1otWbWFhAGuvRBQ6qoXrgkB6qmGDwQ1hQMzZO0ai5gSyxCOUopH371BD80aKN3fVQ1SuT3aPO/Ad+xocT29lRKHe8Z20bJ68I3vlsQHDM7SwfP5LBO40qgoMO+2LIS285Oc5X0r5C8elefipVNjMjZbAf/K4trrgw/bf7qYvBw; 25:sm889fv2Inzrykha7S1vb0Jo+VYVtSV/bQd9h842kBph8MExumXKJ7ZjhBDgct0AiuZosdaUWc3V2EAbT5qcPcviyeGoijNtkmkTtxYXIfr8ildCLrfnAtSFY51065V9COywOvY196Vp0CsSHrSSYyWz1A0end5L04ARc18coiBfwlO5KuQNDXkWYWOvG7IL0foeHPI1vcoTnbByB7FNaRroAGuydyQX2zytRGviQPdfHHFvUUY/pSey6b2g20VDe0SOFCxx3mQwEZWoR8xU7coRu6XIlJ/UFN7j/pYdwqwADE6BTwTa60MEoo2fcuOl9x6Arbl3qZuDGbIKwtoqad9FBelW+LLvDc3YVmSb6vClMxODHvFCaS4e2o5Ht9Kkvm+Gv9B9A3EMG/LFOHzDc2DngyEhrWKx30lK3ZexvZDZp6sNhoGIPmAUjF3KZSEvUAm4Uyyyakz1xiTH2N6QiZWptVPaDhyqYHOTKioxXKY= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0911; 31:ZaXhBpwxR0X6MlSd30Hs0ngDtc0sVi9S/AZ6RwLC+LobevRvfizY5aLl2CNqtX9aL65pvOrWZN6iUfTmn00PAVdhPt3uaW4AxBqxznD5+lVU2vGwoPsRfJiuvk3q/4IaLfYvR2LwfTjVE7R4D/pEUPLLxjuzF3+2kR9uoPa92izV811nb/T0neQ9h1A2rSPnWVG9OkRf3qmoR0U8IQzWhDGLAk2yzMhq8a/lr1J3yHfKO2A+RdHvrGYOTlKsmlrDiP1Tg+gOEldeq0RTMcJbhaBH+SCIE/pNI3lHMFRmlDk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700061)(100105000095)(100000701061)(100105300095)(100000702061)(100105100095)(6095135)(601004)(2401047)(5005006)(8121501046)(13024025)(13018025)(13015025)(13017025)(13023025)(93006095)(93001095)(100000703061)(100105400095)(10201501046)(3002001)(6055026)(6096035)(20161123556025)(20161123563025)(20161123559100)(20161123565025)(20161123561025)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(100000704061)(100105200095)(100000705061)(100105500095); SRVR:DM2PR0301MB0911; BCL:0; PCL:0; RULEID:(100000800061)(100110000095)(100000801061)(100110300095)(100000802061)(100110100095)(100000803061)(100110400095)(400006)(100000804061)(100110200095); SRVR:DM2PR0301MB0911; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0301MB0911; 4:yuVDkpRefyi5CHBAKCYHQWgl/aIwvUhI4QLrm4GY?= =?us-ascii?Q?ihYiCjFO6/vqBGzHbo/9F9nTH79U12msvRGzAIkfsY8At6d87SGok4GQjJOJ?= =?us-ascii?Q?D83DVbTvv4Sm9ZY81XL0IgnqepPISmVq+mtBNmDWto+x1zm/r6OFO6Ndow++?= =?us-ascii?Q?Pl7G+vRyzGbNt3S++ynDlclErYtEW5EYW1az2o3wRhj+0gX1UqMsJL6/aZTn?= =?us-ascii?Q?aXBaRFK1rLkYJgO6c0ggmLlJCggnTg1gCYu8XI4loqhqEintw0doDhA/XtGA?= =?us-ascii?Q?mJxOyWU6vKRwLjk4k87zD+ixdITzWYMpYB543tf+EcY+gWvTCzu26rZL2a6P?= =?us-ascii?Q?LZ8jpl4Eg/DFZMDU+OInn5+3/XCMJOynQ5U4BeRTW4atizv6clWGPDEeRRLB?= =?us-ascii?Q?rkAjWXuMKSW+SnwzeQJpItDLt0aD1kAfo6sKjAb3XgafWDZXXQUmHvvTL+kk?= =?us-ascii?Q?/BIwnWpWTvk+DhtCwfpnIq4VICeCNlLFUhkukC6JTyTLSITubQEGuImCBGXF?= =?us-ascii?Q?YU1Upehf0Caf3SVfVZySrk9bqR8jY/RtQpI0RAIramj2pARjMnnNpY0WVvyd?= =?us-ascii?Q?PVIiVcZEBF33+6toRb5EN70f2erBywBRSN5iGpUvjDBENngV3wAXK/TM1nM6?= =?us-ascii?Q?N/QS+K08C3/ueIraw32sxQVgxsM6F5MkYnX0uq/13nD47KXH0x++ib7Tw1C0?= =?us-ascii?Q?A+mdqB4Kwg+AvQ5zL7ty2kxEJtl/C8pKOgHxLi7yXnCMohLhyscqMdmZwVvH?= =?us-ascii?Q?V20SxsZII9oqmRZ8l/LWTEc9sJlACsDdFS18yt5OEizhhamk8DhOgZZEv5lZ?= =?us-ascii?Q?VplU0N2QCj9IO8E9HcdS84m1uOICnB/ebEl4EpenVfOgrZ7Ako69NjHLQrcO?= =?us-ascii?Q?NMsTj97iy/89JMYPa3XbSKv4tM7kXoYujHS0ElosEYPv33iGGlNfdNfmJDsN?= =?us-ascii?Q?xyONztyD8/jLhGWEmALjBrK/wWqUmzgn+fDso7TcR06HfJLZcekY40EgTxlr?= =?us-ascii?Q?xBqrld6J/sWJlHpSYzROQODeCB8fHkMJgIc/2zuDKjp3OmNgx2W4YBUs0AZu?= =?us-ascii?Q?fOFVtrQ7oIQvwsBIDa28pl4FXbm4xybMij4eSYWOzaLKoBn2rU7BUANRn0Jd?= =?us-ascii?Q?AvrXUNS6XiNjW/Eg0hcBFc886MSEvbbF8x9R4lUMUJk/8TRd/kIjelzkciRE?= =?us-ascii?Q?/RQOcGdWz+9mhu28lcRnLN2lVxA/fhOTYSQ8qoKWHG8fG+lf11IOGp+B5mg0?= =?us-ascii?Q?kuENisEhapN2eojWEIDnWveaAhXORMAkTFvu3X6fnrbEjBQWCVo2qvUn5dHU?= =?us-ascii?Q?mIlZo4beubapAYEDP1nVAC9n2ynUmweas2yHiDuYEqchnR+Byi7nAReUSc99?= =?us-ascii?Q?LSkJ1g=3D=3D?= X-Forefront-PRVS: 031996B7EF X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0301MB0911; 23:t2BqfzR5m2pdl4p5cJe9z8jVCFPSe/lKx/lEU5x?= =?us-ascii?Q?VRXiH6bdU7IFKUygprJyAjeFE7CcMSy9SAsRyR05QzzaSUO9YzdYOYHJNBk6?= =?us-ascii?Q?UpiE5PgrhuWBY9Atz/1kEwJXkAgL6G9/6Sizh5rb5uJSN6jv1hbjya8X4Q4h?= =?us-ascii?Q?Bof5+S3JP3nkbOW7osew80FNaGqYvbd0FsPa5zi/+v3+aqUebFsByXHWGkus?= =?us-ascii?Q?48yc+rYbW3NNNbGneIEZ5pH8cPOh70q4W7pJCC3hJjnFukhxm6YkfGRsvy2w?= =?us-ascii?Q?QysUPGU9dq5SRFKO39JF6wyrcaQYpZNLmqPzc6zQbAsb5rpXGfMSDapbZPah?= =?us-ascii?Q?QI6e1yCOpwdrhATtvFLEnStiM4t1A+3vhu2OkKRu0CJnf52FJpWrpKjObvu+?= =?us-ascii?Q?JB7rBhMS0Hx13Moy61t/V4+SgF4DfLuLBvq3jtxMA2ne5lyi8H93tTHBtTBn?= =?us-ascii?Q?ScPIOfQTR4fvPCH0+7Vf9eY6GejP+Suc6t2d4P63i6DJEDZrXTUQo/v/EZFr?= =?us-ascii?Q?63hG1U+DrXXj6orJ/BvHugECO2w3CXcw3fg2G/tgMam+CsUPHCXOx+iIIonr?= =?us-ascii?Q?a5lLiOtkOe9ovB9j31bH8HxYkEN8Me8PBj8Bg1VDxS3Cgz8YIu6HvnPvhkyh?= =?us-ascii?Q?xHxNwEoM/tJpTPgA8eWwfrFAdnAcj0ROyOkM9lsV8DYq0BQvRrW1xaQm+HeC?= =?us-ascii?Q?DrRaHsWB7BGGKoEsx78BvdhwX57MUpjm02hiZD3JCuLOI+7pWYy3eI1oxx37?= =?us-ascii?Q?qWNTa/aAOZI3AM9YdOLBN7pz5I+Um3cb0+vQjyXb/Wgu7zjmCRZQ5Tbspyb3?= =?us-ascii?Q?82f7CfyqysEQl7dV2GDbCKVYLdwvkoxAHm2Du5EPtpnOMhtkigvy9JwL9n18?= =?us-ascii?Q?pXmuhTxjC3xStoMwxOipHL0YRfhAWu1OwN/rLCL67cbfXtOCEm9hSQuVQf+V?= =?us-ascii?Q?9oUEZBBmJn5kv6W1ZKkXCbMTZg1oTqRdLu37B2FahsJpFlMne/vcNLS/Io5D?= =?us-ascii?Q?YeJqvtdRQ7l0HPJqbyyadNSWHdPFzYG7UKyqMeAinV10lo6OSdCtTds69bKe?= =?us-ascii?Q?cc06ygMXPwZmUXYb6WJkYCUcjwo6DQjHbGP+JsFBmJUtLwBuRQVYwgzKBpXy?= =?us-ascii?Q?1S3HnYcrWyDlp6lBB/+B2zzB3yc+QUDLP4chcoaMr3pBzQE/e8sJUrrmVRRh?= =?us-ascii?Q?ngODojXACP5ZkJTavkZUGoEeceRqOlaxpDxOPNBT4Q7QAqkkCjnud9+eqFUC?= =?us-ascii?Q?5GETfSDayjo8ZUk4GySh28cALICRIoNIZc7vTyYe7Ehj238JikFFKLlPp9cJ?= =?us-ascii?Q?dDA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0911; 6:0UwftACIHGCrF4na6gPCRSJsl1ClnVOuVwvVdcMYYKWOutGuNNQGiwR5LoK22mxob13Kbf1BQr43YwE+hcYS5iNtQfbyEFbuJ0kBh9LXZTycIfIxxzcJxvP8xD+c33VMYqtifZu/LJ+ugib2UbXaA0IwLZzUXlRLIkA38QUM6Lr+z/yhTXK4QYxUWdCh53teoYmX6uJlSaq28HlTAskDZYa3knNoGC/z51AvpT66qCi7YSbA/EC6nX1PIG1p6/MmWd2mIaWlL+LnpdXvshG/o6TJaBQAMShKSsXTZjD02Ejk6u/XWd6M/rmv9nqNQSmHJs77OSLobzrPOhayBbEEChFnJyXALYGTdlIz3NMABI0X8wOp6wqXn9SQnJ3/Al03H+uK0p+wuAt6Y2fqnlTuTwfSG3JRgrjFFrepuVLAUMKr/YxMO1YmkIYsbGvCTC4oRHhRYHsXnGpifJigb3gddIZKixu9qfQUfG3g6GZYh6NQIBPaARdmjopazlkVYOybTSXSlaVn+rXBVC0lryIZQg== X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0911; 5:hjPi/+8cLZh1nagNA1Xtgooqn5Q+/cWlDFjB7o29TTc1hp7tehX8i2FdY+2VDByDzuERsACQ6apF01VNx+VPO2FhQiznE9tH8p+00kgbdGow5hVyb1hHDO93jj5uVvmyNYtcmrSviLjDVsGoLrWJcHvm1iQU4/MAoCeP99iXRHCIMu7wNYeTRFi6Ue+PdIBE9lQptAUkDVIvWgUySZz+TRhGsqlaQw0Uccc8JSBJjviMSHpGK1O8g8uhoa35eD+yrcIe0EYR4TP19pYxLhuFECCgVMnF2hR8zStg3IZ444s87EFoBk2oifR5qXAt/FECOdgUItzavkBycPDW9mdV+0q2GmsTU/DE8BLksVILsAvzsqVi5V0eTOiNSBhWcBUkRhEDTXbRevs77HAivXbL2mE5UUKhx8VsFcbQj6C1OxRmfCuzmIGlydGtYbqYkPwX8DqZnF1BuU4h20Wwod74dw==; 24:sIY3SzA0zUdEnZ+3LUqKKLMKpX+hOdGUmY/Awb5jOs2qd9K8UCKwxhWko+XyV6DqYm3qgDCz+sb2WgPdaIHVVJGZ2Dl/U4YYgizMc9Weevo=; 7:iF+dCPxvlthfGPCjHdo9S7zYTFrik/G1kl+13DPusXUi9ARoCjhyoFtoxk7ngtZOEjMbmwm5UbGuPfe3iG0UKvIt/qZ3Mu71mYNROFBW967autnFWJld7EM7T96Gi8+EAH4PRgHWVTsAFll3r+wsYWpvxIseZBp7Jc2OgMRdjBASTId5HHq+ETQRsUp9YAbHrk6FR95JSe1eHL/mhvyWpd2K5uIiJmYyj3wpUnN6yUawNVkbORPdhX+ZT2sAZdqMRxsT45T6y1Uq0iRBR7YgFK73WQuNHJucFXE8mxzox/GtrogVJkhrTjrgF27ApHDWUbZnaoT+gZxZK+dgsnA1eQ== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 May 2017 06:51:57.5615 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB0911 Subject: [dpdk-dev] [PATCH v4 16/20] net/dpaa2: add support for flow control X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 May 2017 06:52:01 -0000 Signed-off-by: Hemant Agrawal --- doc/guides/nics/features/dpaa2.ini | 1 + drivers/net/dpaa2/dpaa2_ethdev.c | 142 ++++++++++++++++++++++++++++++++++++ drivers/net/dpaa2/mc/dpni.c | 18 +++++ drivers/net/dpaa2/mc/fsl_dpni.h | 24 ++++++ drivers/net/dpaa2/mc/fsl_dpni_cmd.h | 8 ++ 5 files changed, 193 insertions(+) diff --git a/doc/guides/nics/features/dpaa2.ini b/doc/guides/nics/features/dpaa2.ini index 4b1e000..720c35b 100644 --- a/doc/guides/nics/features/dpaa2.ini +++ b/doc/guides/nics/features/dpaa2.ini @@ -12,6 +12,7 @@ Allmulticast mode = Y Unicast MAC filter = Y RSS hash = Y VLAN filter = Y +Flow control = Y VLAN offload = Y L3 checksum offload = Y L4 checksum offload = Y diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index fa9db17..edff04a 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1105,6 +1105,146 @@ void dpaa2_dev_stats_reset(struct rte_eth_dev *dev) return ret; } +static int +dpaa2_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +{ + int ret = -EINVAL; + struct dpaa2_dev_priv *priv; + struct fsl_mc_io *dpni; + struct dpni_link_state state = {0}; + + PMD_INIT_FUNC_TRACE(); + + priv = dev->data->dev_private; + dpni = (struct fsl_mc_io *)priv->hw; + + if (dpni == NULL || fc_conf == NULL) { + RTE_LOG(ERR, PMD, "device not configured"); + return ret; + } + + ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state); + if (ret) { + RTE_LOG(ERR, PMD, "error: dpni_get_link_state %d", ret); + return ret; + } + + memset(fc_conf, 0, sizeof(struct rte_eth_fc_conf)); + if (state.options & DPNI_LINK_OPT_PAUSE) { + /* DPNI_LINK_OPT_PAUSE set + * if ASYM_PAUSE not set, + * RX Side flow control (handle received Pause frame) + * TX side flow control (send Pause frame) + * if ASYM_PAUSE set, + * RX Side flow control (handle received Pause frame) + * No TX side flow control (send Pause frame disabled) + */ + if (!(state.options & DPNI_LINK_OPT_ASYM_PAUSE)) + fc_conf->mode = RTE_FC_FULL; + else + fc_conf->mode = RTE_FC_RX_PAUSE; + } else { + /* DPNI_LINK_OPT_PAUSE not set + * if ASYM_PAUSE set, + * TX side flow control (send Pause frame) + * No RX side flow control (No action on pause frame rx) + * if ASYM_PAUSE not set, + * Flow control disabled + */ + if (state.options & DPNI_LINK_OPT_ASYM_PAUSE) + fc_conf->mode = RTE_FC_TX_PAUSE; + else + fc_conf->mode = RTE_FC_NONE; + } + + return ret; +} + +static int +dpaa2_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +{ + int ret = -EINVAL; + struct dpaa2_dev_priv *priv; + struct fsl_mc_io *dpni; + struct dpni_link_state state = {0}; + struct dpni_link_cfg cfg = {0}; + + PMD_INIT_FUNC_TRACE(); + + priv = dev->data->dev_private; + dpni = (struct fsl_mc_io *)priv->hw; + + if (dpni == NULL) { + RTE_LOG(ERR, PMD, "dpni is NULL"); + return ret; + } + + /* It is necessary to obtain the current state before setting fc_conf + * as MC would return error in case rate, autoneg or duplex values are + * different. + */ + ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state); + if (ret) { + RTE_LOG(ERR, PMD, "Unable to get link state (err=%d)", ret); + return -1; + } + + /* Disable link before setting configuration */ + dpaa2_dev_set_link_down(dev); + + /* Based on fc_conf, update cfg */ + cfg.rate = state.rate; + cfg.options = state.options; + + /* update cfg with fc_conf */ + switch (fc_conf->mode) { + case RTE_FC_FULL: + /* Full flow control; + * OPT_PAUSE set, ASYM_PAUSE not set + */ + cfg.options |= DPNI_LINK_OPT_PAUSE; + cfg.options &= ~DPNI_LINK_OPT_ASYM_PAUSE; + case RTE_FC_TX_PAUSE: + /* Enable RX flow control + * OPT_PAUSE not set; + * ASYM_PAUSE set; + */ + cfg.options |= DPNI_LINK_OPT_ASYM_PAUSE; + cfg.options &= ~DPNI_LINK_OPT_PAUSE; + break; + case RTE_FC_RX_PAUSE: + /* Enable TX Flow control + * OPT_PAUSE set + * ASYM_PAUSE set + */ + cfg.options |= DPNI_LINK_OPT_PAUSE; + cfg.options |= DPNI_LINK_OPT_ASYM_PAUSE; + break; + case RTE_FC_NONE: + /* Disable Flow control + * OPT_PAUSE not set + * ASYM_PAUSE not set + */ + cfg.options &= ~DPNI_LINK_OPT_PAUSE; + cfg.options &= ~DPNI_LINK_OPT_ASYM_PAUSE; + break; + default: + RTE_LOG(ERR, PMD, "Incorrect Flow control flag (%d)", + fc_conf->mode); + return -1; + } + + ret = dpni_set_link_cfg(dpni, CMD_PRI_LOW, priv->token, &cfg); + if (ret) + RTE_LOG(ERR, PMD, "Unable to set Link configuration (err=%d)", + ret); + + /* Enable link */ + dpaa2_dev_set_link_up(dev); + + return ret; +} + static struct eth_dev_ops dpaa2_ethdev_ops = { .dev_configure = dpaa2_eth_dev_configure, .dev_start = dpaa2_dev_start, @@ -1128,6 +1268,8 @@ void dpaa2_dev_stats_reset(struct rte_eth_dev *dev) .rx_queue_release = dpaa2_dev_rx_queue_release, .tx_queue_setup = dpaa2_dev_tx_queue_setup, .tx_queue_release = dpaa2_dev_tx_queue_release, + .flow_ctrl_get = dpaa2_flow_ctrl_get, + .flow_ctrl_set = dpaa2_flow_ctrl_set, .mac_addr_add = dpaa2_dev_add_mac_addr, .mac_addr_remove = dpaa2_dev_remove_mac_addr, .mac_addr_set = dpaa2_dev_set_mac_addr, diff --git a/drivers/net/dpaa2/mc/dpni.c b/drivers/net/dpaa2/mc/dpni.c index 0ad6d11..dbe3f7c 100644 --- a/drivers/net/dpaa2/mc/dpni.c +++ b/drivers/net/dpaa2/mc/dpni.c @@ -444,6 +444,24 @@ int dpni_get_qdid(struct fsl_mc_io *mc_io, return 0; } + +int dpni_set_link_cfg(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + const struct dpni_link_cfg *cfg) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_LINK_CFG, + cmd_flags, + token); + DPNI_CMD_SET_LINK_CFG(cmd, cfg); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + int dpni_get_link_state(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, diff --git a/drivers/net/dpaa2/mc/fsl_dpni.h b/drivers/net/dpaa2/mc/fsl_dpni.h index 2f69526..bf31872 100644 --- a/drivers/net/dpaa2/mc/fsl_dpni.h +++ b/drivers/net/dpaa2/mc/fsl_dpni.h @@ -740,6 +740,30 @@ int dpni_get_qdid(struct fsl_mc_io *mc_io, #define DPNI_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL /** + * struct - Structure representing DPNI link configuration + * @rate: Rate + * @options: Mask of available options; use 'DPNI_LINK_OPT_' values + */ +struct dpni_link_cfg { + uint32_t rate; + uint64_t options; +}; + +/** + * dpni_set_link_cfg() - set the link configuration. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPNI object + * @cfg: Link configuration + * + * Return: '0' on Success; Error code otherwise. + */ +int dpni_set_link_cfg(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + const struct dpni_link_cfg *cfg); + +/** * struct dpni_link_state - Structure representing DPNI link state * @rate: Rate * @options: Mask of available options; use 'DPNI_LINK_OPT_' values diff --git a/drivers/net/dpaa2/mc/fsl_dpni_cmd.h b/drivers/net/dpaa2/mc/fsl_dpni_cmd.h index 6e96271..4395aac 100644 --- a/drivers/net/dpaa2/mc/fsl_dpni_cmd.h +++ b/drivers/net/dpaa2/mc/fsl_dpni_cmd.h @@ -64,6 +64,7 @@ #define DPNI_CMDID_GET_LINK_STATE ((0x215 << 4) | (0x1)) #define DPNI_CMDID_SET_MAX_FRAME_LENGTH ((0x216 << 4) | (0x1)) #define DPNI_CMDID_GET_MAX_FRAME_LENGTH ((0x217 << 4) | (0x1)) +#define DPNI_CMDID_SET_LINK_CFG ((0x21a << 4) | (0x1)) #define DPNI_CMDID_SET_MCAST_PROMISC ((0x220 << 4) | (0x1)) #define DPNI_CMDID_GET_MCAST_PROMISC ((0x221 << 4) | (0x1)) @@ -238,6 +239,13 @@ } while (0) /* cmd, param, offset, width, type, arg_name */ +#define DPNI_CMD_SET_LINK_CFG(cmd, cfg) \ +do { \ + MC_CMD_OP(cmd, 1, 0, 32, uint32_t, cfg->rate);\ + MC_CMD_OP(cmd, 2, 0, 64, uint64_t, cfg->options);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ #define DPNI_RSP_GET_LINK_STATE(cmd, state) \ do { \ MC_RSP_OP(cmd, 0, 32, 1, int, state->up);\ -- 1.9.1