From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6CD87A2E1B for ; Thu, 5 Sep 2019 08:07:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 35E071ED82; Thu, 5 Sep 2019 08:07:02 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00063.outbound.protection.outlook.com [40.107.0.63]) by dpdk.org (Postfix) with ESMTP id 7E7B42862; Thu, 5 Sep 2019 08:06:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TE0jKpto7q6eRrk8TuC2GRdW7M0v7YZtZqSJFE/IaDQ=; b=OHxCcrI8hzwk2aiyJvd0YOmsgCipGNOvuKNhVRIC/rzeH1tXVjw/yia2gPwV+sr+bNcHIlaI9zZ6OK9eOR06ViDTm2PGJfZqnNYvlh7AQNY8HbSOs04K+WGPAHDvU3Wxi0Ec28AzfLAbUbDB+BoMy/hRkcZT5NrmyKB4Ccs3Yuo= Received: from HE1PR08CA0070.eurprd08.prod.outlook.com (2603:10a6:7:2a::41) by VI1PR0801MB2045.eurprd08.prod.outlook.com (2603:10a6:800:89::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.20; Thu, 5 Sep 2019 06:06:55 +0000 Received: from AM5EUR03FT032.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::205) by HE1PR08CA0070.outlook.office365.com (2603:10a6:7:2a::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2241.13 via Frontend Transport; Thu, 5 Sep 2019 06:06:55 +0000 Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT032.mail.protection.outlook.com (10.152.16.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2241.14 via Frontend Transport; Thu, 5 Sep 2019 06:06:54 +0000 Received: ("Tessian outbound 802e738ad7e5:v27"); Thu, 05 Sep 2019 06:06:54 +0000 X-CR-MTA-TID: 64aa7808 Received: from cb0bb962bd0a.1 (cr-mta-lb-1.cr-mta-net [104.47.4.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id BF5543B4-1CD8-459E-8CA8-BE03EE24F0BA.1; Thu, 05 Sep 2019 06:06:49 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02lp2051.outbound.protection.outlook.com [104.47.4.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cb0bb962bd0a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Thu, 05 Sep 2019 06:06:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y92DL4Vv8N7UYB7E3fIB39Cs9P4AfeB9ebxeTvt04wmyP6GQ1BcA5XLnCnQlZf4Gk685JbrRq5odGObOZ0ScekWWcZbEIZw0kEet/SKgfeDD0ChWFR35AUrmnL5v89tikBKqxfcVpgB72sw86nPApQbLOfCJ7VEsGljLwd3FDCS4lidv8yyxSkeEWGk838XT3qlXwjFAOUEfeL422BPxOvodOwBaI+FVI4TiLdSWDBOxlSrxdRpdqfmFJma/vzN5ftsnKcxbqX2r/PH6vbHOiFSGRQsLu/odGaVPQhY5TZwUf+rzHy5iBf8q3LIgxNEVsb09wHs3YR6Zsqt5oPaxtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZZ/Hs9GEx0P+4+4gi/ZrnY401wmW5s4w2bxAp42mebY=; b=f5U9Ja/rjtLheG5LIrtobi66elJhmwA6FL+/5ocozEUT/ySH52w0CYmnVtD9jBqwTv/0NYGVibjClGyYnk6+duBKG8kx4WrxMFJ1huwRmPGnBuQl/w3Vi+jNkX+JOTDrBl158pVralKBDEJ7Ntc9GC/o89c/UfkLxErlZu6gQjwslPr4IgGVeAf5zGJocyPNmqKDgqg9deexpiP6cMZnfEiJcWQJJFSLA5ocDjViv00eEe44mNBmv3EYKFedDnvSWm0dgdR4DeFRss6l5x01SD5niNSa4s5MQOCSgbzyhz3p3GN6U/rI9jEZRNzRnBcgbTYOetbvd0hcJzXMIUsF+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZZ/Hs9GEx0P+4+4gi/ZrnY401wmW5s4w2bxAp42mebY=; b=9HBEIOyp2EKlVfTwNdUPaq3ZUQVMj+WAqdJyZV6np0GwvIj17nK06IyB4oRV3dtBPEOYEaUx3G84U4/z+2fgRg09pMklT7Xybd2uiYARMcMipCOzDVF4AhWPxcUcgiE9QOSMTOaszol+nhmOblHnFwT5nEdNf5n2sMJkIIuQBts= Received: from VI1PR08MB5376.eurprd08.prod.outlook.com (52.133.244.200) by VI1PR08MB3887.eurprd08.prod.outlook.com (20.178.80.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2199.21; Thu, 5 Sep 2019 06:06:47 +0000 Received: from VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::c09a:49d3:eab2:f707]) by VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::c09a:49d3:eab2:f707%3]) with mapi id 15.20.2241.014; Thu, 5 Sep 2019 06:06:47 +0000 From: "Gavin Hu (Arm Technology China)" To: Xiao Zhang , "dev@dpdk.org" CC: "wenzhuo.lu@intel.com" , "wei.zhao1@intel.com" , "xiaolong.ye@intel.com" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [v8] net/e1000: fix i219 hang on reset/close Thread-Index: AQHVQFUpx722LPt+kkOwh2Lfir3JXacc3heA Date: Thu, 5 Sep 2019 06:06:47 +0000 Message-ID: References: <1563797960-58560-1-git-send-email-xiao.zhang@intel.com> <1563808312-64145-1-git-send-email-xiao.zhang@intel.com> In-Reply-To: <1563808312-64145-1-git-send-email-xiao.zhang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: ef308207-a7bf-427c-b019-ee1d80e99ced.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 23b5ce76-969a-4f01-965b-08d731c74047 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:VI1PR08MB3887; X-MS-TrafficTypeDiagnostic: VI1PR08MB3887:|VI1PR0801MB2045: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:9508;OLM:9508; x-forefront-prvs: 015114592F X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(136003)(39860400002)(396003)(376002)(366004)(346002)(189003)(199004)(13464003)(3846002)(6116002)(52536014)(76116006)(66556008)(8936002)(8676002)(66946007)(25786009)(81166006)(81156014)(14454004)(74316002)(7736002)(110136005)(86362001)(5660300002)(316002)(54906003)(66066001)(66476007)(64756008)(66446008)(305945005)(6246003)(76176011)(2906002)(7696005)(99286004)(71190400001)(71200400001)(4326008)(6506007)(478600001)(229853002)(2501003)(26005)(33656002)(256004)(14444005)(476003)(11346002)(446003)(53936002)(53546011)(102836004)(9686003)(6436002)(486006)(186003)(55236004)(55016002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3887; H:VI1PR08MB5376.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: 1QwY+VB431K2y6RLpJctTqWHN/EAvkRKB92zvXUVYN6UppN6dfcpB1DLE/uVmZI+0DI49R3UHCHcZQPkfqoKwnzazX1gAVJbrp/5gGEIUjM5vcD5CtlSezjmMbaSYkSZljyXm9M0FwoDdOHydL9cjCyi+IGS2Tqjru2+GzxWjF0jTuQpkSohLFwmfjDra0C61lwBdqMEVF4Qex2jJK8KE0jzXSVsiuR8XED2KsoZe2OyPcrNoXwUEd4mK0Nfv6gu0NFDAoqG7bIJjp3dfbJUP+3U5ZVgJZ1mT7Odz9rMfefGueWveXXkCriVB3ZWVAFuS1I4WGJmQTuAFbmUEauKQxBMDg8Ppbhw8OGTzSLOiTBc6vxvmuKDOlGwra04OiL/F5Oto1Swd/aRPvDffveemAej55R80PheXZG01+vFou8= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3887 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT032.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(346002)(396003)(136003)(2980300002)(40434004)(13464003)(199004)(189003)(336012)(229853002)(486006)(356004)(76130400001)(446003)(99286004)(63350400001)(126002)(476003)(63370400001)(478600001)(102836004)(26005)(46406003)(11346002)(86362001)(8746002)(55016002)(33656002)(53546011)(6506007)(26826003)(22756006)(14454004)(76176011)(7696005)(52536014)(54906003)(36906005)(2906002)(305945005)(9686003)(81166006)(81156014)(186003)(5660300002)(50466002)(7736002)(47776003)(8676002)(4326008)(25786009)(316002)(2501003)(23726003)(3846002)(6116002)(70586007)(450100002)(6246003)(70206006)(66066001)(97756001)(14444005)(5024004)(74316002)(8936002)(110136005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0801MB2045; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; A:1; MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 305d57f7-efdc-45cc-9b40-08d731c73c31 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(710020)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:VI1PR0801MB2045; X-Forefront-PRVS: 015114592F X-Microsoft-Antispam-Message-Info: rLAFrelywo9pipB/R/0BNW8+xavb3v/QzDostnVGU+UqnSEeKl9yVH08RSWNw0mqoQgAQkFqwFn76VV5+J6ZvMN0iVvEvzvwZ0/QukJr9v+NvQH7crjXudCByPaIQkU7uHv4kC6CYNk9SOCoB8XNTFZLM51AvJf0uNwN4z9e7do0MIbQEFHGWt67FwM+AWbEXlWxLpg6dMz8tCzPZvJzsEMcxOC5u8aBl9TAP2MjHwW6KvGJg2lEpol4agmzKbK+bbLnqrJXw8jC2PTFjKJjrEYDOmq5mno6KZ6gtaOkVj74rbgiVr5wRzSNmfB6OT6usosHQZxWS5Ia0aV2oUGiNjrYAqJwV39DHlNvs5iZCpqYGGpiIr3fNplhYgp6w9QfUEpNF3UnBRHXp+0F89yLBeY0JvJgzqeNCTxpwbUlJls= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2019 06:06:54.0989 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23b5ce76-969a-4f01-965b-08d731c74047 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2045 Subject: Re: [dpdk-stable] [dpdk-dev] [v8] net/e1000: fix i219 hang on reset/close 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi Xiao, > -----Original Message----- > From: dev On Behalf Of Xiao Zhang > Sent: Monday, July 22, 2019 11:12 PM > To: dev@dpdk.org > Cc: wenzhuo.lu@intel.com; wei.zhao1@intel.com; xiaolong.ye@intel.com; > Xiao Zhang ; stable@dpdk.org > Subject: [dpdk-dev] [v8] net/e1000: fix i219 hang on reset/close > > Unit hang may occur if multiple descriptors are available in the rings > during reset or close. This state can be detected by configure status > by bit 8 in register. If the bit is set and there are pending > descriptors in one of the rings, we must flush them before reset or > close. > > Fixes: 80580344("e1000: support EM devices (also known as e1000/e1000e)") > Cc: stable@dpdk.org > > Signed-off-by: Xiao Zhang > --- > v8 Modify to follow code style of dpdk community. > v7 Add fix line. > v6 Change the fix on em driver instead of igb driver and update the > register address according to C-Spec. > v5 Change the subject. > v4 Correct the tail descriptor of tx ring. > v3 Add loop to handle all tx and rx queues. > v2 Use configuration register instead of NVM7 to get the hang state. > --- > drivers/net/e1000/e1000_ethdev.h | 4 ++ > drivers/net/e1000/em_ethdev.c | 5 ++ > drivers/net/e1000/em_rxtx.c | 111 > +++++++++++++++++++++++++++++++++++++++ > 3 files changed, 120 insertions(+) > > diff --git a/drivers/net/e1000/e1000_ethdev.h > b/drivers/net/e1000/e1000_ethdev.h > index 67acb73..01ff943 100644 > --- a/drivers/net/e1000/e1000_ethdev.h > +++ b/drivers/net/e1000/e1000_ethdev.h > @@ -35,6 +35,9 @@ > #define IGB_MAX_RX_QUEUE_NUM 8 > #define IGB_MAX_RX_QUEUE_NUM_82576 16 > > +#define E1000_I219_MAX_RX_QUEUE_NUM 2 > +#define E1000_I219_MAX_TX_QUEUE_NUM 2 > + > #define E1000_SYN_FILTER_ENABLE 0x00000001 /* syn filter enable f= ield > */ > #define E1000_SYN_FILTER_QUEUE 0x0000000E /* syn filter queue fi= eld > */ > #define E1000_SYN_FILTER_QUEUE_SHIFT 1 /* syn filter queue fi= eld */ > @@ -522,5 +525,6 @@ int igb_action_rss_same(const struct > rte_flow_action_rss *comp, > int igb_config_rss_filter(struct rte_eth_dev *dev, > struct igb_rte_flow_rss_conf *conf, > bool add); > +void em_flush_desc_rings(struct rte_eth_dev *dev); > > #endif /* _E1000_ETHDEV_H_ */ > diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.= c > index dc88661..62d3a95 100644 > --- a/drivers/net/e1000/em_ethdev.c > +++ b/drivers/net/e1000/em_ethdev.c > @@ -738,6 +738,11 @@ eth_em_stop(struct rte_eth_dev *dev) > em_lsc_intr_disable(hw); > > e1000_reset_hw(hw); > + > + /* Flush desc rings for i219 */ > + if (hw->mac.type >=3D e1000_pch_spt) > + em_flush_desc_rings(dev); > + > if (hw->mac.type >=3D e1000_82544) > E1000_WRITE_REG(hw, E1000_WUC, 0); > > diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c > index 708f832..55d8a67 100644 > --- a/drivers/net/e1000/em_rxtx.c > +++ b/drivers/net/e1000/em_rxtx.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -59,6 +60,11 @@ > #define E1000_TX_OFFLOAD_NOTSUP_MASK \ > (PKT_TX_OFFLOAD_MASK ^ E1000_TX_OFFLOAD_MASK) > > +/* PCI offset for querying configuration status register */ > +#define PCI_CFG_STATUS_REG 0x06 > +#define FLUSH_DESC_REQUIRED 0x100 > + > + > /** > * Structure associated with each descriptor of the RX ring of a RX queu= e. > */ > @@ -2000,3 +2006,108 @@ em_txq_info_get(struct rte_eth_dev *dev, > uint16_t queue_id, > qinfo->conf.tx_rs_thresh =3D txq->tx_rs_thresh; > qinfo->conf.offloads =3D txq->offloads; > } > + > +static void > +e1000_flush_tx_ring(struct rte_eth_dev *dev) > +{ > + struct e1000_hw *hw =3D E1000_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > + volatile struct e1000_data_desc *tx_desc; > + volatile uint32_t *tdt_reg_addr; > + uint32_t tdt, tctl, txd_lower =3D E1000_TXD_CMD_IFCS; > + uint16_t size =3D 512; > + struct em_tx_queue *txq; > + int i; > + > + if (dev->data->tx_queues =3D=3D NULL) > + return; > + tctl =3D E1000_READ_REG(hw, E1000_TCTL); > + E1000_WRITE_REG(hw, E1000_TCTL, tctl | E1000_TCTL_EN); > + for (i =3D 0; i < dev->data->nb_tx_queues && > + i < E1000_I219_MAX_TX_QUEUE_NUM; i++) { > + txq =3D dev->data->tx_queues[i]; > + tdt =3D E1000_READ_REG(hw, E1000_TDT(i)); > + if (tdt !=3D txq->tx_tail) > + return; > + tx_desc =3D &txq->tx_ring[txq->tx_tail]; > + tx_desc->buffer_addr =3D rte_cpu_to_le_64(txq- > >tx_ring_phys_addr); > + tx_desc->lower.data =3D rte_cpu_to_le_32(txd_lower | size); > + tx_desc->upper.data =3D 0; > + > + rte_wmb(); Tx_desc is CIO memory, should rte_cio_wmb be used here? > + txq->tx_tail++; > + if (txq->tx_tail =3D=3D txq->nb_tx_desc) > + txq->tx_tail =3D 0; > + rte_io_wmb(); This line can be merged into the following line and use E1000_PCI_REG_WRITE= API instead, which has an rte_io_wmb included. This not only looks better but also better for understanding. > + tdt_reg_addr =3D E1000_PCI_REG_ADDR(hw, E1000_TDT(i)); > + E1000_PCI_REG_WRITE_RELAXED(tdt_reg_addr, txq->tx_tail); > + usec_delay(250); > + } > +} > + > +static void > +e1000_flush_rx_ring(struct rte_eth_dev *dev) > +{ > + uint32_t rctl, rxdctl; > + struct e1000_hw *hw =3D E1000_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > + int i; > + > + rctl =3D E1000_READ_REG(hw, E1000_RCTL); > + E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); > + E1000_WRITE_FLUSH(hw); > + usec_delay(150); > + > + for (i =3D 0; i < dev->data->nb_rx_queues && > + i < E1000_I219_MAX_RX_QUEUE_NUM; i++) { > + rxdctl =3D E1000_READ_REG(hw, E1000_RXDCTL(i)); > + /* zero the lower 14 bits (prefetch and host thresholds) */ > + rxdctl &=3D 0xffffc000; > + > + /* update thresholds: prefetch threshold to 31, > + * host threshold to 1 and make sure the granularity > + * is "descriptors" and not "cache lines" > + */ > + rxdctl |=3D (0x1F | (1UL << 8) | > E1000_RXDCTL_THRESH_UNIT_DESC); > + > + E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl); > + } > + /* momentarily enable the RX ring for the changes to take effect */ > + E1000_WRITE_REG(hw, E1000_RCTL, rctl | E1000_RCTL_EN); > + E1000_WRITE_FLUSH(hw); > + usec_delay(150); > + E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); > +} > + > +/** > + * em_flush_desc_rings - remove all descriptors from the descriptor ring= s > + * > + * In i219, the descriptor rings must be emptied before resetting/closin= g the > + * HW. Failure to do this will cause the HW to enter a unit hang state w= hich > + * can only be released by PCI reset on the device > + * > + */ > + > +void > +em_flush_desc_rings(struct rte_eth_dev *dev) > +{ > + uint32_t fextnvm11, tdlen; > + struct e1000_hw *hw =3D E1000_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > + struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(dev); > + uint16_t pci_cfg_status =3D 0; > + > + fextnvm11 =3D E1000_READ_REG(hw, E1000_FEXTNVM11); > + E1000_WRITE_REG(hw, E1000_FEXTNVM11, > + fextnvm11 | > E1000_FEXTNVM11_DISABLE_MULR_FIX); > + tdlen =3D E1000_READ_REG(hw, E1000_TDLEN(0)); > + rte_pci_read_config(pci_dev, &pci_cfg_status, sizeof(pci_cfg_status= ), > + PCI_CFG_STATUS_REG); > + > + /* do nothing if we're not in faulty state, or if the queue is empt= y */ > + if ((pci_cfg_status & FLUSH_DESC_REQUIRED) && tdlen) { > + /* flush desc ring */ > + e1000_flush_tx_ring(dev); > + rte_pci_read_config(pci_dev, &pci_cfg_status, > + sizeof(pci_cfg_status), > PCI_CFG_STATUS_REG); > + if (pci_cfg_status & FLUSH_DESC_REQUIRED) > + e1000_flush_rx_ring(dev); > + } > +} > -- > 2.7.4 IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.