From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0052.outbound.protection.outlook.com [104.47.36.52]) by dpdk.org (Postfix) with ESMTP id 6C12298; Wed, 25 Jul 2018 00:26:13 +0200 (CEST) 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:X-MS-Exchange-SenderADCheck; bh=Kss3KubU9PY6BNz1b4xEZdfj4qv/+tONslqo6GzdGPs=; b=FTOfuptTxwQdo8NiHY/Sf2/BB1Fai2XFW88IkficAAbJmXe7buXb43kQCe+Hsu9lFeB32mRNJJpqW90HLsQzpFl30jTC9XlpIeVsRAvff+z/HLYIjiLEUpASx4K5F3c/J1ftQL63Jx+q0S0l0XZkVGfLUZn2ZyvoECYKkP2FCEU= Received: from cavium.com (198.186.1.6) by BL0PR07MB4020.namprd07.prod.outlook.com (2603:10b6:207:4b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.21; Tue, 24 Jul 2018 22:26:09 +0000 From: Rasesh Mody To: dev@dpdk.org Cc: Rasesh Mody , ferruh.yigit@intel.com, Dept-EngDPDKDev@cavium.com, stable@dpdk.org Date: Tue, 24 Jul 2018 15:25:48 -0700 Message-Id: <1532471149-2369-1-git-send-email-rasesh.mody@cavium.com> X-Mailer: git-send-email 1.7.10.3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [198.186.1.6] X-ClientProxiedBy: BYAPR03CA0032.namprd03.prod.outlook.com (2603:10b6:a02:a8::45) To BL0PR07MB4020.namprd07.prod.outlook.com (2603:10b6:207:4b::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cb9bec51-0558-4c75-f0ad-08d5f1b474b6 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(2017052603328)(7153060)(7193020); SRVR:BL0PR07MB4020; X-Microsoft-Exchange-Diagnostics: 1; BL0PR07MB4020; 3:7XHqAwZFbF31NiMyDyPQKcsuQs5zG/sgbRO/IjfHVB++Ity2FUqDpGtwwCWsi6gxhT3opP4qruYjRVhPXtkc9b/kdkF8dnEzdbrp7oueH5uhhJJ/WcNvBiDCU1/g/6z/ZMot8f98SWI5O2p42M4KQEi41c3pmUXIiuvf7EXhsWC83eO7to3CQUqIJFfPpDNAjFg2IQcVejDtSYWOog5p4CRX3rh4I/RjuKZUTAng2DIkJc5q06d8FjbnYjRLeNoV; 25:82f5pfN6f863G3DebYDxMfn9T9VyQ0yCqvklcSOJORXeVN+kmYHI1tmzUxz5M46U3/sGOnSzezaLpLJ4pQXraQ3IM1nJyfN95bEQd4jWYWGuGTo2/TCtr00z0IR1xat8hKhyUei4zEo0iBZD36FtqXPZKq9yEdVh+X6eZGRpTbbpJ0bEdpEAPO+lU1ZjuY9ifvM7zQ9W9vv+/UoqP6QzoS5tkML5jLxWGumrgkuvxLHfybyxwkJnAJ3jLAjBkKUIgV8J0+zaoXB5AnCsafXUssS8m5BYGdTVa+OoTcCMPLrM8rF96ObAPRAXmr1l44ig1bWoDsWGBGaWMkys4BP5ug==; 31:7XBAUSdA1/9jx/N0/iO6qiztMx2WozYs6D5Dr9v5WnOruEZ/h704Qoqc0OtCJVRrOTG0BYUl/dksc4y5p14o4wfzDan3/3cqiAOONAh05EE8hWKTWBe6ktCplG0gTmi6yMBjMISfLGrLneqJdcttedteKZYPtPCPEoSzPdNWnvcTZaHrNPWi9xphxir0YUajBbpR1cd1qg2/fsMFIWLSpW60zVzhiz9SrpGOklLd++w= X-MS-TrafficTypeDiagnostic: BL0PR07MB4020: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rasesh.Mody@cavium.com; X-Microsoft-Exchange-Diagnostics: 1; BL0PR07MB4020; 20:HK6DxWEKdySQoNJ5GN6dpUz4VX+my0kOQWi5lWPSO2qP4jNegJ+KoFxgRAUbnAGD80R/oWMBXlOSn9RtxPa6ZXU6l4UfKLB2EnXoHrsoK/CFgUrEFCbp0znXDTdGCPV4y0sW7Vfh9rzTJuUdn32jfmqhc1EdW2O/7b2JmOzzMS3y/asiIx1shCArXsEhJyW/pc8jAVoIl3fq4XF9vsNQ15zfmGJsJ5acO/QSGTKHrHPtrUTfEkq4l/L4cyv40FzFHwxjUN3tUjWjWwmAOMkHoerl2INsyNPYjTppEswJvCCtD9b4kAi2jjqR87AYJr7Ged0BXeSsOFRxcPJq7FgTqq6Mbn6ek4LuRkYloYmKSpBJ+MgKJafWrX9a313XeeRLhx2j0GREpBndMJa/eIoAEtFXy8bX9d0FEMOS2+RJJH4MYrmhpXEysQv2HQbLhE1hRW4YzL2PGnKAIqu6QlZhU7JKT2kp0IwsA7hD8XwCfleyF9B057Zskl0rT3epa+kt; 4:y6ZFCMyt3zrz0kccJsHgm4Di06yZSg+mqyfk0LwJJdBPcHg0m0RZ1f9dTHp60w4+BryDy52E2vqgg7lNTu8+zkUFyVIKtGEACP/uyiPtXpKbNwS6AiV/gFsGAdeA8NDKHmIkGppBI/iD2fgi/uzIfi2oRQimF71dyWuMS6dl5EaUGo9qgXBkwYbB7C+IF5c2wfKgT7Ueur4pgi0TQjj1G0CrfeRsVVyAltlFGohSx8K1v7kRP8/18hBAcWvWbHnX0xd/dV/7HftsHnxgOP3hCw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:BL0PR07MB4020; BCL:0; PCL:0; RULEID:; SRVR:BL0PR07MB4020; X-Forefront-PRVS: 0743E8D0A6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(376002)(346002)(39860400002)(136003)(366004)(189003)(199004)(486006)(48376002)(478600001)(956004)(81166006)(72206003)(81156014)(6116002)(6666003)(4720700003)(3846002)(66066001)(2616005)(68736007)(8936002)(21086003)(97736004)(2906002)(44832011)(55016002)(86362001)(53936002)(14444005)(16586007)(4326008)(316002)(105586002)(305945005)(6916009)(2361001)(25786009)(26005)(47776003)(7696005)(8676002)(386003)(51416003)(52116002)(50226002)(16526019)(2351001)(36756003)(186003)(69596002)(476003)(106356001)(50466002)(5660300001)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:BL0PR07MB4020; H:cavium.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL0PR07MB4020; 23:DSpi6y8B3pLJDI+HdyH/8098gqW1IlLNW2VA8oeMb?= =?us-ascii?Q?bzJeUOSmprkEzdAktCRbDM+TWCAR1dNCjTx2/NsaBIgvG0LtGEBUgGHFS0VJ?= =?us-ascii?Q?lvdmo5gCA0sGSQC4J9ItWcRdjK5iKxPKyCwqHkqT+ZKdQWZ1V8q9nadExyZn?= =?us-ascii?Q?2BkCHDW42xVKfva9sM5cMDW0xWIr+WuWPNgnAwYmfqORzTWNJujtUoYEQjB6?= =?us-ascii?Q?gb0E+C2SiCNim1cW6LsGXTpX7b6FxlPsNKP+kMo1AbvSEBoEfSl2emH+z7Xt?= =?us-ascii?Q?LTHj6qxv98ZGjRk2dSmrnj2rzB6FHn4BnOUEkttKlUrzZbblkJ0c5Mv2xowm?= =?us-ascii?Q?/OhTCgurgvPk6EwS8coPDWRYYHvd2q453hnCd2DeQr68+uguPGBeUIv6Asn5?= =?us-ascii?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Pu8y/ZvvIcrUUg0IiQ0SifW3SUYEYdWW4d5xJUyEdaiCfPKsEmuFnIsPcOvWYMx5HAmTc/Y3s1JBTV36g4vRHa7tbepqh1EmMY6ZY7lltEEZAnIH6CMKyn444wrQNFofhWLnE5h142mkUyehizlIEwfkQ/qHwWkxIc+9maCk4hQ9I592s45cxI98Pj/0szByUXbXHl5Lh86HTX+RA5z7AGEhvlG6yNcH1XWICEIXGtuWEWLpTJGkuUgW+k1DdO SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2018 22:26:09.1565 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cb9bec51-0558-4c75-f0ad-08d5f1b474b6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR07MB4020 Subject: [dpdk-stable] [PATCH 1/2] net/bnx2x: fix to poll link status X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jul 2018 22:26:14 -0000 The PMD has been modified to invoke the polling function in the link management code which detects the peer speed/mode, configure the link and update the status accordingly. This patch is the fix for the link down issue seen when we do dev_stop() and dev_start() from an application. Fixes: 540a211084a7 ("bnx2x: driver core") Cc: stable@dpdk.org Signed-off-by: Rasesh Mody --- drivers/net/bnx2x/bnx2x.c | 18 ------- drivers/net/bnx2x/bnx2x.h | 1 + drivers/net/bnx2x/bnx2x_ethdev.c | 105 +++++++++++++++++++++++++++++--------- drivers/net/bnx2x/bnx2x_ethdev.h | 3 +- 4 files changed, 83 insertions(+), 44 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 84ade5f..4bb3343 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -125,7 +125,6 @@ static void bnx2x_update_rx_prod(struct bnx2x_softc *sc, static int bnx2x_handle_sp_tq(struct bnx2x_softc *sc); static void bnx2x_handle_fp_tq(struct bnx2x_fastpath *fp, int scan_fp); -static void bnx2x_periodic_stop(struct bnx2x_softc *sc); static void bnx2x_ack_sb(struct bnx2x_softc *sc, uint8_t igu_sb_id, uint8_t storm, uint16_t index, uint8_t op, uint8_t update); @@ -1969,9 +1968,6 @@ static void bnx2x_squeeze_objects(struct bnx2x_softc *sc) PMD_DRV_LOG(DEBUG, "Starting NIC unload..."); - /* stop the periodic callout */ - bnx2x_periodic_stop(sc); - /* mark driver as unloaded in shmem2 */ if (IS_PF(sc) && SHMEM2_HAS(sc, drv_capabilities_flag)) { val = SHMEM2_RD(sc, drv_capabilities_flag[SC_FW_MB_IDX(sc)]); @@ -6997,16 +6993,6 @@ void bnx2x_link_status_update(struct bnx2x_softc *sc) } } -static void bnx2x_periodic_start(struct bnx2x_softc *sc) -{ - atomic_store_rel_long(&sc->periodic_flags, PERIODIC_GO); -} - -static void bnx2x_periodic_stop(struct bnx2x_softc *sc) -{ - atomic_store_rel_long(&sc->periodic_flags, PERIODIC_STOP); -} - static int bnx2x_initial_phy_init(struct bnx2x_softc *sc, int load_mode) { int rc, cfg_idx = bnx2x_get_link_cfg_idx(sc); @@ -7041,10 +7027,6 @@ static int bnx2x_initial_phy_init(struct bnx2x_softc *sc, int load_mode) bnx2x_link_report(sc); } - if (!CHIP_REV_IS_SLOW(sc)) { - bnx2x_periodic_start(sc); - } - sc->link_params.req_line_speed[cfg_idx] = req_line_speed; return rc; } diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index 4150fd8..873b003 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h @@ -1930,6 +1930,7 @@ void ecore_storm_memset_struct(struct bnx2x_softc *sc, uint32_t addr, int bnx2x_complete_sp(struct bnx2x_softc *sc); int bnx2x_set_storm_rx_mode(struct bnx2x_softc *sc); void bnx2x_periodic_callout(struct bnx2x_softc *sc); +void bnx2x_periodic_stop(void *param); int bnx2x_vf_get_resources(struct bnx2x_softc *sc, uint8_t tx_count, uint8_t rx_count); void bnx2x_vf_close(struct bnx2x_softc *sc); diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 3a554b8..b1a1d2d 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -13,6 +13,7 @@ #include #include +#include int bnx2x_logtype_init; int bnx2x_logtype_driver; @@ -81,26 +82,31 @@ struct rte_bnx2x_xstats_name_off { offsetof(struct bnx2x_eth_stats, pfc_frames_received_lo)} }; -static void +static int bnx2x_link_update(struct rte_eth_dev *dev) { struct bnx2x_softc *sc = dev->data->dev_private; + struct rte_eth_link link; PMD_INIT_FUNC_TRACE(); + bnx2x_link_status_update(sc); + memset(&link, 0, sizeof(link)); mb(); - dev->data->dev_link.link_speed = sc->link_vars.line_speed; + link.link_speed = sc->link_vars.line_speed; switch (sc->link_vars.duplex) { case DUPLEX_FULL: - dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX; + link.link_duplex = ETH_LINK_FULL_DUPLEX; break; case DUPLEX_HALF: - dev->data->dev_link.link_duplex = ETH_LINK_HALF_DUPLEX; + link.link_duplex = ETH_LINK_HALF_DUPLEX; break; } - dev->data->dev_link.link_autoneg = !(dev->data->dev_conf.link_speeds & + link.link_autoneg = !(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); - dev->data->dev_link.link_status = sc->link_vars.link_up; + link.link_status = sc->link_vars.link_up; + + return rte_eth_linkstatus_set(dev, &link); } static void @@ -109,8 +115,6 @@ struct rte_bnx2x_xstats_name_off { struct bnx2x_softc *sc = dev->data->dev_private; uint32_t link_status; - PMD_DEBUG_PERIODIC_LOG(INFO, "Interrupt handled"); - bnx2x_intr_legacy(sc, 0); if (sc->periodic_flags & PERIODIC_GO) @@ -128,10 +132,41 @@ struct rte_bnx2x_xstats_name_off { struct rte_eth_dev *dev = (struct rte_eth_dev *)param; struct bnx2x_softc *sc = dev->data->dev_private; + PMD_DEBUG_PERIODIC_LOG(INFO, sc, "Interrupt handled"); + bnx2x_interrupt_action(dev); rte_intr_enable(&sc->pci_dev->intr_handle); } +static void bnx2x_periodic_start(void *param) +{ + struct rte_eth_dev *dev = (struct rte_eth_dev *)param; + struct bnx2x_softc *sc = dev->data->dev_private; + int ret = 0; + + atomic_store_rel_long(&sc->periodic_flags, PERIODIC_GO); + bnx2x_interrupt_action(dev); + if (IS_PF(sc)) { + ret = rte_eal_alarm_set(BNX2X_SP_TIMER_PERIOD, + bnx2x_periodic_start, (void *)dev); + if (ret) { + PMD_DRV_LOG(ERR, sc, "Unable to start periodic" + " timer rc %d", ret); + assert(false && "Unable to start periodic timer"); + } + } +} + +void bnx2x_periodic_stop(void *param) +{ + struct rte_eth_dev *dev = (struct rte_eth_dev *)param; + struct bnx2x_softc *sc = dev->data->dev_private; + + atomic_store_rel_long(&sc->periodic_flags, PERIODIC_STOP); + + rte_eal_alarm_cancel(bnx2x_periodic_start, (void *)dev); +} + /* * Devops - helper functions can be called from user application */ @@ -187,6 +222,10 @@ struct rte_bnx2x_xstats_name_off { PMD_INIT_FUNC_TRACE(); + /* start the periodic callout */ + if (sc->periodic_flags & PERIODIC_STOP) + bnx2x_periodic_start(dev); + ret = bnx2x_init(sc); if (ret) { PMD_DRV_LOG(DEBUG, "bnx2x_init failed (%d)", ret); @@ -227,6 +266,9 @@ struct rte_bnx2x_xstats_name_off { bnx2x_interrupt_handler, (void *)dev); } + /* stop the periodic callout */ + bnx2x_periodic_stop(dev); + ret = bnx2x_nic_unload(sc, UNLOAD_NORMAL, FALSE); if (ret) { PMD_DRV_LOG(DEBUG, "bnx2x_nic_unload failed (%d)", ret); @@ -309,20 +351,16 @@ struct rte_bnx2x_xstats_name_off { { PMD_INIT_FUNC_TRACE(); - int old_link_status = dev->data->dev_link.link_status; - - bnx2x_link_update(dev); - - return old_link_status == dev->data->dev_link.link_status ? -1 : 0; + return bnx2x_link_update(dev); } static int bnx2xvf_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete) { - int old_link_status = dev->data->dev_link.link_status; struct bnx2x_softc *sc = dev->data->dev_private; + int ret = 0; - bnx2x_link_update(dev); + ret = bnx2x_link_update(dev); bnx2x_check_bull(sc); if (sc->old_bulletin.valid_bitmap & (1 << CHANNEL_DOWN)) { @@ -331,7 +369,7 @@ struct rte_bnx2x_xstats_name_off { dev->data->dev_link.link_status = ETH_LINK_DOWN; } - return old_link_status == dev->data->dev_link.link_status ? -1 : 0; + return ret; } static int @@ -585,6 +623,17 @@ struct rte_bnx2x_xstats_name_off { return ret; } + /* schedule periodic poll for slowpath link events */ + if (IS_PF(sc)) { + ret = rte_eal_alarm_set(BNX2X_SP_TIMER_PERIOD, + bnx2x_periodic_start, (void *)eth_dev); + if (ret) { + PMD_DRV_LOG(ERR, sc, "Unable to start periodic" + " timer rc %d", ret); + return -EINVAL; + } + } + eth_dev->data->mac_addrs = (struct ether_addr *)sc->link_params.mac_addr; PMD_DRV_LOG(INFO, "pcie_bus=%d, pcie_device=%d", @@ -599,18 +648,20 @@ struct rte_bnx2x_xstats_name_off { if (IS_VF(sc)) { rte_spinlock_init(&sc->vf2pf_lock); - if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_mbx_msg), - &sc->vf2pf_mbox_mapping, "vf2pf_mbox", - RTE_CACHE_LINE_SIZE) != 0) - return -ENOMEM; + ret = bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_mbx_msg), + &sc->vf2pf_mbox_mapping, "vf2pf_mbox", + RTE_CACHE_LINE_SIZE); + if (ret) + goto out; sc->vf2pf_mbox = (struct bnx2x_vf_mbx_msg *) sc->vf2pf_mbox_mapping.vaddr; - if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_bulletin), - &sc->pf2vf_bulletin_mapping, "vf2pf_bull", - RTE_CACHE_LINE_SIZE) != 0) - return -ENOMEM; + ret = bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_bulletin), + &sc->pf2vf_bulletin_mapping, "vf2pf_bull", + RTE_CACHE_LINE_SIZE); + if (ret) + goto out; sc->pf2vf_bulletin = (struct bnx2x_vf_bulletin *) sc->pf2vf_bulletin_mapping.vaddr; @@ -618,10 +669,14 @@ struct rte_bnx2x_xstats_name_off { ret = bnx2x_vf_get_resources(sc, sc->max_tx_queues, sc->max_rx_queues); if (ret) - return ret; + goto out; } return 0; + +out: + bnx2x_periodic_stop(eth_dev); + return ret; } static int diff --git a/drivers/net/bnx2x/bnx2x_ethdev.h b/drivers/net/bnx2x/bnx2x_ethdev.h index f05be7e..5f9169d 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.h +++ b/drivers/net/bnx2x/bnx2x_ethdev.h @@ -58,7 +58,6 @@ #define wmb() rte_wmb() #define rmb() rte_rmb() - #define MAX_QUEUES sysconf(_SC_NPROCESSORS_CONF) #define BNX2X_MIN_RX_BUF_SIZE 1024 @@ -72,6 +71,8 @@ /* Maximum number of Rx packets to process at a time */ #define BNX2X_RX_BUDGET 0xffffffff +#define BNX2X_SP_TIMER_PERIOD US_PER_S /* 1 second */ + #endif /* MAC address operations */ -- 1.7.10.3