From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <nuxi@vault24.org>
Received: from pinero.vault24.org (pinero.vault24.org [69.164.212.126])
 by dpdk.org (Postfix) with ESMTP id 16C8A8E94
 for <dev@dpdk.org>; Mon, 23 Nov 2015 16:14:33 +0100 (CET)
Received: from feynman.vault24.org (c-98-224-165-226.hsd1.mi.comcast.net
 [98.224.165.226])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by pinero.vault24.org (Postfix) with ESMTPS id A1BC760A5
 for <dev@dpdk.org>; Mon, 23 Nov 2015 10:14:32 -0500 (EST)
Received: by feynman.vault24.org (Postfix, from userid 113)
 id 29630402328F; Mon, 23 Nov 2015 10:14:32 -0500 (EST)
Received: from nobel.vault24.org (nobel.vault24.org [10.222.173.3])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by feynman.vault24.org (Postfix) with ESMTPS id D47F14023289;
 Mon, 23 Nov 2015 10:14:31 -0500 (EST)
Received: by nobel.vault24.org (Postfix, from userid 1000)
 id 5BDF59AD; Mon, 23 Nov 2015 10:14:44 -0500 (EST)
From: Jon DeVree <nuxi@vault24.org>
To: dev@dpdk.org
Date: Mon, 23 Nov 2015 10:13:53 -0500
Message-Id: <1448291633-14347-1-git-send-email-nuxi@vault24.org>
X-Mailer: git-send-email 2.6.2
X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4
Subject: [dpdk-dev] [PATCH] igb/e1000: Copy PCI device info after the
	rte_eal_process_type() check
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: Mon, 23 Nov 2015 15:14:33 -0000

This fixes a bug added to these two drivers by eeefe73 (drivers: copy
PCI device info to ethdev data) which causes the pci info seen by the
primary process to become invalidated by secondary process startup.
This call was added after the process type check in the other drivers.

Signed-off-by: Jon DeVree <nuxi@vault24.org>
---
 drivers/net/e1000/em_ethdev.c  | 4 ++--
 drivers/net/e1000/igb_ethdev.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 3e81109..66e8993 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -244,8 +244,6 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)
 
 	pci_dev = eth_dev->pci_dev;
 
-	rte_eth_copy_pci_info(eth_dev, pci_dev);
-
 	eth_dev->dev_ops = &eth_em_ops;
 	eth_dev->rx_pkt_burst = (eth_rx_burst_t)&eth_em_recv_pkts;
 	eth_dev->tx_pkt_burst = (eth_tx_burst_t)&eth_em_xmit_pkts;
@@ -260,6 +258,8 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)
 		return 0;
 	}
 
+	rte_eth_copy_pci_info(eth_dev, pci_dev);
+
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
 	hw->device_id = pci_dev->id.device_id;
 	adapter->stopped = 0;
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 88995b0..0dc6357 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -647,8 +647,6 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
 
 	pci_dev = eth_dev->pci_dev;
 
-	rte_eth_copy_pci_info(eth_dev, pci_dev);
-
 	eth_dev->dev_ops = &eth_igb_ops;
 	eth_dev->rx_pkt_burst = &eth_igb_recv_pkts;
 	eth_dev->tx_pkt_burst = &eth_igb_xmit_pkts;
@@ -662,6 +660,8 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
 		return 0;
 	}
 
+	rte_eth_copy_pci_info(eth_dev, pci_dev);
+
 	hw->hw_addr= (void *)pci_dev->mem_resource[0].addr;
 
 	igb_identify_hardware(eth_dev);
-- 
2.6.2