Skip to contentSkip to conversation

qede: SR-IOV PF driver support

PATCH Superseded Manish Chopra 4 participants 26 messages Jul 13, 2020 – Jul 20, 2020

Subsystems (3)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover qede: SR-IOV PF driver support

Hi,

This series adds SR-IOV PF pmd driver support to have VF pmd driver work over PF pmd driver instances in order to run the adapter completely under DPDK environment for one of the use cases like ovs-dpdk.

This is very initial bring-up with following testing covered -

* Enable/Disable SR-IOV VFs through igb_uio sysfs hook.
* Load VFs, run fastpath, teardown VFs in hypervisor and guest VM.
* VF FLR flow (in case of VF PCI passthrough to the guest VM)
* Bulletin mechanism tested to communicate link changes to the VFs.

Note that this series is intended for upcoming DPDK release (20.08) Please consider applying this series to dpdk-next-net-mrvl.git

V1->V2: (Incorporated comments from Jerin Jacob)
================================================

* Added rte_pci_regs.h file (copy of linux/pci_regs.h) under lib/librte_pci to remove the dependency of dpdk on user headers

* Added generic API to find PCI extended capability and use that in the drivers, removed individual functions implemented by the drivers

Thanks,
Manish

Manish Chopra (7):
lib/librte_pci: add rte_pci_regs.h
drivers: add generic API to find PCI extended cap net/qede: define PCI config space specific osals net/qede: configure VFs on hardware net/qede: add infrastructure support for VF load net/qede: initialize VF MAC and link net/qede: add VF FLR support

 doc/guides/nics/features/qede.ini          |    1 +
 doc/guides/nics/qede.rst                   |    7 +-
 drivers/bus/pci/linux/pci_uio.c            |    2 +-
 drivers/bus/pci/linux/pci_vfio.c           |    2 +-
 drivers/bus/pci/pci_common.c               |   41 +
 drivers/bus/pci/rte_bus_pci.h              |   11 +
 drivers/net/bnx2x/bnx2x.h                  |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c          |    2 +-
 drivers/net/ice/ice_ethdev.c               |   53 +-
 drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c |   48 +-
 drivers/net/qede/Makefile                  |    1 +
 drivers/net/qede/base/bcm_osal.c           |   31 +
 drivers/net/qede/base/bcm_osal.h           |   33 +-
 drivers/net/qede/base/ecore.h              |    7 +
 drivers/net/qede/base/ecore_iov_api.h      |    3 +
 drivers/net/qede/meson.build               |    1 +
 drivers/net/qede/qede_ethdev.c             |   37 +-
 drivers/net/qede/qede_ethdev.h             |    1 +
 drivers/net/qede/qede_if.h                 |    1 +
 drivers/net/qede/qede_main.c               |   13 +-
 drivers/net/qede/qede_sriov.c              |  219 ++++
 drivers/net/qede/qede_sriov.h              |   22 +
 drivers/vdpa/ifc/base/ifcvf_osdep.h        |    2 +-
 lib/librte_pci/Makefile                    |    1 +
 lib/librte_pci/meson.build                 |    2 +-
 lib/librte_pci/rte_pci_regs.h              | 1075 ++++++++++++++++++++
 26 files changed, 1500 insertions(+), 118 deletions(-)
 create mode 100644 drivers/net/qede/qede_sriov.c
 create mode 100644 drivers/net/qede/qede_sriov.h
 create mode 100644 lib/librte_pci/rte_pci_regs.h
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/7 lib/librte_pci: add rte_pci_regs.h

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h
drivers/bus/pci/linux/pci_uio.c +1 -1
index b62200153..698eace00 100644
@@ -10,12 +10,12 @@
 #include <sys/stat.h>
 #include <sys/mman.h>
 #include <sys/sysmacros.h>
-#include <linux/pci_regs.h>
 
 #if defined(RTE_ARCH_X86)
 #include <sys/io.h>
 #endif
 
+#include <rte_pci_regs.h>
 #include <rte_string_fns.h>
 #include <rte_log.h>
 #include <rte_pci.h>
drivers/bus/pci/linux/pci_vfio.c +1 -1
index fdeb9a8ca..96494fcfd 100644
@@ -4,13 +4,13 @@
 
 #include <string.h>
 #include <fcntl.h>
-#include <linux/pci_regs.h>
 #include <sys/eventfd.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <stdbool.h>
 
+#include <rte_pci_regs.h>
 #include <rte_log.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
drivers/net/bnx2x/bnx2x.h +1 -1
index 69cc1430a..4ec269dc6 100644
@@ -18,6 +18,7 @@
 #include <rte_spinlock.h>
 #include <rte_bus_pci.h>
 #include <rte_io.h>
+#include <rte_pci_regs.h>
 
 #include "bnx2x_osal.h"
 #include "bnx2x_ethdev.h"
@@ -31,7 +32,6 @@
 #include "elink.h"
 
 #ifndef RTE_EXEC_ENV_FREEBSD
-#include <linux/pci_regs.h>
 
 #define PCIY_PMG                       PCI_CAP_ID_PM
 #define PCIY_MSI                       PCI_CAP_ID_MSI
drivers/net/hns3/hns3_ethdev_vf.c +1 -1
index 54e5dac52..81f9e7edc 100644
@@ -9,8 +9,8 @@
 #include <inttypes.h>
 #include <unistd.h>
 #include <arpa/inet.h>
-#include <linux/pci_regs.h>
 
+#include <rte_pci_regs.h>
 #include <rte_alarm.h>
 #include <rte_atomic.h>
 #include <rte_bus_pci.h>
drivers/vdpa/ifc/base/ifcvf_osdep.h +1 -1
index 6aef25ea4..0a759703d 100644
@@ -6,8 +6,8 @@
 #define _IFCVF_OSDEP_H_
 
 #include <stdint.h>
-#include <linux/pci_regs.h>
 
+#include <rte_pci_regs.h>
 #include <rte_cycles.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
lib/librte_pci/Makefile +1 -0
index 7943f30ca..4d153b9ac 100644
@@ -15,5 +15,6 @@ EXPORT_MAP := rte_pci_version.map
 SRCS-$(CONFIG_RTE_LIBRTE_PCI) += rte_pci.c
 
 SYMLINK-$(CONFIG_RTE_LIBRTE_PCI)-include += rte_pci.h
+SYMLINK-y-include += rte_pci_regs.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pci/meson.build +1 -1
index dd41cd506..5c7afbbfb 100644
@@ -2,4 +2,4 @@
 # Copyright(c) 2017 Intel Corporation
 
 sources = files('rte_pci.c')
-headers = files('rte_pci.h')
+headers = files('rte_pci.h', 'rte_pci_regs.h')
lib/librte_pci/rte_pci_regs.h new file +1075 -0

1,075 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 3 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the motivation here?

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

Quoted 14 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h

[...]

lib/librte_pci/rte_pci_regs.h line 2

Quoted 8 lines
lib/librte_pci/rte_pci_regs.h new file +2 -0
new file mode 100644
index 000000000..1d11f4de5
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting userspace. This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3 and GPL-2.0.

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you think?

Signature · 1 line
Gaëtan
#3 lore raw

Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

In reply to Manish Chopra

Re-CCing [email protected] as it was removed from the reply.

Quoted 3 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the motivation here?

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

Quoted 14 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h

[...]

lib/librte_pci/rte_pci_regs.h line 2

Quoted 8 lines
lib/librte_pci/rte_pci_regs.h new file +2 -0
new file mode 100644
index 000000000..1d11f4de5
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting userspace. This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3 and GPL-2.0.

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you think?

Signature · 1 line
Gaëtan
#4 lore raw

Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 7 lines · Gaëtan Rivet

Re-CCing [email protected] as it was removed from the reply.

Quoted 3 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

Quoted 7 lines

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the motivation here?

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the linux part of the PCI bus driver instead, using stubs for other systems.

Quoted 39 lines
Quoted 14 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h

[...]

lib/librte_pci/rte_pci_regs.h line 2

Quoted 8 lines
lib/librte_pci/rte_pci_regs.h new file +2 -0
new file mode 100644
index 000000000..1d11f4de5
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting userspace. This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3 and GPL-2.0.

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you think?

Signature · 1 line
Gaëtan
Signature · 1 line
Gaëtan
#5 lore raw

Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 17 lines · Gaëtan Rivet
Quoted 7 lines · Gaëtan Rivet

Re-CCing [email protected] as it was removed from the reply.

Quoted 3 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

Quoted 7 lines

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the motivation here?

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

Quoted 42 lines

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the linux part of the PCI bus driver instead, using stubs for other systems.

Quoted 36 lines
Quoted 14 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h

[...]

lib/librte_pci/rte_pci_regs.h line 2

Quoted 8 lines
lib/librte_pci/rte_pci_regs.h new file +2 -0
new file mode 100644
index 000000000..1d11f4de5
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting userspace. This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3 and GPL-2.0.

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you think?

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK
as symbols start from RTE_PCI_*(It will fix up the namespace as well).

Quoted 6 lines
Quoted 3 lines

--
Gaëtan

--
Gaëtan

#6 lore raw

Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

16/07/2020 12:27, Jerin Jacob:

Quoted 58 lines · Gaëtan Rivet
Quoted 57 lines · Gaëtan Rivet
Quoted 7 lines

Re-CCing [email protected] as it was removed from the reply.

Quoted 3 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

Quoted 7 lines

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the motivation here?

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the linux part of the PCI bus driver instead, using stubs for other systems.

Quoted 34 lines
Quoted 14 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h

[...]

lib/librte_pci/rte_pci_regs.h line 2

Quoted 8 lines
lib/librte_pci/rte_pci_regs.h new file +2 -0
new file mode 100644
index 000000000..1d11f4de5
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting userspace. This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3 and GPL-2.0.

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you think?

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK
as symbols start from RTE_PCI_*(It will fix up the namespace as well).

If symbols can be found in /usr/include/, don't add anything.

#7 lore raw

Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 60 lines · Thomas Monjalon

16/07/2020 12:27, Jerin Jacob:

Quoted 58 lines · Gaëtan Rivet
Quoted 57 lines · Gaëtan Rivet
Quoted 7 lines

Re-CCing [email protected] as it was removed from the reply.

Quoted 3 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

Quoted 7 lines

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the motivation here?

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the linux part of the PCI bus driver instead, using stubs for other systems.

Quoted 34 lines
Quoted 14 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h

[...]

lib/librte_pci/rte_pci_regs.h line 2

Quoted 8 lines
lib/librte_pci/rte_pci_regs.h new file +2 -0
new file mode 100644
index 000000000..1d11f4de5
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting userspace. This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3 and GPL-2.0.

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you think?

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK
as symbols start from RTE_PCI_*(It will fix up the namespace as well).

If symbols can be found in /usr/include/, don't add anything.

Not by default on all the distros. It is part of pciutils library. Moreover, we need these symbols for Windows OS as well.
IMO, We should add absolute minimum constants that needed for DPDK as RTE_PCI_*

Quoted 2 lines
#8 lore raw

Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

16/07/2020 13:55, Jerin Jacob:

Quoted 68 lines · Thomas Monjalon
Quoted 67 lines

16/07/2020 12:27, Jerin Jacob:

Quoted 64 lines · Gaëtan Rivet
Quoted 17 lines · Gaëtan Rivet
Quoted 7 lines

Re-CCing [email protected] as it was removed from the reply.

Quoted 3 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

Quoted 7 lines

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the motivation here?

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

Quoted 42 lines

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the linux part of the PCI bus driver instead, using stubs for other systems.

Quoted 36 lines
Quoted 14 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h

[...]

lib/librte_pci/rte_pci_regs.h line 2

Quoted 8 lines
lib/librte_pci/rte_pci_regs.h new file +2 -0
new file mode 100644
index 000000000..1d11f4de5
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting userspace. This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3 and GPL-2.0.

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you think?

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK
as symbols start from RTE_PCI_*(It will fix up the namespace as well).

Quoted 5 lines
Quoted 1 line

If symbols can be found in /usr/include/, don't add anything.

Not by default on all the distros. It is part of pciutils library. Moreover, we need these symbols for Windows OS as well.
IMO, We should add absolute minimum constants that needed for DPDK as RTE_PCI_*

I am for mandating the dependency instead of copying it.

