[v1] gpu/cuda: set unused gdrcopy functions arguments

Message ID 20220310000650.25171-1-eagostini@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v1] gpu/cuda: set unused gdrcopy functions arguments |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build fail github build: failed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Elena Agostini March 10, 2022, 12:06 a.m. UTC
  From: Elena Agostini <eagostini@nvidia.com>

Without enabling gdrcopy, dpdk build has warnings about
unused gdrcopy functions input parameters.

This patch set them to __rte_unused .

Fixes: 24c7759 ("gpu/cuda: map GPU memory with GDRCopy")

Signed-off-by: Elena Agostini <eagostini@nvidia.com>
---
 drivers/gpu/cuda/gdrcopy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Thomas Monjalon March 10, 2022, 8:23 p.m. UTC | #1
10/03/2022 01:06, eagostini@nvidia.com:
> From: Elena Agostini <eagostini@nvidia.com>
> 
> Without enabling gdrcopy, dpdk build has warnings about
> unused gdrcopy functions input parameters.

As developers we should test with --werror option given to meson,
so we don't miss such details.
This is what the script devtools/test-meson-builds.sh does.

> This patch set them to __rte_unused .
> 
> Fixes: 24c7759 ("gpu/cuda: map GPU memory with GDRCopy")

Let's keep this casing of GDRCopy in the new title.

> Signed-off-by: Elena Agostini <eagostini@nvidia.com>
> ---
>  int
> -gdrcopy_pin(gdr_t *gdrc_h, __rte_unused gdr_mh_t *mh, uint64_t d_addr, size_t size, void **h_addr)
> +gdrcopy_pin(__rte_unused gdr_t *gdrc_h, __rte_unused gdr_mh_t *mh, __rte_unused uint64_t d_addr, __rte_unused size_t size, __rte_unused void **h_addr)

While at it, break the too long line.

It seems my compiler is smart enough to not require the unused attribute
for parameters used in another branch of #ifdef.
But it is probably required for some old compilers.

Applied, thanks.
  

Patch

diff --git a/drivers/gpu/cuda/gdrcopy.c b/drivers/gpu/cuda/gdrcopy.c
index 96e768b97b..3126d246eb 100644
--- a/drivers/gpu/cuda/gdrcopy.c
+++ b/drivers/gpu/cuda/gdrcopy.c
@@ -80,7 +80,7 @@  gdrcopy_open(gdr_t *g)
 #endif
 
 int
-gdrcopy_pin(gdr_t *gdrc_h, __rte_unused gdr_mh_t *mh, uint64_t d_addr, size_t size, void **h_addr)
+gdrcopy_pin(__rte_unused gdr_t *gdrc_h, __rte_unused gdr_mh_t *mh, __rte_unused uint64_t d_addr, __rte_unused size_t size, __rte_unused void **h_addr)
 {
 #ifdef DRIVERS_GPU_CUDA_GDRCOPY_H
 	if (*gdrc_h == NULL) {
@@ -116,7 +116,7 @@  gdrcopy_pin(gdr_t *gdrc_h, __rte_unused gdr_mh_t *mh, uint64_t d_addr, size_t si
 }
 
 int
-gdrcopy_unpin(gdr_t gdrc_h, __rte_unused gdr_mh_t mh, void *d_addr, size_t size)
+gdrcopy_unpin(gdr_t gdrc_h, __rte_unused gdr_mh_t mh, __rte_unused void *d_addr, __rte_unused size_t size)
 {
 	if (gdrc_h == NULL)
 		return -EINVAL;