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 1A5FD42529; Wed, 6 Sep 2023 12:42:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 05D3F4027E; Wed, 6 Sep 2023 12:42:28 +0200 (CEST) Received: from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56]) by mails.dpdk.org (Postfix) with ESMTP id 937A74027C for ; Wed, 6 Sep 2023 12:42:24 +0200 (CEST) X-QQ-mid: bizesmtp78t1693996922tpy6gnyi Received: from LAPTOP96V0OHHN ( [183.81.182.182]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 06 Sep 2023 18:42:00 +0800 (CST) X-QQ-SSF: 00400000000000D0F000000A0000000 X-QQ-FEAT: J14clyG+6H72VwEg4dNalDnxHT97JBBO0vh7lyXshFxIzEPLlMFXwHDZV0ArT pid5TSF/I5Ao77Uwkyop4W6om+fcch4kERI1/onFHy4k5pO2wG2ogRh8RQIMTw6QHGQ7DF6 d03QaZFdbJ4eoKYxR56aJIiXn3XleOyO1/DMcC9VmlrTEUTlDHvpsy0BW18m3877X4mS/go 2if3YeFG0GK24Ur+zMVMIjHmp1TWGYj61dB884wUKap/M+quXBZ3f9of7rWK9bE1oco8EQO eiHu/6BVEf36Jyfs8Kg7+scol+0gFJ+56ZIendDJFNyF1tY1pNZQItjJJojfq5A8+0LqGhy 44twGyJMfc/Mzxlr5UcVSD4AvXgwgYe/P4xKCdSrv2OZFRTFKHHYyqf7xuZGMa9eGiEHBoM J4fw5/mNhGNoKckGJDNSdw== X-QQ-GoodBg: 2 X-BIZMAIL-ID: 17223608513050721767 From: "11" To: "'Ferruh Yigit'" , "'Anatoly Burakov'" Cc: , , , References: <20230901023050.40893-1-caowenbo@mucse.com> <20230901023050.40893-3-caowenbo@mucse.com> <5b134eee-95f1-53f9-2f24-b6a2b0bea3af@amd.com> In-Reply-To: <5b134eee-95f1-53f9-2f24-b6a2b0bea3af@amd.com> Subject: RE: [PATCH v6 2/8] net/rnp: add ethdev probe and remove Date: Wed, 6 Sep 2023 18:42:01 +0800 Message-ID: <8A459F9F87FE1B6A+017701d9e0ae$c5f10a60$51d31f20$@mucse.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: zh-cn Thread-Index: AQI30P9XUj3aWZJ7n+uYhLh06w3v0AKPn2xkAYInIhivMSrk4A== X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:mucse.com:qybglogicsvrgz:qybglogicsvrgz5a-0 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 > -----Original Message----- > From: Ferruh Yigit > Sent: 2023=E5=B9=B49=E6=9C=885=E6=97=A5 23:36 > To: Wenbo Cao ; Anatoly Burakov > > Cc: dev@dpdk.org; thomas@monjalon.net; andrew.rybchenko@oktetlabs.ru; > yaojun@mucse.com > Subject: Re: [PATCH v6 2/8] net/rnp: add ethdev probe and remove >=20 > On 9/1/2023 3:30 AM, Wenbo Cao wrote: > > Add basic PCIe ethdev probe and remove. > > > > Signed-off-by: Wenbo Cao > > --- > > drivers/net/rnp/rnp.h | 13 ++++++ > > drivers/net/rnp/rnp_ethdev.c | 83 > > ++++++++++++++++++++++++++++++++++++ > > 2 files changed, 96 insertions(+) > > create mode 100644 drivers/net/rnp/rnp.h > > > > diff --git a/drivers/net/rnp/rnp.h b/drivers/net/rnp/rnp.h new file > > mode 100644 index 0000000000..76d281cc0a > > --- /dev/null > > +++ b/drivers/net/rnp/rnp.h > > @@ -0,0 +1,13 @@ > > +/* SPDX-License-Identifier: BSD-3-Clause > > + * Copyright(C) 2023 Mucse IC Design Ltd. > > + */ > > +#ifndef __RNP_H__ > > +#define __RNP_H__ > > + > > +#define PCI_VENDOR_ID_MUCSE (0x8848) > > +#define RNP_DEV_ID_N10G (0x1000) > > + > > +struct rnp_eth_port { > > +} __rte_cache_aligned; > > + >=20 > Is the struct needs to be cache aligned? >=20 This struct may use frequently so I want it to fast to load. > > +#endif /* __RNP_H__ */ > > diff --git a/drivers/net/rnp/rnp_ethdev.c > > b/drivers/net/rnp/rnp_ethdev.c index 9ce3c0b497..390f2e7743 100644 > > --- a/drivers/net/rnp/rnp_ethdev.c > > +++ b/drivers/net/rnp/rnp_ethdev.c > > @@ -1,3 +1,86 @@ > > /* SPDX-License-Identifier: BSD-3-Clause > > * Copyright(C) 2023 Mucse IC Design Ltd. > > */ > > + > > +#include > > +#include > > +#include > > + > > +#include "rnp.h" > > + > > +static int > > +rnp_eth_dev_init(struct rte_eth_dev *eth_dev) { > > + RTE_SET_USED(eth_dev); > > + > > + return -ENODEV; > > +} > > + > > +static int > > +rnp_eth_dev_uninit(struct rte_eth_dev *eth_dev) { > > + RTE_SET_USED(eth_dev); > > + > > + return -ENODEV; > > +} > > + > > +static int > > +rnp_pci_remove(struct rte_pci_device *pci_dev) { > > + struct rte_eth_dev *eth_dev; > > + int rc; > > + > > + eth_dev =3D rte_eth_dev_allocated(pci_dev->device.name); > > + > > + if (eth_dev) { > > + /* Cleanup eth dev */ > > + rc =3D rte_eth_dev_pci_generic_remove(pci_dev, > > + rnp_eth_dev_uninit); > > + if (rc) > > + return rc; > > + } > > + /* Nothing to be done for secondary processes */ > > + if (rte_eal_process_type() !=3D RTE_PROC_PRIMARY) > > + return 0; > > + >=20 > Primary also don't do anything after this stage, I suggest adding this = code when > primary & secondary diverges. >=20 Ok, I get it. > > + return 0; > > +} > > + > > +static int > > +rnp_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device > > +*pci_dev) { > > + int rc; > > + > > + RTE_SET_USED(pci_drv); > > + > > + rc =3D rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct > rnp_eth_port), > > + rnp_eth_dev_init); > > + > > + /* On error on secondary, recheck if port exists in primary or > > + * in mid of detach state. > > + */ > > + if (rte_eal_process_type() !=3D RTE_PROC_PRIMARY && rc) > > + if (!rte_eth_dev_allocated(pci_dev->device.name)) > > + return 0; >=20 > Why this additional secondary check is required? > 'rte_eth_dev_pci_generic_probe()' should be dealing with = primary/secondary > process case. >=20 Because of multiple port mode single pcie-bdf the other port Alloc use xx:xx.0_0, xx:xx.0_1, xx:xx.0_2, xx:xx.0_0, use = rnp_alloc_eth_port api.