[dpdk-dev] examples/l3fwd: force CRC stripping for i40evf

Message ID 2DBBFF226F7CF64BAFCA79B681719D9537F24DE5@shsmsx102.ccr.corp.intel.com (mailing list archive)
State Not Applicable, archived
Headers

Commit Message

Yao, Lei A Nov. 9, 2016, 8:37 a.m. UTC
  Tested-by: Lei Yao <lei.a.yao@intel.com>

- Apply patch to v16.11-rc3
- Compile: Pass
- Host OS: VMware ESXi 6.0
- VM OS: Fedora 20
- GCC: 4.8.3

Tested with this patch, l3fwd sample can work with i40e VF with Fedora VM using VMware as the host.

-----Original Message-----
From: Topel, Bjorn 

Sent: Wednesday, November 9, 2016 4:24 PM
To: dev@dpdk.org
Cc: Xu, Qian Q <qian.q.xu@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; thomas.monjalon@6wind.com; Topel, Bjorn <bjorn.topel@intel.com>
Subject: [PATCH] examples/l3fwd: force CRC stripping for i40evf

Commit 1bbcc5d21129 ("i40evf: report error for unsupported CRC stripping config") broke l3fwd, since it was forcing that CRC was kept. Now, if i40evf is running, CRC stripping will be enabled.

Signed-off-by: Björn Töpel <bjorn.topel@intel.com>

---
 examples/l3fwd/main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

--
2.9.3
  

Patch

diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 7223e773107e..b60278794135 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -906,6 +906,14 @@  main(int argc, char **argv)
 			n_tx_queue = MAX_TX_QUEUE_PER_PORT;
 		printf("Creating queues: nb_rxq=%d nb_txq=%u... ",
 			nb_rx_queue, (unsigned)n_tx_queue );
+		rte_eth_dev_info_get(portid, &dev_info);
+		if (dev_info.driver_name &&
+		    strcmp(dev_info.driver_name, "net_i40e_vf") == 0) {
+			/* i40evf require that CRC stripping is enabled. */
+			port_conf.rxmode.hw_strip_crc = 1;
+		} else {
+			port_conf.rxmode.hw_strip_crc = 0;
+		}
 		ret = rte_eth_dev_configure(portid, nb_rx_queue,
 					(uint16_t)n_tx_queue, &port_conf);
 		if (ret < 0)
@@ -946,7 +954,6 @@  main(int argc, char **argv)
 			printf("txq=%u,%d,%d ", lcore_id, queueid, socketid);
 			fflush(stdout);
 
-			rte_eth_dev_info_get(portid, &dev_info);
 			txconf = &dev_info.default_txconf;
 			if (port_conf.rxmode.jumbo_frame)
 				txconf->txq_flags = 0;