From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1CA91A0544; Mon, 29 Aug 2022 05:38:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D6C3A40DDA; Mon, 29 Aug 2022 05:38:08 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2072.outbound.protection.outlook.com [40.107.92.72]) by mails.dpdk.org (Postfix) with ESMTP id D6D5E4069F for ; Mon, 29 Aug 2022 05:38:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fY1k8i9JU4EmX/RUSqNf6c+Kctf5aSYKw1j69rP0TIamUkTCciqc2f13aAnd6pYE/PwujXJ4xda0qhIo72QKNAFkOugxeyvJ5o9dWFJ0mPW0XnXM4SY30V052pPv7a7+DC9zO2aYYXSB2aFPpTeDy7rODeTmNCWfK5/jQbnqJTcz67gDch2077YE+3ztWlTQSL669KIqw232DwkRebpduKn799VYIA7tkTs5+eLAyLXhZC+5r3PQixQUvbvYUW0XE9NnCdvUNyeRObhsgN40/ZPgZ1jPaNaAP4gha9b7aHyEGBmXFbOQTeOlVS/ZTYxFhzxL5W4mvkEKESO2eefAMw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fu68Jqs/b6NgjpbiD7D2q3vxpFyCJnGRYZVUJmkS7zE=; b=I1LiJtKcDIXe379MyksQllct2o+ltK0ig1rYki7w0DRx3uZAKcTk2wz2ZOEMpSo4wad1tKCjhSniKOA652EXBCL0NRAhlweqWFXru0NOQeuMMovxwdbcAQP5TohmX3hvbENyq/o6OJhyzvSHNpyWkydBg1NjfF/e5XtKV3vcc33hiiS9ABpikTieRi0mIXOrGe4oTnpa8d0X3iMS+pKcKYImWO4myDeJiLsEq1fb93meLIJOzy3wp41nF1CrmrkmccFqjkdo2NzJfljJpZSWj3uGWsGh2E5ZnBOgKtn1M53YnvJhU5l6aQBOdFUozm609ecoQKInIRHavhuvC9mP1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fu68Jqs/b6NgjpbiD7D2q3vxpFyCJnGRYZVUJmkS7zE=; b=P4/CRoia2sWETQ5uUub7YhmdpOphZAYoOWzh7sa1nzCRXvA2My/zaQS9doEH4i8rwMHQ2ZCDHt64xgq5BP3RALHpxhSpW2LHQsR5T9xlo1iNbSMwxJMRWpt9Zr10eZxnbIZeB2HZiBFa7GrFbDRKkfZ0YQEWd2G0FRDMut5pXJnoCtpPolcOxWfht7FX8VC88sFnbpdLc6wPrQQtzl5rjvBor4gycONva6qwkQ0IqGyQwusinlM9KvkMQk3UGhS3RcvBY7T8QJu4ahtcn7D7xRTC7g47/5U7yS37+JQm9cNSurl2liHsQkY09f13Fmxc5QmsTYu4NcqVtNB0PEFIqw== Received: from CO6PR12MB5396.namprd12.prod.outlook.com (2603:10b6:303:139::8) by BL0PR12MB4964.namprd12.prod.outlook.com (2603:10b6:208:1c7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.14; Mon, 29 Aug 2022 03:38:03 +0000 Received: from CO6PR12MB5396.namprd12.prod.outlook.com ([fe80::fd64:7bf5:2d01:5baf]) by CO6PR12MB5396.namprd12.prod.outlook.com ([fe80::fd64:7bf5:2d01:5baf%7]) with mapi id 15.20.5566.021; Mon, 29 Aug 2022 03:38:03 +0000 From: Suanming Mou To: "longli@linuxonhyperv.com" , Ferruh Yigit CC: "dev@dpdk.org" , Ajay Sharma , Stephen Hemminger , "NBU-Contact-longli (EXTERNAL)" Subject: RE: [Patch v5 16/18] net/mana: add function to start/stop device Thread-Topic: [Patch v5 16/18] net/mana: add function to start/stop device Thread-Index: AQHYua0ZdfV3pDjbYU2ceewEBQJraq3FPZ/g Date: Mon, 29 Aug 2022 03:38:03 +0000 Message-ID: References: <1661560509-11009-1-git-send-email-longli@linuxonhyperv.com> <1661560509-11009-17-git-send-email-longli@linuxonhyperv.com> In-Reply-To: <1661560509-11009-17-git-send-email-longli@linuxonhyperv.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2c4dc968-50ce-4cad-9caf-08da896fe0ee x-ms-traffictypediagnostic: BL0PR12MB4964:EE_ x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rm1HVqNpZ0Wy6+nbusJUQ9JMSOU3fuDRD03nO7W8LPyuuCl0XUsgEy/oniTz2N8DGM8D2QQI+ulVpFIyBGFTRqy+OI7M+ouLVx5DHx8zsCLetW0htpUnbUjDQq3Lzedgu0pGuWodVTLzdwUlpnnuVV/reww0hGhn0+4r49k6NaQ0joa/++Po6oIByvxp7lMlY1k/7EHGglu0RfOoV39I4+tkcpM1A6LTKmkdQSg+TVNjYueD4obL77FAlX82NnwuAwC7/ieODahKTbP/NHClKHdKSUGG9cNUU/ixfcBXTzt+ygtwheF+qZtAvAyw3I2ZZgQbTGV0NnMTSveKI9IJfBmOkyfA77CaG6DsrsGeY7sGRfUZV6kCY72OPldlgB81WUQiXQoMrp8pQ1p4nbpAOgPJTG5TI9TNUWwePwEWu+ZhifaT8GrgWJvF3v+Yy2hTNdwGVUotij0OoAirHDfBq+6KujEAROI2XnL3iTUFxcSGSZfBu+AuqHZYJGzzJt5rsRK2A89gJ3snE0ulhpfaPASDDbk8tgtkZSAXo7x0U3gp+t4tty0zoex7WgaRlnF0NtfHS0eST7Pjjr9W7xxso1VGnelMnG7dUquDp8bAqfQV9aC+lqSijqcmzGW45HpVnLlU6blp5XYLL9RaxARRk3FVzAxWgVBpbiUJ+wVUCqwuT8xiQ03bRelu9IU+pTqfG5o+xZr0xDYRjW3ArLRT/YhlmcBJui6yz8OYlTEx0lJQUbP4Wp0m3WCri4FqcglL03/smGOyNFPA3dB5wkC/ig== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR12MB5396.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(396003)(376002)(136003)(366004)(346002)(39860400002)(478600001)(55016003)(7696005)(66476007)(66446008)(66946007)(76116006)(66556008)(4326008)(8676002)(64756008)(53546011)(2906002)(83380400001)(9686003)(26005)(5660300002)(41300700001)(8936002)(52536014)(33656002)(6506007)(316002)(71200400001)(110136005)(38070700005)(86362001)(54906003)(122000001)(186003)(38100700002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Yd/UoQOh5PAFW3bYnjMZAMbl8UFKs84aSyTehwUoGTC2bA1au6/6KRffVLYw?= =?us-ascii?Q?S+BxT3Jjyic+xYBO69ubMylXporVZpTjxSuddvn6Lkru/SwmNHnzowoYxuIF?= =?us-ascii?Q?n1ONjcLnl+QV+SKj8SPjxtSkmSxr4/z4eXOhvyss36sxyOrH9lGiNRgW5JUt?= =?us-ascii?Q?QCgpnZNJ3snIyP1D6T8CdQz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=?us-ascii?Q?CpXpHqV6mX8v5gn7uxj/iGnsyhGAdS6sNm16KU5PniirZr8ch3NsCCWMDpFI?= =?us-ascii?Q?wRVjWsyQJyiLyasdoE97v+YWUrb2z2Y72EcCr274AVy4kKpDVJSVQT+dgTeI?= =?us-ascii?Q?yQ9npUFuU3q5Ufnzhd5S6zPGXGFnOTolOFnCbOdCyaFMnVeC5n8FJx6SDX3L?= =?us-ascii?Q?8RJRhF2O0TzrYV8WeNGzPQz+DUqbWfshh/j6DkLZYBlZUTyiI8KbaJGc2sDP?= =?us-ascii?Q?D06vjJj9zXAyhlxLBd9QZKRmS1U1zIxi5gQX7E5PwymjoDByfJ+D+zKLSOiB?= =?us-ascii?Q?tUb7Yena/91DrQhcpS4ncPTrBa8/jhaI2D9fOyM2TZ1/GZEbg9ZLE5FqNBHY?= =?us-ascii?Q?qpDWIgsWfuunvm7fCEs8sASJnCcqR0iqqdN3trHUReZ0XN5ss7bAlqiwafc+?= =?us-ascii?Q?5LLDEjjWaJB02KiHRLX83H0rMtun1V7NHNU/zYvGNvXCwuRUK+bhiI3b8lOm?= =?us-ascii?Q?GL668irWwEEbJOxp+9ouLzEgppopbmolp8VdfG92?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR12MB5396.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c4dc968-50ce-4cad-9caf-08da896fe0ee X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2022 03:38:03.4143 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: BUkykky0WZXWmyuMwsbrV8yO1YNLA6ShCyvJZICYhve966h3X0ug8afUSur0qhKLKdSRKF7HCD0xWAsct98ZEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4964 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi, > -----Original Message----- > From: longli@linuxonhyperv.com > Sent: Saturday, August 27, 2022 8:35 AM > To: Ferruh Yigit > Cc: dev@dpdk.org; Ajay Sharma ; Stephen > Hemminger ; NBU-Contact-longli (EXTERNAL) > > Subject: [Patch v5 16/18] net/mana: add function to start/stop device >=20 > From: Long Li >=20 > Add support for starting/stopping the device. >=20 > Signed-off-by: Long Li > --- > Change log: > v2: > Use spinlock for memory registration cache. > Add prefix mana_ to all function names. >=20 > drivers/net/mana/mana.c | 70 > +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 70 insertions(+) >=20 > diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c index > 0dcd3f3124..119fdfd8bc 100644 > --- a/drivers/net/mana/mana.c > +++ b/drivers/net/mana/mana.c > @@ -97,6 +97,74 @@ static int mana_dev_configure(struct rte_eth_dev *dev) >=20 > static int mana_intr_uninstall(struct mana_priv *priv); >=20 > +static int > +mana_dev_start(struct rte_eth_dev *dev) { > + int ret; > + struct mana_priv *priv =3D dev->data->dev_private; > + > + rte_spinlock_init(&priv->mr_btree_lock); > + ret =3D mana_mr_btree_init(&priv->mr_btree, Refer to the previous patch, looks mana_mr_btree_free() is needed in the la= ter failure routine, right? > MANA_MR_BTREE_CACHE_N, > + dev->device->numa_node); > + if (ret) { > + DRV_LOG(ERR, "Failed to init device MR btree %d", ret); > + return ret; > + } > + > + ret =3D mana_start_tx_queues(dev); > + if (ret) { > + DRV_LOG(ERR, "failed to start tx queues %d", ret); > + return ret; > + } > + > + ret =3D mana_start_rx_queues(dev); > + if (ret) { > + DRV_LOG(ERR, "failed to start rx queues %d", ret); > + mana_stop_tx_queues(dev); > + return ret; > + } > + > + rte_wmb(); > + > + dev->tx_pkt_burst =3D mana_tx_burst; > + dev->rx_pkt_burst =3D mana_rx_burst; > + > + DRV_LOG(INFO, "TX/RX queues have started"); > + > + /* Enable datapath for secondary processes */ > + mana_mp_req_on_rxtx(dev, MANA_MP_REQ_START_RXTX); > + > + return 0; > +} > + > +static int > +mana_dev_stop(struct rte_eth_dev *dev __rte_unused) { > + int ret; > + > + dev->tx_pkt_burst =3D mana_tx_burst_removed; > + dev->rx_pkt_burst =3D mana_rx_burst_removed; > + > + /* Stop datapath on secondary processes */ > + mana_mp_req_on_rxtx(dev, MANA_MP_REQ_STOP_RXTX); > + > + rte_wmb(); > + > + ret =3D mana_stop_tx_queues(dev); > + if (ret) { > + DRV_LOG(ERR, "failed to stop tx queues"); > + return ret; > + } > + > + ret =3D mana_stop_rx_queues(dev); > + if (ret) { > + DRV_LOG(ERR, "failed to stop tx queues"); > + return ret; > + } > + > + return 0; > +} > + > static int > mana_dev_close(struct rte_eth_dev *dev) { @@ -435,6 +503,8 @@ static in= t > mana_dev_link_update(struct rte_eth_dev *dev, >=20 > const struct eth_dev_ops mana_dev_ops =3D { > .dev_configure =3D mana_dev_configure, > + .dev_start =3D mana_dev_start, > + .dev_stop =3D mana_dev_stop, > .dev_close =3D mana_dev_close, > .dev_infos_get =3D mana_dev_info_get, > .txq_info_get =3D mana_dev_tx_queue_info, > -- > 2.34.1