From: "11" <caowenbo@mucse.com>
To: "'Ferruh Yigit'" <ferruh.yigit@amd.com>,
"'Anatoly Burakov'" <anatoly.burakov@intel.com>
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
Date: Wed, 6 Sep 2023 18:42:01 +0800 [thread overview]
Message-ID: <8A459F9F87FE1B6A+017701d9e0ae$c5f10a60$51d31f20$@mucse.com> (raw)
In-Reply-To: <5b134eee-95f1-53f9-2f24-b6a2b0bea3af@amd.com>
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@amd.com>
> Sent: 2023年9月5日 23:36
> To: Wenbo Cao <caowenbo@mucse.com>; Anatoly Burakov
> <anatoly.burakov@intel.com>
> 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
>
> On 9/1/2023 3:30 AM, Wenbo Cao wrote:
> > Add basic PCIe ethdev probe and remove.
> >
> > Signed-off-by: Wenbo Cao <caowenbo@mucse.com>
> > ---
> > 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;
> > +
>
> Is the struct needs to be cache aligned?
>
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 <ethdev_pci.h>
> > +#include <rte_io.h>
> > +#include <rte_malloc.h>
> > +
> > +#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 = rte_eth_dev_allocated(pci_dev->device.name);
> > +
> > + if (eth_dev) {
> > + /* Cleanup eth dev */
> > + rc = 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() != RTE_PROC_PRIMARY)
> > + return 0;
> > +
>
> Primary also don't do anything after this stage, I suggest adding this code when
> primary & secondary diverges.
>
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 = 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() != RTE_PROC_PRIMARY && rc)
> > + if (!rte_eth_dev_allocated(pci_dev->device.name))
> > + return 0;
>
> Why this additional secondary check is required?
> 'rte_eth_dev_pci_generic_probe()' should be dealing with primary/secondary
> process case.
>
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.
next prev parent reply other threads:[~2023-09-06 10:42 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-01 2:30 [PATCH v6 0/8] [v6]drivers/net Add Support mucse N10 Pmd Driver Wenbo Cao
2023-09-01 2:30 ` [PATCH v6 1/8] net/rnp: add skeleton Wenbo Cao
2023-09-05 15:35 ` Ferruh Yigit
2023-09-06 8:15 ` 11
2024-03-29 11:28 ` Ferruh Yigit
2024-03-29 14:45 ` 11
2024-04-02 10:15 ` Ferruh Yigit
2023-09-01 2:30 ` [PATCH v6 2/8] net/rnp: add ethdev probe and remove Wenbo Cao
2023-09-05 15:36 ` Ferruh Yigit
2023-09-06 10:42 ` 11 [this message]
2023-09-01 2:30 ` [PATCH v6 3/8] net/rnp: add device init and uninit Wenbo Cao
2023-09-05 15:44 ` Ferruh Yigit
2023-09-06 11:03 ` 11
2023-09-01 2:30 ` [PATCH v6 4/8] net/rnp: add mbx basic api feature Wenbo Cao
2023-09-05 15:45 ` Ferruh Yigit
2023-09-06 10:32 ` 11
2023-09-01 2:30 ` [PATCH v6 5/8] net/rnp add reset code for Chip Init process Wenbo Cao
2023-09-05 15:46 ` Ferruh Yigit
2023-09-06 9:23 ` 11
2023-09-01 2:30 ` [PATCH v6 6/8] net/rnp add port info resource init Wenbo Cao
2023-09-05 16:56 ` Ferruh Yigit
2023-09-06 9:07 ` 11
2023-09-01 2:30 ` [PATCH v6 7/8] net/rnp add devargs runtime parsing functions Wenbo Cao
2023-09-05 15:46 ` Ferruh Yigit
2023-09-06 9:13 ` 11
2023-09-01 2:30 ` [PATCH v6 8/8] net/rnp handle device interrupts Wenbo Cao
2023-09-05 15:34 ` [PATCH v6 0/8] [v6]drivers/net Add Support mucse N10 Pmd Driver Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='8A459F9F87FE1B6A+017701d9e0ae$c5f10a60$51d31f20$@mucse.com' \
--to=caowenbo@mucse.com \
--cc=anatoly.burakov@intel.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=thomas@monjalon.net \
--cc=yaojun@mucse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).