Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions onvm/go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ function usage {
echo -e "\tRuns ONVM the same way as above, but prints statistics to stdout"
echo -e "$0 -k 3 -n 0xF0 -m 2,3,4 -s stdout -c"
echo -e "\tRuns ONVM the same way as above, but enables shared cpu support"
echo -e "$0 -k 3 -n 0xF0 -m 2,3,4 -s stdout -c -j"
echo -e "\tRuns ONVM the same way as above, but allows ports to send and receive jumbo frames"
echo -e "$0 -k 3 -n 0xF0 -m 2,3,4 -s stdout -t 42"
echo -e "\tRuns ONVM the same way as above, but shuts down after 42 seconds"
echo -e "$0 -k 3 -n 0xF0 -m 2,3,4 -s stdout -l 64"
Expand Down Expand Up @@ -110,7 +112,7 @@ then
exit 1
fi

while getopts "a:r:d:s:t:l:p:z:cvm:k:n:" opt; do
while getopts "a:r:d:s:t:l:p:z:cvm:k:n:j" opt; do
case $opt in
a) virt_addr="--base-virtaddr=$OPTARG";;
r) num_srvc="-r $OPTARG";;
Expand Down Expand Up @@ -152,6 +154,7 @@ while getopts "a:r:d:s:t:l:p:z:cvm:k:n:" opt; do
else
nf_cores=$OPTARG
fi;;
j) jumbo_frames_flag="-j";;
\?) echo "Unknown option -$OPTARG" && usage
;;
esac
Expand Down Expand Up @@ -269,7 +272,7 @@ fi
sudo rm -rf /mnt/huge/rtemap_*
# watch out for variable expansion
# shellcheck disable=SC2086
sudo "$SCRIPTPATH"/onvm_mgr/"$RTE_TARGET"/onvm_mgr -l "$cpu" -n 4 --proc-type=primary ${virt_addr} -- -p ${ports} -n ${nf_cores} ${num_srvc} ${def_srvc} ${stats} ${stats_sleep_time} ${verbosity_level} ${ttl} ${packet_limit} ${shared_cpu_flag}
sudo "$SCRIPTPATH"/onvm_mgr/"$RTE_TARGET"/onvm_mgr -l "$cpu" -n 4 --proc-type=primary ${virt_addr} -- -p ${ports} -n ${nf_cores} ${num_srvc} ${def_srvc} ${stats} ${stats_sleep_time} ${verbosity_level} ${ttl} ${packet_limit} ${shared_cpu_flag} ${jumbo_frames_flag}

if [ "${stats}" = "-s web" ]
then
Expand Down
14 changes: 11 additions & 3 deletions onvm/onvm_mgr/onvm_args.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ uint8_t global_verbosity_level = 1;
/* global flag for enabling shared core logic - extern in init.h */
uint8_t ONVM_NF_SHARE_CORES = 0;

/* global flag for jumbo frames - extern in init.h */
uint8_t ONVM_USE_JUMBO_FRAMES = 0;

/* global var for program name */
static const char *progname;

Expand Down Expand Up @@ -126,11 +129,12 @@ parse_app_args(uint8_t max_ports, int argc, char *argv[]) {
{"nf-cores", required_argument, NULL, 'n'}, {"default-service", required_argument, NULL, 'd'},
{"stats-out", no_argument, NULL, 's'}, {"stats-sleep-time", no_argument, NULL, 'z'},
{"time_to_live", no_argument, NULL, 't'}, {"packet_limit", no_argument, NULL, 'l'},
{"verbocity-level", no_argument, NULL, 'v'}, {"enable_shared_cpu", no_argument, NULL, 'c'}};
{"verbocity-level", no_argument, NULL, 'v'}, {"enable_shared_cpu", no_argument, NULL, 'c'},
{"jumbo_frames", no_argument, NULL, 'j'}};

progname = argv[0];

