Skip to content

Commit 9c996a6

Browse files
committed
Added the -Wextra compilation option and fixed compilation errors.
1 parent 79f99da commit 9c996a6

File tree

7 files changed

+24
-23
lines changed

7 files changed

+24
-23
lines changed

lib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ endif
6262

6363
PKGCONF ?= pkg-config
6464

65-
DPDK_CFLAGS= -Wall -Wno-deprecated-declarations -Werror $(shell $(PKGCONF) --cflags libdpdk)
65+
DPDK_CFLAGS= -Wall -Wextra -Wno-deprecated-declarations -Werror $(shell $(PKGCONF) --cflags libdpdk)
6666

6767
KERNPREINCLUDES:= ${INCLUDES}
6868
INCLUDES= -I${OVERRIDE_INCLUDES_ROOT} ${KERNPREINCLUDES}

lib/ff_config.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static int
7171
parse_lcore_mask(struct ff_config *cfg, const char *coremask)
7272
{
7373
int i, j, idx = 0, shift = 0, zero_num = 0;
74-
unsigned count = 0;
74+
int count = 0;
7575
char c;
7676
int val;
7777
uint16_t *proc_lcore;
@@ -121,7 +121,7 @@ parse_lcore_mask(struct ff_config *cfg, const char *coremask)
121121
snprintf(buf, sizeof(buf) - 1, "%llx%s",
122122
(unsigned long long)1<<shift, zero);
123123
cfg->dpdk.proc_mask = strdup(buf);
124-
}
124+
}
125125
count++;
126126
}
127127
}
@@ -857,7 +857,7 @@ bond_cfg_handler(struct ff_config *cfg, const char *section,
857857
}
858858

859859
static int
860-
rss_tbl_cfg_handler(struct ff_config *cfg, struct ff_rss_check_cfg *cur)
860+
rss_tbl_cfg_handler(struct ff_rss_check_cfg *cur)
861861
{
862862
//vip cfg
863863
int ret, nb_rss_tbl, i, j, k;
@@ -900,7 +900,7 @@ rss_tbl_cfg_handler(struct ff_config *cfg, struct ff_rss_check_cfg *cur)
900900
}
901901