pciutils cannot be installed on Windows?
Why do you care about Windows?
I don't see any contribution for qede on Windows.

#9 lore raw

Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 70 lines · Thomas Monjalon

16/07/2020 13:55, Jerin Jacob:

Quoted 68 lines · Thomas Monjalon
Quoted 67 lines

16/07/2020 12:27, Jerin Jacob:

Quoted 64 lines · Gaëtan Rivet
Quoted 17 lines · Gaëtan Rivet
Quoted 7 lines

Re-CCing [email protected] as it was removed from the reply.

Quoted 3 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

Quoted 7 lines

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the motivation here?

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

Quoted 42 lines

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the linux part of the PCI bus driver instead, using stubs for other systems.

Quoted 36 lines
Quoted 14 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h

[...]

lib/librte_pci/rte_pci_regs.h line 2

Quoted 8 lines
lib/librte_pci/rte_pci_regs.h new file +2 -0
new file mode 100644
index 000000000..1d11f4de5
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting userspace. This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3 and GPL-2.0.

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you think?

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK
as symbols start from RTE_PCI_*(It will fix up the namespace as well).

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

If symbols can be found in /usr/include/, don't add anything.

Not by default on all the distros. It is part of pciutils library. Moreover, we need these symbols for Windows OS as well.
IMO, We should add absolute minimum constants that needed for DPDK as RTE_PCI_*

I am for mandating the dependency instead of copying it.

You mean _pciutils_ package as a mandatory dependency to DPDK.

Quoted 4 lines

pciutils cannot be installed on Windows?
Why do you care about Windows?
I don't see any contribution for qede on Windows.

You closely review the patch, it not about qede. The proposed file comes at lib/librte_pci/rte_pci_regs.h which is common to Windows.

Quoted 2 lines
#10 lore raw

Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

16/07/2020 15:02, Jerin Jacob:

Quoted 73 lines · Thomas Monjalon
Quoted 72 lines

16/07/2020 13:55, Jerin Jacob:

Quoted 70 lines · Thomas Monjalon
Quoted 68 lines

16/07/2020 12:27, Jerin Jacob:

Quoted 58 lines · Gaëtan Rivet
Quoted 57 lines · Gaëtan Rivet
Quoted 7 lines

Re-CCing [email protected] as it was removed from the reply.

Quoted 3 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

Quoted 7 lines

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the motivation here?

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the linux part of the PCI bus driver instead, using stubs for other systems.

Quoted 34 lines
Quoted 14 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h

[...]

lib/librte_pci/rte_pci_regs.h line 2

Quoted 8 lines
lib/librte_pci/rte_pci_regs.h new file +2 -0
new file mode 100644
index 000000000..1d11f4de5
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting userspace. This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3 and GPL-2.0.

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you think?

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK
as symbols start from RTE_PCI_*(It will fix up the namespace as well).

If symbols can be found in /usr/include/, don't add anything.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Not by default on all the distros. It is part of pciutils library. Moreover, we need these symbols for Windows OS as well.
IMO, We should add absolute minimum constants that needed for DPDK as RTE_PCI_*

I am for mandating the dependency instead of copying it.

You mean _pciutils_ package as a mandatory dependency to DPDK.

There is already this dependency:

	#include <linux/pci_regs.h>

I'm missing the real justification for this patch. Is there some missing definitions?
Is there some environments where this file is missing?

Quoted 6 lines
Quoted 3 lines

pciutils cannot be installed on Windows?
Why do you care about Windows?
I don't see any contribution for qede on Windows.

You closely review the patch, it not about qede. The proposed file comes at lib/librte_pci/rte_pci_regs.h which is common to Windows.

The series is for qede. I'm trying to understand the motivation.

#11 lore raw

Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 79 lines · Thomas Monjalon

16/07/2020 15:02, Jerin Jacob:

Quoted 77 lines · Thomas Monjalon
Quoted 76 lines

16/07/2020 13:55, Jerin Jacob:

Quoted 73 lines · Thomas Monjalon
Quoted 60 lines

16/07/2020 12:27, Jerin Jacob:

Quoted 58 lines · Gaëtan Rivet
Quoted 57 lines · Gaëtan Rivet
Quoted 7 lines

Re-CCing [email protected] as it was removed from the reply.

Quoted 3 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

Quoted 7 lines

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the motivation here?

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the linux part of the PCI bus driver instead, using stubs for other systems.

Quoted 34 lines
Quoted 14 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h

[...]

lib/librte_pci/rte_pci_regs.h line 2

Quoted 8 lines
lib/librte_pci/rte_pci_regs.h new file +2 -0
new file mode 100644
index 000000000..1d11f4de5
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting userspace. This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3 and GPL-2.0.

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you think?

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK
as symbols start from RTE_PCI_*(It will fix up the namespace as well).

If symbols can be found in /usr/include/, don't add anything.

Not by default on all the distros. It is part of pciutils library. Moreover, we need these symbols for Windows OS as well.
IMO, We should add absolute minimum constants that needed for DPDK as RTE_PCI_*

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I am for mandating the dependency instead of copying it.

You mean _pciutils_ package as a mandatory dependency to DPDK.

There is already this dependency:

        #include <linux/pci_regs.h>

I just checked in archlinux, PCI headers can be provided by

# pacman -F /usr/include/pci/header.h
usr/include/pci/header.h is owned by core/pciutils 3.7.0-
# pacman -F /usr/include/linux/pci.h
usr/include/linux/pci.h is owned by core/linux-api-headers 5.4.17-1
Quoted 1 line

I'm missing the real justification for this patch.

See below.

Quoted 11 lines

Is there some missing definitions?
Is there some environments where this file is missing?

Quoted 6 lines
Quoted 3 lines

pciutils cannot be installed on Windows?
Why do you care about Windows?
I don't see any contribution for qede on Windows.

You closely review the patch, it not about qede. The proposed file comes at lib/librte_pci/rte_pci_regs.h which is common to Windows.

The series is for qede. I'm trying to understand the motivation.

First version of qede driver sent with defined generic PCI symbols and generic PCI function like pci_find_next_ext_capability() in qede driver.

In the review, I suggested using generic rte_ function as
a) It is not specific to qede.
b) Other drivers also doing the same thing in their own driver space as there is no dpdk API for the same.
This patches create generic API for pci_find_next_ext_capability() and remove duplicate implementation
from the drivers.
http://patches.dpdk.org/patch/73959/

Quoted 2 lines
#12 lore raw

Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

16/07/2020 18:43, Jerin Jacob:

Quoted 107 lines · Thomas Monjalon
Quoted 79 lines

16/07/2020 15:02, Jerin Jacob:

Quoted 77 lines · Thomas Monjalon
Quoted 76 lines

16/07/2020 13:55, Jerin Jacob:

Quoted 73 lines · Thomas Monjalon
Quoted 60 lines

16/07/2020 12:27, Jerin Jacob:

Quoted 58 lines · Gaëtan Rivet
Quoted 57 lines · Gaëtan Rivet
Quoted 7 lines

Re-CCing [email protected] as it was removed from the reply.

Quoted 3 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

Quoted 7 lines

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the motivation here?

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the linux part of the PCI bus driver instead, using stubs for other systems.

Quoted 34 lines
Quoted 14 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h

[...]

lib/librte_pci/rte_pci_regs.h line 2

Quoted 8 lines
lib/librte_pci/rte_pci_regs.h new file +2 -0
new file mode 100644
index 000000000..1d11f4de5
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting userspace. This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3 and GPL-2.0.

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you think?

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK
as symbols start from RTE_PCI_*(It will fix up the namespace as well).

If symbols can be found in /usr/include/, don't add anything.

Not by default on all the distros. It is part of pciutils library. Moreover, we need these symbols for Windows OS as well.
IMO, We should add absolute minimum constants that needed for DPDK as RTE_PCI_*

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I am for mandating the dependency instead of copying it.

You mean _pciutils_ package as a mandatory dependency to DPDK.

There is already this dependency:

        #include <linux/pci_regs.h>

I just checked in archlinux, PCI headers can be provided by

# pacman -F /usr/include/pci/header.h
usr/include/pci/header.h is owned by core/pciutils 3.7.0-
# pacman -F /usr/include/linux/pci.h
usr/include/linux/pci.h is owned by core/linux-api-headers 5.4.17-1
Quoted 1 line

I'm missing the real justification for this patch.

See below.

Quoted 7 lines

Is there some missing definitions?
Is there some environments where this file is missing?

Quoted 4 lines
Quoted 3 lines

pciutils cannot be installed on Windows?
Why do you care about Windows?
I don't see any contribution for qede on Windows.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

You closely review the patch, it not about qede. The proposed file comes at lib/librte_pci/rte_pci_regs.h which is common to Windows.

The series is for qede. I'm trying to understand the motivation.

First version of qede driver sent with defined generic PCI symbols and generic PCI function like pci_find_next_ext_capability() in qede driver.

That's a pity the v2 is not threaded with v1, I would have found these explanations easily myself.

Quoted 8 lines

In the review, I suggested using generic rte_ function as
a) It is not specific to qede.
b) Other drivers also doing the same thing in their own driver space as there is no dpdk API for the same.
This patches create generic API for pci_find_next_ext_capability() and remove duplicate implementation
from the drivers.
http://patches.dpdk.org/patch/73959/

I agree it's good to have an API for such thing.

So far such feature is supported in drivers on Linux, requiring only Linux headers to be installed. Do we need more?

#13 lore raw

Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 129 lines · Thomas Monjalon

16/07/2020 18:43, Jerin Jacob:

Quoted 107 lines · Thomas Monjalon
Quoted 79 lines

16/07/2020 15:02, Jerin Jacob:

Quoted 77 lines · Thomas Monjalon
Quoted 76 lines

16/07/2020 13:55, Jerin Jacob:

Quoted 73 lines · Thomas Monjalon
Quoted 60 lines

16/07/2020 12:27, Jerin Jacob:

Quoted 58 lines · Gaëtan Rivet
Quoted 57 lines · Gaëtan Rivet
Quoted 7 lines

Re-CCing [email protected] as it was removed from the reply.

Quoted 3 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

Quoted 7 lines

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the motivation here?

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the linux part of the PCI bus driver instead, using stubs for other systems.

Quoted 34 lines
Quoted 14 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h

[...]

lib/librte_pci/rte_pci_regs.h line 2

Quoted 8 lines
lib/librte_pci/rte_pci_regs.h new file +2 -0
new file mode 100644
index 000000000..1d11f4de5
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting userspace. This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3 and GPL-2.0.

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you think?

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK
as symbols start from RTE_PCI_*(It will fix up the namespace as well).

If symbols can be found in /usr/include/, don't add anything.

Not by default on all the distros. It is part of pciutils library. Moreover, we need these symbols for Windows OS as well.
IMO, We should add absolute minimum constants that needed for DPDK as RTE_PCI_*

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I am for mandating the dependency instead of copying it.

You mean _pciutils_ package as a mandatory dependency to DPDK.

There is already this dependency:

        #include <linux/pci_regs.h>

I just checked in archlinux, PCI headers can be provided by

# pacman -F /usr/include/pci/header.h
usr/include/pci/header.h is owned by core/pciutils 3.7.0-
# pacman -F /usr/include/linux/pci.h
usr/include/linux/pci.h is owned by core/linux-api-headers 5.4.17-1
Quoted 1 line

I'm missing the real justification for this patch.

See below.

Quoted 7 lines

Is there some missing definitions?
Is there some environments where this file is missing?

Quoted 4 lines
Quoted 3 lines

pciutils cannot be installed on Windows?
Why do you care about Windows?
I don't see any contribution for qede on Windows.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

You closely review the patch, it not about qede. The proposed file comes at lib/librte_pci/rte_pci_regs.h which is common to Windows.

The series is for qede. I'm trying to understand the motivation.

First version of qede driver sent with defined generic PCI symbols and generic PCI function like pci_find_next_ext_capability() in qede driver.

That's a pity the v2 is not threaded with v1, I would have found these explanations easily myself.

Quoted 8 lines

In the review, I suggested using generic rte_ function as
a) It is not specific to qede.
b) Other drivers also doing the same thing in their own driver space as there is no dpdk API for the same.
This patches create generic API for pci_find_next_ext_capability() and remove duplicate implementation
from the drivers.
http://patches.dpdk.org/patch/73959/

