[dpdk-dev] [PATCH v3 25/39] examples/tep_termination: convert to new ethdev offloads API

Shahaf Shuler shahafs at mellanox.com
Tue Dec 26 10:23:24 CET 2017


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 <shahafs at mellanox.com>
---
 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 1ad4ca3cd..b53f8fc8d 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -95,17 +95,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),
 	},
 };
 
@@ -141,6 +146,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;
 
@@ -154,15 +160,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;
 
@@ -172,6 +181,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),
@@ -180,6 +190,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.12.0



More information about the dev mailing list