summaryrefslogtreecommitdiffstats
path: root/src/main_dpdk.cpp
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-07-15 18:33:24 +0300
committerHanoh Haim <hhaim@cisco.com>2016-07-15 18:33:24 +0300
commit76cde6b6406fe14b6e8a2196bf1b38eb4ea2c458 (patch)
tree5be76b3a32db5e0c97359fa010243a83863e7f4a /src/main_dpdk.cpp
parentaf72dceeff1811557c658f716d00ecfc55395593 (diff)
parent659ba2606be997631d736070d2efd92472496a11 (diff)
merge cs_offload WIP - need to add more support and tests for that
Diffstat (limited to 'src/main_dpdk.cpp')
-rw-r--r--src/main_dpdk.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index 17b9f25f..7bff8253 100644
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -50,6 +50,7 @@
#include <rte_mbuf.h>
#include <rte_random.h>
#include <rte_version.h>
+#include <rte_ip.h>
#include "bp_sim.h"
#include "os_time.h"
@@ -554,7 +555,8 @@ enum { OPT_HELP,
OPT_PREFIX,
OPT_SEND_DEBUG_PKT,
OPT_NO_WATCHDOG,
- OPT_ALLOW_COREDUMP
+ OPT_ALLOW_COREDUMP,
+ OPT_CHECKSUM_OFFLOAD,
};
@@ -618,6 +620,7 @@ static CSimpleOpt::SOption parser_options[] =
{ OPT_MBUF_FACTOR , "--mbuf-factor", SO_REQ_SEP },
{ OPT_NO_WATCHDOG , "--no-watchdog", SO_NONE },
{ OPT_ALLOW_COREDUMP , "--allow-coredump", SO_NONE },
+ { OPT_CHECKSUM_OFFLOAD, "--checksum-offload", SO_NONE },
SO_END_OF_OPTIONS
@@ -724,7 +727,8 @@ static int usage(){
printf(" --allow-coredump : allow a creation of core dump \n");
printf(" \n");
printf(" --vm-sim : simulate vm with driver of one input queue and one output queue \n");
-
+ printf(" \n");
+ printf(" --checksum-offload : enable IP, TCP and UDP tx checksum offloading with DPDK. This requires all used interfaces to support this \n");
printf(" \n");
printf(" Examples: ");
printf(" basic trex run for 10 sec and multiplier of x10 \n");
@@ -981,6 +985,10 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t
po->m_debug_pkt_proto = (uint8_t)tmp_data;
break;
+ case OPT_CHECKSUM_OFFLOAD:
+ po->preview.setChecksumOffloadEnable(true);
+ break;
+
default:
usage();
@@ -1327,6 +1335,19 @@ void CPhyEthIF::configure(uint16_t nb_rx_queue,
/* get device info */
rte_eth_dev_info_get(m_port_id, &m_dev_info);
+ if (CGlobalInfo::m_options.preview.getChecksumOffloadEnable()) {
+ /* check if the device supports TCP and UDP checksum offloading */
+ if ((m_dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) == 0) {
+ rte_exit(EXIT_FAILURE, "Device does not support UDP checksum offload: "
+ "port=%u\n",
+ m_port_id);
+ }
+ if ((m_dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) == 0) {
+ rte_exit(EXIT_FAILURE, "Device does not support TCP checksum offload: "
+ "port=%u\n",
+ m_port_id);
+ }
+ }
}