Quoted 5 lines

I agree it's good to have an API for such thing.

So far such feature is supported in drivers on Linux, requiring only Linux headers to be installed. Do we need more?

We would need only Linux headers for Implementing rte_pci_find_next_ext_capability().
I leave, @Manish Chopra to comment on other PCI symbols requirements.

Quoted 2 lines
#14 lore raw

Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

In reply to Thomas Monjalon
Quoted 128 lines · Thomas Monjalon

16/07/2020 18:43, Jerin Jacob:

Quoted 107 lines · Thomas Monjalon
Quoted 79 lines

16/07/2020 15:02, Jerin Jacob:

Quoted 77 lines · Thomas Monjalon
Quoted 76 lines

16/07/2020 13:55, Jerin Jacob:

Quoted 73 lines · Thomas Monjalon
Quoted 60 lines

16/07/2020 12:27, Jerin Jacob:

Quoted 58 lines · Gaëtan Rivet
Quoted 57 lines · Gaëtan Rivet
Quoted 7 lines

Re-CCing [email protected] as it was removed from the reply.

Quoted 3 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

Quoted 7 lines

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the motivation here?

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the linux part of the PCI bus driver instead, using stubs for other systems.

Quoted 34 lines
Quoted 14 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075 +++++++++++++++++++++++++++
 8 files changed, 1082 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_pci/rte_pci_regs.h

[...]

lib/librte_pci/rte_pci_regs.h line 2

Quoted 8 lines
lib/librte_pci/rte_pci_regs.h new file +2 -0
new file mode 100644
index 000000000..1d11f4de5
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting userspace. This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3 and GPL-2.0.

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you think?

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK
as symbols start from RTE_PCI_*(It will fix up the namespace as well).

If symbols can be found in /usr/include/, don't add anything.

Not by default on all the distros. It is part of pciutils library. Moreover, we need these symbols for Windows OS as well.
IMO, We should add absolute minimum constants that needed for DPDK as RTE_PCI_*

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I am for mandating the dependency instead of copying it.

You mean _pciutils_ package as a mandatory dependency to DPDK.

There is already this dependency:

        #include <linux/pci_regs.h>

I just checked in archlinux, PCI headers can be provided by

# pacman -F /usr/include/pci/header.h
usr/include/pci/header.h is owned by core/pciutils 3.7.0-
# pacman -F /usr/include/linux/pci.h
usr/include/linux/pci.h is owned by core/linux-api-headers 5.4.17-1
Quoted 1 line

I'm missing the real justification for this patch.

See below.

Quoted 7 lines

Is there some missing definitions?
Is there some environments where this file is missing?

Quoted 4 lines
Quoted 3 lines

pciutils cannot be installed on Windows?
Why do you care about Windows?
I don't see any contribution for qede on Windows.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

You closely review the patch, it not about qede. The proposed file comes at lib/librte_pci/rte_pci_regs.h which is common to Windows.

The series is for qede. I'm trying to understand the motivation.

First version of qede driver sent with defined generic PCI symbols and generic PCI function like pci_find_next_ext_capability() in qede driver.

That's a pity the v2 is not threaded with v1, I would have found these explanations easily myself.

Quoted 8 lines

In the review, I suggested using generic rte_ function as
a) It is not specific to qede.
b) Other drivers also doing the same thing in their own driver space as there is no dpdk API for the same.
This patches create generic API for pci_find_next_ext_capability() and remove duplicate implementation
from the drivers.
http://patches.dpdk.org/patch/73959/

Quoted 7 lines

I agree it's good to have an API for such thing.

So far such feature is supported in drivers on Linux, requiring only Linux headers to be installed. Do we need more?

+1 to make it generic, no question here.

On linux, the dependency is already there (either from linux headers or pciutils) to have the original. So including this header in DPDK is only useful for other OSes.

I think right now we should only add pci_find_next_ext_capability() full implementation within linux part of PCI bus, other systems being stubs.

We can go with your suggestion Jerin about adding only the specific symbols needed, prefixed with RTE_, once we decide to have windows support. Question is whether we need it right now. Is there a driver that would make use of it support more than linux currently?

Signature · 1 line
Gaëtan
#15 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 180 lines

-----Original Message-----
From: Gaëtan Rivet <[email protected]>
Sent: Thursday, July 16, 2020 11:26 PM
To: Thomas Monjalon <[email protected]>
Cc: Jerin Jacob <[email protected]>; Manish Chopra <[email protected]>; Ferruh Yigit <[email protected]>; Igor Russkikh <[email protected]>; dpdk-dev <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

External Email

----------------------------------------------------------------------

Quoted 2 lines · Thomas Monjalon

16/07/2020 18:43, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 9:25 PM Thomas Monjalon

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines

16/07/2020 15:02, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 6:20 PM Thomas Monjalon

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

16/07/2020 13:55, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 4:57 PM Thomas Monjalon

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

16/07/2020 12:27, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 3:48 PM Gaëtan Rivet

Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines · Gaëtan Rivet
Quoted 2 lines

Re-CCing [email protected] as it was removed from the reply.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Manish Chopra
Quoted 3 lines

This is merely copy of latest linux/pci_regs.h in order to avoid dependency of dpdk on user headers.

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the

motivation here?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the linux part of the PCI bus driver instead, using stubs for other

systems.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 4 lines
Signed-off-by Igor Russkikh

<[email protected]>

Quoted 9 lines
---
 drivers/bus/pci/linux/pci_uio.c     |    2 +-
 drivers/bus/pci/linux/pci_vfio.c    |    2 +-
 drivers/net/bnx2x/bnx2x.h           |    2 +-
 drivers/net/hns3/hns3_ethdev_vf.c   |    2 +-
 drivers/vdpa/ifc/base/ifcvf_osdep.h |    2 +-
 lib/librte_pci/Makefile             |    1 +
 lib/librte_pci/meson.build          |    2 +-
 lib/librte_pci/rte_pci_regs.h       | 1075

+++++++++++++++++++++++++++

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
 8 files changed, 1082 insertions(+), 6

deletions(-) create mode 100644
lib/librte_pci/rte_pci_regs.h

[...]

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

lib/librte_pci/rte_pci_regs.h line 3

Quoted 9 lines
(quoted diff) +0 -0

b/lib/librte_pci/rte_pci_regs.h new file mode
100644 index 000000000..1d11f4de5

lib/librte_pci/rte_pci_regs.h new file +3 -0
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH
+Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting

userspace.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3

and GPL-2.0.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you

think?

Quoted 35 lines
Quoted 35 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK as symbols start from RTE_PCI_*(It will fix up the namespace as well).

If symbols can be found in /usr/include/, don't add anything.

Not by default on all the distros. It is part of pciutils library. Moreover, we need these symbols for Windows OS as well. IMO, We should add absolute minimum constants that needed for DPDK as RTE_PCI_*

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I am for mandating the dependency instead of copying it.

You mean _pciutils_ package as a mandatory dependency to DPDK.

There is already this dependency:

        #include <linux/pci_regs.h>

I just checked in archlinux, PCI headers can be provided by

# pacman -F /usr/include/pci/header.h usr/include/pci/header.h is
owned by core/pciutils 3.7.0-
# pacman -F /usr/include/linux/pci.h usr/include/linux/pci.h is
owned by core/linux-api-headers 5.4.17-1
Quoted 1 line

I'm missing the real justification for this patch.

See below.

Quoted 3 lines

Is there some missing definitions?
Is there some environments where this file is missing?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

pciutils cannot be installed on Windows?
Why do you care about Windows?
I don't see any contribution for qede on Windows.

You closely review the patch, it not about qede. The proposed file comes at lib/librte_pci/rte_pci_regs.h which is common to

Windows.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

The series is for qede. I'm trying to understand the motivation.

First version of qede driver sent with defined generic PCI symbols and generic PCI function like pci_find_next_ext_capability() in qede

driver.

Quoted 12 lines

That's a pity the v2 is not threaded with v1, I would have found these explanations easily myself.

Quoted 8 lines

In the review, I suggested using generic rte_ function as
a) It is not specific to qede.
b) Other drivers also doing the same thing in their own driver space as there is no dpdk API for the same.
This patches create generic API for pci_find_next_ext_capability() and remove duplicate implementation from the drivers.
https://urldefense.proofpoint.com/v2/url?u=http-3A__patches.dpdk.org

_patch_73959_&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=bMTgx2X48QVX yXOEL8

Quoted 1 line
Quoted 1 line

ALyI4dsWoR-m74c5n3d-

ruJI8&m=eNuzGYhB7u2Wzru3VeBTY7QDZSSb9VQ9eQXW56D4

Quoted 9 lines
Quoted 1 line

64Y&s=eatY5xyw-474yS0cBJXyG7gLyPXFo243P2LmBDDsXd8&e=

I agree it's good to have an API for such thing.

So far such feature is supported in drivers on Linux, requiring only Linux headers to be installed.
Do we need more?

+1 to make it generic, no question here.

On linux, the dependency is already there (either from linux headers or pciutils) to have the original. So including this header in DPDK is only useful for other OSes.

I think right now we should only add pci_find_next_ext_capability() full implementation within linux part of PCI bus, other systems being stubs.

Quoted 6 lines

We can go with your suggestion Jerin about adding only the specific symbols needed, prefixed with RTE_, once we decide to have windows support. Question is whether we need it right now. Is there a driver that would make use of it support more than linux currently?

--

I don't know if there are any drivers which will require this other than linux as of today -

My only motivation of adding these symbols in dpdk via rte_pci_regs.h (new file in lib/librte_pci/) was to avoid any dependency of dpdk on /usr/include/../pci_regs.h, since I was little unsure whether in all distributions (linux/windows) supported will have the required PCI defines available in /usr/include/../pci_regs.h file or not in order to implement rte_pci_find_next_ext_capability(). (unless user to bound for updating headers by mean of installing any latest _pciutils_/packages). Moreover, for not just this API, but if going forward if we have to add any new APIs which could rely/depend on PCI defines availability under /usr/include.

From the discussion so far -

1. Define the function under drivers/bus/pci/linux/pci.c only and add empty/stub implementation for windows/pci.c and bsd/pci.c ?
2. Just relying on /usr/include/ is perfectly okay without adding any defines anywhere for now ?, it will just require <linux/pci_regs.h> inclusion in drivers/bus/pci/linux/pci.c. OR Shall I add (may be in lib/librte_pci/rte_pci.h ?) only required PCI defines with RTE_ prefixed and use them instead ?

Thanks,
Manish

#16 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 226 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Manish Chopra
Sent: Friday, July 17, 2020 2:19 AM
To: Gaëtan Rivet <[email protected]>; Thomas Monjalon <[email protected]>
Cc: Jerin Jacob <[email protected]>; Ferruh Yigit <[email protected]>; Igor Russkikh <[email protected]>; dpdk-dev <[email protected]>
Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 22 lines

-----Original Message-----
From: Gaëtan Rivet <[email protected]>
Sent: Thursday, July 16, 2020 11:26 PM
To: Thomas Monjalon <[email protected]>
Cc: Jerin Jacob <[email protected]>; Manish Chopra <[email protected]>; Ferruh Yigit <[email protected]>; Igor Russkikh <[email protected]>; dpdk-dev <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

External Email

----------------------------------------------------------------------

Quoted 2 lines · Thomas Monjalon

16/07/2020 18:43, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 9:25 PM Thomas Monjalon

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines

16/07/2020 15:02, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 6:20 PM Thomas Monjalon

Quoted 1 line · <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 10 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

16/07/2020 13:55, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 4:57 PM Thomas Monjalon

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

16/07/2020 12:27, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 3:48 PM Gaëtan Rivet

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines · Gaëtan Rivet
Quoted 1 line

Re-CCing [email protected] as it was removed from the

reply.

Quoted 112 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines · Manish Chopra
Quoted 3 lines

This is merely copy of latest linux/pci_regs.h
in order to avoid dependency of dpdk on user headers.

I guess this dependency is an issue on non-linux systems, when you must use those defines in a generic implementation. Can you confirm this is the

motivation here?

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines

If so, I think it would be clearer to state "in order to avoid dependency of DPDK on linux headers".

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the
linux part of the PCI bus driver instead, using
stubs for other

systems.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

