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 79714A04FD; Tue, 30 Aug 2022 03:10:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A54F40F18; Tue, 30 Aug 2022 03:10:00 +0200 (CEST) Received: from na01-obe.outbound.protection.outlook.com (mail-eastus2azon11021022.outbound.protection.outlook.com [52.101.57.22]) by mails.dpdk.org (Postfix) with ESMTP id B6ABE40F17 for ; Tue, 30 Aug 2022 03:09:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xr9wFAlUU1mwJ9+SQORQ8/6Fj1gBw9YGzcUJbXbNm9KV47KC6gOdeUlkcQd6KjjzPWyTFDiCITMaEwylZo9vytWNBi+f2TESiowoUp5aUzZic0QevyrQJuPcI9T7/teUekXdPS3dsa8fOOz4n0k8d3N5LNhxEPla7saE9bM+ONEK1COx2GRgNcDgqc+lB8xOQ7LEZtZ6Xbk3zYipxgnI3z3pMiWamvhjP0XpYB2/sRYfhkBTdjgfFBK5vewVuA00IuMv+Ud7K6ET2u3v5OnJO5x6sLa0C5S7ngai2Czh/e/0M8xpjMsDIRGcBGFk+hsQ/xzMLmKVF4YgMlvA1/uurA== 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=WkXAuPo53sXFDyPKmAmvtllKqdNOH0JKmlySwsHcYHA=; b=lOmumIOb5F2vAZpB/CJQxwnzT/JcXzTuQjo8O70sajN3J3+kqWnV7nf3P0MI2RlshdCxVr31TJsDZgZjrCuJLp7K54WnlgsZac7vkTpSIFSwnHXJ4+JNpRc2aADwEycT0aEjXyzGgzJVTrkPwIH+CAuFwNWYoHq0xtXOMQRjpmnJGr4vgpEzqJ8kNfdZDijV8S2uc6C1fOTlcc6A1wGck1DSOZERHd1AqYEA6XlBUyd6CNoyfPW1xIfm07xBQ707QRzZt2JzT/v+9mQgoffTldYjAeFutHHpCD7LnxsBqzrGlmnaqZpNuIBDOCdPtBpERaCEKcTUL6BOBaR96wehMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WkXAuPo53sXFDyPKmAmvtllKqdNOH0JKmlySwsHcYHA=; b=ch/0/+/s7vkEBD+Z4KZkZQKeFZze8/fcfjf9wr5Vh3DsVqlaZdyIjSRDddJUYzpGuQ6VAZf6zbCdOe0ICtXMMtGI9PvDpOQvEm7nMv7cQYABYujV7ZIWfXJu2FcMWXpooUQRJe+bqm/t2wf3IXtl5hSU9VlVaP56hlFe37b7Zto= Received: from PH7PR21MB3263.namprd21.prod.outlook.com (2603:10b6:510:1db::16) by BYAPR21MB1352.namprd21.prod.outlook.com (2603:10b6:a03:115::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.3; Tue, 30 Aug 2022 01:09:55 +0000 Received: from PH7PR21MB3263.namprd21.prod.outlook.com ([fe80::c42c:5004:23c1:bcac]) by PH7PR21MB3263.namprd21.prod.outlook.com ([fe80::c42c:5004:23c1:bcac%6]) with mapi id 15.20.5612.002; Tue, 30 Aug 2022 01:09:55 +0000 From: Long Li To: Suanming Mou , "longli@linuxonhyperv.com" , Ferruh Yigit CC: "dev@dpdk.org" , Ajay Sharma , Stephen Hemminger 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: AQHYuazqyRG2ykXp4kax1kQvuwxNUK3FPiKAgAFod9A= Date: Tue, 30 Aug 2022 01:09:55 +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: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=3b39f616-0ac2-4dde-a714-9b996f018fe6; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2022-08-30T01:08:12Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH7PR21MB3263:EE_|BYAPR21MB1352:EE_ x-ms-office365-filtering-correlation-id: 88d15f8c-4807-47e2-8c25-08da8a2459e6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: eSJJDfkCqMvNdV+qzBwn9qzBjpNY2R6GYlyuc56nkj811plq9B2liF63Pz255pfU9x8kSWxxeVpID+OVqZclP9aCFElsJoZYcHiryOCVGcoKfJeXKcG/iuk5yDXcuks744P8onmieBqYmDgcDKrbVFa/U8oxGJkIuEHnydLNz7D0W+xLrS/PaKgUAtgmPhQDBx1JSKMGVBC3ZNNoBEd8V6FuipFRf7mj41T8Opqi+hnD+84kDUNKbUateOwEIWKBQUvNclPwep6pKqEprbV/SjQNDBlUGeCx3T9Fg0l9ywg/pMmX8yVE8LUFZGCAdsJV9FrhKL0/KcjVGWsz8MEqt3APXSbFf/nOPDu5PMvwgZtuMjK2lqpj7EXlMTG81ZYduLbO77V08GRMWyg4OuaYBBdLyWpjXXzNB8tQ0C8ZI1Nn46lemvzNrkOQqsEsIIeITNPjTAKCv/k8qZBarkiidyd39GOmDj1ao7rY8h/wSIk6XHL//etS4k5w1FuIaO3Jw5SOKAjWYmao5G5XjBulU/yev6GPYV5mjhnaBAM87nwRLgI4KWLtFY508MtWgR30XNiVZHlvk121C0FKRd36vaTJvCjSPVVLe/hYv2lvlnktdtvkpYIXB7wHWeKOsdQDbfh+w6Pbpv5yLe8uZVubHOnQM8lDW/m7MHZ7V6f51wLSjO03g65t7sYlJ3Ho3OnbXdsuBQTXk43yO6KhmCVAaizU4n6dXZUcNlnaHUzbEqXJR+3HneksHb/L3d7AJOxEEDpv6grnHfHTNQXjOSqRBSfCITLJDznQJvbiOxM8bRXHiePw3M7+O09Fwdl4YT36 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH7PR21MB3263.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(366004)(376002)(346002)(396003)(136003)(451199009)(122000001)(33656002)(10290500003)(110136005)(54906003)(316002)(107886003)(86362001)(38070700005)(478600001)(8990500004)(64756008)(71200400001)(66446008)(66946007)(4326008)(41300700001)(8676002)(66556008)(76116006)(66476007)(82960400001)(82950400001)(55016003)(5660300002)(83380400001)(8936002)(52536014)(6506007)(26005)(9686003)(2906002)(38100700002)(7696005)(186003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ddsUE9y4Nuptt77tTwZ/TUtUX1wnKu1DR99K/JRsEAijDMO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dII5Lac4j5uAP4S751qhBK42pG5o4ii4DkalNXKMNZ7T/7Q?= =?us-ascii?Q?seJ3fMvvC5swEch0eYKFdWvENZjtFX9+8GdDbZ82UNef8KjVMqurTApfmhCc?= =?us-ascii?Q?L+lEIU9X7M4IABqqYNa1rM703HQSgS+Em/zn2pu8OHnIH0vfv6OvcGEqm4Y9?= =?us-ascii?Q?TAIKo3NONREzGCLlAGG0RqH5SnhI18hzSqEByLa/8SCFxPesrlNMKi2ZOm3n?= =?us-ascii?Q?CXeqla8idq1qZ6zqFPVfB3b16txtXEwBMcmNNWr7XsTl/mwDQy0x+mmcnUo8?= =?us-ascii?Q?QWqYWpvggY+XPSkLRNa/wpTq6PQBKyRpD9I0otpg0/BuTIbZu8KSB0SCukcn?= =?us-ascii?Q?lzXDJhMAffS8x/9opIp7SGsTQws43WBJz3kdvQAoi5pJ6RF7OS88rIlEQiGE?= =?us-ascii?Q?i7T6nKLoHISF7JDaY0BJmNN0frH35YO3WAQbXio7w5ehKsdaM+Drrj3EFMNX?= =?us-ascii?Q?cWV7QeM4Pihf5XJiVR/bx5ORxEtqt4JuM7NMIMPbjb+ms+yD6lwrx6rTpHAd?= =?us-ascii?Q?BCQeChpXYuQ5EkWhKCc2PlwAIleUj3StHJRvEDxsYtGsgvdbiQE0FBPLb401?= =?us-ascii?Q?l0WJw0lQcXnQL7B0zJktJxLZ6L1n9PKha316cdYT0otK3H5gxgdkxR0fPO7c?= =?us-ascii?Q?8GA81MpOvy6cvjgJI0zAYkhQCTlz0XANk7TLTtJG?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR21MB1352 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 > > Subject: [Patch v5 16/18] net/mana: add function to start/stop device > > > > From: Long Li > > > > Add support for starting/stopping the device. > > > > Signed-off-by: Long Li > > --- > > Change log: > > v2: > > Use spinlock for memory registration cache. > > Add prefix mana_ to all function names. > > > > drivers/net/mana/mana.c | 70 > > +++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 70 insertions(+) > > > > 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) > > > > static int mana_intr_uninstall(struct mana_priv *priv); > > > > +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, >=20 > Refer to the previous patch, looks mana_mr_btree_free() is needed in the = later > failure routine, right? Thank you, will fix this. >=20 > > 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 > > int mana_dev_link_update(struct rte_eth_dev *dev, > > > > 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