From 524efb72d3c8f55754af1374f192f1edc9b08d16 Mon Sep 17 00:00:00 2001 From: Shahaf Shuler Date: Tue, 26 Dec 2017 11:23:24 +0200 Subject: [PATCH] examples/tep_termination: convert to new ethdev offloads API Ethdev offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") This commit support the new API. Signed-off-by: Shahaf Shuler Reviewed-by: Ferruh Yigit --- examples/tep_termination/vxlan_setup.c | 29 ++++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index f790255783..ba7d92aac1 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -66,17 +66,22 @@ uint8_t tep_filter_type[] = {RTE_TUNNEL_FILTER_IMAC_TENID, RTE_TUNNEL_FILTER_OMAC_TENID_IMAC,}; /* Options for configuring ethernet port */ -static const struct rte_eth_conf port_conf = { +static struct rte_eth_conf port_conf = { .rxmode = { .split_hdr_size = 0, - .header_split = 0, /**< Header Split disabled */ - .hw_ip_checksum = 0, /**< IP checksum offload disabled */ - .hw_vlan_filter = 0, /**< VLAN filtering disabled */ - .jumbo_frame = 0, /**< Jumbo Frame Support disabled */ - .hw_strip_crc = 1, /**< CRC stripped by hardware */ + .ignore_offload_bitfield = 1, + .offloads = DEV_RX_OFFLOAD_CRC_STRIP, }, .txmode = { .mq_mode = ETH_MQ_TX_NONE, + .offloads = (DEV_TX_OFFLOAD_IPV4_CKSUM | + DEV_TX_OFFLOAD_UDP_CKSUM | + DEV_TX_OFFLOAD_TCP_CKSUM | + DEV_TX_OFFLOAD_SCTP_CKSUM | + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | + DEV_TX_OFFLOAD_TCP_TSO | + DEV_TX_OFFLOAD_MULTI_SEGS | + DEV_TX_OFFLOAD_VXLAN_TNL_TSO), }, }; @@ -112,6 +117,7 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool) struct rte_eth_rxconf *rxconf; struct rte_eth_txconf *txconf; struct vxlan_conf *pconf = &vxdev; + struct rte_eth_conf local_port_conf = port_conf; pconf->dst_port = udp_port; @@ -125,15 +131,18 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool) rxconf = &dev_info.default_rxconf; txconf = &dev_info.default_txconf; - txconf->txq_flags = 0; + txconf->txq_flags = ETH_TXQ_FLAGS_IGNORE; if (port >= rte_eth_dev_count()) return -1; rx_rings = nb_devices; - + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE) + local_port_conf.txmode.offloads |= + DEV_TX_OFFLOAD_MBUF_FAST_FREE; /* Configure ethernet device. */ - retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf); + retval = rte_eth_dev_configure(port, rx_rings, tx_rings, + &local_port_conf); if (retval != 0) return retval; @@ -143,6 +152,7 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; /* Setup the queues. */ + rxconf->offloads = local_port_conf.rxmode.offloads; for (q = 0; q < rx_rings; q++) { retval = rte_eth_rx_queue_setup(port, q, rx_ring_size, rte_eth_dev_socket_id(port), @@ -151,6 +161,7 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool) if (retval < 0) return retval; } + txconf->offloads = local_port_conf.txmode.offloads; for (q = 0; q < tx_rings; q++) { retval = rte_eth_tx_queue_setup(port, q, tx_ring_size, rte_eth_dev_socket_id(port), -- 2.20.1