Signed-off-by: Manish Chopra
<[email protected]>
Signed-off-by: Igor Russkikh
<[email protected]>
---
drivers/bus/pci/linux/pci_uio.c | 2 +-
drivers/bus/pci/linux/pci_vfio.c | 2 +-
drivers/net/bnx2x/bnx2x.h | 2 +-
drivers/net/hns3/hns3_ethdev_vf.c | 2 +-
drivers/vdpa/ifc/base/ifcvf_osdep.h | 2 +-
lib/librte_pci/Makefile | 1 +
lib/librte_pci/meson.build | 2 +-
lib/librte_pci/rte_pci_regs.h | 1075

+++++++++++++++++++++++++++

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

8 files changed, 1082 insertions(+), 6
deletions(-) create mode 100644
lib/librte_pci/rte_pci_regs.h

[...]

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

diff --git a/lib/librte_pci/rte_pci_regs.h
b/lib/librte_pci/rte_pci_regs.h new file mode
100644 index 000000000..1d11f4de5
--- /dev/null

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

+++ b/lib/librte_pci/rte_pci_regs.h
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH
+Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib, targeting

userspace.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

This seems to be an exception to the license policy described in license/README. Code shared between kernel and userspace is expected to be dual-licensed BSD-3

and GPL-2.0.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

As it is a copy of Linux user includes, re-licensing it as BSD-3 as well is not possible.

So I think it might require a techboard + governing board exception approval. Ferruh or Thomas, what do you

think?

Quoted 35 lines
Quoted 35 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK as symbols start from RTE_PCI_*(It will fix up the namespace as well).

If symbols can be found in /usr/include/, don't add anything.

Not by default on all the distros. It is part of pciutils library. Moreover, we need these symbols for Windows OS as well. IMO, We should add absolute minimum constants that needed for DPDK as RTE_PCI_*

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I am for mandating the dependency instead of copying it.

You mean _pciutils_ package as a mandatory dependency to DPDK.

There is already this dependency:

        #include <linux/pci_regs.h>

I just checked in archlinux, PCI headers can be provided by

# pacman -F /usr/include/pci/header.h usr/include/pci/header.h is
owned by core/pciutils 3.7.0-
# pacman -F /usr/include/linux/pci.h usr/include/linux/pci.h is
owned by core/linux-api-headers 5.4.17-1
Quoted 1 line

I'm missing the real justification for this patch.

See below.

Quoted 3 lines

Is there some missing definitions?
Is there some environments where this file is missing?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

pciutils cannot be installed on Windows?
Why do you care about Windows?
I don't see any contribution for qede on Windows.

You closely review the patch, it not about qede. The proposed file comes at lib/librte_pci/rte_pci_regs.h which is common to

Quoted 22 lines

Windows.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

The series is for qede. I'm trying to understand the motivation.

First version of qede driver sent with defined generic PCI symbols and generic PCI function like pci_find_next_ext_capability() in qede

driver.

Quoted 13 lines

That's a pity the v2 is not threaded with v1, I would have found these explanations easily myself.

Quoted 9 lines

In the review, I suggested using generic rte_ function as
a) It is not specific to qede.
b) Other drivers also doing the same thing in their own driver space as there is no dpdk API for the same.
This patches create generic API for pci_find_next_ext_capability() and remove duplicate implementation from the drivers.
https://urldefense.proofpoint.com/v2/url?u=http-3A__patches.dpdk.o
rg

_patch_73959_&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=bMTgx2X48QVX

Quoted 15 lines

yXOEL8

Quoted 1 line
Quoted 1 line

ALyI4dsWoR-m74c5n3d-

ruJI8&m=eNuzGYhB7u2Wzru3VeBTY7QDZSSb9VQ9eQXW56D4

Quoted 9 lines
Quoted 1 line

64Y&s=eatY5xyw-474yS0cBJXyG7gLyPXFo243P2LmBDDsXd8&e=

I agree it's good to have an API for such thing.

So far such feature is supported in drivers on Linux, requiring only Linux headers to be installed.
Do we need more?

+1 to make it generic, no question here.

Quoted 7 lines

On linux, the dependency is already there (either from linux headers or
pciutils) to have the original. So including this header in DPDK is only useful for other OSes.

I think right now we should only add pci_find_next_ext_capability() full implementation within linux part of PCI bus, other systems being

stubs.

Quoted 3 lines

We can go with your suggestion Jerin about adding only the specific symbols needed, prefixed with RTE_, once we decide to have windows

support.

Quoted 4 lines

Question is whether we need it right now. Is there a driver that would make use of it support more than linux currently?

--

I don't know if there are any drivers which will require this other than linux as of today -

My only motivation of adding these symbols in dpdk via rte_pci_regs.h (new file in lib/librte_pci/) was to avoid any dependency of dpdk on /usr/include/../pci_regs.h, since I was little unsure whether in all distributions (linux/windows) supported will have the required PCI defines available in /usr/include/../pci_regs.h file or not in order to implement rte_pci_find_next_ext_capability(). (unless user to bound for updating headers by mean of installing any latest _pciutils_/packages). Moreover, for not just this API, but if going forward if we have to add any new APIs which could rely/depend on PCI defines availability under /usr/include.

From the discussion so far -

Quoted 8 lines

1. Define the function under drivers/bus/pci/linux/pci.c only and add empty/stub implementation for windows/pci.c and bsd/pci.c ?
2. Just relying on /usr/include/ is perfectly okay without adding any defines anywhere for now ?, it will just require <linux/pci_regs.h> inclusion in drivers/bus/pci/linux/pci.c. OR Shall I add (may be in
lib/librte_pci/rte_pci.h ?) only required PCI defines with RTE_ prefixed and use them instead ?

Hello Gaetan/Jerin,

Could you please comment on above - what's sufficient to be incorporated in v3 for now ? I will work on the changes accordingly.

Thanks,
Manish

#17 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 236 lines · Manish Chopra
Quoted 227 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Manish Chopra
Sent: Friday, July 17, 2020 2:19 AM
To: Gaëtan Rivet <[email protected]>; Thomas Monjalon <[email protected]>
Cc: Jerin Jacob <[email protected]>; Ferruh Yigit <[email protected]>; Igor Russkikh <[email protected]>; dpdk-dev <[email protected]>
Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 22 lines

-----Original Message-----
From: Gaëtan Rivet <[email protected]>
Sent: Thursday, July 16, 2020 11:26 PM
To: Thomas Monjalon <[email protected]>
Cc: Jerin Jacob <[email protected]>; Manish Chopra <[email protected]>; Ferruh Yigit <[email protected]>; Igor Russkikh <[email protected]>; dpdk-dev <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

External Email

----------------------------------------------------------------------

Quoted 2 lines · Thomas Monjalon

16/07/2020 18:43, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 9:25 PM Thomas Monjalon

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines

16/07/2020 15:02, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 6:20 PM Thomas Monjalon

Quoted 1 line · <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 10 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

16/07/2020 13:55, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 4:57 PM Thomas Monjalon

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

16/07/2020 12:27, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 3:48 PM Gaëtan Rivet

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines · Gaëtan Rivet
Quoted 1 line

Re-CCing [email protected] as it was removed from the

reply.

Quoted 112 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines · Manish Chopra

This is merely copy of latest linux/pci_regs.h
in order to avoid dependency of dpdk on user headers.

I guess this dependency is an issue on non-linux
systems, when you must use those defines in a
generic implementation. Can you confirm this is
the

motivation here?

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines

If so, I think it would be clearer to state "in
order to avoid dependency of DPDK on linux headers".

To add to it, if this is actually the motivation to add this header, I don't think it is sufficient.

You can restrict the function definition to the
linux part of the PCI bus driver instead, using
stubs for other

systems.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

Signed-off-by: Manish Chopra
<[email protected]>
Signed-off-by: Igor Russkikh
<[email protected]>
---
drivers/bus/pci/linux/pci_uio.c | 2 +-
drivers/bus/pci/linux/pci_vfio.c | 2 +-
drivers/net/bnx2x/bnx2x.h | 2 +-
drivers/net/hns3/hns3_ethdev_vf.c | 2 +-
drivers/vdpa/ifc/base/ifcvf_osdep.h | 2 +-
lib/librte_pci/Makefile | 1 +
lib/librte_pci/meson.build | 2 +-
lib/librte_pci/rte_pci_regs.h | 1075

+++++++++++++++++++++++++++

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

8 files changed, 1082 insertions(+), 6
deletions(-) create mode 100644
lib/librte_pci/rte_pci_regs.h

[...]

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

diff --git a/lib/librte_pci/rte_pci_regs.h
b/lib/librte_pci/rte_pci_regs.h new file mode
100644 index 000000000..1d11f4de5
--- /dev/null

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+++ b/lib/librte_pci/rte_pci_regs.h
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH
+Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib,
targeting

userspace.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

This seems to be an exception to the license
policy described in license/README. Code shared
between kernel and userspace is expected to be
dual-licensed BSD-3

and GPL-2.0.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

As it is a copy of Linux user includes,
re-licensing it as BSD-3 as well is not possible.

So I think it might require a techboard +
governing board exception approval. Ferruh or
Thomas, what do you

think?

Quoted 35 lines
Quoted 35 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK as symbols start from RTE_PCI_*(It will fix up the namespace as well).

If symbols can be found in /usr/include/, don't add anything.

Not by default on all the distros. It is part of pciutils library. Moreover, we need these symbols for Windows OS as well. IMO, We should add absolute minimum constants that needed for DPDK as RTE_PCI_*

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I am for mandating the dependency instead of copying it.

You mean _pciutils_ package as a mandatory dependency to DPDK.

There is already this dependency:

        #include <linux/pci_regs.h>

I just checked in archlinux, PCI headers can be provided by

# pacman -F /usr/include/pci/header.h usr/include/pci/header.h is
owned by core/pciutils 3.7.0-
# pacman -F /usr/include/linux/pci.h usr/include/linux/pci.h is
owned by core/linux-api-headers 5.4.17-1
Quoted 1 line

I'm missing the real justification for this patch.

See below.

Quoted 3 lines

Is there some missing definitions?
Is there some environments where this file is missing?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

pciutils cannot be installed on Windows?
Why do you care about Windows?
I don't see any contribution for qede on Windows.

You closely review the patch, it not about qede. The proposed file comes at lib/librte_pci/rte_pci_regs.h which is common to

Quoted 22 lines

Windows.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

The series is for qede. I'm trying to understand the motivation.

First version of qede driver sent with defined generic PCI symbols and generic PCI function like pci_find_next_ext_capability() in qede

driver.

Quoted 13 lines

That's a pity the v2 is not threaded with v1, I would have found these explanations easily myself.

Quoted 9 lines

In the review, I suggested using generic rte_ function as
a) It is not specific to qede.
b) Other drivers also doing the same thing in their own driver space as there is no dpdk API for the same.
This patches create generic API for pci_find_next_ext_capability() and remove duplicate implementation from the drivers.
https://urldefense.proofpoint.com/v2/url?u=http-3A__patches.dpdk.o
rg

_patch_73959_&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=bMTgx2X48QVX

Quoted 15 lines

yXOEL8

Quoted 1 line
Quoted 1 line

ALyI4dsWoR-m74c5n3d-

ruJI8&m=eNuzGYhB7u2Wzru3VeBTY7QDZSSb9VQ9eQXW56D4

Quoted 9 lines
Quoted 1 line

64Y&s=eatY5xyw-474yS0cBJXyG7gLyPXFo243P2LmBDDsXd8&e=

I agree it's good to have an API for such thing.

So far such feature is supported in drivers on Linux, requiring only Linux headers to be installed.
Do we need more?

+1 to make it generic, no question here.

Quoted 7 lines

On linux, the dependency is already there (either from linux headers or
pciutils) to have the original. So including this header in DPDK is only useful for other OSes.

I think right now we should only add pci_find_next_ext_capability() full implementation within linux part of PCI bus, other systems being

stubs.

Quoted 3 lines

We can go with your suggestion Jerin about adding only the specific symbols needed, prefixed with RTE_, once we decide to have windows

support.

Quoted 4 lines

Question is whether we need it right now. Is there a driver that would make use of it support more than linux currently?

--

I don't know if there are any drivers which will require this other than linux as of today -

