From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0062.outbound.protection.outlook.com [104.47.36.62]) by dpdk.org (Postfix) with ESMTP id 459ADD466 for ; Sat, 25 Mar 2017 07:28:52 +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=C9R+PJ8ArVPt3cvfwW982avSuNmp5xvswTbIuzUwT1A=; b=KnwEPtIIEeSX41hH81LcSPF6YZFxus11qGNT7nA1/Q7YJbKv9SMCaCHM688P0ipojppOI0G0e1VAQSmfqU+Cy/aOm4ySLXbpv45FnTTFoGEOSaurRxFGmeSXylkw2U0pnz9Aa8eSh1IGnXsCamNM5gLZ/B9GWbF6vlw/RkMV+1g= 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 CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11; Sat, 25 Mar 2017 06:28:48 +0000 From: Shijith Thotton To: Ferruh Yigit Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Sat, 25 Mar 2017 11:54:49 +0530 Message-Id: <1490423097-6797-39-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1490423097-6797-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> <1490423097-6797-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: BM1PR01CA0117.INDPRD01.PROD.OUTLOOK.COM (10.174.208.33) To CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) X-MS-Office365-Filtering-Correlation-Id: 6e1ad567-d7f3-45c5-e020-08d4734833cb X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 3:k4N1T2ApCGmGdDJKyP7peWHhmdfml4uxxJ8pYsgYRBtvA9+iVgkwomqIqndf07gg5USCc4nRVbjwnXn6UiTaZ91KrSofiXGZPtW0ebuoZcm+5P5+WYIFYvrahwcv32lM8Kwl2bsxiNlt2IkLv/8vV5S3v+bHDX7+wxYe0qi9WiXb9Qu3TQFeRBGD0t0k1Y1XKsB4rBL0epM2OK5Jz/9DyOk9cIYHQHldjDmRNwnS31RtWnB79RiuPnGNTLNzFv0vMH4pMn0YJeHDno6NfntP9g==; 25:JWc/zZbh8BmKv79iqokbfBCWAi6kh5apNo3WM13tihl3WEQHA1SsmZ/XJnHNExPkR/RD2NkDNQ2G07iMoarJHLSbxtAArBoyPBG5XUA7A3r7IXitdpKAOru5uhO8mlwOwDxyaBHyaW+R2pm29/SbbjtWav0LKM4jsITiuo9Eq/gvDo9pvxp4L2/QENMYGyn1kZGzb/qdJgZq5KyR+edxjrMNpcBvPqLaAoGfOqixoODDFnpOGOIWpgjpmYHC+z0qozWrhU9RL4DZGMajOtoutcAn+3xG2psOYKblELidI3hPQqVaUHpHXZR0oHmPeoFCMfJ87KPvb8ndIzRn/LqbUB/MXJG8KmHRxxOR2I/8qP0pTQ2YEhacUgQ/Sepgx4HNgl79c2OHqEJK+uqtDDqYsTJBqNe3NmmhBs2AhBByZatPW4Klz20R+cBMmPiormdcZCryOaxUbYyIHUwJCu3QbQ== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 31:gp12QoVn0xR1zbqUe7VWT6RuJV4aTsL8UEaZfE8NOdJAd8iNKM7IzYXJ6Q1Ax6lbtds9oTipJGpSQOcKUL2Um2RuowhiZ8kJ/kKtmtCxxcSFut+TONBltI0JpYR0A8tfm2GoshJZhpY/c6udR/Kq0ia78clw87tny/YXDlqiSPmxwO5Ro8lmocIDIjFcAHLmYsppZIzwe/yNK5iywOZ5EgiviNm80AM42oidKZm3j4bhM3OjuZzbFJNrfap2h//f; 20:PYXF6KhokPCjyRIncsQ4NSPp7dmfCZh6+arGoWp3ouP3ceoOTAp1cpR9fB2OGekoauxk87TSncmFKHt18IyKJZ7GjUdxSGynr6jYsktke64MwkH+1pJTGzexkSADW7SIeY9yhzcvjigmf+rr+wFnXxuRu0PZxOhuaaKTnxneGbefGydPZVj6vXMkio0T65GaFW4386+gXJJ8MYP5wiTs6imruxHQb3F3a5k+SwewZD7y83Es1EUhHZpz9T7iMTWjNGgfVeHYTCQ8dHIkG/AMk1XPVdpeSJsuYL15cfGU3DS+CdWVQAodc5fNU4uccN9IMoEBHGEv5BxOky9KF8WYuTsEGe3JdW9x4rLOC0DcoGU+1RUMq6SAQjQHmhYpib5iH4Add7AUJRKoGYABNY1Fr1s0EtedSsY7bYDYtq3PHcFx2ueq+zZwr8R4wI9obcLxa9SyDjIfVWxR/afZdz4MHkzC/nbtT+qc1wYoI3xxLp6vQL026EmPhb11r+amuC0kpRgMlOjbLAeJEiGEjOMn5aJA+UvKMdeu97bZDVq+PP8es7VkGmmeeN7j70u8SWw4//CdvWmV5FuWl/8aS5L3VsF0wcF9B5qPbl8LuIa7RlY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123558025)(20161123555025)(6072148); SRVR:CY1PR07MB2280; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 4:7HXgXCIKJUOUD3J31BMTcBl2EhVpsvPz4ECDT1ahgeN/XcoIbq+kkG/cTqOzqhuZFDZFuF+1SyXBuRTaCSUlpkel7Z83/8TsIc/ECr0Tc3KFDqLJznfVAaRiCWalajrELcjqW5RlOLENDFEZOFJ2Lo5Mw/XdK0x8vTD22L7CD6pfHjKIN4abOylXf3qNPP0gZVN0u2IA4v//fvKZEEQzglFLs/2qUOePMdNNXQgvMn0byf2Rvbokkp5aaMPNL/GW2nDKJSBK7IzSSVc5xOgb9uJjEtqwYdzlcMFmsgd6/o6kXpuvO+2qoUGadcPS1k859DxMgl8QiUW+KO6xaZW/4rJx1Sw1kpjnlIHHyYXropJU42J3cgSGAWyxUiKxOukML13ur8mjfTAgN6USsbINmMHghwcVI+GhvIlGgkVZRXZkBY9EOz3WOAsksYEL+7dqSPwuBBlkdlVlCwPhtUMOX3o4ZLguIo1CkqXFwFzQNOP1+DKZaRuSXkWgP0rNCP4KhJtJ0SZy0Fm65+lgGgVFjIjaZaCtSdc9ilZJ0DWOstsgVMCDSiXIa/UpPpZj3pz1Xjox4xGUZewQXzJlnr5BhA+guIGYSVkQPn6/EyJsGdQ= X-Forefront-PRVS: 025796F161 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39410400002)(39830400002)(2906002)(2950100002)(5003940100001)(66066001)(42882006)(6916009)(50466002)(48376002)(47776003)(42186005)(53936002)(6512007)(68736007)(5009440100003)(54906002)(50226002)(38730400002)(6486002)(25786009)(305945005)(81166006)(7736002)(6116002)(3846002)(4326008)(8676002)(6506006)(189998001)(36756003)(50986999)(76176999)(33646002)(4720700003)(5660300001)(110136004)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2280; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2280; 23:IppOf+Mocvfkv3ILoy1bQMVA1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E6i81mTaVDTWoWgDuYwCcF/xH2jbRKq7tPNq?= =?us-ascii?Q?zs10vVa0XQpvZ9m+7IUebnSRH9u1He/kCqWJSz4jGWr+z1NoFTYoO7cxLDLB?= =?us-ascii?Q?BhSif5etnoq9SQNZ1ozjrpuBMh0aCqwR2lsaPX9tqS6eO8oBlM2wG6omgwfq?= =?us-ascii?Q?JBXSek=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 6:JihIVkVQwc7/ChpWV2ya0NdkBPUJteMdLXjQJBfv4tMuYT3weNIPRS1+liyoXOVsJ8ZyWOVePpeMwx/H0wXSRxXXJS9PPuupk7IVSojIQR4QgdDpi25umc6/hF24AFqBaLMdeNSlfZPJxZhmCX2ta4ChiPHz2n1txdbyzdVMM8zWZxF5yy5r5DGIbOQ1sw11dfPnNYSIMqMb6GPI1UhZZioxzzwxOteetEbo+urFe1Nc2f8c1Efagqoce4P4MJxgs4S6X9vwr1ub5d67z42aXhUMGB8TsIVSMok8W41tkFA2/KhO9fidZSpZMm8K1YkR7yPh+zIMWJpD2Dyn4WlzzBypCtyAGy0jGCuwzCZXgkZ0XX/iJNkR/pXOAffOcFkmR/rmQ7zRJQHQDRxIuNdBhg==; 5:Zs/ydZgSxjkYftd/n8Fk/RhGl9k/NSIIWOw9GKnqwkyTnvX5hOW1wIQ87gIljAAAO60huSKm75bPSryfJO3rOoFxom0o8C7FrMzRgaygjy3i5BD+4rma4g+8MXsplWKCPdJc47jwLF6SzJTDd7YfNg==; 24:G64gPMIdg1tP8o1wcrTZu1RwkuankFL84zXTRQ0/sfP13tKOlN4KtA2rDdNmo2Uj/cHHynLBVAnYpbX/wgdPD534SMpzDLs1ulaXLJefsfU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 7:qCiIX9qv2a8Rwx0Edek/MAmcu7k9h6g9hvt6425ErpnK6o/hL2ogAIoOi3PE0G09MNeuqmi7px4ywSt+F4LX0LTTJvhbPCrzH5ggaAt2L/BBUgYVAbDto5K+9NtXPjWqAprQPYjgubLAun1Ag7xIlzNP/29vG9YZVFpGV/Hoy65ZDR175jH4euGbXQzyIbJifpVniwaB7bfnFyJ2Mv42LTJhlSo7RMVks8sCqIhf0KHsoQ2uvkiDRoOAGNqTZ9mafShdw0B1QJ/1mq8BznmtaOFR88qX5Vyk8t5+cFtRCnlO2Gl5E85AcTTCzxpvhoZRwKWsh7vJFrdvCZmg9tDxlA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2017 06:28:48.6082 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2280 Subject: [dpdk-dev] [PATCH v3 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: Sat, 25 Mar 2017 06:28:52 -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 ab97977..ef4d794 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