From: Manish Chopra <manishc@marvell.com>
To: Jerin Jacob <jerinjacobk@gmail.com>, Gaetan Rivet <grive@u256.net>
Cc: Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
Ferruh Yigit <ferruh.yigit@intel.com>, dpdk-dev <dev@dpdk.org>,
Igor Russkikh <irusskikh@marvell.com>,
Rasesh Mody <rmody@marvell.com>,
GR-Everest-DPDK-Dev <GR-Everest-DPDK-Dev@marvell.com>
Subject: Re: [dpdk-dev] [EXT] Re: [PATCH 1/6] net/qede: define PCI config space specific osals
Date: Thu, 9 Jul 2020 15:05:33 +0000 [thread overview]
Message-ID: <DM6PR18MB338809B1ED18AE36F7A4EA72AB640@DM6PR18MB3388.namprd18.prod.outlook.com> (raw)
In-Reply-To: <CALBAE1Mmx3KB_ioEryV+YXK19FDTq051h+XUXfnfiPPC3a6YPw@mail.gmail.com>
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Friday, June 26, 2020 10:24 AM
> To: Manish Chopra <manishc@marvell.com>; Gaetan Rivet
> <grive@u256.net>
> Cc: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Ferruh Yigit
> <ferruh.yigit@intel.com>; dpdk-dev <dev@dpdk.org>; Igor Russkikh
> <irusskikh@marvell.com>; Rasesh Mody <rmody@marvell.com>; GR-Everest-
> DPDK-Dev <GR-Everest-DPDK-Dev@marvell.com>
> Subject: [EXT] Re: [PATCH 1/6] net/qede: define PCI config space specific
> osals
>
> External Email
>
> ----------------------------------------------------------------------
> On Wed, Jun 10, 2020 at 1:13 AM Manish Chopra <manishc@marvell.com>
> wrote:
> >
> > This patch defines various PCI config space access APIs in order to
> > read and find IOV specific PCI capabilities.
> >
> > With these definitions implemented, it enables the base driver to do
> > SR-IOV specific initialization and HW specific configuration required
> > from PF-PMD driver instance.
> >
> > Signed-off-by: Manish Chopra <manishc@marvell.com>
> > Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
> > Signed-off-by: Rasesh Mody <rmody@marvell.com>
> > ---
> > +
> > +int osal_pci_find_next_ext_capability(struct rte_pci_device *dev,
> > + int cap)
>
>
> + Gaetan (PCI maintainer)
>
> Manish,
> It must be a candidate for a generic PCI API as it is nothing to do with qede.
> Please move to common PCI code if such API is not already present.
>
>
> > +{
> > + int pos = PCI_CFG_SPACE_SIZE;
> > + uint32_t header;
> > + int ttl;
> > +
> > + /* minimum 8 bytes per capability */
> > + ttl = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8;
> > +
> > + if (rte_pci_read_config(dev, &header, 4, pos) < 0)
> > + return -1;
> > +
> > + /*
> > + * If we have no capabilities, this is indicated by cap ID,
> > + * cap version and next pointer all being 0.
> > + */
> > + if (header == 0)
> > + return 0;
> > +
> > + while (ttl-- > 0) {
> > + if (PCI_EXT_CAP_ID(header) == cap)
> > + return pos;
> > +
> > + pos = PCI_EXT_CAP_NEXT(header);
> > +
> > + if (pos < PCI_CFG_SPACE_SIZE)
> > + break;
> > +
> > + if (rte_pci_read_config(dev, &header, 4, pos) < 0)
> > + return -1;
> > + }
> > +
> > + return 0;
> > +}
> >
>
> >
> > +#define PCICFG_VENDOR_ID_OFFSET 0x00
> > +#define PCICFG_DEVICE_ID_OFFSET 0x02
> > +#define PCI_CFG_SPACE_SIZE 256
> > +#define PCI_EXP_DEVCTL 0x0008
> > +#define PCI_EXT_CAP_ID(header) (int)((header) & 0x0000ffff) #define
> > +PCI_EXT_CAP_NEXT(header) (((header) >> 20) & 0xffc) #define
> > +PCI_CFG_SPACE_EXP_SIZE 4096
> > +
> > +#define PCI_SRIOV_CTRL 0x08 /* SR-IOV Control */ #define
> > +PCI_SRIOV_TOTAL_VF 0x0e /* Total VFs */ #define PCI_SRIOV_INITIAL_VF
> > +0x0c /* Initial VFs */ #define PCI_SRIOV_NUM_VF 0x10 /* Number of VFs
> > +*/ #define PCI_SRIOV_VF_OFFSET 0x14 /* First VF Offset */ #define
> > +PCI_SRIOV_VF_STRIDE 0x16 /* Following VF Stride */ #define
> > +PCI_SRIOV_VF_DID 0x1a #define PCI_SRIOV_SUP_PGSIZE 0x1c #define
> > +PCI_SRIOV_CAP 0x04 #define PCI_SRIOV_FUNC_LINK 0x12 #define
> > +PCI_EXT_CAP_ID_SRIOV 0x10
>
> Dont DEFINE PCI_ symbols in drivers, It may conflict with other PCI
> definitions in the future.
> Please move GENERIC PCI_ symbols to the generic PCI layer.
>
>
>
Hi Jerin/Gaetan,
Which generic PCI code/files these defines/API should be added to ? (lib/librte_pci/rte_pci.[c|h]) ?
Just FYI, note that it can't be done without cleaning up other vendors, as I can see that various other vendors have also
defined this function to find pci extended cap and some of these PCI_* macro defines as well in their respective drivers.
Thanks,
Manish
next prev parent reply other threads:[~2020-07-09 15:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-09 19:42 [dpdk-dev] [PATCH 0/6] qede: SR-IOV PF driver support Manish Chopra
2020-06-09 19:42 ` [dpdk-dev] [PATCH 1/6] net/qede: define PCI config space specific osals Manish Chopra
2020-06-26 4:53 ` Jerin Jacob
2020-07-09 15:05 ` Manish Chopra [this message]
2020-07-09 16:11 ` [dpdk-dev] [EXT] " Jerin Jacob
2020-07-09 22:28 ` Manish Chopra
2020-07-10 5:03 ` Jerin Jacob
2020-06-09 19:42 ` [dpdk-dev] [PATCH 2/6] net/qede: configure VFs on hardware Manish Chopra
2020-06-09 19:42 ` [dpdk-dev] [PATCH 3/6] net/qede: add infrastructure support for VF load Manish Chopra
2020-06-09 19:42 ` [dpdk-dev] [PATCH 4/6] net/qede: initialize VF MAC and link Manish Chopra
2020-06-09 19:42 ` [dpdk-dev] [PATCH 5/6] net/qede: add VF FLR support Manish Chopra
2020-06-09 19:42 ` [dpdk-dev] [PATCH 6/6] doc/guides: update qede features list Manish Chopra
2020-06-26 4:55 ` Jerin Jacob
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=DM6PR18MB338809B1ED18AE36F7A4EA72AB640@DM6PR18MB3388.namprd18.prod.outlook.com \
--to=manishc@marvell.com \
--cc=GR-Everest-DPDK-Dev@marvell.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=grive@u256.net \
--cc=irusskikh@marvell.com \
--cc=jerinj@marvell.com \
--cc=jerinjacobk@gmail.com \
--cc=rmody@marvell.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).