My only motivation of adding these symbols in dpdk via rte_pci_regs.h (new file in lib/librte_pci/) was to avoid any dependency of dpdk on /usr/include/../pci_regs.h, since I was little unsure whether in all distributions (linux/windows) supported will have the required PCI defines available in /usr/include/../pci_regs.h file or not in order to implement rte_pci_find_next_ext_capability(). (unless user to bound for updating headers by mean of installing any latest _pciutils_/packages). Moreover, for not just this API, but if going forward if we have to add any new APIs which could rely/depend on PCI defines availability under /usr/include.

From the discussion so far -

Quoted 8 lines

1. Define the function under drivers/bus/pci/linux/pci.c only and add empty/stub implementation for windows/pci.c and bsd/pci.c ?
2. Just relying on /usr/include/ is perfectly okay without adding any defines anywhere for now ?, it will just require <linux/pci_regs.h> inclusion in drivers/bus/pci/linux/pci.c. OR Shall I add (may be in
lib/librte_pci/rte_pci.h ?) only required PCI defines with RTE_ prefixed and use them instead ?

Quoted 4 lines

Hello Gaetan/Jerin,

Could you please comment on above - what's sufficient to be incorporated in v3 for now ? I will work on the changes accordingly.

I am for introducing a handful(Not the completed list, Only add what is needed for DPDK) of PCI constants as RTE_PCI_ in our public API. And implement rte_pci_find_next_ext_capability() as common routine as it is not specific to Linux.(I.e reading the config registers should be only Linux/Windows-specific)

I leave the final decision to PCI and other maintainers.

Quoted 3 lines

Thanks,
Manish

#18 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 242 lines · Jerin Jacob
Quoted 236 lines · Manish Chopra
Quoted 227 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Manish Chopra
Sent: Friday, July 17, 2020 2:19 AM
To: Gaëtan Rivet <[email protected]>; Thomas Monjalon <[email protected]>
Cc: Jerin Jacob <[email protected]>; Ferruh Yigit <[email protected]>; Igor Russkikh <[email protected]>; dpdk-dev <[email protected]>
Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

Quoted 22 lines

-----Original Message-----
From: Gaëtan Rivet <[email protected]>
Sent: Thursday, July 16, 2020 11:26 PM
To: Thomas Monjalon <[email protected]>
Cc: Jerin Jacob <[email protected]>; Manish Chopra <[email protected]>; Ferruh Yigit <[email protected]>; Igor Russkikh <[email protected]>; dpdk-dev <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 1/7] lib/librte_pci: add rte_pci_regs.h

External Email

----------------------------------------------------------------------

Quoted 2 lines · Thomas Monjalon

16/07/2020 18:43, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 9:25 PM Thomas Monjalon

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines

16/07/2020 15:02, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 6:20 PM Thomas Monjalon

Quoted 1 line · <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 10 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

16/07/2020 13:55, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 4:57 PM Thomas Monjalon

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

16/07/2020 12:27, Jerin Jacob:

Quoted 1 line

On Thu, Jul 16, 2020 at 3:48 PM Gaëtan Rivet

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines · Gaëtan Rivet

Re-CCing [email protected] as it was removed from the

reply.

Quoted 112 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

On 13/07/20 08:13 -0700, Manish Chopra wrote:
This is merely copy of latest linux/pci_regs.h
in order to avoid dependency of dpdk on user headers.

I guess this dependency is an issue on non-linux
systems, when you must use those defines in a
generic implementation. Can you confirm this is
the

motivation here?

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

If so, I think it would be clearer to state "in
order to avoid dependency of DPDK on linux headers".

To add to it, if this is actually the motivation to
add this header, I don't think it is sufficient.

You can restrict the function definition to the
linux part of the PCI bus driver instead, using
stubs for other

systems.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

Signed-off-by: Manish Chopra
<[email protected]>
Signed-off-by: Igor Russkikh
<[email protected]>
---
drivers/bus/pci/linux/pci_uio.c | 2 +-
drivers/bus/pci/linux/pci_vfio.c | 2 +-
drivers/net/bnx2x/bnx2x.h | 2 +-
drivers/net/hns3/hns3_ethdev_vf.c | 2 +-
drivers/vdpa/ifc/base/ifcvf_osdep.h | 2 +-
lib/librte_pci/Makefile | 1 +
lib/librte_pci/meson.build | 2 +-
lib/librte_pci/rte_pci_regs.h | 1075

+++++++++++++++++++++++++++

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

8 files changed, 1082 insertions(+), 6
deletions(-) create mode 100644
lib/librte_pci/rte_pci_regs.h

[...]

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

diff --git a/lib/librte_pci/rte_pci_regs.h
b/lib/librte_pci/rte_pci_regs.h new file mode
100644 index 000000000..1d11f4de5
--- /dev/null

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+++ b/lib/librte_pci/rte_pci_regs.h
@@ -0,0 +1,1075 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH
+Linux-syscall-note */
+/*

This file is delivered alongside the PCI lib,
targeting

userspace.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

This seems to be an exception to the license
policy described in license/README. Code shared
between kernel and userspace is expected to be
dual-licensed BSD-3

and GPL-2.0.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

As it is a copy of Linux user includes,
re-licensing it as BSD-3 as well is not possible.

So I think it might require a techboard +
governing board exception approval. Ferruh or
Thomas, what do you

think?

Quoted 35 lines
Quoted 35 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

I think, instead of importing GPL-2.0 file, We can add the constants as need by the DPDK as symbols start from RTE_PCI_*(It will fix up the namespace as well).

If symbols can be found in /usr/include/, don't add anything.

Not by default on all the distros. It is part of pciutils library. Moreover, we need these symbols for Windows OS as well. IMO, We should add absolute minimum constants that needed for DPDK as RTE_PCI_*

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I am for mandating the dependency instead of copying it.

You mean _pciutils_ package as a mandatory dependency to DPDK.

There is already this dependency:

        #include <linux/pci_regs.h>

I just checked in archlinux, PCI headers can be provided by

# pacman -F /usr/include/pci/header.h usr/include/pci/header.h is
owned by core/pciutils 3.7.0-
# pacman -F /usr/include/linux/pci.h usr/include/linux/pci.h is
owned by core/linux-api-headers 5.4.17-1
Quoted 1 line

I'm missing the real justification for this patch.

See below.

Quoted 3 lines

Is there some missing definitions?
Is there some environments where this file is missing?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

pciutils cannot be installed on Windows?
Why do you care about Windows?
I don't see any contribution for qede on Windows.

You closely review the patch, it not about qede. The proposed file comes at lib/librte_pci/rte_pci_regs.h which is common to

Quoted 22 lines

Windows.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

The series is for qede. I'm trying to understand the motivation.

First version of qede driver sent with defined generic PCI symbols and generic PCI function like pci_find_next_ext_capability() in qede

driver.

Quoted 13 lines

That's a pity the v2 is not threaded with v1, I would have found these explanations easily myself.

Quoted 9 lines

In the review, I suggested using generic rte_ function as
a) It is not specific to qede.
b) Other drivers also doing the same thing in their own driver space as there is no dpdk API for the same.
This patches create generic API for pci_find_next_ext_capability() and remove duplicate implementation from the drivers.
https://urldefense.proofpoint.com/v2/url?u=http-3A__patches.dpdk.o
rg

_patch_73959_&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=bMTgx2X48QVX

Quoted 15 lines

yXOEL8

Quoted 1 line
Quoted 1 line

ALyI4dsWoR-m74c5n3d-

ruJI8&m=eNuzGYhB7u2Wzru3VeBTY7QDZSSb9VQ9eQXW56D4

Quoted 9 lines
Quoted 1 line

64Y&s=eatY5xyw-474yS0cBJXyG7gLyPXFo243P2LmBDDsXd8&e=

I agree it's good to have an API for such thing.

So far such feature is supported in drivers on Linux, requiring only Linux headers to be installed.
Do we need more?

+1 to make it generic, no question here.

Quoted 7 lines

On linux, the dependency is already there (either from linux headers or
pciutils) to have the original. So including this header in DPDK is only useful for other OSes.

I think right now we should only add pci_find_next_ext_capability() full implementation within linux part of PCI bus, other systems being

stubs.

Quoted 3 lines

We can go with your suggestion Jerin about adding only the specific symbols needed, prefixed with RTE_, once we decide to have windows

support.

Quoted 4 lines

Question is whether we need it right now. Is there a driver that would make use of it support more than linux currently?

--

I don't know if there are any drivers which will require this other than linux as of today -

My only motivation of adding these symbols in dpdk via rte_pci_regs.h (new file in lib/librte_pci/) was to avoid any dependency of dpdk on /usr/include/../pci_regs.h, since I was little unsure whether in all distributions (linux/windows) supported will have the required PCI defines available in /usr/include/../pci_regs.h file or not in order to implement rte_pci_find_next_ext_capability(). (unless user to bound for updating headers by mean of installing any latest _pciutils_/packages). Moreover, for not just this API, but if going forward if we have to add any new APIs which could rely/depend on PCI defines availability under /usr/include.

From the discussion so far -

Quoted 8 lines

1. Define the function under drivers/bus/pci/linux/pci.c only and add empty/stub implementation for windows/pci.c and bsd/pci.c ?
2. Just relying on /usr/include/ is perfectly okay without adding any defines anywhere for now ?, it will just require <linux/pci_regs.h> inclusion in drivers/bus/pci/linux/pci.c. OR Shall I add (may be in
lib/librte_pci/rte_pci.h ?) only required PCI defines with RTE_ prefixed and use them instead ?

Quoted 4 lines

Hello Gaetan/Jerin,

Could you please comment on above - what's sufficient to be incorporated in v3 for now ? I will work on the changes accordingly.

Quoted 7 lines

I am for introducing a handful(Not the completed list, Only add what is needed for DPDK) of PCI constants as RTE_PCI_ in our public API. And implement rte_pci_find_next_ext_capability() as common routine as it is not specific to Linux.(I.e reading the config registers should be only Linux/Windows-specific)

I leave the final decision to PCI and other maintainers.

Hi Jerin, Manish,

There is currently no PCI bus maintainer, but most people in the project are interested in it working properly :).

I think it's a good principle to try to limit as much as possible the amount of system-specific code. rte_pci_read_config() seems like a fair cut-off point.

Given than the current PMD implementations were doing exactly what you describe, I think it's better to go for it currently, even if no one is using those symbols outside linux. So +1 from me regarding what you propose.

Signature · 1 line
Gaëtan
#19 lore raw

PATCH v2 2/7 drivers: add generic API to find PCI extended cap

In reply to Manish Chopra

By adding generic API, this patch removes individual functions/defines implemented by drivers to find PCI extended capability.

---
 drivers/bus/pci/pci_common.c               | 41 +++++++++++++++++
 drivers/bus/pci/rte_bus_pci.h              | 11 +++++
 drivers/net/ice/ice_ethdev.c               | 53 ++--------------------
 drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 48 ++------------------
 lib/librte_pci/rte_pci_regs.h              |  2 +-
 5 files changed, 60 insertions(+), 95 deletions(-)
drivers/bus/pci/pci_common.c +41 -0
index a8e5fd52c..5117c8e7b 100644
@@ -23,6 +23,7 @@
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_vfio.h>
+#include <rte_pci_regs.h>
 
 #include "private.h"
 
@@ -665,6 +666,46 @@ rte_pci_get_iommu_class(void)
 	return iova_mode;
 }
 
+int rte_pci_find_next_ext_capability(struct rte_pci_device *dev, int cap)
+{
+	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) {
+		RTE_LOG(ERR, EAL, "error in reading extended capabilities\n");
+		return -EINVAL;
+	}
+
+	/*
+	 * 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) {
+			RTE_LOG(ERR, EAL,
+				"error in reading extended capabilities\n");
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
 struct rte_pci_bus rte_pci_bus = {
 	.bus = {
 		.scan = rte_pci_scan,
drivers/bus/pci/rte_bus_pci.h +11 -0
index 29bea6d70..3cc66220a 100644
@@ -224,6 +224,17 @@ void rte_pci_unmap_device(struct rte_pci_device *dev);
  */
 void rte_pci_dump(FILE *f);
 
