From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0083.outbound.protection.outlook.com [104.47.40.83]) by dpdk.org (Postfix) with ESMTP id 9A539FA47 for ; Thu, 2 Mar 2017 12:39:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=q0yHo2kpWwHHMsj55tHKyFWWwEkIrZ1qPOtKHw4Qjqg=; b=b6sVAJNBKOF89p/sb+jZFVKMcmEpJtYmBf2r5Kp0efwDid1585pRi75ULVU6rJlkWaXhqfrgRMtSwT9NIYM9/md3gk8S+fqgiJV7z1IwoFG8X4j+cn4PKyhLO2QacEGyswwKsScDgBWvvznwm7nfex7jFQPw/s7YhELCpgswGBE= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Thu, 2 Mar 2017 11:39:52 +0000 From: Shijith Thotton To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Thu, 2 Mar 2017 17:02:43 +0530 Message-Id: <1488454371-3342-39-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BM1PR01CA0021.INDPRD01.PROD.OUTLOOK.COM (10.163.198.156) To CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) X-MS-Office365-Filtering-Correlation-Id: 83ecf76d-9e22-45be-d0c2-08d46160d91d X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:hbk+l1wNTzURceFGsCaLpNKnWUbIpbBVnn+aRhmzjDycOC8pUJTK+bBFy83iIo8gKhEA881YwM202KdsIuNIqcNzePmSdhqiHnMkdCwa4FdPvh4bB+JUfM/2NxAKfkFpj46/Bg8M8AE9k1gTaWSbmfUoLWDN6aTkSjD6l8F1g2EPfpJ6goE90LRG5qE0JdjFx7i9CmBdIe2LFczSIDtOi1PdWmjcW5sDTul2JUqqgSQy1BlLYh0BQtBeeK8FYf25/Nrqzy6XT6plO67q7muosg==; 25:yXAR7M+jD6kcdP93TA9JckittBhnM9yTSt0rPWNsfmeCusf20lAwDtYZ7umzfEuOPdYeIb1g1F4Nfk3J+UE/sdTSlJlkpG4FYsG0jPFQesiHNq/RJynASHSRkRVod6/sQmzrx73AlolfXvlh+NXKM71sbutvguwGzKb0p1mwGdXMuhtZc4dsXQE0YDVMEhs8eYVky1H5R3Ib3OYOTMJ0TWrT6pGM+T7Kc3gyVuPdXq6yT967G9Q3LSY9dYm2bHvVz/UbjsHHtPuI3uOMFDgkUMTtq7A8dVRIBoI6qNeotVWPq4I1oLLaPNJyMTJiPFskSw6UqPzVS4DJU383dlv0QFkAckn4V0NXBboHZK0927yWmakwxvB2hvJG0w0ojL56zZfv9oU+OwvPa9d3HID3p3268jvbu4sB7LA9FuKOULZpxA42zAK7CooOMqdpO6YLuB0FoKFGQfr+zR2MMReiYQ== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:fcQ2H16g7j8b4Lb60TQinqoazlvdxyF8JFbqBdq4m/4vFhEP5mfyEAzW/xLGrZPVwT4UUoLHaeaiA4+dvdtIA3lHy6Ysp32aVc1Gp0oxFdCN/tYDgmaLnA47mHnwQKtwiyinzQSYzHPpOZ/mpYjRxtYcvRXgWAHk/MyxhF5NML+qjKsCKsZHqyeqjrlrWqgV0M6UJj9MH4pDlqBe47Oz2/x0bMZARVc4V7PQxamU7ECvkO2n9mQYc2m7IgdGO97S; 20:pW1qKdR1yxp/tvF+pnZiSV3fFDuh4BmSLwEpt2R0inX3MhvN+Z2HbizK5ACCdwsavZeRctIvxLtEk3NqH1t5l1ViwDPJSfmhUtlIyciQo4pNkl6d49wf22ducD95i2UKfUDwLz9t1/4smRtYkdXtO2Yh0dLejfnBBNEvB2jnNuFvd8AHAHDAwX/z7B+Sk6xqHHKIC/ug0wfm2tXkCPdJSQbM01DK1CJzFqahGBXq4z8mWDbnPPukZGcfKGeuci7OCBRb4lSpcZDPlJrgzcp/itwGThv0unEr8VDBvKA0jZza6BxgMmiddY7da8TksOFfrSkHsyoLnKyjR7XaBf5xCwJi+iWDnqSC80C7QefNCe2UoadYM4fxzJl9/Yw6ld737SMkTDdHApzH2y0EgPoL3cFh1xtV7juk3Nqh1IWoJj2JAYFsApoCoKJTH2WGcYbmEN+wJcYdkB2WsKfcWlKzUCUA4DWNpSCCGc1rx17dWWx/Cshcq1o4m8HD95rDvOnZdKeP3ESZqBdlm40gd/nkKx+48ZhZjsmzVngXhm3yrEOHWjPbMmUmXE5XMFqJgwSrCKyEsuR0fa9uGVW2Jw4xJiYQ60WmPZlr3TRZ8lfh/44= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(20161123558025)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148); SRVR:CY1PR07MB2277; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 4:xppHCnHVTTzgdGP9cpV+ZSLqF5ZRjmHKIHcJMuNoCiLoOpSxXwB1nL9YioCsA42a7dqSfbqD5bIOJ0m7SLFANefcm/3S+yypyv/1n3yXmXr5VBamZjdaKj+9QriZ6i6ZwdIguG34za77K1bTFJ7J16xEU26wCE+4ywGgy8cym7qTRD/lzgFUzOggxFYJNqcVQE4CGTj1UCH3vZ7yTPenjyk6znsDGUkx7dEKyP/1JuYxDf6RjYtZBltl1vWkUupaDmVlvOQRGvIEi5XogMK2+g/umWTvNR9yxYCkUhagunJfOzM/Y57JMzFQWHxrLyfg+1ftIuiFZXDGDjx664vjI8wu3jiy6LbeR1xSuvNuMHZ3E5/XIwA7LzT9n27qo97wRXq3pDukI/1v5AuZvb0sx/KJEMVZM59dpo7zt3ZQkxxLXix8MGoTYui4D/ZqMBQTbfXsd5f4EbMKkFFhcNgZMDvVacW6H3WiKbFnzkIsN4NBzaH2ch9eUxId/zluufx4N5aWwwLkpaJvrhp3cRIf/i/G8OGN7yDxrhy/uUbb7TZOOB7H4yHuyU0DCM9lQLfxfqz6AbtWxCkNoEKQxuAFD1D8DojLICaAiqcQS2tdG3o= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(2950100002)(6916009)(42882006)(5660300001)(92566002)(4720700003)(33646002)(48376002)(50226002)(6666003)(2906002)(5003940100001)(36756003)(8676002)(50466002)(81166006)(110136004)(38730400002)(4326008)(305945005)(2361001)(53936002)(2351001)(25786008)(6512007)(189998001)(54906002)(47776003)(6506006)(6486002)(66066001)(6116002)(3846002)(50986999)(76176999)(5009440100003)(42186005)(7736002)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2277; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2277; 23:2+fn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fvz5ujI9GEFXGx?= =?us-ascii?Q?Y8u32iVuoICKv066UnLszPbiNIzNRUzzwscWNBQqYfjA7RcRVzBluwKIXqIz?= =?us-ascii?Q?onb3oeOvxYbzzaG5OMN7CLH5/EAUVvSuKr2LdwiEFS3iYRWt7TV1QeU5DDVj?= =?us-ascii?Q?QL+JJ1pTAd5FivDuIaUn+baTvyBpVv8x+TUWsYm18NossjpkfLRSWh3SGq0q?= =?us-ascii?Q?MqA6zw1GTY3ByRjmvM2s7PfG4KjzNyMsocWjrGX+6+SRTkTQg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 6:lec14cXU6Ed1L53y3Bl2NKlP9tk34cqMWS6l09tXDcv9++rCFtvPlsVwG4eSMQ+6/rd2SmzIHto/9JHkCH82eSBHp91l96tgkebfMdxuK3ZarRrj4bXzW354BDkXZJ382rVJc40XvrQjxf03yF5a2BN0hWkDIYyCQGivtewrEMMIPfLhjV/2J60WamdCMDRFv2eBbxChEKifg4inGrjz1oYNCgullB/1EDBCxbOczXCNup3M1aBk10JYpUG5i6q9V3nXj8ACQ/4zg3/flasUDbxV/9j+YGdHTI75UMYTK8/2cWd4P3gX210Rv2Tebc8pfWfBMivgcLsKN1h3FDx990bh6xz+g0zVxdZ7aHgBE1TXOMJAZg39J/st5dqf17oDRZblq33Z8E9fsnmCGz2Klg==; 5:Fd0EvtO/1sHCZ4uJ+4vEAybEezjcgk/EnWJQK18di703NyiexMaBKaYz8nnsi7vstOjYuWxzbH7FSSgx83TVmP3rp4jJ9ukCucXBMaVVFVVqlt52VBBfcwx4u/iYTyIfzV1IoYVsyiRPpGnAoiDsAg==; 24:0epstseNQIABQLXvta6B6Qn8EvOyDgxn7mmmxiZ3zs/UcTQ+UoJPwVC1wmhaR2qj840zuqaPxaV0iaUdBtw0sPpCQ4WoIPYIXQkXVsyi9I4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:f4ZLxJ9ceEXOVwCKV56n1E6WQJWOckXiCCGL/i+VHOJy8n0WZnBWfH7LeheJSqSXPtx+BGZ5e32pSC5RuaFZEP0PYMoPNBK2ucD7mJLHn9CBBAUHFfw3ISqq+VeAYOzwEJ7FJbPxl1kGWT6mp6Mnkmo9KM3jqD4hilpe4vE6Jl6NocHz5C+ko7dbXa5lw90NBUzYET6sZocqTZUvcKWCDeiO6bbU1x3QPg3ejamkXo6wrLPWoVdEY2qZcBgczvxf2skqrXiFWH7zEbbzV9UrWdeqMSuGaLlhQWl+Fvm8Po7jLQtUw7rVoz32Mudp5B2ERsJQnaat53UNJyXXpwPLvA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:39:52.9071 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 38/46] net/liquidio: add APIs to set link up and down X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Mar 2017 11:39:57 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S Signed-off-by: Mallesham Jatharakonda --- drivers/net/liquidio/lio_ethdev.c | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 194d219..27727e8 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -973,6 +973,60 @@ return ret; } +static int +lio_dev_set_link_up(struct rte_eth_dev *eth_dev) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + + if (!lio_dev->intf_open) { + lio_dev_info(lio_dev, "Port is stopped, Start the port first\n"); + return 0; + } + + if (lio_dev->linfo.link.s.link_up) { + lio_dev_info(lio_dev, "Link is already UP\n"); + return 0; + } + + if (lio_send_rx_ctrl_cmd(eth_dev, 1)) { + lio_dev_err(lio_dev, "Unable to set Link UP\n"); + return -1; + } + + lio_dev->linfo.link.s.link_up = 1; + eth_dev->data->dev_link.link_status = ETH_LINK_UP; + + return 0; +} + +static int +lio_dev_set_link_down(struct rte_eth_dev *eth_dev) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + + if (!lio_dev->intf_open) { + lio_dev_info(lio_dev, "Port is stopped, Start the port first\n"); + return 0; + } + + if (!lio_dev->linfo.link.s.link_up) { + lio_dev_info(lio_dev, "Link is already DOWN\n"); + return 0; + } + + lio_dev->linfo.link.s.link_up = 0; + eth_dev->data->dev_link.link_status = ETH_LINK_DOWN; + + if (lio_send_rx_ctrl_cmd(eth_dev, 0)) { + lio_dev->linfo.link.s.link_up = 1; + eth_dev->data->dev_link.link_status = ETH_LINK_UP; + lio_dev_err(lio_dev, "Unable to set Link Down\n"); + return -1; + } + + return 0; +} + static int lio_dev_configure(struct rte_eth_dev *eth_dev) { struct lio_device *lio_dev = LIO_DEV(eth_dev); @@ -1144,6 +1198,8 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) static const struct eth_dev_ops liovf_eth_dev_ops = { .dev_configure = lio_dev_configure, .dev_start = lio_dev_start, + .dev_set_link_up = lio_dev_set_link_up, + .dev_set_link_down = lio_dev_set_link_down, .allmulticast_enable = lio_dev_allmulticast_enable, .allmulticast_disable = lio_dev_allmulticast_disable, .link_update = lio_dev_link_update, -- 1.8.3.1