aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorCiprian Barbu <ciprian.barbu@linaro.org>2014-10-01 18:53:50 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2014-10-02 13:51:35 +0400
commite968af6c153700149d1516c733766478e3b52006 (patch)
treecfa2d027597410a8d082d8b8e678898a7040164f /example
parent885542fb76691c49fd61f279f07d3d92841c249b (diff)
Remove pktio type awareness
Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'example')
-rw-r--r--example/generator/odp_generator.c14
-rw-r--r--example/ipsec/odp_ipsec.c38
-rw-r--r--example/l2fwd/odp_l2fwd.c30
-rw-r--r--example/packet/odp_pktio.c40
4 files changed, 27 insertions, 95 deletions
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index 27fc86803..78d9df51d 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -294,8 +294,6 @@ static void *gen_send_thread(void *arg)
odp_pktio_t pktio;
thread_args_t *thr_args;
odp_queue_t outq_def;
- odp_pktio_params_t params;
- socket_params_t *sock_params = &params.sock_params;
odp_buffer_t buf;
@@ -303,8 +301,7 @@ static void *gen_send_thread(void *arg)
thr_args = arg;
/* Open a packet IO instance for this thread */
- sock_params->type = 1;
- pktio = odp_pktio_open(thr_args->pktio_dev, thr_args->pool, &params);
+ pktio = odp_pktio_open(thr_args->pktio_dev, thr_args->pool);
if (pktio == ODP_PKTIO_INVALID) {
ODP_ERR(" [%02i] Error: pktio create failed\n", thr);
return NULL;
@@ -454,10 +451,8 @@ static void *gen_recv_thread(void *arg)
odp_pktio_t pktio;
thread_args_t *thr_args;
odp_queue_t inq_def;
- odp_pktio_params_t params;
char inq_name[ODP_QUEUE_NAME_LEN];
odp_queue_param_t qparam;
- socket_params_t *sock_params = &params.sock_params;
odp_packet_t pkt;
odp_buffer_t buf;
@@ -466,8 +461,7 @@ static void *gen_recv_thread(void *arg)
thr_args = arg;
/* Open a packet IO instance for this thread */
- sock_params->type = 1;
- pktio = odp_pktio_open(thr_args->pktio_dev, thr_args->pool, &params);
+ pktio = odp_pktio_open(thr_args->pktio_dev, thr_args->pool);
if (pktio == ODP_PKTIO_INVALID) {
ODP_ERR(" [%02i] Error: pktio create failed\n", thr);
return NULL;
@@ -901,6 +895,10 @@ static void usage(char *progname)
"\n"
"Optional OPTIONS\n"
" -h, --help Display help and exit.\n"
+ " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n"
+ " ODP_PKTIO_DISABLE_SOCKET_MMSG\n"
+ " ODP_PKTIO_DISABLE_SOCKET_BASIC\n"
+ " can be used to advanced pkt I/O selection for linux-generic\n"
"\n", NO_PATH(progname), NO_PATH(progname)
);
}
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index a9bba24de..cd94d9ab2 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -52,8 +52,6 @@ typedef struct {
int core_count;
int if_count; /**< Number of interfaces to be used */
char **if_names; /**< Array of pointers to interface names */
- int type; /**< Packet IO type */
- int fanout; /**< Packet IO fanout */
crypto_api_mode_e mode; /**< Crypto API preferred mode */
odp_buffer_pool_t pool; /**< Buffer pool for packet IO */
} appl_args_t;
@@ -540,11 +538,9 @@ void initialize_loop(char *intf)
* forwarding database.
*
* @param intf Interface name string
- * @param type Packet IO type (BASIC, MMSG, MMAP)
- * @param fanout Packet IO fanout
*/
static
-void initialize_intf(char *intf, int type, int fanout)
+void initialize_intf(char *intf)
{
odp_pktio_t pktio;
odp_queue_t outq_def;
@@ -552,17 +548,13 @@ void initialize_intf(char *intf, int type, int fanout)
char inq_name[ODP_QUEUE_NAME_LEN];
odp_queue_param_t qparam;
int ret;
- odp_pktio_params_t params;
- socket_params_t *sock_params = &params.sock_params;
uint8_t src_mac[ODPH_ETHADDR_LEN];
char src_mac_str[MAX_STRING];
/*
* Open a packet IO instance for thread and get default output queue
*/
- sock_params->type = type;
- sock_params->fanout = fanout;
- pktio = odp_pktio_open(intf, pkt_pool, &params);
+ pktio = odp_pktio_open(intf, pkt_pool);
if (ODP_PKTIO_INVALID == pktio) {
ODP_ERR("Error: pktio create failed for %s\n", intf);
exit(EXIT_FAILURE);
@@ -1292,9 +1284,7 @@ main(int argc, char *argv[])
if (!strncmp("loop", args->appl.if_names[i], strlen("loop")))
initialize_loop(args->appl.if_names[i]);
else
- initialize_intf(args->appl.if_names[i],
- args->appl.type,
- args->appl.fanout);
+ initialize_intf(args->appl.if_names[i]);
}
/* If we have test streams build them before starting workers */
@@ -1373,12 +1363,10 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
printf("\nParsing command line options\n");
- appl_args->type = 3; /* 3: ODP_PKTIO_TYPE_SOCKET_MMAP */
- appl_args->fanout = 0; /* turn off fanout by default for mmap */
appl_args->mode = 0; /* turn off async crypto API by default */
while (!rc) {
- opt = getopt_long(argc, argv, "+c:i:m:t:f:h:r:p:a:e:s:",
+ opt = getopt_long(argc, argv, "+c:i:m:h:r:p:a:e:s:",
longopts, &long_index);
if (-1 == opt)
@@ -1431,14 +1419,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
}
break;
- case 't':
- appl_args->type = atoi(optarg);
- break;
-
- case 'f':
- appl_args->fanout = atoi(optarg);
- break;
-
case 'm':
appl_args->mode = atoi(optarg);
break;
@@ -1536,12 +1516,6 @@ static void usage(char *progname)
"\n"
"Mandatory OPTIONS:\n"
" -i, --interface Eth interfaces (comma-separated, no spaces)\n"
- " -t, --type 1: ODP_PKTIO_TYPE_SOCKET_BASIC\n"
- " 2: ODP_PKTIO_TYPE_SOCKET_MMSG\n"
- " 3: ODP_PKTIO_TYPE_SOCKET_MMAP\n"
- " 4: ODP_PKTIO_TYPE_NETMAP\n"
- " Default: 3: ODP_PKTIO_TYPE_SOCKET_MMAP\n"
- " -f, --fanout 0: off 1: on (Default 1: on)\n"
" -m, --mode 0: SYNC\n"
" 1: ASYNC_IN_PLACE\n"
" 2: ASYNC_NEW_BUFFER\n"
@@ -1568,6 +1542,10 @@ static void usage(char *progname)
"Optional OPTIONS\n"
" -c, --count <number> Core count.\n"
" -h, --help Display help and exit.\n"
+ " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n"
+ " ODP_PKTIO_DISABLE_SOCKET_MMSG\n"
+ " ODP_PKTIO_DISABLE_SOCKET_BASIC\n"
+ " can be used to advanced pkt I/O selection for linux-generic\n"
"\n", NO_PATH(progname), NO_PATH(progname)
);
}
diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
index 6c1d64af6..fb325c430 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -122,15 +122,11 @@ static void usage(char *progname);
static odp_pktio_t burst_mode_init_params(void *arg, odp_buffer_pool_t pool)
{
thread_args_t *args;
- odp_pktio_params_t params;
- socket_params_t *sock_params = &params.sock_params;
odp_pktio_t pktio;
args = arg;
/* Open a packet IO instance for this thread */
- sock_params->type = args->type;
- sock_params->fanout = args->fanout;
- pktio = odp_pktio_open(args->srcif, pool, &params);
+ pktio = odp_pktio_open(args->srcif, pool);
if (pktio == ODP_PKTIO_INVALID)
ODP_ERR(" Error: pktio create failed");
@@ -417,8 +413,6 @@ int main(int argc, char *argv[])
gbl_args->thread[i].dstif = gbl_args->appl.if_names[if_idx-1];
gbl_args->thread[i].pool = pool;
gbl_args->thread[i].mode = gbl_args->appl.mode;
- gbl_args->thread[i].type = gbl_args->appl.type;
- gbl_args->thread[i].fanout = gbl_args->appl.fanout;
if (gbl_args->appl.mode == APPL_MODE_PKT_BURST) {
pktio = burst_mode_init_params(&gbl_args->thread[i], pool);
@@ -518,11 +512,9 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
};
appl_args->mode = -1; /* Invalid, must be changed by parsing */
- appl_args->type = 3; /* 3: ODP_PKTIO_TYPE_SOCKET_MMAP */
- appl_args->fanout = 1; /* turn off fanout by default for mmap */
while (1) {
- opt = getopt_long(argc, argv, "+c:i:m:t:f:h",
+ opt = getopt_long(argc, argv, "+c:i:m:h",
longopts, &long_index);
if (opt == -1)
@@ -583,14 +575,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
appl_args->mode = APPL_MODE_PKT_QUEUE;
break;
- case 't':
- appl_args->type = atoi(optarg);
- break;
-
- case 'f':
- appl_args->fanout = atoi(optarg);
- break;
-
case 'h':
usage(argv[0]);
exit(EXIT_SUCCESS);
@@ -663,16 +647,14 @@ static void usage(char *progname)
" -i, --interface Eth interfaces (comma-separated, no spaces)\n"
" -m, --mode 0: Burst send&receive packets (no queues)\n"
" 1: Send&receive packets through ODP queues.\n"
- " -t, --type 1: ODP_PKTIO_TYPE_SOCKET_BASIC\n"
- " 2: ODP_PKTIO_TYPE_SOCKET_MMSG\n"
- " 3: ODP_PKTIO_TYPE_SOCKET_MMAP\n"
- " 4: ODP_PKTIO_TYPE_NETMAP\n"
- " Default: 3: ODP_PKTIO_TYPE_SOCKET_MMAP\n"
- " -f, --fanout 0: off 1: on (Default 1: on)\n"
"\n"
"Optional OPTIONS\n"
" -c, --count <number> Core count.\n"
" -h, --help Display help and exit.\n\n"
+ " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n"
+ " ODP_PKTIO_DISABLE_SOCKET_MMSG\n"
+ " ODP_PKTIO_DISABLE_SOCKET_BASIC\n"
+ " can be used to advanced pkt I/O selection for linux-generic\n"
"\n", NO_PATH(progname), NO_PATH(progname)
);
}
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 41315f729..a949a05a2 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -68,8 +68,6 @@ typedef struct {
int if_count; /**< Number of interfaces to be used */
char **if_names; /**< Array of pointers to interface names */
int mode; /**< Packet IO mode */
- int type; /**< Packet IO type */
- int fanout; /**< Packet IO fanout */
odp_buffer_pool_t pool; /**< Buffer pool for packet IO */
} appl_args_t;
@@ -80,8 +78,6 @@ typedef struct {
char *pktio_dev; /**< Interface name to use */
odp_buffer_pool_t pool; /**< Buffer pool for packet IO */
int mode; /**< Thread mode */
- int type; /**< Thread i/o type */
- int fanout; /**< Thread i/o fanout */
} thread_args_t;
/**
@@ -124,8 +120,6 @@ static void *pktio_queue_thread(void *arg)
int ret;
unsigned long pkt_cnt = 0;
unsigned long err_cnt = 0;
- odp_pktio_params_t params;
- socket_params_t *sock_params = &params.sock_params;
thr = odp_thread_id();
thr_args = arg;
@@ -141,9 +135,7 @@ static void *pktio_queue_thread(void *arg)
}
/* Open a packet IO instance for this thread */
- sock_params->type = thr_args->type;
- sock_params->fanout = thr_args->fanout;
- pktio = odp_pktio_open(thr_args->pktio_dev, pkt_pool, &params);
+ pktio = odp_pktio_open(thr_args->pktio_dev, pkt_pool);
if (pktio == ODP_PKTIO_INVALID) {
ODP_ERR(" [%02i] Error: pktio create failed\n", thr);
return NULL;
@@ -237,8 +229,6 @@ static void *pktio_ifburst_thread(void *arg)
unsigned long pkt_cnt = 0;
unsigned long err_cnt = 0;
unsigned long tmp = 0;
- odp_pktio_params_t params;
- socket_params_t *sock_params = &params.sock_params;
thr = odp_thread_id();
thr_args = arg;
@@ -254,9 +244,7 @@ static void *pktio_ifburst_thread(void *arg)
}
/* Open a packet IO instance for this thread */
- sock_params->type = thr_args->type;
- sock_params->fanout = thr_args->fanout;
- pktio = odp_pktio_open(thr_args->pktio_dev, pkt_pool, &params);
+ pktio = odp_pktio_open(thr_args->pktio_dev, pkt_pool);
if (pktio == ODP_PKTIO_INVALID) {
ODP_ERR(" [%02i] Error: pktio create failed.\n", thr);
return NULL;
@@ -395,8 +383,6 @@ int main(int argc, char *argv[])
args->thread[i].pktio_dev = args->appl.if_names[if_idx];
args->thread[i].pool = pool;
args->thread[i].mode = args->appl.mode;
- args->thread[i].type = args->appl.type;
- args->thread[i].fanout = args->appl.fanout;
if (args->appl.mode == APPL_MODE_PKT_BURST)
thr_run_func = pktio_ifburst_thread;
@@ -510,11 +496,9 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
};
appl_args->mode = -1; /* Invalid, must be changed by parsing */
- appl_args->type = 3; /* 3: ODP_PKTIO_TYPE_SOCKET_MMAP */
- appl_args->fanout = 1; /* turn off fanout by default for mmap */
while (1) {
- opt = getopt_long(argc, argv, "+c:i:m:t:f:h",
+ opt = getopt_long(argc, argv, "+c:i:m:h",
longopts, &long_index);
if (opt == -1)
@@ -575,14 +559,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
appl_args->mode = APPL_MODE_PKT_QUEUE;
break;
- case 't':
- appl_args->type = atoi(optarg);
- break;
-
- case 'f':
- appl_args->fanout = atoi(optarg);
- break;
-
case 'h':
usage(argv[0]);
exit(EXIT_SUCCESS);
@@ -652,16 +628,14 @@ static void usage(char *progname)
" -i, --interface Eth interfaces (comma-separated, no spaces)\n"
" -m, --mode 0: Burst send&receive packets (no queues)\n"
" 1: Send&receive packets through ODP queues.\n"
- " -t, --type 1: ODP_PKTIO_TYPE_SOCKET_BASIC\n"
- " 2: ODP_PKTIO_TYPE_SOCKET_MMSG\n"
- " 3: ODP_PKTIO_TYPE_SOCKET_MMAP\n"
- " 4: ODP_PKTIO_TYPE_NETMAP\n"
- " Default: 3: ODP_PKTIO_TYPE_SOCKET_MMAP\n"
- " -f, --fanout 0: off 1: on (Default 1: on)\n"
"\n"
"Optional OPTIONS\n"
" -c, --count <number> Core count.\n"
" -h, --help Display help and exit.\n"
+ " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n"
+ " ODP_PKTIO_DISABLE_SOCKET_MMSG\n"
+ " ODP_PKTIO_DISABLE_SOCKET_BASIC\n"
+ " can be used to advanced pkt I/O selection for linux-generic\n"
"\n", NO_PATH(progname), NO_PATH(progname)
);
}