+/**
+ * Find device's extended capability
+ *
+ *  @param dev
+ *    A pointer to rte_pci_device structure
+ *
+ *  @param cap
+ *    Extended capability to find
+ */
+int rte_pci_find_next_ext_capability(struct rte_pci_device *dev, int cap);
+
 /**
  * Register a PCI driver.
  *
drivers/net/ice/ice_ethdev.c +4 -49

72 lines not on this page · raw message

drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c +3 -45

66 lines not on this page · raw message

lib/librte_pci/rte_pci_regs.h +1 -1
index 1d11f4de5..108193049 100644
@@ -686,7 +686,7 @@
 #define PCI_EXP_SLTSTA2		58	/* Slot Status 2 */
 
 /* Extended Capabilities (PCI-X 2.0 and Express) */
-#define PCI_EXT_CAP_ID(header)		(header & 0x0000ffff)
+#define PCI_EXT_CAP_ID(header)		(int)(header & 0x0000ffff)
 #define PCI_EXT_CAP_VER(header)		((header >> 16) & 0xf)
 #define PCI_EXT_CAP_NEXT(header)	((header >> 20) & 0xffc)
 
Signature · 1 line
2.17.1
#20 lore raw

Re: [dpdk-dev] [PATCH v2 2/7] drivers: add generic API to find PCI extended cap

Quoted 27 lines · Manish Chopra

By adding generic API, this patch removes individual functions/defines implemented by drivers to find PCI extended capability.

---
 drivers/bus/pci/pci_common.c               | 41 +++++++++++++++++
 drivers/bus/pci/rte_bus_pci.h              | 11 +++++
 drivers/net/ice/ice_ethdev.c               | 53 ++--------------------
 drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 48 ++------------------
 lib/librte_pci/rte_pci_regs.h              |  2 +-
 5 files changed, 60 insertions(+), 95 deletions(-)
drivers/bus/pci/pci_common.c +1 -0
index a8e5fd52c..5117c8e7b 100644
@@ -23,6 +23,7 @@
 #include <rte_common.h>
 #include <rte_devargs.h>
 #include <rte_vfio.h>
+#include <rte_pci_regs.h>
 
 #include "private.h"
 

drivers/bus/pci/pci_common.c rte_pci_get_iommu_class(void) · line 671

Quoted 6 lines
drivers/bus/pci/pci_common.c +3 -0
@@ -665,6 +666,46 @@ rte_pci_get_iommu_class(void)
 	return iova_mode;
 }
 
+int rte_pci_find_next_ext_capability(struct rte_pci_device *dev, int cap)
+{
+	int pos = PCI_CFG_SPACE_SIZE;

pos is somewhat nondescript. position is long however. offset seems more appropriate, short but describing properly the value.

Remember to prefix all those defines with 'RTE_'.

drivers/bus/pci/pci_common.c rte_pci_get_iommu_class(void) · line 680

Quoted 9 lines
drivers/bus/pci/pci_common.c +9 -0
+	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) {
+		RTE_LOG(ERR, EAL, "error in reading extended capabilities\n");
+		return -EINVAL;

The -EINVAL here is not useful. It is not used by callers anyway. It can be simplified to -1.

drivers/bus/pci/pci_common.c rte_pci_get_iommu_class(void) · line 690

Quoted 10 lines
drivers/bus/pci/pci_common.c +10 -0
+	}
+
+	/*
+	 * 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) {

Not a fan of this, the checkpatch-compliant form of (ttl --> 0). Decrementing the value within the loop conditional is generally frowned upon and should be avoided.

    while (ttl != 0) {
            [...]
            ttl -= 1;
    }

drivers/bus/pci/pci_common.c rte_pci_get_iommu_class(void) · line 691

Quoted 1 line
drivers/bus/pci/pci_common.c +1 -0
+		if (PCI_EXT_CAP_ID(header) == cap)

This define would originally resolve to uint32_t, which is why you had to cast it to int in the macro itself.

This is not ok, the cap type should already be in sync (uint32_t). Casting should not be needed. It should not be used just to shut up a warning about signed to unsigned comparison.

drivers/bus/pci/pci_common.c rte_pci_get_iommu_class(void) · line 692

Quoted 1 line
drivers/bus/pci/pci_common.c +1 -0
+			return pos;

Similarly for the return type, it is used as off_t afterward when calling rte_pci_read_config(). All users of this API will be encouraged to use an int where they should be using off_t instead (even if POSIX defines it as signed int anyway).

It's really messy that the return type is an int that will be used either as <0 on read error, 0 on missing cap, >0 for proper offset. Separating the error channel from the payload won't make the API cleaner though, so let's keep it that way. However, given that POSIX defines off_t as a signed type anyway, let's use off_t directly, -1 for error, 0 for no error but no header, and >0 for a proper offset.

This means this function will not be a transparent drop-in for the previous implem, but so be it.

Quoted 24 lines
drivers/bus/pci/pci_common.c +16 -0
+
+		pos = PCI_EXT_CAP_NEXT(header);
+
+		if (pos < PCI_CFG_SPACE_SIZE)
+			break;
+
+		if (rte_pci_read_config(dev, &header, 4, pos) < 0) {
+			RTE_LOG(ERR, EAL,
+				"error in reading extended capabilities\n");
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
 struct rte_pci_bus rte_pci_bus = {
 	.bus = {
 		.scan = rte_pci_scan,
drivers/bus/pci/rte_bus_pci.h +0 -0
index 29bea6d70..3cc66220a 100644

drivers/bus/pci/rte_bus_pci.h void rte_pci_unmap_device(struct rte_pci_device *dev); · line 231

Quoted 8 lines
drivers/bus/pci/rte_bus_pci.h +5 -0
@@ -224,6 +224,17 @@ void rte_pci_unmap_device(struct rte_pci_device *dev);
  */
 void rte_pci_dump(FILE *f);
 
+/**
+ * Find device's extended capability
+ *
+ *  @param dev
+ *    A pointer to rte_pci_device structure

Missing a period here.

drivers/bus/pci/rte_bus_pci.h void rte_pci_unmap_device(struct rte_pci_device *dev); · line 234

Quoted 3 lines
drivers/bus/pci/rte_bus_pci.h +3 -0
+ *
+ *  @param cap
+ *    Extended capability to find

ditto.

drivers/bus/pci/rte_bus_pci.h void rte_pci_unmap_device(struct rte_pci_device *dev); · line 235

Quoted 1 line
drivers/bus/pci/rte_bus_pci.h +1 -0
+ */

The doc is missing the return values and their signification. It returns an offset where the ext. cap can be read in the PCI config? Users should be able to understand this reading only this comment.

Also, 0 meaning the cap is not available is critical to know.

