aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rw-r--r--extras/libmemif/examples/icmp_responder-eb/main.c12
-rw-r--r--extras/libmemif/examples/icmp_responder-epoll/main.c13
-rw-r--r--extras/libmemif/examples/icmp_responder-mt/main.c9
-rw-r--r--extras/libmemif/examples/icmp_responder-zero-copy-slave/main.c11
-rw-r--r--extras/libmemif/examples/icmp_responder/icmp_proto.c1
-rw-r--r--extras/libmemif/examples/icmp_responder/main.c3
-rw-r--r--extras/libmemif/test/main_test.c4
-rw-r--r--extras/libmemif/test/unit_test.c6
8 files changed, 14 insertions, 45 deletions
diff --git a/extras/libmemif/examples/icmp_responder-eb/main.c b/extras/libmemif/examples/icmp_responder-eb/main.c
index 9e71d283c2c..646a6ca0511 100644
--- a/extras/libmemif/examples/icmp_responder-eb/main.c
+++ b/extras/libmemif/examples/icmp_responder-eb/main.c
@@ -462,6 +462,9 @@ icmpr_add_external_region (void * *addr, uint32_t size, int *fd,
err = ftruncate (rfd, size);
+ if (err)
+ return err;
+
raddr = mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, rfd, 0);
*addr = raddr;
@@ -500,7 +503,6 @@ on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
int err = MEMIF_ERR_SUCCESS, ret_val;
uint16_t rx = 0, tx = 0;
- uint16_t fb = 0;
int i = 0;
int j = 0;
@@ -579,8 +581,6 @@ on_interrupt1 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
int err = MEMIF_ERR_SUCCESS, ret_val;
int i;
uint16_t rx, tx;
- uint16_t fb;
- uint16_t pck_seq;
do
{
@@ -657,7 +657,6 @@ icmpr_memif_create (long index, long mode, char *s)
memif_connection_t *c = &memif_connection[index];
memif_conn_args_t args;
- int fd = -1;
memset (&args, 0, sizeof (args));
args.is_master = mode;
args.log2_ring_size = 11;
@@ -830,8 +829,6 @@ icmpr_send (long index, long packet_num, char *hw, char *ip)
memif_connection_t *c = &memif_connection[index];
if (c->conn == NULL)
return -1;
- int err, i;
- uint16_t tx = 0, rx = 0;
char *end, *ui;
uint8_t tmp[6];
icmpr_thread_data_t *data = &icmpr_thread_data[index];
@@ -977,9 +974,8 @@ done:
int
poll_event (int timeout)
{
- struct epoll_event evt, *e;
+ struct epoll_event evt;
int app_err = 0, memif_err = 0, en = 0;
- int tmp, nfd;
uint32_t events = 0;
memset (&evt, 0, sizeof (evt));
evt.events = EPOLLIN | EPOLLOUT;
diff --git a/extras/libmemif/examples/icmp_responder-epoll/main.c b/extras/libmemif/examples/icmp_responder-epoll/main.c
index 02414fa25be..ecc05a41e77 100644
--- a/extras/libmemif/examples/icmp_responder-epoll/main.c
+++ b/extras/libmemif/examples/icmp_responder-epoll/main.c
@@ -372,7 +372,6 @@ on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
int err = MEMIF_ERR_SUCCESS, ret_val;
uint16_t rx = 0, tx = 0;
- uint16_t fb = 0;
int i = 0; /* rx buffer iterator */
int j = 0; /* tx bufferiterator */
@@ -457,10 +456,8 @@ on_interrupt0 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
int err = MEMIF_ERR_SUCCESS, ret_val;
uint16_t rx = 0, tx = 0;
- uint16_t fb;
int i; /* rx buffer iterator */
int j; /* tx bufferiterator */
- int prev_i; /* first allocated rx buffer */
/* loop while there are packets in shm */
do
@@ -475,7 +472,7 @@ on_interrupt0 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
goto error;
}
- prev_i = i = 0;
+ i = 0;
/* loop while there are RX buffers to be processed */
while (rx)
@@ -522,7 +519,6 @@ on_interrupt0 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
if (err != MEMIF_ERR_SUCCESS)
INFO ("memif_buffer_free: %s", memif_strerror (err));
rx -= j;
- prev_i = i;
DBG ("freed %d buffers. %u/%u alloc/free buffers",
fb, rx, MAX_MEMIF_BUFS - rx);
@@ -570,8 +566,6 @@ on_interrupt1 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
int err = MEMIF_ERR_SUCCESS, ret_val;
int i;
uint16_t rx, tx;
- uint16_t fb;
- uint16_t pck_seq;
do
{
@@ -639,7 +633,6 @@ icmpr_memif_create (long index, long mode, char *s)
/* setting memif connection arguments */
memif_conn_args_t args;
- int fd = -1;
memset (&args, 0, sizeof (args));
args.is_master = mode;
args.log2_ring_size = 11;
@@ -1106,7 +1099,6 @@ error:
int
user_input_handler ()
{
- int i;
char *in = (char *) malloc (256);
char *ui = fgets (in, 256, stdin);
char *end;
@@ -1223,9 +1215,8 @@ done:
int
poll_event (int timeout)
{
- struct epoll_event evt, *e;
+ struct epoll_event evt;
int app_err = 0, memif_err = 0, en = 0;
- int tmp, nfd;
uint32_t events = 0;
struct timespec start, end;
memset (&evt, 0, sizeof (evt));
diff --git a/extras/libmemif/examples/icmp_responder-mt/main.c b/extras/libmemif/examples/icmp_responder-mt/main.c
index 8fa64cf93af..bc2f71dd328 100644
--- a/extras/libmemif/examples/icmp_responder-mt/main.c
+++ b/extras/libmemif/examples/icmp_responder-mt/main.c
@@ -112,7 +112,6 @@ pthread_t thread[MAX_THREADS];
void
user_signal_handler (int sig)
{
- sig = sig;
}
static void
@@ -375,9 +374,8 @@ memif_rx_interrupt (void *ptr)
memif_connection_t *c = &memif_connection[data->index];
int err;
uint16_t rx = 0, tx = 0, fb = 0;
- struct epoll_event evt, *e;
+ struct epoll_event evt;
int en = 0;
- uint32_t events = 0;
sigset_t sigset;
signal (SIGUSR1, user_signal_handler);
@@ -602,7 +600,6 @@ icmpr_memif_create (long index)
/* setting memif connection arguments */
memif_conn_args_t args;
- int fd = -1;
memset (&args, 0, sizeof (args));
args.is_master = 0;
args.log2_ring_size = 10;
@@ -765,7 +762,6 @@ error:
int
user_input_handler ()
{
- int i;
char *in = (char *) malloc (256);
char *ui = fgets (in, 256, stdin);
char *end;
@@ -830,9 +826,8 @@ done:
int
poll_event (int timeout)
{
- struct epoll_event evt, *e;
+ struct epoll_event evt;
int app_err = 0, memif_err = 0, en = 0;
- int tmp, nfd;
uint32_t events = 0;
memset (&evt, 0, sizeof (evt));
evt.events = EPOLLIN | EPOLLOUT;
diff --git a/extras/libmemif/examples/icmp_responder-zero-copy-slave/main.c b/extras/libmemif/examples/icmp_responder-zero-copy-slave/main.c
index aad33039bd8..7913588299a 100644
--- a/extras/libmemif/examples/icmp_responder-zero-copy-slave/main.c
+++ b/extras/libmemif/examples/icmp_responder-zero-copy-slave/main.c
@@ -330,9 +330,7 @@ on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
int err = MEMIF_ERR_SUCCESS, ret_val;
uint16_t rx = 0, tx = 0;
- uint16_t fb = 0;
int i = 0; /* rx buffer iterator */
- int j = 0; /* tx bufferiterator */
/* loop while there are packets in shm */
do
@@ -413,9 +411,7 @@ on_interrupt0 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
int err = MEMIF_ERR_SUCCESS, ret_val;
uint16_t rx = 0, tx = 0;
- uint16_t fb = 0;
int i = 0; /* rx buffer iterator */
- int j = 0; /* tx bufferiterator */
/* loop while there are packets in shm */
do
@@ -497,8 +493,6 @@ on_interrupt1 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
int err = MEMIF_ERR_SUCCESS, ret_val;
int i;
uint16_t rx, tx;
- uint16_t fb;
- uint16_t pck_seq;
do
{
@@ -565,7 +559,6 @@ icmpr_memif_create (long index, long mode, char *s)
/* setting memif connection arguments */
memif_conn_args_t args;
- int fd = -1;
memset (&args, 0, sizeof (args));
args.is_master = mode;
args.log2_ring_size = 11;
@@ -1051,7 +1044,6 @@ error:
int
user_input_handler ()
{
- int i;
char *in = (char *) malloc (256);
char *ui = fgets (in, 256, stdin);
char *end;
@@ -1167,9 +1159,8 @@ done:
int
poll_event (int timeout)
{
- struct epoll_event evt, *e;
+ struct epoll_event evt;
int app_err = 0, memif_err = 0, en = 0;
- int tmp, nfd;
uint32_t events = 0;
struct timespec start, end;
memset (&evt, 0, sizeof (evt));
diff --git a/extras/libmemif/examples/icmp_responder/icmp_proto.c b/extras/libmemif/examples/icmp_responder/icmp_proto.c
index e1d255aca27..785aebd5567 100644
--- a/extras/libmemif/examples/icmp_responder/icmp_proto.c
+++ b/extras/libmemif/examples/icmp_responder/icmp_proto.c
@@ -458,7 +458,6 @@ int
resolve_packet3 (void **pck_, uint32_t * size, uint8_t ip_addr[4])
{
struct ether_header *eh;
- struct ether_arp *eah;
struct iphdr *ip;
struct icmphdr *icmp;
int32_t offset = 0;
diff --git a/extras/libmemif/examples/icmp_responder/main.c b/extras/libmemif/examples/icmp_responder/main.c
index fa7bcb9a636..2e85d0320d5 100644
--- a/extras/libmemif/examples/icmp_responder/main.c
+++ b/extras/libmemif/examples/icmp_responder/main.c
@@ -290,6 +290,7 @@ on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
memif_connection_t *c = &memif_connection;
int err;
uint16_t rx;
+ uint16_t fb = 0;
/* receive data from shared memory buffers */
err = memif_rx_burst (c->conn, qid, c->rx_bufs, MAX_MEMIF_BUFS, &rx);
c->rx_buf_num += rx;
@@ -311,7 +312,6 @@ on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
&(c->tx_bufs + i)->len, c->ip_addr);
}
- uint16_t fb;
/* mark memif buffers and shared memory buffers as free */
err = memif_refill_queue (c->conn, qid, rx, 0);
c->rx_buf_num -= fb;
@@ -338,7 +338,6 @@ icmpr_memif_create (int is_master)
{
/* setting memif connection arguments */
memif_conn_args_t args;
- int fd = -1;
memset (&args, 0, sizeof (args));
args.is_master = is_master;
args.log2_ring_size = 10;
diff --git a/extras/libmemif/test/main_test.c b/extras/libmemif/test/main_test.c
index e4697beb56f..6c29babcb2e 100644
--- a/extras/libmemif/test/main_test.c
+++ b/extras/libmemif/test/main_test.c
@@ -173,8 +173,6 @@ START_TEST (test_create_master)
memset (&args, 0, sizeof (args));
args.is_master = 1;
- libmemif_main_t *lm = &libmemif_main;
-
if ((err =
memif_init (control_fd_update, TEST_APP_NAME, NULL,
NULL, NULL)) != MEMIF_ERR_SUCCESS)
@@ -584,7 +582,7 @@ END_TEST
START_TEST (test_rx_burst)
{
int err, i;
- uint16_t max_buf = 10, buf, rx;
+ uint16_t max_buf = 10, rx;
uint8_t qid;
memif_buffer_t *bufs;
memif_queue_t *mq;
diff --git a/extras/libmemif/test/unit_test.c b/extras/libmemif/test/unit_test.c
index a305de93fbe..9c9a8d4de66 100644
--- a/extras/libmemif/test/unit_test.c
+++ b/extras/libmemif/test/unit_test.c
@@ -46,13 +46,13 @@ int
main (void)
{
int num_fail;
- Suite *main, *socket;
+ Suite *mains, *socket;
SRunner *sr;
- main = main_suite ();
+ mains = main_suite ();
socket = socket_suite ();
- sr = srunner_create (main);
+ sr = srunner_create (mains);
srunner_add_suite (sr, socket);