902902
static int
903-
rss_check_cfg_handler(struct ff_config *cfg, const char *section,
903+
rss_check_cfg_handler(struct ff_config *cfg, __rte_unused const char *section,
904904
const char *name, const char *value)
905905
{
906906
if (cfg->dpdk.port_cfgs == NULL && cfg->dpdk.vlan_cfgs == NULL) {
@@ -924,7 +924,7 @@ rss_check_cfg_handler(struct ff_config *cfg, const char *section,
924924
} else if (strcmp(name, "rss_tbl") == 0) {
925925
cur->rss_tbl_str = strdup(value);
926926
if (cur->rss_tbl_str) {
927-
return rss_tbl_cfg_handler(cfg, cur);
927+
return rss_tbl_cfg_handler(cur);
928928
}
929929
}
930930

lib/ff_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ struct ff_rss_tbl_cfg {
241241

242242
struct ff_rss_check_cfg {
243243
int enable;
244-
uint32_t nb_rss_tbl;
244+
int nb_rss_tbl;
245245
char *rss_tbl_str;
246246
struct ff_rss_tbl_cfg rss_tbl_cfgs[FF_RSS_TBL_MAX_ENTRIES];
247247
};

lib/ff_dpdk_if.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ set_rss_table(uint16_t port_id, uint16_t reta_size, uint16_t nb_queues)
572572
return;
573573
}
574574

575-
int reta_conf_size = RTE_MAX(1, reta_size / RTE_ETH_RETA_GROUP_SIZE);
575+
unsigned reta_conf_size = RTE_MAX(1, reta_size / RTE_ETH_RETA_GROUP_SIZE);
576576
struct rte_eth_rss_reta_entry64 reta_conf[reta_conf_size];
577577

578578
/* config HW indirection table */
@@ -2249,9 +2249,9 @@ main_loop(void *arg)
22492249

22502250
ff_get_current_time(&sec, &nsec);
22512251
if (sec > last_sec) {
2252-
if (kni_rate_limt.gerneal_packets > ff_global_cfg.kni.general_packets_ratelimit ||
2253-
kni_rate_limt.console_packets > ff_global_cfg.kni.console_packets_ratelimit ||
2254-
kni_rate_limt.kernel_packets > ff_global_cfg.kni.kernel_packets_ratelimit) {
2252+
if (kni_rate_limt.gerneal_packets > (uint64_t)ff_global_cfg.kni.general_packets_ratelimit ||
2253+
kni_rate_limt.console_packets > (uint64_t)ff_global_cfg.kni.console_packets_ratelimit ||
2254+
kni_rate_limt.kernel_packets > (uint64_t)ff_global_cfg.kni.kernel_packets_ratelimit) {
22552255
printf("kni ratelimit, general:%lu/%d, console:%lu/%d, kernel:%lu/%d, last sec:%ld, sec:%ld\n",
22562256
kni_rate_limt.gerneal_packets, ff_global_cfg.kni.general_packets_ratelimit,
22572257
kni_rate_limt.console_packets, ff_global_cfg.kni.console_packets_ratelimit,

lib/ff_dpdk_kni.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ kni_set_bitmap(const char *p, unsigned char *port_bitmap)
143143
#ifdef FF_KNI_KNI
144144
/* Currently we don't support change mtu. */
145145
static int
146-
kni_change_mtu(uint16_t port_id, unsigned new_mtu)
146+
kni_change_mtu(__rte_unused uint16_t port_id, __rte_unused unsigned new_mtu)
147147
{
148148
return 0;
149149
}
@@ -213,7 +213,7 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[])
213213
#endif
214214

215215
static int
216-
kni_process_tx(uint16_t port_id, uint16_t queue_id,
216+
kni_process_tx(uint16_t port_id, __rte_unused uint16_t queue_id,
217217
struct rte_mbuf **pkts_burst, unsigned count)
218218
{
219219
/* read packet from kni ring(phy port) and transmit to kni */
@@ -225,7 +225,7 @@ kni_process_tx(uint16_t port_id, uint16_t queue_id,
225225
* If there are too many processes, there is also the possibility that the control packet will be ratelimited.
226226
*/
227227
if (ff_global_cfg.kni.kernel_packets_ratelimit) {
228-
if (likely(kni_rate_limt.kernel_packets < ff_global_cfg.kni.kernel_packets_ratelimit)) {
228+
if (likely(kni_rate_limt.kernel_packets < (uint64_t)ff_global_cfg.kni.kernel_packets_ratelimit)) {
229229
nb_to_tx = nb_tx;
230230
} else {
231231
nb_to_tx = 0;
@@ -526,8 +526,8 @@ ff_kni_init(uint16_t nb_ports, int type, const char *tcp_ports, const char *udp_
526526
}
527527

528528
void
529-
ff_kni_alloc(uint16_t port_id, unsigned socket_id, int type, int port_idx,
530-
struct rte_mempool *mbuf_pool, unsigned ring_queue_size)
529+
ff_kni_alloc(uint16_t port_id, unsigned socket_id, __rte_unused int type, int port_idx,
530+
__rte_unused struct rte_mempool *mbuf_pool, unsigned ring_queue_size)
531531
{
532532
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
533533
struct rte_ether_addr addr = {{0}};
@@ -644,14 +644,14 @@ ff_kni_enqueue(enum FilterReturn filter, uint16_t port_id, struct rte_mbuf *pkt)
644644
if (filter >= FILTER_ARP) {
645645
if (ff_global_cfg.kni.console_packets_ratelimit) {
646646
kni_rate_limt.console_packets++;
647-
if (kni_rate_limt.console_packets > ff_global_cfg.kni.console_packets_ratelimit) {
647+
if (kni_rate_limt.console_packets > (uint64_t)ff_global_cfg.kni.console_packets_ratelimit) {
648648
goto error;
649649
}
650650
}
651651
} else {
652652
if (ff_global_cfg.kni.general_packets_ratelimit) {
653653
kni_rate_limt.gerneal_packets++;
654-
if (kni_rate_limt.gerneal_packets > ff_global_cfg.kni.general_packets_ratelimit) {
654+
if (kni_rate_limt.gerneal_packets > (uint64_t)ff_global_cfg.kni.general_packets_ratelimit) {
655655
goto error;
656656
}
657657
}

lib/ff_epoll.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ ff_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
103103
return ff_kevent(epfd, kev, changes, NULL, 0, NULL);
104104
}
105105

106-
static void
106+
static void
107107
ff_event_to_epoll(void **ev, struct kevent *kev)
108108
{
109109
unsigned int event_one = 0;
@@ -144,10 +144,11 @@ ff_event_to_epoll(void **ev, struct kevent *kev)
144144
(*ppev)++;
145145
}
146146

147-
int
147+
int
148148
ff_epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
149149
{
150150
int i, ret;
151+
(void)timeout;
151152
if (!events || maxevents < 1) {
152153
errno = EINVAL;
153154
return -1;

lib/ff_host_interface.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ ff_mmap(void *addr, uint64_t len, int prot, int flags, int fd, uint64_t offset)
7676

7777
void *ret = (mmap(addr, len, host_prot, host_flags, fd, offset));
7878

79-
if ((uint64_t)ret == -1) {
79+
if (ret == MAP_FAILED) {
8080
printf("fst mmap failed:%s\n", strerror(errno));
8181
exit(1);
8282
}
@@ -271,10 +271,10 @@ void ff_os_errno(int error)
271271
case ff_EPIPE: errno = EPIPE; break;
272272
case ff_EDOM: errno = EDOM; break;
273273
case ff_ERANGE: errno = ERANGE; break;
274-
274+
275275
/* case ff_EAGAIN: same as EWOULDBLOCK */
276276
case ff_EWOULDBLOCK: errno = EWOULDBLOCK; break;
277-
277+
278278
case ff_EINPROGRESS: errno = EINPROGRESS; break;
279279
case ff_EALREADY: errno = EALREADY; break;
280280
case ff_ENOTSOCK: errno = ENOTSOCK; break;

0 commit comments

Comments
 (0)