Quoted 73 lines
drivers/bus/pci/rte_bus_pci.h +2 -0
+int rte_pci_find_next_ext_capability(struct rte_pci_device *dev, int cap);
+
 /**
  * Register a PCI driver.
  *
drivers/net/ice/ice_ethdev.c +2 -47
index 3534d18ca..0724324d2 100644
@@ -4,6 +4,8 @@
 
 #include <rte_string_fns.h>
 #include <rte_ethdev_pci.h>
+#include <rte_bus_pci.h>
+#include <rte_pci_regs.h>
 
 #include <stdio.h>
 #include <sys/types.h>
@@ -1730,53 +1732,6 @@ ice_pf_setup(struct ice_pf *pf)
 	return 0;
 }
 
-/* PCIe configuration space setting */
-#define PCI_CFG_SPACE_SIZE          256
-#define PCI_CFG_SPACE_EXP_SIZE      4096
-#define PCI_EXT_CAP_ID(header)      (int)((header) & 0x0000ffff)
-#define PCI_EXT_CAP_NEXT(header)    (((header) >> 20) & 0xffc)
-#define PCI_EXT_CAP_ID_DSN          0x03
-
-static int
-ice_pci_find_next_ext_capability(struct rte_pci_device *dev, int cap)
-{
-	uint32_t header;
-	int ttl;
-	int pos = PCI_CFG_SPACE_SIZE;
-
-	/* 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) {
-		PMD_INIT_LOG(ERR, "ice error reading extended capabilities\n");
-		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) {
-			PMD_INIT_LOG(ERR, "ice error reading extended capabilities\n");
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
 /*
  * Extract device serial number from PCIe Configuration Space and
  * determine the pkg file path according to the DSN.

drivers/net/ice/ice_ethdev.c ice_pkg_file_search_path(struct rte_pci_device *pci_dev, char *pkg_file) · line 1749

Quoted 8 lines
drivers/net/ice/ice_ethdev.c +2 -2
@@ -1789,9 +1744,9 @@ ice_pkg_file_search_path(struct rte_pci_device *pci_dev, char *pkg_file)
 	uint32_t dsn_low, dsn_high;
 	memset(opt_ddp_filename, 0, ICE_MAX_PKG_FILENAME_SIZE);
 
-	pos = ice_pci_find_next_ext_capability(pci_dev, PCI_EXT_CAP_ID_DSN);
+	pos = rte_pci_find_next_ext_capability(pci_dev, PCI_EXT_CAP_ID_DSN);
 
-	if (pos) {
+	if (pos > 0) {

You are fixing a bug in the ICE driver here.
On PCI config read error, -1 is returned, meaning the offset (-1 + 4) is used to read 4 bytes, which does not seem ok.

This should be fixed in a separate commit to allow a backport.

Quoted 92 lines
drivers/net/ice/ice_ethdev.c +0 -0
 		rte_pci_read_config(pci_dev, &dsn_low, 4, pos + 4);
 		rte_pci_read_config(pci_dev, &dsn_high, 4, pos + 8);
 		snprintf(opt_ddp_filename, ICE_MAX_PKG_FILENAME_SIZE,
drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c +3 -45
index 0b9db974e..b11d8148a 100644
@@ -35,6 +35,8 @@
 
 #include <rte_ethdev_pci.h>
 #include <rte_string_fns.h>
+#include <rte_bus_pci.h>
+#include <rte_pci_regs.h>
 
 #include "nfp_cpp.h"
 #include "nfp_target.h"
@@ -746,50 +748,6 @@ nfp6000_set_interface(struct rte_pci_device *dev, struct nfp_cpp *cpp)
 	return 0;
 }
 
-#define PCI_CFG_SPACE_SIZE	256
-#define PCI_CFG_SPACE_EXP_SIZE	4096
-#define PCI_EXT_CAP_ID(header)		(int)(header & 0x0000ffff)
-#define PCI_EXT_CAP_NEXT(header)	((header >> 20) & 0xffc)
-#define PCI_EXT_CAP_ID_DSN	0x03
-static int
-nfp_pci_find_next_ext_capability(struct rte_pci_device *dev, int cap)
-{
-	uint32_t header;
-	int ttl;
-	int pos = PCI_CFG_SPACE_SIZE;
-
-	/* 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) {
-		printf("nfp error reading extended capabilities\n");
-		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) {
-			printf("nfp error reading extended capabilities\n");
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
 static int
 nfp6000_set_serial(struct rte_pci_device *dev, struct nfp_cpp *cpp)
 {
@@ -798,7 +756,7 @@ nfp6000_set_serial(struct rte_pci_device *dev, struct nfp_cpp *cpp)
 	int serial_len = 6;
 	int pos;
 
-	pos = nfp_pci_find_next_ext_capability(dev, PCI_EXT_CAP_ID_DSN);
+	pos = rte_pci_find_next_ext_capability(dev, PCI_EXT_CAP_ID_DSN);
 	if (pos <= 0) {
 		printf("PCI_EXT_CAP_ID_DSN not found. nfp set serial failed\n");
 		return -1;
lib/librte_pci/rte_pci_regs.h +1 -1
index 1d11f4de5..108193049 100644
@@ -686,7 +686,7 @@
 #define PCI_EXP_SLTSTA2		58	/* Slot Status 2 */
 
 /* Extended Capabilities (PCI-X 2.0 and Express) */
-#define PCI_EXT_CAP_ID(header)		(header & 0x0000ffff)
+#define PCI_EXT_CAP_ID(header)		(int)(header & 0x0000ffff)
 #define PCI_EXT_CAP_VER(header)		((header >> 16) & 0xf)
 #define PCI_EXT_CAP_NEXT(header)	((header >> 20) & 0xffc)
 
Signature · 1 line
2.17.1
Signature · 1 line
Gaëtan
#21 lore raw

PATCH v2 3/7 net/qede: define PCI config space specific osals

In reply to Manish Chopra

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.

---
 drivers/net/qede/base/bcm_osal.h | 18 +++++++++++++-----
 drivers/net/qede/base/ecore.h    |  3 +++
 drivers/net/qede/qede_main.c     |  1 +
 3 files changed, 17 insertions(+), 5 deletions(-)
drivers/net/qede/base/bcm_osal.h +13 -5
index 5d4df5907..317e088e1 100644
@@ -21,6 +21,11 @@
 #include <rte_ether.h>
 #include <rte_io.h>
 #include <rte_version.h>
+#include <rte_bus_pci.h>
+#include <rte_pci_regs.h>
+
+#define PCICFG_VENDOR_ID_OFFSET PCI_VENDOR_ID
+#define PCICFG_DEVICE_ID_OFFSET PCI_DEVICE_ID
 
 /* Forward declaration */
 struct ecore_dev;
@@ -286,11 +291,14 @@ typedef struct osal_list_t {
 	OSAL_LIST_PUSH_HEAD(new_entry, list)
 
 /* PCI config space */
-
-#define OSAL_PCI_READ_CONFIG_BYTE(dev, address, dst) nothing
-#define OSAL_PCI_READ_CONFIG_WORD(dev, address, dst) nothing
-#define OSAL_PCI_READ_CONFIG_DWORD(dev, address, dst) nothing
-#define OSAL_PCI_FIND_EXT_CAPABILITY(dev, pcie_id) 0
+#define OSAL_PCI_READ_CONFIG_BYTE(dev, address, dst) \
+	rte_pci_read_config((dev)->pci_dev, dst, 1, address)
+#define OSAL_PCI_READ_CONFIG_WORD(dev, address, dst) \
+	rte_pci_read_config((dev)->pci_dev, dst, 2, address)
+#define OSAL_PCI_READ_CONFIG_DWORD(dev, address, dst) \
+	rte_pci_read_config((dev)->pci_dev, dst, 4, address)
+#define OSAL_PCI_FIND_EXT_CAPABILITY(dev, cap) \
+	rte_pci_find_next_ext_capability((dev)->pci_dev, cap)
 #define OSAL_PCI_FIND_CAPABILITY(dev, pcie_id) 0
 #define OSAL_PCI_WRITE_CONFIG_WORD(dev, address, val) nothing
 #define OSAL_BAR_SIZE(dev, bar_id) 0
drivers/net/qede/base/ecore.h +3 -0
index 63bd7466a..750e99a8f 100644
@@ -937,6 +937,9 @@ struct ecore_dev {
 	struct ecore_dbg_feature	dbg_features[DBG_FEATURE_NUM];
 	struct ecore_dbg_params		dbg_params;
 	osal_mutex_t			dbg_lock;
+
+	/* DPDK specific ecore field */
+	struct rte_pci_device		*pci_dev;
 };
 
 enum ecore_hsi_def_type {
drivers/net/qede/qede_main.c +1 -0
index 987a6f1e1..d919f9f11 100644
@@ -37,6 +37,7 @@ static void qed_init_pci(struct ecore_dev *edev, struct rte_pci_device *pci_dev)
 	edev->regview = pci_dev->mem_resource[0].addr;
 	edev->doorbells = pci_dev->mem_resource[2].addr;
 	edev->db_size = pci_dev->mem_resource[2].len;
+	edev->pci_dev = pci_dev;
 }
 
 static int
Signature · 1 line
2.17.1
#22 lore raw

PATCH v2 4/7 net/qede: configure VFs on hardware

In reply to Manish Chopra

Based on number of VFs enabled at PCI, PF-PMD driver instance enables/configures those VFs from hardware perspective, such that in later patches they could get required HW access to communicate with PFs for slowpath configuration and run the fastpath themsleves.

This patch also add two new qede IOV files [qede_sriov(.c|.h)] under qede directory to add non-base driver IOV APIs/contents there.

---
 drivers/net/qede/Makefile      |  1 +
 drivers/net/qede/meson.build   |  1 +
 drivers/net/qede/qede_ethdev.c |  1 +
 drivers/net/qede/qede_ethdev.h |  1 +
 drivers/net/qede/qede_if.h     |  1 +
 drivers/net/qede/qede_main.c   |  1 +
 drivers/net/qede/qede_sriov.c  | 85 ++++++++++++++++++++++++++++++++++
 drivers/net/qede/qede_sriov.h  |  9 ++++
 8 files changed, 100 insertions(+)
 create mode 100644 drivers/net/qede/qede_sriov.c
 create mode 100644 drivers/net/qede/qede_sriov.h
drivers/net/qede/Makefile +1 -0
index 0e8a67b0d..c57bef0e3 100644
@@ -105,5 +105,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_filter.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_regs.c
+SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_sriov.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/qede/meson.build +1 -0
index 05c9bff73..ff0ac0b03 100644
@@ -11,6 +11,7 @@ sources = files(
 	'qede_rxtx.c',
 	'qede_debug.c',
 	'qede_regs.c',
+	'qede_sriov.c',
 )
 
 if cc.has_argument('-Wno-format-nonliteral')
drivers/net/qede/qede_ethdev.c +1 -0
index e5a2581dd..6008d88e7 100644
@@ -2703,6 +2703,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
 		adapter->vxlan.enable = false;
 		adapter->geneve.enable = false;
 		adapter->ipgre.enable = false;
+		qed_ops->sriov_configure(edev, pci_dev->max_vfs);
 	}
 
 	DP_INFO(edev, "MAC address : %02x:%02x:%02x:%02x:%02x:%02x\n",
drivers/net/qede/qede_ethdev.h +1 -0
index 76c5dae3b..4fb77b05c 100644
@@ -34,6 +34,7 @@
 #include "base/ecore_l2.h"
 #include "base/ecore_vf.h"
 
+#include "qede_sriov.h"
 #include "qede_logs.h"
 #include "qede_if.h"
 #include "qede_rxtx.h"
drivers/net/qede/qede_if.h +1 -0
index c5ae3fb2e..1693a243f 100644
@@ -82,6 +82,7 @@ struct qed_eth_ops {
 	const struct qed_common_ops *common;
 	int (*fill_dev_info)(struct ecore_dev *edev,
 			     struct qed_dev_eth_info *info);
+	void (*sriov_configure)(struct ecore_dev *edev, int num_vfs);
 };
 
 struct qed_link_params {
drivers/net/qede/qede_main.c +1 -0
index d919f9f11..c37e8ebe0 100644
@@ -822,6 +822,7 @@ const struct qed_common_ops qed_common_ops_pass = {
 const struct qed_eth_ops qed_eth_ops_pass = {
 	INIT_STRUCT_FIELD(common, &qed_common_ops_pass),
 	INIT_STRUCT_FIELD(fill_dev_info, &qed_fill_eth_dev_info),
+	INIT_STRUCT_FIELD(sriov_configure, &qed_sriov_configure),
 };
 
 const struct qed_eth_ops *qed_get_eth_ops(void)
drivers/net/qede/qede_sriov.c new file +85 -0

85 lines not on this page · raw message

drivers/net/qede/qede_sriov.h new file +9 -0
new file mode 100644
index 000000000..6c85b1dd5
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2020 Marvell.
+ * All rights reserved.
+ * www.marvell.com
+ */
+
+#include "qede_ethdev.h"
+
+void qed_sriov_configure(struct ecore_dev *edev, int num_vfs_param);
Signature · 1 line
2.17.1
#23 lore raw

PATCH v2 5/7 net/qede: add infrastructure support for VF load

In reply to Manish Chopra

This patch adds necessary infrastructure support (required to handle messages from VF and sending ramrod on behalf of VF's configuration request from alarm handler context) to start/load the VF-PMD driver instance on top of PF-PMD driver instance.

---
 drivers/net/qede/base/bcm_osal.c      | 26 ++++++++++++
 drivers/net/qede/base/bcm_osal.h      | 11 +++--
 drivers/net/qede/base/ecore.h         |  4 ++
 drivers/net/qede/base/ecore_iov_api.h |  3 ++
 drivers/net/qede/qede_ethdev.c        |  2 +
 drivers/net/qede/qede_main.c          |  4 +-
 drivers/net/qede/qede_sriov.c         | 61 +++++++++++++++++++++++++++
 drivers/net/qede/qede_sriov.h         | 16 ++++++-
 8 files changed, 121 insertions(+), 6 deletions(-)
drivers/net/qede/base/bcm_osal.c +26 -0
index 65837b53d..ef47339df 100644
@@ -14,6 +14,32 @@
 #include "ecore_iov_api.h"
 #include "ecore_mcp_api.h"
 #include "ecore_l2_api.h"
+#include "../qede_sriov.h"
+
+int osal_pf_vf_msg(struct ecore_hwfn *p_hwfn)
+{
+	int rc;
+
+	rc = qed_schedule_iov(p_hwfn, QED_IOV_WQ_MSG_FLAG);
+	if (rc) {
+		DP_VERBOSE(p_hwfn, ECORE_MSG_IOV,
+			   "Failed to schedule alarm handler rc=%d\n", rc);
+	}
+
+	return rc;
+}
+
+void osal_poll_mode_dpc(osal_int_ptr_t hwfn_cookie)
+{
+	struct ecore_hwfn *p_hwfn = (struct ecore_hwfn *)hwfn_cookie;
+
+	if (!p_hwfn)
+		return;
+
+	OSAL_SPIN_LOCK(&p_hwfn->spq_lock);
+	ecore_int_sp_dpc((osal_int_ptr_t)(p_hwfn));
+	OSAL_SPIN_UNLOCK(&p_hwfn->spq_lock);
+}
 
 /* Array of memzone pointers */
 static const struct rte_memzone *ecore_mz_mapping[RTE_MAX_MEMZONE];
drivers/net/qede/base/bcm_osal.h +8 -3
index 317e088e1..fad441752 100644
@@ -182,9 +182,12 @@ typedef pthread_mutex_t osal_mutex_t;
 
 /* DPC */
 
+void osal_poll_mode_dpc(osal_int_ptr_t hwfn_cookie);
 #define OSAL_DPC_ALLOC(hwfn) OSAL_ALLOC(hwfn, GFP, sizeof(osal_dpc_t))
-#define OSAL_DPC_INIT(dpc, hwfn) nothing
-#define OSAL_POLL_MODE_DPC(hwfn) nothing
+#define OSAL_DPC_INIT(dpc, hwfn) \
+	OSAL_SPIN_LOCK_INIT(&(hwfn)->spq_lock)
+#define OSAL_POLL_MODE_DPC(hwfn) \
+	osal_poll_mode_dpc((osal_int_ptr_t)(p_hwfn))
 #define OSAL_DPC_SYNC(hwfn) nothing
 
 /* Lists */
@@ -349,10 +352,12 @@ u32 qede_find_first_zero_bit(u32 *bitmap, u32 length);
 
 /* SR-IOV channel */
 
+int osal_pf_vf_msg(struct ecore_hwfn *p_hwfn);
 #define OSAL_VF_FLR_UPDATE(hwfn) nothing
 #define OSAL_VF_SEND_MSG2PF(dev, done, msg, reply_addr, msg_size, reply_size) 0
 #define OSAL_VF_CQE_COMPLETION(_dev_p, _cqe, _protocol)	(0)
-#define OSAL_PF_VF_MSG(hwfn, vfid) 0
+#define OSAL_PF_VF_MSG(hwfn, vfid) \
+	osal_pf_vf_msg(hwfn)
 #define OSAL_PF_VF_MALICIOUS(hwfn, vfid) nothing
 #define OSAL_IOV_CHK_UCAST(hwfn, vfid, params) 0
 #define OSAL_IOV_POST_START_VPORT(hwfn, vf, vport_id, opaque_fid) nothing
drivers/net/qede/base/ecore.h +4 -0
index 750e99a8f..6c8e6d407 100644
@@ -714,6 +714,10 @@ struct ecore_hwfn {
 
 	/* @DPDK */
 	struct ecore_ptt		*p_arfs_ptt;
+
+	/* DPDK specific, not the part of vanilla ecore */
+	osal_spinlock_t spq_lock;
+	u32 iov_task_flags;
 };
 
 enum ecore_mf_mode {
drivers/net/qede/base/ecore_iov_api.h +3 -0
index 545001812..bd7c5703f 100644
@@ -14,6 +14,9 @@
 #define ECORE_ETH_VF_NUM_VLAN_FILTERS 2
 #define ECORE_VF_ARRAY_LENGTH (3)
 
+#define ECORE_VF_ARRAY_GET_VFID(arr, vfid)	\
+	(((arr)[(vfid) / 64]) & (1ULL << ((vfid) % 64)))
+
 #define IS_VF(p_dev)		((p_dev)->b_is_vf)
 #define IS_PF(p_dev)		(!((p_dev)->b_is_vf))
 #ifdef CONFIG_ECORE_SRIOV
drivers/net/qede/qede_ethdev.c +2 -0
index 6008d88e7..a30294f2e 100644
@@ -281,7 +281,9 @@ qede_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size)
 
 static void qede_interrupt_action(struct ecore_hwfn *p_hwfn)
 {
+	OSAL_SPIN_LOCK(&p_hwfn->spq_lock);
 	ecore_int_sp_dpc((osal_int_ptr_t)(p_hwfn));
+	OSAL_SPIN_UNLOCK(&p_hwfn->spq_lock);
 }
 
 static void
drivers/net/qede/qede_main.c +3 -1
index c37e8ebe0..0afacc064 100644
@@ -221,7 +221,9 @@ static void qed_stop_iov_task(struct ecore_dev *edev)
 
 	for_each_hwfn(edev, i) {
 		p_hwfn = &edev->hwfns[i];
-		if (!IS_PF(edev))
+		if (IS_PF(edev))
+			rte_eal_alarm_cancel(qed_iov_pf_task, p_hwfn);
+		else
 			rte_eal_alarm_cancel(qede_vf_task, p_hwfn);
 	}
 }
drivers/net/qede/qede_sriov.c +61 -0

70 lines not on this page · raw message

drivers/net/qede/qede_sriov.h +14 -2
index 6c85b1dd5..8b7fa7daa 100644
@@ -4,6 +4,18 @@
  * www.marvell.com
  */
 
-#include "qede_ethdev.h"
-
 void qed_sriov_configure(struct ecore_dev *edev, int num_vfs_param);
+
+enum qed_iov_wq_flag {
+	QED_IOV_WQ_MSG_FLAG,
+	QED_IOV_WQ_SET_UNICAST_FILTER_FLAG,
+	QED_IOV_WQ_BULLETIN_UPDATE_FLAG,
+	QED_IOV_WQ_STOP_WQ_FLAG,
+	QED_IOV_WQ_FLR_FLAG,
+	QED_IOV_WQ_TRUST_FLAG,
+	QED_IOV_WQ_VF_FORCE_LINK_QUERY_FLAG,
+	QED_IOV_WQ_DB_REC_HANDLER,
+};
+
+int qed_schedule_iov(struct ecore_hwfn *p_hwfn, enum qed_iov_wq_flag flag);
+void qed_iov_pf_task(void *arg);
Signature · 1 line
2.17.1
#24 lore raw

PATCH v2 6/7 net/qede: initialize VF MAC and link

In reply to Manish Chopra

This patch configures VFs with random mac if no MAC is provided by the PF/bulletin. This also adds required bulletin APIs by PF-PMD driver to communicate LINK properties/changes to the VFs through bulletin update mechanism.

With these changes, VF-PMD instance is able to run fastpath over PF-PMD driver instance.

---
 drivers/net/qede/qede_ethdev.c | 34 ++++++++++++++++++++-
 drivers/net/qede/qede_main.c   |  7 ++++-
 drivers/net/qede/qede_sriov.c  | 55 ++++++++++++++++++++++++++++++++++
 drivers/net/qede/qede_sriov.h  |  1 +
 4 files changed, 95 insertions(+), 2 deletions(-)
drivers/net/qede/qede_ethdev.c +33 -1
index a30294f2e..e39629481 100644
@@ -2482,6 +2482,24 @@ static void qede_update_pf_params(struct ecore_dev *edev)
 	qed_ops->common->update_pf_params(edev, &pf_params);
 }
 
+static void qede_generate_random_mac_addr(struct rte_ether_addr *mac_addr)
+{
+	uint64_t random;
+
+	/* Set Organizationally Unique Identifier (OUI) prefix. */
+	mac_addr->addr_bytes[0] = 0x00;
+	mac_addr->addr_bytes[1] = 0x09;
+	mac_addr->addr_bytes[2] = 0xC0;
+
+	/* Force indication of locally assigned MAC address. */
+	mac_addr->addr_bytes[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR;
+
+	/* Generate the last 3 bytes of the MAC address with a random number. */
+	random = rte_rand();
+
+	memcpy(&mac_addr->addr_bytes[3], &random, 3);
+}
+
 static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
 {
 	struct rte_pci_device *pci_dev;
@@ -2494,7 +2512,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
 	uint8_t bulletin_change;
 	uint8_t vf_mac[RTE_ETHER_ADDR_LEN];
 	uint8_t is_mac_forced;
-	bool is_mac_exist;
+	bool is_mac_exist = false;
 	/* Fix up ecore debug level */
 	uint32_t dp_module = ~0 & ~ECORE_MSG_HW;
 	uint8_t dp_level = ECORE_LEVEL_VERBOSE;
@@ -2672,6 +2690,20 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
 				DP_ERR(edev, "No VF macaddr assigned\n");
 			}
 		}
+
+		/* If MAC doesn't exist from PF, generate random one */
+		if (!is_mac_exist) {
+			struct rte_ether_addr *mac_addr;
+
+			mac_addr = (struct rte_ether_addr *)&vf_mac;
+			qede_generate_random_mac_addr(mac_addr);
+
+			rte_ether_addr_copy(mac_addr,
+					    &eth_dev->data->mac_addrs[0]);
+
+			rte_ether_addr_copy(&eth_dev->data->mac_addrs[0],
+					    &adapter->primary_mac);
+		}
 	}
 
 	eth_dev->dev_ops = (is_vf) ? &qede_eth_vf_dev_ops : &qede_eth_dev_ops;
drivers/net/qede/qede_main.c +6 -1
index 0afacc064..805a95e3c 100644
@@ -651,10 +651,15 @@ void qed_link_update(struct ecore_hwfn *hwfn)
 	struct ecore_dev *edev = hwfn->p_dev;
 	struct qede_dev *qdev = (struct qede_dev *)edev;
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)qdev->ethdev;
+	int rc;
+
+	rc = qede_link_update(dev, 0);
+	qed_inform_vf_link_state(hwfn);
 
-	if (!qede_link_update(dev, 0))
+	if (!rc) {
 		_rte_eth_dev_callback_process(dev,
 					      RTE_ETH_EVENT_INTR_LSC, NULL);
+	}
 }
 
 static int qed_drain(struct ecore_dev *edev)
