From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bjorn.topel@intel.com>
Received: from mga05.intel.com (mga05.intel.com [192.55.52.43])
 by dpdk.org (Postfix) with ESMTP id 948963772
 for <dev@dpdk.org>; Wed,  9 Nov 2016 09:23:54 +0100 (CET)
Received: from fmsmga006.fm.intel.com ([10.253.24.20])
 by fmsmga105.fm.intel.com with ESMTP; 09 Nov 2016 00:23:53 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.31,465,1473145200"; d="scan'208";a="29087125"
Received: from rmitura-mobl1.ger.corp.intel.com (HELO btopel-mobl1.intel.com)
 ([10.252.24.154])
 by fmsmga006.fm.intel.com with ESMTP; 09 Nov 2016 00:23:51 -0800
From: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= <bjorn.topel@intel.com>
To: dev@dpdk.org
Cc: qian.q.xu@intel.com, lei.a.yao@intel.com, jingjing.wu@intel.com,
 thomas.monjalon@6wind.com,
 =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= <bjorn.topel@intel.com>
Date: Wed,  9 Nov 2016 09:23:41 +0100
Message-Id: <20161109082341.19825-1-bjorn.topel@intel.com>
X-Mailer: git-send-email 2.9.3
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH] examples/l3fwd: force CRC stripping for i40evf
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 09 Nov 2016 08:23:55 -0000

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(-)

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;
-- 
2.9.3