Skip to contentSkip to conversation

pci: fix unneeded includes in public header file

PATCH Applied Bruce Richardson 5 participants 6 messages Mar 16, 2020 – Mar 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci: fix unneeded includes in public header file

The rte_pci.h file includes more header files than are actually needed, which means that all users of it also include those headers. This patch removes the unneeded headers - adding them elsewhere where other components were requiring them but not including them directly.

Fixes c752998b5e2e ("pci: introduce library and driver")
---
 drivers/bus/ifpga/rte_bus_ifpga.h | 1 +
 drivers/common/mlx5/mlx5_common.h | 1 +
 lib/librte_pci/rte_pci.h          | 6 ------
 3 files changed, 2 insertions(+), 6 deletions(-)
drivers/bus/ifpga/rte_bus_ifpga.h +1 -0
index 88a628964..a6eeaaf56 100644
@@ -17,6 +17,7 @@ extern "C" {
 
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_interrupts.h>
 #include <rte_spinlock.h>
 
 /** Name of Intel FPGA Bus */
drivers/common/mlx5/mlx5_common.h +1 -0
index 961c60634..16de1b397 100644
@@ -8,6 +8,7 @@
 #include <stdio.h>
 
 #include <rte_pci.h>
+#include <rte_debug.h>
 #include <rte_atomic.h>
 #include <rte_log.h>
 #include <rte_kvargs.h>
lib/librte_pci/rte_pci.h +0 -6
index c87891405..c591af010 100644
@@ -16,17 +16,11 @@
 extern "C" {
 #endif
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>
-#include <errno.h>
 #include <sys/queue.h>
-#include <stdint.h>
 #include <inttypes.h>
 
-#include <rte_debug.h>
-#include <rte_interrupts.h>
-
 /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
 #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
 #define PCI_PRI_STR_SIZE sizeof("XXXXXXXX:XX:XX.X")
Signature · 1 line
2.20.1
Acked-by on v1 1/1 Applied
#1 lore raw

16/03/2020 12:29, Bruce Richardson:

Quoted 10 lines

The rte_pci.h file includes more header files than are actually needed, which means that all users of it also include those headers. This patch removes the unneeded headers - adding them elsewhere where other components were requiring them but not including them directly.

Fixes c752998b5e2e ("pci: introduce library and driver")

[...]

lib/librte_pci/rte_pci.h line 28

Quoted 12 lines
lib/librte_pci/rte_pci.h +0 -5
-#include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>
-#include <errno.h>
 #include <sys/queue.h>
-#include <stdint.h>
 #include <inttypes.h>
 
-#include <rte_debug.h>
-#include <rte_interrupts.h>

Removing useless includes (or lines in general) is always good.

Applied, thanks

#2 lore raw
In reply to Bruce Richardson
Quoted 54 lines

The rte_pci.h file includes more header files than are actually needed, which means that all users of it also include those headers. This patch removes the unneeded headers - adding them elsewhere where other components were requiring them but not including them directly.

Fixes c752998b5e2e ("pci: introduce library and driver")
---
  drivers/bus/ifpga/rte_bus_ifpga.h | 1 +
  drivers/common/mlx5/mlx5_common.h | 1 +
  lib/librte_pci/rte_pci.h          | 6 ------
  3 files changed, 2 insertions(+), 6 deletions(-)
drivers/bus/ifpga/rte_bus_ifpga.h +1 -0
index 88a628964..a6eeaaf56 100644
@@ -17,6 +17,7 @@ extern "C" {
 
  #include <rte_bus.h>
  #include <rte_pci.h>
+#include <rte_interrupts.h>
  #include <rte_spinlock.h>
 
  /** Name of Intel FPGA Bus */
drivers/common/mlx5/mlx5_common.h +1 -0
index 961c60634..16de1b397 100644
@@ -8,6 +8,7 @@
  #include <stdio.h>
 
  #include <rte_pci.h>
+#include <rte_debug.h>
  #include <rte_atomic.h>
  #include <rte_log.h>
  #include <rte_kvargs.h>
lib/librte_pci/rte_pci.h +0 -2
index c87891405..c591af010 100644
@@ -16,17 +16,11 @@
  extern "C" {
  #endif
 
-#include <stdio.h>
  #include <stdlib.h>
  #include <limits.h>
-#include <errno.h>

lib/librte_pci/rte_pci.h line 26

Quoted 10 lines
lib/librte_pci/rte_pci.h +0 -4
  #include <sys/queue.h>
-#include <stdint.h>
  #include <inttypes.h>
 
-#include <rte_debug.h>
-#include <rte_interrupts.h>
-
  /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
  #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
  #define PCI_PRI_STR_SIZE sizeof("XXXXXXXX:XX:XX.X")

Patch is generating build errors with meson on my POWER system, though I don't see how they're POWER specific:

Patch is generating build errors on my POWER system:

[17/964] Compiling C object 'lib/76b5a35@@rte_pci@sta/librte_pci_rte_pci.c.o'.
../lib/librte_pci/rte_pci.c: In function ‘rte_pci_device_name’:
../lib/librte_pci/rte_pci.c:94:2: warning: implicit declaration of function ‘RTE_VERIFY’; did you mean ‘RTE_PRIO’? [-Wimplicit-function-declaration]
RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
^~~~~~~~~~
RTE_PRIO
../lib/librte_pci/rte_pci.c:94:2: warning: nested extern declaration of ‘RTE_VERIFY’ [-Wnested-externs]
[18/964] Compiling C object 'drivers/a715181@@tmp_rte_bus_ifpga@sta/bus_ifpga_ifpga_bus.c.o'.
../drivers/bus/ifpga/ifpga_bus.c: In function ‘rte_ifpga_driver_register’:
../drivers/bus/ifpga/ifpga_bus.c:50:2: warning: implicit declaration of function ‘RTE_VERIFY’; did you mean ‘RTE_PRIO’? [-Wimplicit-function-declaration]
RTE_VERIFY(driver);
^~~~~~~~~~
RTE_PRIO
../drivers/bus/ifpga/ifpga_bus.c:50:2: warning: nested extern declaration of ‘RTE_VERIFY’ [-Wnested-externs]
[332/964] Linking target lib/librte_pci.so.20.0.2.
FAILED: lib/librte_pci.so.20.0.2
cc -o lib/librte_pci.so.20.0.2 'lib/76b5a35@@rte_pci@sta/librte_pci_rte_pci.c.o' -Wl,--no-undefined -Wl,--as-needed -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,librte_pci.so.20.0 -Wl,--no-as-needed -pthread -lm -ldl -lnuma lib/librte_eal.so.20.0.2 lib/librte_kvargs.so.20.0.2 -Wl,--end-group -Wl,--version-script=/home/drc/src/dpdk/lib/librte_pci/rte_pci_version.map '-Wl,-rpath,$ORIGIN/' -Wl,-rpath-link,/home/drc/src/dpdk/build/lib lib/76b5a35@@rte_pci@sta/librte_pci_rte_pci.c.o: In function `rte_pci_device_name':
rte_pci.c:(.text+0x38): undefined reference to `RTE_VERIFY'
rte_pci.c:(.text+0x6c): undefined reference to `RTE_VERIFY'
collect2: error: ld returned 1 exit status
[461/964] Compiling C object 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_rxtx.c.o'.
ninja: build stopped: subcommand failed.

Added <rte_debug.h> to the affected files resolves the problem.

Dave

#3 lore raw
Quoted 6 lines · David Christensen
Quoted 6 lines

The rte_pci.h file includes more header files than are actually needed, which means that all users of it also include those headers. This patch removes the unneeded headers - adding them elsewhere where other components were requiring them but not including them directly.

Quoted 7 lines
Quoted 5 lines
Fixes c752998b5e2e ("pci: introduce library and driver")

Patch is generating build errors with meson on my POWER system, though I don't see how they're POWER specific:

There's a pending patch to enable Travis for POWER systems:

http://patches.dpdk.org/patch/65986/

Any reason it hasn't been accepted yet? Looks like it would have caught this problem.

Dave

#4 lore raw
Quoted 17 lines · David Christensen
Quoted 7 lines · David Christensen
Quoted 7 lines

The rte_pci.h file includes more header files than are actually needed, which means that all users of it also include those headers. This patch removes the unneeded headers - adding them elsewhere where other components
were requiring them but not including them directly.

Quoted 8 lines
Quoted 5 lines
Fixes c752998b5e2e ("pci: introduce library and driver")

Patch is generating build errors with meson on my POWER system, though I don't see how they're POWER specific:

Quoted 6 lines

There's a pending patch to enable Travis for POWER systems:

http://patches.dpdk.org/patch/65986/

Any reason it hasn't been accepted yet? Looks like it would have caught this problem.

The reason is that this series has a change in the IOVA detection code. I have a lot of things to look at, so any help in reviews is appreciated.

Signature · 1 line
David Marchand
#5 lore raw
Quoted 22 lines · David Marchand
Quoted 19 lines · David Christensen
Quoted 7 lines · David Christensen
Quoted 7 lines

The rte_pci.h file includes more header files than are actually needed, which means that all users of it also include those headers. This patch removes the unneeded headers - adding them elsewhere where other components
were requiring them but not including them directly.

Quoted 8 lines
Quoted 5 lines
Fixes c752998b5e2e ("pci: introduce library and driver")

Patch is generating build errors with meson on my POWER system, though I don't see how they're POWER specific:

There's a pending patch to enable Travis for POWER systems:

Quoted 7 lines
Quoted 4 lines

http://patches.dpdk.org/patch/65986/

Any reason it hasn't been accepted yet? Looks like it would have caught this problem.

The reason is that this series has a change in the IOVA detection code. I have a lot of things to look at, so any help in reviews is appreciated.

Reviewed...

Quoted 5 lines

--
David Marchand