From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0049.outbound.protection.outlook.com [104.47.36.49]) by dpdk.org (Postfix) with ESMTP id 242EED267 for ; Sat, 25 Mar 2017 07:28:31 +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=leeiwtT41mF9g4cokGAwXjhODfSxOkYU9Zg/lN69hUs=; b=N4VXeOHfzC0/RB/3tKpqEDzIDq9I9nSbkBmEsiJDIqEGix5acadzlzBhe4cxT08SLl2Ubh+FubxIn7pjG/MD89Dk/XeAg5d6BTUmLwZUUPMOF44Gzfdbr56Gj4vVcMYkKHfp1bwfg5Y74FQMd9J3bc+g/+J7B9pxJPtVHjgAR8s= 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:27 +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:42 +0530 Message-Id: <1490423097-6797-32-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: 954427ac-cd5c-4fbb-3f9c-08d473482714 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 3:EXLpK2n8PiijCE3iZ8b1NRFH+NL6Q/p/Ux8NsxkYkQ5K89Qp1didfAwoB3mCstBeDGioCvRhfh0YbvQ+vydYB7B0kNk6h/FBqbvyIgBa1mJ8z4J9ILGoFASILvE9C/xrSPUpnFSmXaRBxYZq/zDr1X8vHnB8KTXSGB0eo+S8NcLFC8ZycIwh751ZpmxGa2qa4PTJOJGBwyUuK2adP1pjJCR0rDsVD6sniCmf+XcXZEQF7FOgflR308fHBCFXWtfS/HhMOUaJ1ftE8dfeT4UcOg==; 25:vwvhnnyeMrvA+G8KNNTOBEsep6ucmuw+zNmjn3v3FexXVMsOPTjbISlHaF72ADoBfmjTiCi3dqoncPyBGvyMr98HmdkNUCLRt3H3KloyzEiJ9jHSPPI2sExMxcgrNTFa+AqZd396J5S+k/c7drrRCIokz0zPLJ93a4XJHu9noD/LtE1zKZiC2A5OB+Q9IGNvmPnvxLbBnQzl32DoZfJMhnqngSojXGLWxI5236msFOmhWLZk8paOvbiNAW2rIqZsSdTzjjo7oqMrTKNBA9lWm+vULnGkhbNnoCHss99XpDuXHWnqW9Fm1jJ+Jzrui4vAodlMIEA1TXcA+K9+8XsE91q548WWHLrd2JrS0hqDLoDgT0BPdHc+tWwmjP30BZFyeUfsArYCvqKPyxzGAPfREDX+bBqFdkw+PSxBJHEt1INOLq8VN68MAz54OBxL6gdbR2PU5F8ivv9qYPznxryAYA== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 31:J4869hG4oTSeORE43ca1n4n9j/XXtCRR6qiPCQa7W2U75+wbklLpbPR8apoNM3loZPiadROVQz+KV9rS0eeS3T99s5t+nLkChksHKITCwp8E2CFkvcXh5mU/A8eKO57OGNIRGERmwhqC232n4XE/ahj/xJ3PFbsUMsNNXSnDtqaTpbI+l9+QdEVySY538vxJWkI/+Hm4Q43QwHGlCZebCAFzKJRyF/Qet1cyBkKJP+s=; 20:BLbyjLM9MXUafXKcCAIEPWFpgWtuHdJeNbYVwdzgkMnclZ53Cff6KWkyvv53NnKjWkj7exFZ5noeOmhC7pWZiLiRvCoGHyyUfYPP62GdUCdOWkeK1I+evP99Xj858yZ2yf3L2hCgK6ary8tTq0JjZI3R5XQbmXFMHuzxmBHEFOElZ4z6jAOBLs6UC/LlqHYhpm0iXbB1f6Gpeq44VkZQc0xD9XhDjhHYs0a0K1q4l6wC8j0t+d5gvrATtwFmXXEhnhvIFBIP9ttg0sAZ17fNNgXP/5mKk+xDlNKLnwnSkoKAnFeyNN6eRblS8DCJ0POh1ryjVszbQZdM17XmBNoObWZLFGeOSE3qnP6cdjB8f1idscrCEzkna0mKEwaJYODcG5HfYuwu0Nmxl1qqmpyao6VshG8iT+qzL3odXOB+Z8BwOIqc5QjwbzB3qYi0XfmY20kAQ7PePX0Uk8u6FGeMSKo3ZCi4Kr8UwDyv4D6tsuyrQAsMHBd4kEzZvvrlKq7Ns7zcrf1d67Bt+kP4yZzO72Xen3i7UL4EYyeKXPceBBF5WLuThZxoo1k3imLCe5HeR4yPGFiiWVy1UW91kYDvxvK3mb7dZ4yBYOCmNusvlvs= 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:zA4vD19LLuDBY1tykqzp3k8PM9DRxcxUmx8uZDy1+XGlsXOcqSU0kzkqzi+rQbulkSGupSxuF42WmZFG5HK3wc3d3V2ROenhkq1M3yUIgOs8esw/8Du3A9huGb8Xk/sQ4s63hs2bEkqKR9Ik7ed4YGqjpqnk1PT65zQqpFEf1DYiustnIXHbSe8Uq4mhx10ooPm5UaLoVzVV/MCUUP0RdDvhnrIwB3djPRJTcTVG6Jy0KYGqkT7tsDdlE3F7z8fVmP5vnBZHoHXZBdebfKfNvAQoADSxvr9InpwP+UyKE6qYstB5zrlpTBbYyhhczWS4/Ngig1v+WKgaImsqaFMLERb/DwMmAFcZpzT0bzQ2TFBvswQ/HehE4D2ZU6TEeZRZjxU1vUr7Q9JoSGV8/isMvlHL6RY/bD5zwEAPiF3qMI55g0n7HgDUszQEVjdlUBhEOxdFDzoJ/8EQsXIAS1s3Up0X3uvbuo1M32y0YVgC8hxDo6FvxxnO+fPimLuFISvcc/yxVky3v+Rm2hkiOjgumI5U+vxAqICSeJvvMd5MfOejbnnF1422hnzAGCAoviZFNUqy8UYR4zdaIe0thoRfTnLWyHkEh0wYYHG5y8R04jQ= X-Forefront-PRVS: 025796F161 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39410400002)(39830400002)(2906002)(2950100002)(5003940100001)(66066001)(42882006)(6916009)(50466002)(15650500001)(48376002)(47776003)(42186005)(53936002)(6512007)(68736007)(5009440100003)(54906002)(50226002)(38730400002)(6486002)(6666003)(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:lP/p4Gvfsjj2eABOD8y0fAwY3hXC88XuGygehxRX/?= =?us-ascii?Q?h4VZHyWqQTLZvRFejpryZumM/sEjv0rXxjt3iZfZYq64xqSLAVdXgEWcqM3+?= =?us-ascii?Q?sSa1G9HG63TpXDVJjxNnfCkPLrNnh0SgyBRIMQ8i4xDbw34xcM6RJuQV2LkX?= =?us-ascii?Q?//4QXc3ShF1N9HBgjo2w9UJ934AbcnA4j6ZTwbMtwGtNNno1JhyKReX7WQj6?= =?us-ascii?Q?dpIzfvgmkK5IC+iyOP7hMwiMby/1Y5sevYgoLAeJxRG/3ZWWJfvcaC0+fiR5?= =?us-ascii?Q?KT60s8zetZD6kCWceyv35PKjpY17xkvPsb3FOxObOagrKZXI5T4oegubqTUk?= =?us-ascii?Q?klqMoia3DKJ+iB5TugnhenfatMNHSWaBO30ZIqiuYyCFvNggnUCYqv6wc5hm?= =?us-ascii?Q?2pEzsG3HmQYkfNfahtzGjB5SgmDODju+VjFgnoZICWvX1Bxa4TzvbDvzyJKj?= =?us-ascii?Q?FE4hVugUScP5soJ6ZO8p1gyc5dcLXGxMluCM3MhcHzJHOokR06I36VrK2j9/?= =?us-ascii?Q?ln1LtYDkfSXwk6xtQHbAc12e4Mlb26Z7jmwLxoSPRAdt3anekC7KhDFbs/a9?= =?us-ascii?Q?BHZC7aUhznDK3SU9r0CSK5UInsLNbabn1S9l+zHXYKpXMqUhFey10JBFghWg?= =?us-ascii?Q?Zf2szcwmwMmWjz4BJh4czhTsK9x9Zw+VjFERxv0saZouknCgPs+5QQfeBu+h?= =?us-ascii?Q?wDs/hXp/ul+DZlPkH/6nQSg0Hh3OOLzgEJwxna+UgLlC5DMrGVThvCk9355p?= =?us-ascii?Q?xaMmAWjxtCb4GNQ0OV7ao0INcca+CKOjiSD7fahC0NWV8zoYh9HIDt88no7J?= =?us-ascii?Q?IgOq6i7Vx3RjjindkmBueTC0yKB8mN0feL3BKjkiWe80pUXmz/P+aeDGoBeo?= =?us-ascii?Q?6fgDbaFf3JvL0ytrbjdz/8eS2Vjm5S/I4Yur+FLCkQZegGudgEJT3b/Y2dXg?= =?us-ascii?Q?eARd/tmBYH7ZZUlogl7L1l3h0mKpvdwJLRIzwmUpMuu91PEjiO1KGyPO5D4b?= =?us-ascii?Q?dM1yLB9WtETqY9yaW07N7ru86JJ8P4p8ceLC8rUUTS7R+ZZV1QZTMAdxoB2D?= =?us-ascii?Q?tM2wO5+p9GKFreJQZpKusEVT0hgfi5npAPZQhqlGy32uIYgGg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 6:hYXPCEzRiYcNJaPPoFBBZ9ETP97QssoGzJ6KE0egTzZaHnC0OFXlU3Dt/8p7h5vvnqLloX5NubTs6yT7cOlX9aTTqehMrK2hqBkZTmJELETPa90S/RCa5mxQw3ayS2S19sMOX6xpOd45XGNiPAgJWrveFmitGGj5nXS3mzkdsvkQIF6ztjVLJm/6KmeYCfxYr1+dST5viVq+kOK950YQx3DGiJ9zsFzg7ujDxACrTxdRRcw9Its6hmtc55nGu4R4XFtROZlOqiyZhkVxkfV4v7Z7YVD0mPRkogP9ggvj//f2BCeK6cs2pIHmzUJ+h6DoowfOGJZOjmIEFlMGH18htudttmEYAKThkRPvIm/tdjCrlrIs1ntlvgrUr47eYGif58Ai1TlcXwIJLwnQCX8tBg==; 5:7fZB0KgNBBbrNBoS3gCRDlGqC+VSD5SD2A+CZiZL2v1ErMM1FH4Ru2s9XOp0R2YFNGaq46Hq2BSCz8JHSS7riSe8dWD5g5nT/grZpUHerA3GVWjeYJ+MCD+vH8lCkxFkDxtshriFO78VXgMWlrdMBw==; 24:SU0VDHx4HgyqMdtN6xe+fXNw6sDt4tv0Yd7NboZzT25g6uX1Fnne8X+CZVTrvWD+B7Qac7Mayz1X7spr2L7kko1WazYo4bJtB0QmjD4cFEo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 7:tDx6aUYf59IHwr+rAl/EGVENwowrsqEHeNn9AzHkKUSmoTuIfcBb3WcI1+F9CwUBLbY5h+wdGhqopEWo/mEZvBQK8e3LPQGszxrcMjWWW8388K29EFGtKJaavXQSAyZawTaQ7b9I3ZCvSOKHn86d1ltDZe7wnFTLFg+MBVHYBkImgu9+fjnNu381n4T5YJ35STq4qH5HGtmuZ/5n9Xw6O2iPTbX89U2Ze7an6GExjszNOcO8g7oXr3ZFgYIbznDr62+anhm+dQhbn9DoSDxP5ybizrFWDRM3qEOksJaEmpfhcSMtuAFVcv+24Kkay7FI/Jof/IXOUYQKKKpyKDvEfg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2017 06:28:27.2211 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2280 Subject: [dpdk-dev] [PATCH v3 31/46] net/liquidio: add APIs to start device and update link 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:31 -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 --- doc/guides/nics/features/liquidio.ini | 2 + drivers/net/liquidio/base/lio_hw_defs.h | 1 + drivers/net/liquidio/lio_ethdev.c | 182 ++++++++++++++++++++++++++++++++ drivers/net/liquidio/lio_ethdev.h | 13 +++ drivers/net/liquidio/lio_rxtx.c | 2 +- drivers/net/liquidio/lio_struct.h | 2 + 6 files changed, 201 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/features/liquidio.ini b/doc/guides/nics/features/liquidio.ini index d4bbea1..29df586 100644 --- a/doc/guides/nics/features/liquidio.ini +++ b/doc/guides/nics/features/liquidio.ini @@ -4,6 +4,8 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Link status = Y +Link status event = Y Jumbo frame = Y Scattered Rx = Y CRC offload = Y diff --git a/drivers/net/liquidio/base/lio_hw_defs.h b/drivers/net/liquidio/base/lio_hw_defs.h index 1c1ad8e..e3f18e3 100644 --- a/drivers/net/liquidio/base/lio_hw_defs.h +++ b/drivers/net/liquidio/base/lio_hw_defs.h @@ -122,6 +122,7 @@ enum octeon_tag_type { /** LIO_OPCODE subcodes */ /* This subcode is sent by core PCI driver to indicate cores are ready. */ #define LIO_OPCODE_NW_DATA 0x02 /* network packet data */ +#define LIO_OPCODE_INFO 0x04 #define LIO_OPCODE_IF_CFG 0x09 #define LIO_MAX_RX_PKTLEN (64 * 1024) diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 97acfcc..4962cad 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -41,6 +41,32 @@ #include "lio_ethdev.h" #include "lio_rxtx.h" +/** + * Atomically writes the link status information into global + * structure rte_eth_dev. + * + * @param eth_dev + * - Pointer to the structure rte_eth_dev to read from. + * - Pointer to the buffer to be saved with the link status. + * + * @return + * - On success, zero. + * - On failure, negative value. + */ +static inline int +lio_dev_atomic_write_link_status(struct rte_eth_dev *eth_dev, + struct rte_eth_link *link) +{ + struct rte_eth_link *dst = ð_dev->data->dev_link; + struct rte_eth_link *src = link; + + if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, + *(uint64_t *)src) == 0) + return -1; + + return 0; +} + static uint64_t lio_hweight64(uint64_t w) { @@ -55,6 +81,49 @@ return (res + (res >> 32)) & 0x00000000000000FFul; } +static int +lio_dev_link_update(struct rte_eth_dev *eth_dev, + int wait_to_complete __rte_unused) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + struct rte_eth_link link, old; + + /* Initialize */ + link.link_status = ETH_LINK_DOWN; + link.link_speed = ETH_SPEED_NUM_NONE; + link.link_duplex = ETH_LINK_HALF_DUPLEX; + memset(&old, 0, sizeof(old)); + + /* Return what we found */ + if (lio_dev->linfo.link.s.link_up == 0) { + /* Interface is down */ + if (lio_dev_atomic_write_link_status(eth_dev, &link)) + return -1; + if (link.link_status == old.link_status) + return -1; + return 0; + } + + link.link_status = ETH_LINK_UP; /* Interface is up */ + link.link_duplex = ETH_LINK_FULL_DUPLEX; + switch (lio_dev->linfo.link.s.speed) { + case LIO_LINK_SPEED_10000: + link.link_speed = ETH_SPEED_NUM_10G; + break; + default: + link.link_speed = ETH_SPEED_NUM_NONE; + link.link_duplex = ETH_LINK_HALF_DUPLEX; + } + + if (lio_dev_atomic_write_link_status(eth_dev, &link)) + return -1; + + if (link.link_status == old.link_status) + return -1; + + return 0; +} + /** * Setup our receive queue/ringbuffer. This is the * queue the Octeon uses to send us packets and @@ -246,6 +315,115 @@ } } +/** + * Api to check link state. + */ +static void +lio_dev_get_link_status(struct rte_eth_dev *eth_dev) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + uint16_t timeout = LIO_MAX_CMD_TIMEOUT; + struct lio_link_status_resp *resp; + union octeon_link_status *ls; + struct lio_soft_command *sc; + uint32_t resp_size; + + if (!lio_dev->intf_open) + return; + + resp_size = sizeof(struct lio_link_status_resp); + sc = lio_alloc_soft_command(lio_dev, 0, resp_size, 0); + if (sc == NULL) + return; + + resp = (struct lio_link_status_resp *)sc->virtrptr; + lio_prepare_soft_command(lio_dev, sc, LIO_OPCODE, + LIO_OPCODE_INFO, 0, 0, 0); + + /* Setting wait time in seconds */ + sc->wait_time = LIO_MAX_CMD_TIMEOUT / 1000; + + if (lio_send_soft_command(lio_dev, sc) == LIO_IQ_SEND_FAILED) + goto get_status_fail; + + while ((*sc->status_word == LIO_COMPLETION_WORD_INIT) && --timeout) { + lio_flush_iq(lio_dev, lio_dev->instr_queue[sc->iq_no]); + rte_delay_ms(1); + } + + if (resp->status) + goto get_status_fail; + + ls = &resp->link_info.link; + + lio_swap_8B_data((uint64_t *)ls, sizeof(union octeon_link_status) >> 3); + + if (lio_dev->linfo.link.link_status64 != ls->link_status64) { + lio_dev->linfo.link.link_status64 = ls->link_status64; + lio_dev_link_update(eth_dev, 0); + } + + lio_free_soft_command(sc); + + return; + +get_status_fail: + lio_free_soft_command(sc); +} + +/* This function will be invoked every LSC_TIMEOUT ns (100ms) + * and will update link state if it changes. + */ +static void +lio_sync_link_state_check(void *eth_dev) +{ + struct lio_device *lio_dev = + (((struct rte_eth_dev *)eth_dev)->data->dev_private); + + if (lio_dev->port_configured) + lio_dev_get_link_status(eth_dev); + + /* Schedule periodic link status check. + * Stop check if interface is close and start again while opening. + */ + if (lio_dev->intf_open) + rte_eal_alarm_set(LIO_LSC_TIMEOUT, lio_sync_link_state_check, + eth_dev); +} + +static int +lio_dev_start(struct rte_eth_dev *eth_dev) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + int ret = 0; + + lio_dev_info(lio_dev, "Starting port %d\n", eth_dev->data->port_id); + + if (lio_dev->fn_list.enable_io_queues(lio_dev)) + return -1; + + /* Ready for link status updates */ + lio_dev->intf_open = 1; + rte_mb(); + + /* start polling for lsc */ + ret = rte_eal_alarm_set(LIO_LSC_TIMEOUT, + lio_sync_link_state_check, + eth_dev); + if (ret) { + lio_dev_err(lio_dev, + "link state check handler creation failed\n"); + goto dev_lsc_handle_error; + } + + return 0; + +dev_lsc_handle_error: + lio_dev->intf_open = 0; + + return ret; +} + static int lio_dev_configure(struct rte_eth_dev *eth_dev) { struct lio_device *lio_dev = LIO_DEV(eth_dev); @@ -388,6 +566,8 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) return -ENOMEM; } + lio_dev_link_update(eth_dev, 0); + lio_dev->port_configured = 1; lio_free_soft_command(sc); @@ -414,6 +594,8 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) /* Define our ethernet definitions */ static const struct eth_dev_ops liovf_eth_dev_ops = { .dev_configure = lio_dev_configure, + .dev_start = lio_dev_start, + .link_update = lio_dev_link_update, .rx_queue_setup = lio_dev_rx_queue_setup, .rx_queue_release = lio_dev_rx_queue_release, .tx_queue_setup = lio_dev_tx_queue_setup, diff --git a/drivers/net/liquidio/lio_ethdev.h b/drivers/net/liquidio/lio_ethdev.h index 22e3d83..98ff493 100644 --- a/drivers/net/liquidio/lio_ethdev.h +++ b/drivers/net/liquidio/lio_ethdev.h @@ -38,10 +38,17 @@ #include "lio_struct.h" +/* timeout to check link state updates from firmware in us */ +#define LIO_LSC_TIMEOUT 100000 /* 100000us (100ms) */ #define LIO_MAX_CMD_TIMEOUT 10000 /* 10000ms (10s) */ #define LIO_DEV(_eth_dev) ((_eth_dev)->data->dev_private) +enum lio_bus_speed { + LIO_LINK_SPEED_UNKNOWN = 0, + LIO_LINK_SPEED_10000 = 10000 +}; + struct octeon_if_cfg_info { uint64_t iqmask; /** mask for IQs enabled for the port */ uint64_t oqmask; /** mask for OQs enabled for the port */ @@ -73,4 +80,10 @@ struct lio_if_cfg_resp { struct octeon_if_cfg_info cfg_info; uint64_t status; }; + +struct lio_link_status_resp { + uint64_t rh; + struct octeon_link_info link_info; + uint64_t status; +}; #endif /* _LIO_ETHDEV_H_ */ diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index 6a1d265..d7e17bf 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -1587,7 +1587,7 @@ struct lio_soft_command * lio_dev = txq->lio_dev; iq_no = txq->txpciq.s.q_no; - if (!lio_dev->linfo.link.s.link_up) { + if (!lio_dev->intf_open || !lio_dev->linfo.link.s.link_up) { PMD_TX_LOG(lio_dev, ERR, "Transmit failed link_status : %d\n", lio_dev->linfo.link.s.link_up); goto xmit_failed; diff --git a/drivers/net/liquidio/lio_struct.h b/drivers/net/liquidio/lio_struct.h index 478a290..da08fe4 100644 --- a/drivers/net/liquidio/lio_struct.h +++ b/drivers/net/liquidio/lio_struct.h @@ -569,6 +569,8 @@ struct lio_device { /** The state of this device */ rte_atomic64_t status; + uint8_t intf_open; + struct octeon_link_info linfo; uint8_t *hw_addr; -- 1.8.3.1