while ((opt = getopt_long(argc, argvopt, "p:r:n:d:s:t:l:z:v:c", lgopts, &option_index)) != EOF) {
while ((opt = getopt_long(argc, argvopt, "p:r:n:d:s:t:l:z:v:cj", lgopts, &option_index)) != EOF) {
switch (opt) {
case 'p':
if (parse_portmask(max_ports, optarg) != 0) {
Expand Down Expand Up @@ -192,6 +196,9 @@ parse_app_args(uint8_t max_ports, int argc, char *argv[]) {
onvm_config->flags.ONVM_NF_SHARE_CORES = 1;
ONVM_NF_SHARE_CORES = 1;
break;
case 'j':
ONVM_USE_JUMBO_FRAMES = 1;
break;
default:
printf("ERROR: Unknown option '%c'\n", opt);
usage();
Expand All @@ -216,7 +223,8 @@ usage(void) {
"\t-t TTL: time to live, how many seconds to wait until exiting (optional)\n"
"\t-l PACKET_LIMIT: how many millions of packets to recieve before exiting (optional)\n"
"\t-v VERBOCITY_LEVEL: verbocity level of the stats output (optional)\n"
"\t-c ENABLE_SHARED_CORE: allow the NFs to share a core based on mutex sleep/wakeups (optional)\n",
"\t-c ENABLE_SHARED_CORE: allow the NFs to share a core based on mutex sleep/wakeups (optional)\n"
"\t-j JUMBO_FRAMES: allow the ports to send and receive jumbo frames (optional)\n",
progname);
}

Expand Down
14 changes: 13 additions & 1 deletion onvm/onvm_mgr/onvm_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,17 @@ set_default_config(struct onvm_configuration *config) {
*/
static int
init_mbuf_pools(void) {
uint16_t mbuf_size;

if (ONVM_USE_JUMBO_FRAMES)
mbuf_size = 9600 + RTE_ETHER_CRC_LEN + RTE_ETHER_HDR_LEN + MBUF_OVERHEAD;
else
mbuf_size = RTE_MBUF_DEFAULT_DATAROOM + MBUF_OVERHEAD;

/* don't pass single-producer/single-consumer flags to mbuf create as it
* seems faster to use a cache instead */
printf("Creating mbuf pool '%s' [%u mbufs] ...\n", PKTMBUF_POOL_NAME, NUM_MBUFS);
pktmbuf_pool = rte_mempool_create(PKTMBUF_POOL_NAME, NUM_MBUFS, MBUF_SIZE, MBUF_CACHE_SIZE,
pktmbuf_pool = rte_mempool_create(PKTMBUF_POOL_NAME, NUM_MBUFS, mbuf_size, MBUF_CACHE_SIZE,
sizeof(struct rte_pktmbuf_pool_private), rte_pktmbuf_pool_init, NULL,
rte_pktmbuf_init, NULL, rte_socket_id(), NO_FLAGS);

Expand Down Expand Up @@ -363,6 +370,11 @@ init_port(uint8_t port_num) {
port_num, port_conf.rx_adv_conf.rss_conf.rss_hf, local_port_conf.rx_adv_conf.rss_conf.rss_hf);
}

if (ONVM_USE_JUMBO_FRAMES) {
local_port_conf.rxmode.max_rx_pkt_len = 9600 + RTE_ETHER_CRC_LEN + RTE_ETHER_HDR_LEN;
local_port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
}

if ((retval = rte_eth_dev_configure(port_num, rx_rings, tx_rings, &local_port_conf)) != 0)
return retval;

Expand Down
3 changes: 1 addition & 2 deletions onvm/onvm_mgr/onvm_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@

#define MBUF_CACHE_SIZE 512
#define MBUF_OVERHEAD (sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
#define RX_MBUF_DATA_SIZE 2048
#define MBUF_SIZE (RX_MBUF_DATA_SIZE + MBUF_OVERHEAD)

#define NF_INFO_SIZE sizeof(struct onvm_nf_init_cfg)

Expand Down Expand Up @@ -126,6 +124,7 @@ extern uint8_t global_verbosity_level;
/* Custom flags for onvm */
extern struct onvm_configuration *onvm_config;
extern uint8_t ONVM_NF_SHARE_CORES;
extern uint8_t ONVM_USE_JUMBO_FRAMES;

/* For handling shared core logic */
extern struct nf_wakeup_info *nf_wakeup_infos;
Expand Down