diff options
author | Srivatsa Sangli <srivrama@cisco.com> | 2016-06-14 13:10:55 -0700 |
---|---|---|
committer | Srivatsa Sangli <srivrama@cisco.com> | 2016-06-14 16:44:36 -0700 |
commit | 820e363a8d60ec05f1cf18c0c3bf7a200f5a896d (patch) | |
tree | cb421ec8094a2c5949fafefe65163d18af3ab48e | |
parent | 0b14072b6925c83d371657058a4b2922aa6541da (diff) |
Add dpdk per-interface startup config parameter to support rss-flag
New parameter allows specifying rss-flag - one or more of following
ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other ipv4
ipv6-tcp-ex ipv6-udp-ex ipv6-frag ipv6-tcp ipv6-udp
ipv6-sctp ipv6-other l2-payload ipv6-ex ipv6
Sample config:
dpdk {
dev 0000:86:00.0 {
rss {
ipv4
ipv4-tcp
ipv4-udp
}
}
}
Change-Id: I33c047d69ef8710b8ba3c7e1a1964d5d54f6e880
Signed-off-by: Srivatsa Sangli <srivrama@cisco.com>
-rw-r--r-- | vnet/vnet/devices/dpdk/dpdk.h | 4 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/format.c | 33 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/init.c | 12 |
3 files changed, 43 insertions, 6 deletions
diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h index eb0a11f91a3..8cd344cff16 100644 --- a/vnet/vnet/devices/dpdk/dpdk.h +++ b/vnet/vnet/devices/dpdk/dpdk.h @@ -315,7 +315,8 @@ typedef struct dpdk_efd_t { _ (num_rx_queues) \ _ (num_tx_queues) \ _ (num_rx_desc) \ - _ (num_tx_desc) + _ (num_tx_desc) \ + _ (rss_fn) typedef struct { vlib_pci_addr_t pci_addr; @@ -617,6 +618,7 @@ format_function_t format_dpdk_rx_dma_trace; format_function_t format_dpdk_rte_mbuf; format_function_t format_dpdk_rx_rte_mbuf; unformat_function_t unformat_socket_mem; +clib_error_t * unformat_rss_fn(unformat_input_t * input, uword * rss_fn); static inline void diff --git a/vnet/vnet/devices/dpdk/format.c b/vnet/vnet/devices/dpdk/format.c index 6e777460f95..c9d8636fedc 100644 --- a/vnet/vnet/devices/dpdk/format.c +++ b/vnet/vnet/devices/dpdk/format.c @@ -72,13 +72,14 @@ _ (rx_errors, q_errors) #define foreach_dpdk_rss_hf \ - _(ETH_RSS_IPV4, "ipv4") \ _(ETH_RSS_FRAG_IPV4, "ipv4-frag") \ _(ETH_RSS_NONFRAG_IPV4_TCP, "ipv4-tcp") \ _(ETH_RSS_NONFRAG_IPV4_UDP, "ipv4-udp") \ _(ETH_RSS_NONFRAG_IPV4_SCTP, "ipv4-sctp") \ _(ETH_RSS_NONFRAG_IPV4_OTHER, "ipv4-other") \ - _(ETH_RSS_IPV6, "ipv6") \ + _(ETH_RSS_IPV4, "ipv4") \ + _(ETH_RSS_IPV6_TCP_EX, "ipv6-tcp-ex") \ + _(ETH_RSS_IPV6_UDP_EX, "ipv6-udp-ex") \ _(ETH_RSS_FRAG_IPV6, "ipv6-frag") \ _(ETH_RSS_NONFRAG_IPV6_TCP, "ipv6-tcp") \ _(ETH_RSS_NONFRAG_IPV6_UDP, "ipv6-udp") \ @@ -86,8 +87,8 @@ _(ETH_RSS_NONFRAG_IPV6_OTHER, "ipv6-other") \ _(ETH_RSS_L2_PAYLOAD, "l2-payload") \ _(ETH_RSS_IPV6_EX, "ipv6-ex") \ - _(ETH_RSS_IPV6_TCP_EX, "ipv6-tcp-ex") \ - _(ETH_RSS_IPV6_UDP_EX, "ipv6-udp-ex") + _(ETH_RSS_IPV6, "ipv6") + #define foreach_dpdk_rx_offload_caps \ _(DEV_RX_OFFLOAD_VLAN_STRIP, "vlan-strip") \ @@ -833,3 +834,27 @@ unformat_socket_mem (unformat_input_t * input, va_list * va) done: return 1; } + +clib_error_t * +unformat_rss_fn (unformat_input_t * input, uword * rss_fn) +{ + while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) + { + if (0) + ; +#undef _ +#define _(f, s) \ + else if (unformat (input, s)) \ + *rss_fn |= f; + + foreach_dpdk_rss_hf +#undef _ + + else + { + return clib_error_return (0, "unknown input `%U'", + format_unformat_error, input); + } + } + return 0; +} diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c index c685fb4170e..6661c2a117d 100644 --- a/vnet/vnet/devices/dpdk/init.c +++ b/vnet/vnet/devices/dpdk/init.c @@ -355,7 +355,10 @@ dpdk_lib_init (dpdk_main_t * dm) { xd->rx_q_used = devconf->num_rx_queues; xd->port_conf.rxmode.mq_mode = ETH_MQ_RX_RSS; - xd->port_conf.rx_adv_conf.rss_conf.rss_hf = ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP; + if (devconf->rss_fn == 0) + xd->port_conf.rx_adv_conf.rss_conf.rss_hf = ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP; + else + xd->port_conf.rx_adv_conf.rss_conf.rss_hf = devconf->rss_fn; } else xd->rx_q_used = 1; @@ -854,6 +857,7 @@ dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr, unforma clib_error_t * error = 0; uword * p; dpdk_device_config_t * devconf; + unformat_input_t sub_input; if (is_default) { @@ -891,6 +895,12 @@ dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr, unforma else if (unformat (input, "workers %U", unformat_bitmap_list, &devconf->workers)) ; + else if (unformat (input, "rss %U", unformat_vlib_cli_sub_input, &sub_input)) + { + error = unformat_rss_fn(&sub_input, &devconf->rss_fn); + if (error) + break; + } else { error = clib_error_return (0, "unknown input `%U'", |