X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fl2fwd-event%2Fl2fwd_common.c;h=ab341e55b299785bdde7a5f12b46d1d40138f026;hb=50d22ef9453c5c6033effeed93043ca784c1ce0b;hp=c206415d07ebc1cd5b55964bc3984874f980ce0f;hpb=4ff457986f760a9d96a2bc82e3f24f2817cd33aa;p=dpdk.git diff --git a/examples/l2fwd-event/l2fwd_common.c b/examples/l2fwd-event/l2fwd_common.c index c206415d07..ab341e55b2 100644 --- a/examples/l2fwd-event/l2fwd_common.c +++ b/examples/l2fwd-event/l2fwd_common.c @@ -1,3 +1,7 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + #include "l2fwd_common.h" int @@ -18,6 +22,12 @@ l2fwd_event_init_ports(struct l2fwd_resources *rsrc) uint16_t port_id; int ret; + if (rsrc->event_mode) { + port_conf.rxmode.mq_mode = ETH_MQ_RX_RSS; + port_conf.rx_adv_conf.rss_conf.rss_key = NULL; + port_conf.rx_adv_conf.rss_conf.rss_hf = ETH_RSS_IP; + } + /* Initialise each port */ RTE_ETH_FOREACH_DEV(port_id) { struct rte_eth_conf local_port_conf = port_conf; @@ -35,7 +45,22 @@ l2fwd_event_init_ports(struct l2fwd_resources *rsrc) /* init port */ printf("Initializing port %u... ", port_id); fflush(stdout); - rte_eth_dev_info_get(port_id, &dev_info); + + ret = rte_eth_dev_info_get(port_id, &dev_info); + if (ret != 0) + rte_panic("Error during getting device (port %u) info: %s\n", + port_id, strerror(-ret)); + local_port_conf.rx_adv_conf.rss_conf.rss_hf &= + dev_info.flow_type_rss_offloads; + if (local_port_conf.rx_adv_conf.rss_conf.rss_hf != + port_conf.rx_adv_conf.rss_conf.rss_hf) { + printf("Port %u modified RSS hash function based on hardware support," + "requested:%#"PRIx64" configured:%#"PRIx64"", + port_id, + port_conf.rx_adv_conf.rss_conf.rss_hf, + local_port_conf.rx_adv_conf.rss_conf.rss_hf); + } + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE) local_port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE;