From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0079.outbound.protection.outlook.com [104.47.42.79]) by dpdk.org (Postfix) with ESMTP id 9D815FA85 for ; Thu, 2 Mar 2017 12:39:34 +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=UsN/kQ4z8XytkBeRZzv/uw2zobQBFfLyyzahWQBuJgI=; b=JbRgix6kzAES/NjLe7bKJpCFxPD1STmifrhlBwihdDeLIIKeq68P06H/VlIH06bnqp87GKxNBMOmJWp4nWGT4/UQ1wRu2vK0/ZGpFeKQ3ESOpaseWLWr3u240a5b2Y+2J7fjudGI2ECQmY0wKWKk5chpo7gcnaJJWOoR0Dife8k= 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:30 +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:36 +0530 Message-Id: <1488454371-3342-32-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: 378d39f2-4865-43eb-2d10-08d46160cbc5 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:4WHEQmYWoa+bADk6zhWnMDgjt3xeYgJ3ZL+2HnSnXdv15xhl0vFJTBJr9jr4AY1s4XEgpL/P98hqWDFBABaeeqtkApVAjGBznRTFt6gINeeUqG0qst8hZJO9/7Bv0rI7rwMjh8QiYk73ESXOBV+DGnpV9AV+Bp0G7C38GBftGNdzOK2/zVnSNb4slV5mr4arKt3A3ZcE9VQ2WPdksPDMrW1svbKmXYBm8iSx4OEni0Oi4lAiQIGxFFm4IVWmfieWlzTHJuHptp+CjnJN/iw+zg==; 25:l0s3v1P5WyDLz0FvWD8piLu9NBBSRZobDqGddqxFeM6Fx3r60FrOFmP0cz7AAEOL9rFMc3A8ZtGEfIWSl1CW/by5iY73UBRcmOKZA+6DZqh8Msp2txYycLCd9H6dkn0t5WAsTtrDNvJ8ggHlqgqvNVHFDJJJ47bQIJbszSQr8GDwbe6tomnVceVDkVu3yLP37yYKsQ5W+rXX6nOBFZdBs/w/EJQGceDjeMnhBe6JllIH3b4LfhNux8PmlPAl7303GOCUNx89X6/94BM/t1XBycRhhNCj0uxYP1VMDkO+HL2aohaXTPjNxgQPJtSUhTCcu2ixLl2UmskIQtIa1BFamvgFYIXlh+y6iU0AiN1gY/y7QdT1RP5Kh7dZmY/ijdPxMJ8rt0lQ4OJvcBIe4vq8R3DN+3jX0QnMiSLZwM2tD9rOoxlblBTj5abEF7eUF+wAyBkyOBmqKIE9YjdFURKabA== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:SJTnaDbPbg2zFMRicFNoJzeilT620N5jhhguO5TO7fKgg7Zukq/tWRa5cngN7UkDUD4dwJEjydkCjFZYgoQGJ4L2seN/9LXkNYD1Omucg1Mc5/fiu2ki4QuMuxqvVJkDAWkHk7YMNWUjunBzURp7+jfoUt7FiJpxlQMSIbC7RJk1P/TqOX0u0Ka046n5KYC+avAogl8w/mR7vp6cS+e8eDAMSjtnk2PmLo8K6UeSJ8t/2hga0Ql/PgWN7FE7yj/W; 20:ChJs/oSeVplZWpX4OGsM1RthXBQ2ie7fVI5SDru6S+BIP2FDf13WG3E2ptrJz4LHmxBhIEf+QGiPakieZvs8wiYoz2uMwVWvwn1ws9Fg1cpwAxlR57SJmsSwzRJwyYOC4atqZX3okVz4J+gJFEiL3EaOABxN32W44VVt1v83dOdD6Guotei08Z0yxCZPN3oSDMBWrqgjTBJTzp66QyUoe6vUZm91cflsU6R0jTXQtLPmJOw8758vfOZaRobYWTGRqIHrJyRCLzbkhYXgrmi5biNc9H/+Jq3KC3jOyqQBCnu9xYPa6LszFJjELwCbsC5aZ6TK54IMLiqA1j3vE11TxQfLjupaGrBzqBqk75wGhkq0la9ZurXDaYF9LznUY3RLS+zyO6U1MWxrMZ97BV15RYMRc0INOl4fv3cr79gTknZRP307uv1tq+vVp1cJMoGfjj9HTvJJdxmQnkm+oiHPezNP6ZZ341nBEZQAJa9fqBK9ZOtVrQwI0GMGbGeK0bYhjubRaWfKFMVStlQdJJYKOdeI/L9EIKhBjmipZvmVbqSz3maYyM1dIRQps+hMsIjDZPVuST8rt/CsznmECOzXzeMalF/wZKupwiFu2J2kAuE= 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)(6042181); SRVR:CY1PR07MB2277; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 4:dqeOWiD4A2dIZUCt4rN6q30Ts0ilGFcaza79pArlp9z6/Xl9yOPPoSyOV3xs1qhWhhpx7jgFY8TvHcaZe+84NLY2GR5MViKV7gpknl+3gynL6hgdi3xp2eTf6+Bbw2qWy074EftIIVM4RttdGzdxR4DISXjlBKgQkwC0PQ8jWclNip6W4EM07v95Aw4a/gp7T8hVGCvCn4axwnTG79pefFeQviXds+DSORiY5lWQXwAajnY3E2UahOT3R1Mp/kzsz9b2FqkmNf634i/MdvarKYaWp2ekpuLEgGs6ZSkoSy+vkcXaXqwIqyZNqhX5hLJe5c7YPangvXlU9JzAYIjr3o40+hJuiHYakkEqHUtd/8MLFMblm66bS6sp0hdI8/q0k6GpwcTtY73busO9pXpapXVS8j6ug4IoHlhnA4SdYBKRY+bUwfhdOCtkb7QNrE5eWmXL2OGlru1HY80KctFKeo7wTCPHrbu80/Etk/SEbyx8ZeEh9N/YRuyvKFXz+hVCRG9i6vAgomkvTbEOPA68efuxPCPHb8CBYhCOQqePHc2ILUcgn/aPJiF9HQ65hbo/yJ71ZTcUUe8x0Yu+OzqfBJ/jOS/I3h/p6Dl4LZZ7RdUAJ/TpN/t9smEx0GR1KsWI X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(2950100002)(6916009)(42882006)(5660300001)(92566002)(4720700003)(33646002)(48376002)(50226002)(2906002)(5003940100001)(36756003)(8676002)(50466002)(81166006)(110136004)(38730400002)(4326008)(305945005)(2361001)(53936002)(2351001)(25786008)(6512007)(189998001)(54906002)(15650500001)(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:CnRDLPX4AsQquEHrtOw2WOUSew5ZgKb9sHxashTuj?= =?us-ascii?Q?FQdlDv8hyR6yuvNFdKIhboAdc6wsgSDzPzaZaJ8iVb0SVWHJC2VptU974HEf?= =?us-ascii?Q?SpaQd0Zf9hERzdl8/YW2SmvRXHo6qexfB+h/iz6l9wB9dzUf/Ewnw805/xBS?= =?us-ascii?Q?9UwFE48EKI5DMaBkQhbl692MrVcVsPHpVWm1FxUby1lP8hquvE75oIeFKHtG?= =?us-ascii?Q?tErxEEcRHKrPDmttdxEZHexFjrNc+eX56KFhqiKZE1VZO3h4/hnt9gRqNvNm?= =?us-ascii?Q?vBhAA0fAryZFC76v43cKIk/9gYnfzTrPuJ70R5KuwRPziS8ABIT84RefzRtB?= =?us-ascii?Q?ob9+snxmihXi9haHMpBZ/lteHHcM88eBcDgQ/YHfnKmlJ4ZXibXzL8LQySMa?= =?us-ascii?Q?pHKKHpGAVAAA0wG8GSIFhIbSPZ50XYUvocuyl398jAetFFSh4AHSj61QR8fX?= =?us-ascii?Q?5ZX81gTAF3VeYlsPsVM4K8DenVP55OBKj6YJdB0CQEpzQ/iTue1bGxeaILOq?= =?us-ascii?Q?aGHx8WRRtWr8+08B91jJL6jPEV0F4GsuWPEiGgyzKLY4+WTp1GfVxav6CRvH?= =?us-ascii?Q?fBtTZ43BcvznjsmsXOdyPP6GAE/EobAANTlurlvKBfNkrcBZv8q94E6TTVAT?= =?us-ascii?Q?8W6jCDSzRUZEMMH5gyzUz1622xQt0TpOFlQ5FqeOyzX8FxG1xS3WHjv3TdxY?= =?us-ascii?Q?3DhzPQNtoVYuyKKSwEPOUOaV40C7ePBGdlxEbxoYLHj43pNiDICC1kkOqDsF?= =?us-ascii?Q?Z9B9Bvk4x9CVh/xooGbVL4v2wMwnrXNDGIAzxkXOf/1xw66zWxiNMfvPM983?= =?us-ascii?Q?CjN8W3fb1xUuLEbkaEWL8y6z0BQojCzR5BSmUPW3b7VuC0VWpBElfDYLyGBA?= =?us-ascii?Q?TJYudcMigkN/fK4CvGBmURgEwoY/9IV69LbK8qQlaa2nlgpwfarK0xAPQQKa?= =?us-ascii?Q?H7MknlXlEFb8MRQkjlEqFbKUyobnYeAcZ5sc0KmYvpIBgkyiAOSgzXFlnr+7?= =?us-ascii?Q?ctcDFxvz2TUROodqEA1p0TOEjwcSY8fIeRrpKqjCwM4qaLesuf5AGwr1AydZ?= =?us-ascii?Q?D8jxGDgmce9ZP0/xCFljK9GiFG+?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 6:bS1VKn6DSy8gvFRd0YNw415LNDMS8/Br/rRj7Iw+JT9QDXIbDFbjOYmbzSZ9POLyN3upnCxkWMEPGNEDqCE7zMKFRiq5RnITdzI/pUYAoUH98QGPZwpWrp2g+ucmIsnPVP1x55PTs+Emnw+n5iNEslyJlHQLpuGqQGJPWVCPv8v2Ks4aRZSQ40jfWDyGhbUCvQ+Osx8hrEK89rOfp0HtSHY6dhYTMHsuPFzboX4UFDFBfZ0fbYpYxlTDhQ5287735TSR51AK+YNOvTyCE3SkhZyGfmEa+qvC33YSPDG6mrFL8Zpf/lmmszx/82YCZJRU5w+oQYbDRBPgLMyaoAQGej1m5mBjfIxf9g5Y4/xhQn19alIhKzmPvZIbnc0I3DakU4RpKDUvjxlTW6ZIBJtiyQ==; 5:HPXxxt07uhXa7tCsw3CORObNSLZBnrppDGMlZXgCTv7gxXBGPf/C6oQmpNvlyYh07WRSW6oBN8DgiHU4EjTmzfkf4lxEwzr9fqSsH04VlMuB1gHB0oFhOQ4k2QPDyJwPH8SBvhGcmYsVaaoRQrHJEA==; 24:ZVUkVCKZgjStHSi9vks1HCI5sYhrACPbpUj0M09332qS9xuwrIFLID++xEfO3Ei9KScN07uf4OM779rVJRkWZgybKF6EYXDqrceTjR6FYAw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:Rq2RK3o70RrK0mmLhrmPEXcdETEnMqDUMQg0K1lU38vuIOOASsKstzEDEZgHzmQ6e9dVUpFmwL74z4pmnzepYiO7oGO7XKg43qseSq37bkIgiy+JfWLTYiZcp2mkPHBo89geSfo7MCHDnyc+BPYv2Cd72b7w+YkRxeiVKUZc7NjX3cwo9MUs2/0KVWLxeucyjfcaVhKcQ7L8sHLBE7Cxuf51ykTc4kxKXqbO+rrGfEx4mUHjNV9ojab0Y8oqsNRF/8BeiPM2XSugvX0HRISqxBHPeUba1k3tkW1vs8AfaKLavgrqdc7vGINMiUKWO6cZH8gmQSWGmboipJeCm5OVTA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:39:30.5627 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 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: Thu, 02 Mar 2017 11:39:35 -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/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 + 5 files changed, 199 insertions(+), 1 deletion(-) 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