From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-eopbgr700080.outbound.protection.outlook.com [40.107.70.80]) by dpdk.org (Postfix) with ESMTP id 0182E1B51A; Fri, 3 Aug 2018 06:45:32 +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=lsShc6tc46uCZmdLKt34WrepB66EW+jNgASuCu+mwXI=; b=HiDCDPapDqYUsHJ2vtViG+ph/41VJUFS0Le3JYKGjvlMg+aJaerpZ/PeOr7E82dnHnC0QpP3MAqj0jebe0YgkTfqoDbsA3m8kY4MdC3coN7ODzUEQ74hzXajVRCsAtoVMBuo34qYrSymYPlfAlOqWAGXl3BlEMaW3Y4Y4REC5o8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rasesh.Mody@cavium.com; Received: from cavium.com (198.186.1.5) by SN6PR07MB5373.namprd07.prod.outlook.com (2603:10b6:805:74::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Fri, 3 Aug 2018 04:42:57 +0000 From: Rasesh Mody To: dev@dpdk.org Cc: Rasesh Mody , ferruh.yigit@intel.com, Dept-EngDPDKDev@cavium.com, thomas@monjalon.net, stable@dpdk.org Date: Thu, 2 Aug 2018 21:42:45 -0700 Message-Id: <1533271366-1351-1-git-send-email-rasesh.mody@cavium.com> X-Mailer: git-send-email 1.7.10.3 In-Reply-To: <1532471149-2369-1-git-send-email-rasesh.mody@cavium.com> References: <1532471149-2369-1-git-send-email-rasesh.mody@cavium.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [198.186.1.5] X-ClientProxiedBy: BYAPR02CA0001.namprd02.prod.outlook.com (2603:10b6:a02:ee::14) To SN6PR07MB5373.namprd07.prod.outlook.com (2603:10b6:805:74::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b3172907-f4c8-46fc-a347-08d5f8fb961e X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB5373; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB5373; 3:NhZGPTgJlfJeWNYBSl7xNkruqMQZcmJSBUJjM8VE9cSpKqqDjXzNyONHynekuysimX1M0LmvTculTQzQB9x59GTs/2YTwVaHhOxXdUl9Vr46TTboomYdYEFSN+AhqZ1/LspBte+U6tQPPNdUmzHtXhEYInTToRA72SWUSrJVygvZXkKkGx/GD6avU1Imnm+FeaGFvg6h2IZvvFYHmcwhs7SeHwFbX+wjpXu7mdVQLvqmy9XK02SPXFsri/xLI/re; 25:ZcSJbFf+n5ChSXEOkA/30Fs2EIXEJ4bDIGcNIm8za2jg9OikwFjvGqbbYX/acP4/FVOiZH45PK7jF186b1TuUPl+cmk93hJhLkXgQyL/cKeIqhMKR+PUuA59QD8rqvKfh27wvqRt0u7FGwcxlBGjXjqQbf3O7WyFJGRmAiMLjf6jIetJiHkA5Z5F0XNWtjlvOW8Ljeh0VJzDlmyW4JpNnm0IH3V361bB8LQDanjUjtzhhSh6PkCeK/bQeMbrYiuEYPPzIUesNznPMLJ/XRKXODpsk+anhiTb0bIKYC1G/i6cTR2G1s535bHolaq7nOI4oIS8VmEMCwu7+xYsgG4e2w==; 31:0w/bPKw63XpFdbcTOW5qVD8JmM6Y9YbcW8TcjutxDAnDAGcCMkFx9auPTWjOUBApyfScU7f/EGm46Npl1P0seeBw3dMbRla6QyCV1kvbN1gsQu9CXoHeZBOX6rwljCooMTo1FJDLjiA3J9NFB2GvyVzsYewg+YUB2l5TLA9Qwbz6Ice2QTKknJc+ChSBSvK1J5mB4Fn3wCadFA3Vx4ySyq2vh4zC4HtB32KfVKrGE0E= X-MS-TrafficTypeDiagnostic: SN6PR07MB5373: X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB5373; 20:OYrFJ9UHdqMYSaNkREi5enhru2zICsN51Cr2hOMKDIsNoR+w50aCSHYopSHayeX0Jq1us3U/K4rrtjnrgkCax9PaTpB4TMLAUr4gpJ7LkJt6aJ2O0jVeJk9+ddLdvDqoPJlZshTRtgQkwRBHnDsqQSkis193Ohr9Jr7bdVA8y4NBcneXv3ZUdG7yC5U9r7V5/hXXwUIVpKPmrWz6MwRbHykJszngHrEpdAG7L7Ehxh4pFa3gF2sK1uffGnTiUo/fhAMe+CSNFckmoquwBy83eaCeFSPC2A2HRCyd7Nt4wjlLnBAnNNQLwJMlNLt/aYghJJnh8W6R+fGNNthCB0g8czCL7jFFncWLLYBBDiWecMK/YCfKOQj+wFAUkJjFiNVf/ZmNvoGsD8bKWNAMIvOBtAkWr90zF3y4I/jLapgBUfvzCcsHRWLqIEIUddclk2sOzLCEJeDIpTEiKolzZOTVsNWmNufgu1mnXoIkedPpjm3PhgVuRlPCGu3WiLXV/2zq; 4:jvSts7crQ0ZtSwKSXvqwt8y+mqlpd73LoHy0Zz3Ha8PRwR0Be9ksWsiko7JDcnwDK0Y/34cdxRN9cFUdyaFDUxzsBjoZfhCgFff+qhmh9dOBTXQZDC9bVPC4WbBYf5h8cg92P54mC30y92ByaQ1d5Tvgs3/hgnu2HSD/K2gY7ulGiLjrm/U3dQRgCMwnmG0mrQ9rmZGlGpMm0WAlPd+a5vmXdNiP27HinjCpwwgz03XIl81oR8BtQyd7TrKnjI4srFMBW9K311MtuNCZhulxsA== 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)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:SN6PR07MB5373; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB5373; X-Forefront-PRVS: 0753EA505A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(376002)(346002)(136003)(396003)(39860400002)(199004)(189003)(4326008)(7736002)(53936002)(69596002)(21086003)(478600001)(48376002)(6916009)(5660300001)(305945005)(105586002)(50466002)(72206003)(2361001)(97736004)(47776003)(25786009)(55016002)(66066001)(106356001)(11346002)(50226002)(446003)(2906002)(16586007)(316002)(2616005)(86362001)(476003)(44832011)(486006)(386003)(26005)(16526019)(68736007)(186003)(76176011)(52116002)(8936002)(51416003)(6116002)(7696005)(2351001)(3846002)(4720700003)(81156014)(81166006)(14444005)(36756003)(6666003)(956004)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB5373; H:cavium.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN6PR07MB5373; 23:hOots4u3bA8JubEenMgyqMad75Jv3MydvBEzQd86S?= =?us-ascii?Q?pfgtYaMOjKnHM3fMfxV/9kBhrOZ/2t6JjUZ/GbkCp618z4l3HaG6QK4Rc8KZ?= =?us-ascii?Q?cGomYt7u5lDY8IyYcXjjDsYZ7AEAU1WnU08Tg3booQUQBHUYLaFsnHLkOW7N?= =?us-ascii?Q?90NOOKVhqqfj+o2UxVnEnZFyfkfmt8ZQagLn+t6psxmCaKzJmGDZNQCzqqSC?= =?us-ascii?Q?b2slmSFo8q3KIrjyxbIypPtYdPYkoqpLdA9ldz1B/h7vmh48qe4pSdrqaTu3?= =?us-ascii?Q?HUkRsKoLoJZhPz1d09byDwWLZ4fel1jtOuKUUu2MX+Bf1wjMH/C4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0h5Qm7GYPyRbRE7mn+cxPrXefog/E6RtieviL9coALphXzbwn0kHl9z4fxymG/Zmp1sC3CcMxhy83xNVPAokTcqOKpS7Guu005STvQRMUyNZNd0zdwTrP7JYz9fJSbZJpsxBTr7/z4/P9rzhOVy+J1AXdGG1ArWs=; 7:VjVSYUWZzEn4j6ZNWWZVWHgW1Tr6WHhWUUyoYcGVI/j8v3zpv2cTB7MmapxIY53zPZUElMK1BhSkJnW9VKL2A4EIIQ+n9dCnypVCZDmJ47PuBJRKStT3VPwIOch+RSHowo3P73UIn3NxIDzAuj5Xj+VDEXOrma91A3G/70J+SiHgGkNFf4TptLjvrQeMKY26JyNP4uAxdSBxt1X+XSkA7C0JwqoWwrURu2sVAF/8KcryWWO4BK8IsF16G5uL+ogY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2018 04:42:57.8350 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b3172907-f4c8-46fc-a347-08d5f8fb961e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB5373 Subject: [dpdk-dev] [PATCH v2 1/2] net/bnx2x: fix to poll link status 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: Fri, 03 Aug 2018 04:45:32 -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 6228744..9cb9f21 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)]); @@ -6999,16 +6995,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); @@ -7043,10 +7029,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..c32d1da 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, "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, "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, "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