RDMA/core: Fix -Wunused-const-variable warnings
authorQian Cai <cai@lca.pw>
Thu, 11 Jul 2019 13:55:56 +0000 (09:55 -0400)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 11 Jul 2019 14:49:55 +0000 (11:49 -0300)
The commit below introduced a few compilation warnings.

In file included from ./include/rdma/ib_verbs.h:64,
                 from ./include/linux/mlx5/device.h:37,
                 from ./include/linux/mlx5/driver.h:51,
                 from drivers/net/ethernet/mellanox/mlx5/core/uar.c:36:
./include/linux/dim.h:378:1: warning: 'rdma_dim_prof' defined but not
used [-Wunused-const-variable=]
 rdma_dim_prof[RDMA_DIM_PARAMS_NUM_PROFILES] = {
 ^~~~~~~~~~~~~
In file included from ./include/rdma/ib_verbs.h:64,
                 from ./include/linux/mlx5/device.h:37,
                 from ./include/linux/mlx5/driver.h:51,
                 from
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c:37:
./include/linux/dim.h:378:1: warning: 'rdma_dim_prof' defined but not
used [-Wunused-const-variable=]
 rdma_dim_prof[RDMA_DIM_PARAMS_NUM_PROFILES] = {
 ^~~~~~~~~~~~~

Since only ib_cq_rdma_dim_work() in drivers/infiniband/core/cq.c uses it,
just move the definition over there.

Fixes: f4915455dcf0 ("linux/dim: Implement RDMA adaptive moderation (DIM)")
Signed-off-by: Qian Cai <cai@lca.pw>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/cq.c
include/linux/dim.h

index ffd6e24109d52953bdc446f33d7f329675061d7c..7c599878ccf711e22d70771c67a1b093f101670f 100644 (file)
 #define IB_POLL_FLAGS \
        (IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS)
 
+static const struct dim_cq_moder
+rdma_dim_prof[RDMA_DIM_PARAMS_NUM_PROFILES] = {
+       {1,   0, 1,  0},
+       {1,   0, 4,  0},
+       {2,   0, 4,  0},
+       {2,   0, 8,  0},
+       {4,   0, 8,  0},
+       {16,  0, 8,  0},
+       {16,  0, 16, 0},
+       {32,  0, 16, 0},
+       {32,  0, 32, 0},
+};
+
 static void ib_cq_rdma_dim_work(struct work_struct *w)
 {
        struct dim *dim = container_of(w, struct dim, work);
index aa69730c3b8d355b875ccde1ed600d0bc3855ab9..d3a0fbfff2bb0931dddd8fd0d65ab544bc8f76b0 100644 (file)
@@ -374,19 +374,6 @@ void net_dim(struct dim *dim, struct dim_sample end_sample);
 #define RDMA_DIM_PARAMS_NUM_PROFILES 9
 #define RDMA_DIM_START_PROFILE 0
 
-static const struct dim_cq_moder
-rdma_dim_prof[RDMA_DIM_PARAMS_NUM_PROFILES] = {
-       {1,   0, 1,  0},
-       {1,   0, 4,  0},
-       {2,   0, 4,  0},
-       {2,   0, 8,  0},
-       {4,   0, 8,  0},
-       {16,  0, 8,  0},
-       {16,  0, 16, 0},
-       {32,  0, 16, 0},
-       {32,  0, 32, 0},
-};
-
 /**
  * rdma_dim - Runs the adaptive moderation.
  * @dim: The moderation struct.