From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0073.outbound.protection.outlook.com [104.47.36.73]) by dpdk.org (Postfix) with ESMTP id AEEEB1B332; Wed, 8 Nov 2017 13:04:57 +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=57tCFb6b1SBb/2FjhEYDLRBqB4j3GqWMoozlelE+Cws=; b=ehCLxrRbZUuyRyMWXfy1mWNIlU7EnXncEAkcp+HR2U8228qtwmiZYTYcf706453lUN3985ifeQ7XiHKLhWD51iUSxfaIeVW2OIQKidiVF277Ag3987ibqGIjec+5sGs0T8R9Bp6txaqMsjiOzu91lhOy4H8c2QG7NQSJ0WKn4pU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shijith.Thotton@cavium.com; Received: from localhost.caveonetworks.com (14.140.2.178) by CY4PR07MB3062.namprd07.prod.outlook.com (10.172.116.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Wed, 8 Nov 2017 12:04:54 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Ferruh Yigit , "Thomas Monjalon" , stable@dpdk.org Date: Wed, 8 Nov 2017 17:34:07 +0530 Message-Id: <1510142647-30033-1-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BM1PR01CA0108.INDPRD01.PROD.OUTLOOK.COM (10.174.208.24) To CY4PR07MB3062.namprd07.prod.outlook.com (10.172.116.143) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bed5b910-a3c0-4b52-94fc-08d526a0ed34 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:CY4PR07MB3062; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3062; 3:sc8FxHeWq34g9naAjYzudm+tIxeHoT6xQIL/oIsWt/FrjV3jhRS2X/CnAO56vI3akBW6hhIVGkhfK2GF16UIYy4XyzZJ6ptf/zXVCF6g+b0jeClrbCYiUKVNsgZp8Bo5C0Fgb6ojdvi5wkyez1Gm8OVh3sYgcAI+g/Fhz9qV4ebmIZnJGx2r32oJA1jNEIf6XNg06uaN6hzIAXeNxT38JeMyJgbAl15aq+QB+Z2BMtsPJgqx7cw3FZ0+zSr4wz6m; 25:neD+x4k+6OEYPQE8Cee/KG5Bg0fNvvi1mxLjAqjJOBx0+0+3aj1msCHf48zID3ExF2ELeFSy2yDrw2qk0KPHijakOy2DwOPJ0uoN7ZlQkfjpdPCcIzc4ODT4RaGgY9d9QRyUbo8xmC90ArkSjthVpbQBbU0JJJVNMYfzmDOrnKMw8mTadyUfW3GlNsQckJ+3Ccd3Y2jTY6EVjLW2vPAg2zV9fRwqR4TDnFXJZdcRmR6f3SbSG3p1pWEwkXwqVeHt8+gxSs64NjTsyhAOBleDplVGW3Cp7nb33bwI2hcsU+7P9VsLCBi8Lgnat6Z6mm1cx9e0VIanqmabVGbvBrNMpg==; 31:DjxzKhtOsy1YCeL/KiyiC/7j2TCSMKlI/ua5G7MWszrlhr1Qdu1PQ5qYRsYugRVOGsMd432/wMmJ2DrZd05QVYZdR+FUa54F0xvDhOFM6rgZMdjirxFKKKYB06vk/QReRjAoefueMLAqughB1eo/7aQcl25BqFArCjFsXDpYshontrFZG49WIH5e+PANXOMu7X1WvFQKyLd9KiqSSo8jLJaW4KTp7dnTyAEzy3mdhcE= X-MS-TrafficTypeDiagnostic: CY4PR07MB3062: X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3062; 20:2cuLoUUhoDFsj7U2eIwCwTRI0lJD25ToJ1sKD4xAMCPXXNsJr2/YZWqUKaPyg4Ga2NP65Lx2/WWCh3/ky/UCyOnwdoe3ynCJ3MYYlh9vdZNoR+vdT1kdUMBYw6QeMXcmmfAJYGySzRfWqZ4nUOEAwLF8CdmBENOLMX92khhIFwhvTcgO4NqUD2cHePQoY+fuN/PxaRT0KFeP1fvm7lGd/e1pBx0UKsA0UXgPatHTsGhZUhXe+WLfODnCivqZqsQGZTboIQBdWezSVF+1xDEegcb4UoGQweJEofgKAg7yXRXIVd49XB/rWJcTU1X0yn5IY25Us8UdZ4PxxPnTv+BFjEtabEu546YJjygrsdPs9+xPOS35MfyXfpXysIKvmOqPN7CB7+L2RN4jNFKvLjgL6P6ime8ZAlwQQuV9iN8DdRucuAP7L9iQJGGvkCWIP9FyqQHGP34CcHwrBx0XZghkx8F0f/3jmQqKjHktYaW17KlTasB3Flm3a93F+7segt0sINDe/wPBoZUKD/vjJQWEa863HYAicImZSlGym5/iRMOsnBV9txDaJ/haTsVXFi5pgBqUCkhHHGNSQaSY+yYcBD+AT8fzws1HcyxMIgvgy1g=; 4:LRY1HMSqYXgXb+Rk9s0FOGYvBvNyrOt1TKrKTOFJ0R2tYqPvbLgdbcr28Zzg/q+SkFrDphWtPBaOz/e2X7WPcMbzBalnmB0/KhADjDiNlQVEwOeONtQYXvaQKOkuojYK29adKlGP0MPfSp/xW61tMRVjvGFoSeGB4eFZiTzm87ooRXcuu/pyDYqPZmfiNEGSgPg760mLfJjryHujPKXrigVm+H3baj7iqsWnizPuhs/VMX5I7+PEIbz1aP1eS5DkYBqEKYkF68rgAQl8uZ/nIw== X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(93006095)(100000703101)(100105400095)(10201501046)(3002001)(3231021)(6041248)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR07MB3062; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR07MB3062; X-Forefront-PRVS: 0485417665 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(346002)(376002)(199003)(189002)(53416004)(101416001)(6116002)(3846002)(6666003)(6916009)(42882006)(4720700003)(6486002)(966005)(72206003)(5003940100001)(69596002)(50986999)(5009440100003)(6506006)(305945005)(7736002)(5660300001)(16526018)(33646002)(575784001)(47776003)(2361001)(478600001)(2351001)(50226002)(36756003)(66066001)(189998001)(316002)(50466002)(16586007)(54906003)(48376002)(6306002)(76506005)(4326008)(8676002)(81166006)(2906002)(8936002)(97736004)(81156014)(6512007)(106356001)(105586002)(53936002)(25786009)(53376002)(68736007)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3062; H:localhost.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; CY4PR07MB3062; 23:AwWKFjR50cffYxzpluhk18QWkGwcU6YyVGqkC2vOJ?= =?us-ascii?Q?GBkz/veYiw2glrt0XMd8BkPOd9ztMJXNekbfhhtrDsYCNyVYqqKWSm8Wt45A?= =?us-ascii?Q?qLT/1D2o5nSKMacrEWJYGJ4uZyJQpw8IsVzpbFk/LqMJkwgVF/fDhrbFkng6?= =?us-ascii?Q?7IVToxuc+li8RIKvfzELEDZjsDtDDQ/8lh96F6jeET00WcL5W1JcAYKnqr6m?= =?us-ascii?Q?ikpcJDwtksenmlTrmw2/A+3/MGJYt5+ekb9iTeu2vbHvfE8wgpLEX05FmRYE?= =?us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8HdrIldYEzpx0nZvZ1Pzl71tPVQ0V1abh2pJ6V7qPbmO95IBg1yJvS3/zGHjNaugFp7wMY+Zu6UhMh7lN5goAK5OKWHL0vXbqGVd SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2017 12:04:54.3124 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bed5b910-a3c0-4b52-94fc-08d526a0ed34 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3062 Subject: [dpdk-dev] [PATCH] net/liquidio: add support for device reset in driver 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: Wed, 08 Nov 2017 12:04:58 -0000 Reset device during init and close if bound to igb_uio. Fixes: 369db3ae8e91 ("igb_uio: remove device reset in release") Cc: stable@dpdk.org Signed-off-by: Shijith Thotton --- Hi Thomas/Ferruh, Please consider this patch for 17.11 as removing reset from igb_uio breaks LiquidIO PMD[1]. Here I have added support for reset within driver if the kernel driver in use is igb_uio. 1. http://dpdk.org/ml/archives/dev/2017-October/079483.html Thanks, Shijith --- drivers/net/liquidio/base/lio_23xx_vf.c | 19 +++++++++++++++++++ drivers/net/liquidio/base/lio_23xx_vf.h | 2 ++ drivers/net/liquidio/base/lio_hw_defs.h | 3 +++ drivers/net/liquidio/base/lio_mbox.h | 1 + drivers/net/liquidio/lio_ethdev.c | 12 ++++++++++++ 5 files changed, 37 insertions(+) diff --git a/drivers/net/liquidio/base/lio_23xx_vf.c b/drivers/net/liquidio/base/lio_23xx_vf.c index 9978017..e30c20d 100644 --- a/drivers/net/liquidio/base/lio_23xx_vf.c +++ b/drivers/net/liquidio/base/lio_23xx_vf.c @@ -379,6 +379,25 @@ cn23xx_vf_reset_io_queues(lio_dev, num_queues); } +void +cn23xx_vf_ask_pf_to_do_flr(struct lio_device *lio_dev) +{ + struct lio_mbox_cmd mbox_cmd; + + memset(&mbox_cmd, 0, sizeof(struct lio_mbox_cmd)); + mbox_cmd.msg.s.type = LIO_MBOX_REQUEST; + mbox_cmd.msg.s.resp_needed = 0; + mbox_cmd.msg.s.cmd = LIO_VF_FLR_REQUEST; + mbox_cmd.msg.s.len = 1; + mbox_cmd.q_no = 0; + mbox_cmd.recv_len = 0; + mbox_cmd.recv_status = 0; + mbox_cmd.fn = NULL; + mbox_cmd.fn_arg = 0; + + lio_mbox_write(lio_dev, &mbox_cmd); +} + static void cn23xx_pfvf_hs_callback(struct lio_device *lio_dev, struct lio_mbox_cmd *cmd, void *arg) diff --git a/drivers/net/liquidio/base/lio_23xx_vf.h b/drivers/net/liquidio/base/lio_23xx_vf.h index 83dc053..ad8db0d 100644 --- a/drivers/net/liquidio/base/lio_23xx_vf.h +++ b/drivers/net/liquidio/base/lio_23xx_vf.h @@ -87,6 +87,8 @@ #define CN23XX_VF_BUSY_READING_REG_LOOP_COUNT 100000 +void cn23xx_vf_ask_pf_to_do_flr(struct lio_device *lio_dev); + int cn23xx_pfvf_handshake(struct lio_device *lio_dev); int cn23xx_vf_setup_device(struct lio_device *lio_dev); diff --git a/drivers/net/liquidio/base/lio_hw_defs.h b/drivers/net/liquidio/base/lio_hw_defs.h index d4cd23c..fe5c3bb 100644 --- a/drivers/net/liquidio/base/lio_hw_defs.h +++ b/drivers/net/liquidio/base/lio_hw_defs.h @@ -80,6 +80,9 @@ /* Max IOQs per LIO Link */ #define LIO_MAX_IOQS_PER_IF 64 +/* Wait time in milliseconds for FLR */ +#define LIO_PCI_FLR_WAIT 100 + enum lio_card_type { LIO_23XX /* 23xx */ }; diff --git a/drivers/net/liquidio/base/lio_mbox.h b/drivers/net/liquidio/base/lio_mbox.h index f1c5b8e..b0875d6 100644 --- a/drivers/net/liquidio/base/lio_mbox.h +++ b/drivers/net/liquidio/base/lio_mbox.h @@ -43,6 +43,7 @@ #define LIO_MBOX_DATA_MAX 32 #define LIO_VF_ACTIVE 0x1 +#define LIO_VF_FLR_REQUEST 0x2 #define LIO_CORES_CRASHED 0x3 /* Macro for Read acknowledgment */ diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 4b18966..84b8a32 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -1636,6 +1636,11 @@ struct rte_lio_xstats_name_off { rte_write32(pkt_count, droq->pkts_sent_reg); } + if (lio_dev->pci_dev->kdrv == RTE_KDRV_IGB_UIO) { + cn23xx_vf_ask_pf_to_do_flr(lio_dev); + rte_delay_ms(LIO_PCI_FLR_WAIT); + } + /* lio_free_mbox */ lio_dev->fn_list.free_mbox(lio_dev); @@ -2009,6 +2014,13 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) if (cn23xx_pfvf_handshake(lio_dev)) goto error; + /* Request and wait for device reset. */ + if (pdev->kdrv == RTE_KDRV_IGB_UIO) { + cn23xx_vf_ask_pf_to_do_flr(lio_dev); + /* FLR wait time doubled as a precaution. */ + rte_delay_ms(LIO_PCI_FLR_WAIT * 2); + } + if (cn23xx_vf_set_io_queues_off(lio_dev)) { lio_dev_err(lio_dev, "Setting io queues off failed\n"); goto error; -- 1.8.3.1