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

Shahaf Shuler shahafs at mellanox.com
Tue Dec 12 13:26:42 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 | 36 +++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index 1ad4ca3..4edde1b 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -95,17 +95,23 @@
 			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 |
+			     DEV_TX_OFFLOAD_MBUF_FAST_FREE),
 	},
 };
 
@@ -154,7 +160,7 @@
 
 	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;
@@ -162,6 +168,20 @@
 	rx_rings = nb_devices;
 
 	/* Configure ethernet device. */
+	if ((dev_info.rx_offload_capa & port_conf.rxmode.offloads) !=
+	    port_conf.rxmode.offloads) {
+		printf("Some Rx offloads are not supported "
+		       "by port %d: requested 0x%lx supported 0x%lx\n",
+		       port, port_conf.rxmode.offloads,
+		       dev_info.rx_offload_capa);
+	}
+	if ((dev_info.tx_offload_capa & port_conf.txmode.offloads) !=
+			port_conf.txmode.offloads) {
+		printf("Some Tx offloads are not supported "
+		       "by port %d: requested 0x%lx supported 0x%lx\n",
+		       port, port_conf.txmode.offloads,
+		       dev_info.tx_offload_capa);
+	}
 	retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
 	if (retval != 0)
 		return retval;
@@ -172,6 +192,7 @@
 		return retval;
 
 	/* Setup the queues. */
+	rxconf->offloads = 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 +201,7 @@
 		if (retval < 0)
 			return retval;
 	}
+	txconf->offloads = 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),
-- 
1.8.3.1



More information about the dev mailing list