linux/dim: fix -Wunused-const-variable warnings
Subsystems (3)
PATCH 1/1 linux/dim: fix -Wunused-const-variable warnings
There are a lot of compilation warnings due to tx_profile[] and rx_profile[] are only used in lib/dim/net_dim.c but include/linux/dim.h is included elsewhere.
In file included from ./include/rdma/ib_verbs.h:64,
from ./include/linux/mlx5/device.h:37,
from ./include/linux/mlx5/driver.h:51,
fromdrivers/net/ethernet/mellanox/mlx5/core/pagealloc.c:37:./include/linux/dim.h:326:1: warning: 'tx_profile' defined but not used [-Wunused-const-variable=]
tx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { ^~~~~~~~~~./include/linux/dim.h:320:1: warning: 'rx_profile' defined but not used [-Wunused-const-variable=]
rx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { ^~~~~~~~~~
Fix them by moving tx_profile[] and rx_profile[] into lib/dim/net_dim.c instead.
--- include/linux/dim.h | 12 ------------ lib/dim/net_dim.c | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-)
include/linux/dim.h +0 -12
@@ -316,18 +316,6 @@ void dim_calc_stats(struct dim_sample *start, struct dim_sample *end, {64, 32} \ } -static const struct dim_cq_moder -rx_profile[DIM_CQ_PERIOD_NUM_MODES ][NET_DIM_PARAMS_NUM_PROFILES ] = { -NET_DIM_RX_EQE_PROFILES , -NET_DIM_RX_CQE_PROFILES , -}; - -static const struct dim_cq_moder -tx_profile[DIM_CQ_PERIOD_NUM_MODES ][NET_DIM_PARAMS_NUM_PROFILES ] = { -NET_DIM_TX_EQE_PROFILES , -NET_DIM_TX_CQE_PROFILES , -}; -/** * net_dim_get_rx_moderation - provide a CQ moderation object for the given RX profile * @cq_period_mode: CQ period mode
lib/dim/net_dim.c +12 -0
@@ -5,6 +5,18 @@#include <linux/dim.h> +static const struct dim_cq_moder +rx_profile[DIM_CQ_PERIOD_NUM_MODES ][NET_DIM_PARAMS_NUM_PROFILES ] = { +NET_DIM_RX_EQE_PROFILES , +NET_DIM_RX_CQE_PROFILES , +}; + +static const struct dim_cq_moder +tx_profile[DIM_CQ_PERIOD_NUM_MODES ][NET_DIM_PARAMS_NUM_PROFILES ] = { +NET_DIM_TX_EQE_PROFILES , +NET_DIM_TX_CQE_PROFILES , +}; +struct dim_cq_moder net_dim_get_rx_moderation (u8 cq_period_mode,int ix) {
Signature · 1 line
1.8.3.1
Quoted 66 lines · Qian Cai
There are a lot of compilation warnings due to tx_profile[] and rx_profile[] are only used in
lib/dim/net_dim.cbutinclude/linux/dim.h
is included elsewhere.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:326:1: warning: 'tx_profile' defined but not used
[-Wunused-const-variable=]
tx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { ^~~~~~~~~~./include/linux/dim.h:320:1: warning: 'rx_profile' defined but not used
[-Wunused-const-variable=]
rx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { ^~~~~~~~~~Fix them by moving tx_profile[] and rx_profile[] into
lib/dim/net_dim.c
instead.Signed-off-by Qian Cai <[email protected]>--- include/linux/dim.h | 12 ------------ lib/dim/net_dim.c | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-)include/linux/dim.h +0
-12@@ -316,18 +316,6 @@ void dim_calc_stats(struct dim_sample *start, struct dim_sample *end, {64, 32} \ } -static const struct dim_cq_moder -rx_profile[DIM_CQ_PERIOD_NUM_MODES ][NET_DIM_PARAMS_NUM_PROFILES ] = { -NET_DIM_RX_EQE_PROFILES , -NET_DIM_RX_CQE_PROFILES , -}; - -static const struct dim_cq_moder -tx_profile[DIM_CQ_PERIOD_NUM_MODES ][NET_DIM_PARAMS_NUM_PROFILES ] = { -NET_DIM_TX_EQE_PROFILES , -NET_DIM_TX_CQE_PROFILES , -}; -/** * net_dim_get_rx_moderation - provide a CQ moderation object for the given RX profile
* @cq_period_mode: CQ period modelib/dim/net_dim.c +2
-0@@ -5,6 +5,18 @@#include <linux/dim.h> +static const struct dim_cq_moder +rx_profile[DIM_CQ_PERIOD_NUM_MODES ][NET_DIM_PARAMS_NUM_PROFILES ] = {
lib/dim/net_dim.c line 19
Quoted 10 lines
lib/dim/net_dim.c +10
-0+NET_DIM_RX_EQE_PROFILES , + NET_DIM_RX_CQE_PROFILES, +}; + +static const struct dim_cq_moder +tx_profile[DIM_CQ_PERIOD_NUM_MODES ][NET_DIM_PARAMS_NUM_PROFILES ] = { +NET_DIM_TX_EQE_PROFILES , +NET_DIM_TX_CQE_PROFILES , +}; +
Hi Qian,
it worth moving the structs and their dependencies, the whole below code block should move to net_dim.c altogether.
/* Net DIM */
/*
* Net DIM profiles:
* There are different set of profiles for each CQ period mode. * There are different set of profiles for RX/TX CQs. * Each profile size must be of NET_DIM_PARAMS_NUM_PROFILES
*/
#define NET_DIM_PARAMS_NUM_PROFILES 5
#define NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE 256 #define NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE 128 #define NET_DIM_DEF_PROFILE_CQE 1
#define NET_DIM_DEF_PROFILE_EQE 1
#define NET_DIM_RX_EQE_PROFILES { \
{1, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
{8, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
{64, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
{128, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
{256, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
}#define NET_DIM_RX_CQE_PROFILES { \
{2, 256}, \
{8, 128}, \
{16, 64}, \
{32, 64}, \
{64, 64} \
}#define NET_DIM_TX_EQE_PROFILES { \
{1, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \
{8, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \
{32, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \
{64, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \
{128, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE} \
}#define NET_DIM_TX_CQE_PROFILES { \
{5, 128}, \
{8, 64}, \
{16, 32}, \
{32, 32}, \
{64, 32} \
}static const struct dim_cq_moder rx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
NET_DIM_RX_EQE_PROFILES,
NET_DIM_RX_CQE_PROFILES,
};
static const struct dim_cq_moder tx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
NET_DIM_TX_EQE_PROFILES,
NET_DIM_TX_CQE_PROFILES,
};
in case you are going to submit a V2, can you cc netdev mailing list as well ?
Quoted 3 lines
lib/dim/net_dim.c +0
-0struct dim_cq_moder net_dim_get_rx_moderation (u8 cq_period_mode,int ix) {