From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <jingche2@shecgisg004.sh.intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id E8DC158F1
 for <dev@dpdk.org>; Fri, 27 Nov 2015 02:55:54 +0100 (CET)
Received: from fmsmga002.fm.intel.com ([10.253.24.26])
 by fmsmga102.fm.intel.com with ESMTP; 26 Nov 2015 17:55:54 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.20,349,1444719600"; d="scan'208";a="860564867"
Received: from shvmail01.sh.intel.com ([10.239.29.42])
 by fmsmga002.fm.intel.com with ESMTP; 26 Nov 2015 17:55:53 -0800
Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com
 [10.239.29.89])
 by shvmail01.sh.intel.com with ESMTP id tAR1tpu7001373;
 Fri, 27 Nov 2015 09:55:51 +0800
Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1])
 by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id
 tAR1tmOc016275; Fri, 27 Nov 2015 09:55:50 +0800
Received: (from jingche2@localhost)
 by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id tAR1tmt9016271;
 Fri, 27 Nov 2015 09:55:48 +0800
From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
To: dev@dpdk.org
Date: Fri, 27 Nov 2015 09:55:45 +0800
Message-Id: <1448589345-16239-1-git-send-email-jing.d.chen@intel.com>
X-Mailer: git-send-email 1.7.12.2
Subject: [dpdk-dev] [PATCH] fm10k: fix wrong Rx func is used
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: Fri, 27 Nov 2015 01:55:55 -0000

From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>

Steps to reproduce the bug:
1. All Rx offloading is disabled and start the device, then
   Vector Rx is used.
2. Stop the device. Re-configure to enable hw_ip_checksum = 1,
   start the device again.
3. In this case, assume regular Rx should be used since Vector
   Rx doesn't support ip checksum offload. But actually Vector
   Rx is used and cause checksum won't be done by hardware.

The reason is after re-configuring, driver misses an "else" in
func fm10k_set_rx_function(). Then Rx func in last round are
used.

Fixes:77a8ab47("fm10k: select best Rx function")

Reported-by: Xiao Wang <xiao.w.wang@intel.com>
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
 drivers/net/fm10k/fm10k_ethdev.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 4f23ce3..e4aed94 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2486,6 +2486,8 @@ fm10k_set_rx_function(struct rte_eth_dev *dev)
 			dev->rx_pkt_burst = fm10k_recv_pkts_vec;
 	} else if (dev->data->scattered_rx)
 		dev->rx_pkt_burst = fm10k_recv_scattered_pkts;
+	else
+		dev->rx_pkt_burst = fm10k_recv_pkts;
 
 	rx_using_sse =
 		(dev->rx_pkt_burst == fm10k_recv_scattered_pkts_vec ||
-- 
1.7.7.6