drivers/net/qede/qede_sriov.c +55 -0

70 lines not on this page · raw message

drivers/net/qede/qede_sriov.h +1 -0
index 8b7fa7daa..e58ecc2a5 100644
@@ -17,5 +17,6 @@ enum qed_iov_wq_flag {
 	QED_IOV_WQ_DB_REC_HANDLER,
 };
 
+void qed_inform_vf_link_state(struct ecore_hwfn *hwfn);
 int qed_schedule_iov(struct ecore_hwfn *p_hwfn, enum qed_iov_wq_flag flag);
 void qed_iov_pf_task(void *arg);
Signature · 1 line
2.17.1
#25 lore raw

PATCH v2 7/7 net/qede: add VF FLR support

In reply to Manish Chopra

This patch adds required bit to handle VF FLR indication from Management FW (MFW) of the device

With that VFs were able to load in VM (VF attached as PCI passthrough to the guest VM) followed by FLR successfully

Updated the docs/guides with the feature support

---
 doc/guides/nics/features/qede.ini |  1 +
 doc/guides/nics/qede.rst          |  7 +------
 drivers/net/qede/base/bcm_osal.c  |  5 +++++
 drivers/net/qede/base/bcm_osal.h  |  4 +++-
 drivers/net/qede/qede_sriov.c     | 18 ++++++++++++++++++
 5 files changed, 28 insertions(+), 7 deletions(-)
doc/guides/nics/features/qede.ini +1 -0
index f8716523e..46fba8e6c 100644
@@ -32,6 +32,7 @@ Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
 Registers dump       = Y
+SR-IOV               = Y
 Multiprocess aware   = Y
 Linux UIO            = Y
 Linux VFIO           = Y
doc/guides/nics/qede.rst +1 -6
index 5b2f86895..e874915c2 100644
@@ -34,18 +34,13 @@ Supported Features
 - VLAN offload - Filtering and stripping
 - N-tuple filter and flow director (limited support)
 - NPAR (NIC Partitioning)
-- SR-IOV VF
+- SR-IOV PF and VF
 - GRE Tunneling offload
 - GENEVE Tunneling offload
 - VXLAN Tunneling offload
 - MPLSoUDP Tx Tunneling offload
 - Generic flow API
 
-Non-supported Features
-----------------------
-
-- SR-IOV PF
-
 Co-existence considerations
 ---------------------------
 
drivers/net/qede/base/bcm_osal.c +5 -0
index ef47339df..44a8692f5 100644
@@ -29,6 +29,11 @@ int osal_pf_vf_msg(struct ecore_hwfn *p_hwfn)
 	return rc;
 }
 
+void osal_vf_flr_update(struct ecore_hwfn *p_hwfn)
+{
+	qed_schedule_iov(p_hwfn, QED_IOV_WQ_FLR_FLAG);
+}
+
 void osal_poll_mode_dpc(osal_int_ptr_t hwfn_cookie)
 {
 	struct ecore_hwfn *p_hwfn = (struct ecore_hwfn *)hwfn_cookie;
drivers/net/qede/base/bcm_osal.h +3 -1
index fad441752..75084ce23 100644
@@ -353,7 +353,9 @@ u32 qede_find_first_zero_bit(u32 *bitmap, u32 length);
 /* SR-IOV channel */
 
 int osal_pf_vf_msg(struct ecore_hwfn *p_hwfn);
-#define OSAL_VF_FLR_UPDATE(hwfn) nothing
+void osal_vf_flr_update(struct ecore_hwfn *p_hwfn);
+#define OSAL_VF_FLR_UPDATE(hwfn) \
+	osal_vf_flr_update(hwfn)
 #define OSAL_VF_SEND_MSG2PF(dev, done, msg, reply_addr, msg_size, reply_size) 0
 #define OSAL_VF_CQE_COMPLETION(_dev_p, _cqe, _protocol)	(0)
 #define OSAL_PF_VF_MSG(hwfn, vfid) \
drivers/net/qede/qede_sriov.c +18 -0
index 93f7a2a55..0b99a8d6f 100644
@@ -151,6 +151,7 @@ static void qed_handle_bulletin_post(struct ecore_hwfn *hwfn)
 void qed_iov_pf_task(void *arg)
 {
 	struct ecore_hwfn *p_hwfn = arg;
+	int rc;
 
 	if (OSAL_GET_BIT(QED_IOV_WQ_MSG_FLAG, &p_hwfn->iov_task_flags)) {
 		OSAL_CLEAR_BIT(QED_IOV_WQ_MSG_FLAG, &p_hwfn->iov_task_flags);
@@ -163,6 +164,23 @@ void qed_iov_pf_task(void *arg)
 			       &p_hwfn->iov_task_flags);
 		qed_handle_bulletin_post(p_hwfn);
 	}
+
+	if (OSAL_GET_BIT(QED_IOV_WQ_FLR_FLAG, &p_hwfn->iov_task_flags)) {
+		struct ecore_ptt *p_ptt = ecore_ptt_acquire(p_hwfn);
+
+		OSAL_CLEAR_BIT(QED_IOV_WQ_FLR_FLAG, &p_hwfn->iov_task_flags);
+
+		if (!p_ptt) {
+			qed_schedule_iov(p_hwfn, QED_IOV_WQ_FLR_FLAG);
+			return;
+		}
+
+		rc = ecore_iov_vf_flr_cleanup(p_hwfn, p_ptt);
+		if (rc)
+			qed_schedule_iov(p_hwfn, QED_IOV_WQ_FLR_FLAG);
+
+		ecore_ptt_release(p_hwfn, p_ptt);
+	}
 }
 
 int qed_schedule_iov(struct ecore_hwfn *p_hwfn, enum qed_iov_wq_flag flag)
Signature · 1 line
2.17.1