From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0080.outbound.protection.outlook.com [104.47.36.80]) by dpdk.org (Postfix) with ESMTP id 08741FACC for ; Tue, 21 Feb 2017 10:30:18 +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=2qnVFBy3ufADzaD8Ks1hdyPOqrV1vyJQVnsa0giQ7NY=; b=SzFYgh3oDqd9e8Gf0swG1ftKeq3aBUQBw3Kr+VSsPwLrflTIGX9//GI6hepAkDDsZEY6mXfIRjtoeVJKxtu1ur4A2MmTKShTamf83P2LbyzRsJOdPrb2bb8afFzHDv/VTDj3plEkF0S5K+xJOwbvYFDPA0N3YKlwdLcCcnqZiDk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shijith.Thotton@cavium.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Tue, 21 Feb 2017 09:30:14 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:57 +0530 Message-Id: <1487669225-30091-43-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-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: MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (10.174.56.29) To SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) X-MS-Office365-Filtering-Correlation-Id: 578c5579-1eeb-4830-f669-08d45a3c3ec4 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:qEwMja6YsUVWNpZHqVtXETTDwEicCz86L1kf1FSNNe5Uk0rHRDnHJeLAUOusz54Aa82xxat/orLuQG4+we93fYi+Bqyfoc+4LPjfxDjBiR2JUw8ko/viFRWIgBOWYgqoxaSJQGfzinF3mPx1d37B0PGnijQ39LX9xlz0ntLMOO/YHdGAlT7aIVRBLuVFVEK3NWoKx57LoWtLQq4a8EDGcM7/Crf9gAFHUI1pUtBZOSNsggR5BQ09bVi4y04EbOiFHboYqQgYKFZdA389/bgBuw==; 25:JtuvRANT6NdnnAP6k+d9GDtkad1P7Na8jLAFZx3eeGiUOOHzBxBcFyLJhfktY3eahVrmovVg+XXvIGtKwoUa9nJeeM/iNaAUoRRIe6QKbAEzuS1sWPg0KjFIfAkO+B/6QlfW9/jkrtOm58r23ixdNTv9XB6fqCYBKUEdvyrDZFnIrXlPVpQo1gKBAd9z+JPiqn5nkWEH2R8OjWuRakGBTbnyIzgjrIYq0tA1Xp1/9kijltYc8Gha1fMeb/JBaeTZgrmiFpBwJfFzlkrVrCPcLzXOUjV8aVGM3VDWRGGaUguUuMXte7Xge0dpEfrTahNJylXWbnigXpjQl9yn6BKArbdDpEzYxga83gUjuk6czI565zr7vGW00gNyo/IaaqTbuAvrwPC+gL/BKcrofOi5SXKDLsg6dilN6UGmCQOpciG4pq5zk5weg3XwyMKLAIgobvUZ6R9kbwvQu7WVYlk28Q== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:V2hYpdh064P6yGjcD+dsfmrBZPriXg0BbR6JVDQ6pmYW5PmSYhWEfYGMxSMKPIojP3tjrE/jf5Pzd/KAnvcAqphFPcN2dnBRTmCUZWyvY60hMqEyRQ2ZUvLSimiFrO+pggB9+RBTqNMQNZmrIOViUROx8XA0TQKfXLtSUtvc4wOFxKo7/WZijaciPt9STl3M4n1RxloFswrMf9qnyOyZabgyiTiZlBFa4KSZVnOXiCU=; 20:ITwrRLXqnyT2kiqEYKRntLsYDJAZbdg4hYAYPwbcCYlKdlxgvfOq7IwuBRYy8XOKxd5DjzTNzYYADyJUvk+GbPXM3vsXGB5o6mBP8CJTE0rdHZmUoAVZpQdnos26W2syeCVTvKG30xFocN00rlAl2iwWxqtDc8O1ElvRPHayWDWaTzDA++cgj6yMtoMYYEWkO1C6sIg1AzdBm9x5hnRfUgYiUcQiRVcj+duBqZoNIpSvVAUTtWUbhbGUnpor0LLzdPW5/rmS49Fbeabnsv06jWYJZKV7YugYYo9YtBdjoiuMCOtQRv19RRw4h0hDyvhNIAYEE/Ij1xl7xCD0xyRcJZBI9LV79o9q7xOhqzCcT+hcGKUAEDJ5lTDFdRaZUU9wtGvts2A6gI4dCbaxMJyUo8ZlwXDYtw3JYV3gjnIthi2XvEhguShpmvMV3ehph9Jjwl++yvo/5LG5AfYGK48V4SPDsvEuDmGqKfrIuUFUYqwZGGjpSFvofIcM/AduWdTfrFPwuU2tVNwjpyGfNwvZrASuAltZsJTzHDcVcHj2Z4rRMG0aPfScrZmDT/S2YqPdro3ke7f7r+eU9VBYsawjgChGuiEURFy5+7zPVCdqQT0= 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)(3002001)(10201501046)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(20161123558025)(6072148); SRVR:SN1PR07MB2285; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 4:Vmz6HJLLf6iRZ7QeIKdwoni2ZJqUrSdi0zjwnL6xC7fsuyeiH0v0DC1gSbtr8xnwezHbgOsMIezSVQdAYhZxADlibX9lKESrW86/D1BgMEC6w6cwlDjjFc8Jmt90BQ7ZvyBCszo9lWL5Vey55/JvUPpd3bagrfDpBevFh6rEO5ca9Nw5HW62fh+iSt4INkxiU2ks5PgJJuCF58Na7na8XKWyU25H2r9MHmPwqYOcso7ArC4vDH4tp9HDsSLIgMEE0AA+5kod31BFPM73s0gTJokzloq2vWmnnVwxLayG1MjutpnWb2HUUkujAZPzygt+kOT1aNH90HWEJVlCnEkKOBUJe4G21LiZO8TUNgIaCL38y/l6WXws1CC0EZmziL10Vjy1/isUfMdqkuacBvaw2SHsqrKoWVNVGG2zNDGmpSpSbHHRaZbm/WrlP7LXim9OBskw9SfHliHmCYU0N2NOrgJMc/fX9thQxQ/bKCxdvlTVtcp2sLbz8SsgXIiwwp37bgx1JlZw+hEAsWfijmkOJZBvdgqMC7OLE+NP6Hd9ThKPdbOfYW4DQ33MnhXWbPHDI5X8ETiQVztafegFLb3nSkQmmLqb4TbFU7J7auPRprs= X-Forefront-PRVS: 0225B0D5BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39410400002)(39830400002)(189002)(199003)(50226002)(81166006)(42186005)(2361001)(101416001)(81156014)(305945005)(3846002)(6116002)(5009440100003)(8676002)(105586002)(7736002)(53936002)(36756003)(110136004)(106356001)(6506006)(25786008)(38730400002)(2351001)(92566002)(48376002)(6486002)(97736004)(50466002)(5003940100001)(189998001)(68736007)(2906002)(4326007)(33646002)(76176999)(54906002)(5660300001)(6666003)(6916009)(50986999)(2950100002)(6512007)(4720700003)(42882006)(66066001)(47776003)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2285; H:lio357.in.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB2285; 23:PshDItcPbTfj70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LgrvFrDsCcl4tfJ2MKWDdEv/T3A7A34bNW4pvxem8ROixWxFqxJ1lvJm+Ku2nesIh9oPqbjVglu7bw==; 24:UKGkUXkRMUnEpJPstp3ICYoptIRhwhAGeXUTH91WnxJuY+Fxbr0vRpC2kRTwVV70P3i5/Gt1sPM/XGrjf7c+6jmo5kJvfUGAxxnHJMcS854= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:c0rGa6JGwYGWug54bfBcBocm9wXz8G4RvBRm821HcYRn2y+5m6EzP6R6tVUAtfFSPfFkJaGcuJlSapdd+IgKsJKD5jFsb0gwXR4UMKwyDOyAshSfzaIoPe4tsjC/ulIpCr4IS9tpgFZovi5ZpNwgMk2/uqtd7WmRrUi89/qEpXn4GxXuEC9dhjF9ciUsTvOWZ8JZnmv9E0rY9B9DoyWYaLrI0ls3bt5kPBh4TbUTlvfROHy9T+FuJ56ShOC5xHR0j+aldn4PRcs3QlheVumGAeXovydwf/wo3jkTbApJSYxFYHcPg5GdCT7ZH3MUQqbjA5mfEMyf7VOn7x8K98D1AQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:30:14.4340 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 42/50] net/liquidio: add API 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: Tue, 21 Feb 2017 09:30:18 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula 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 c534f48..cbe07f4 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -974,6 +974,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); @@ -1145,6 +1199,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