From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <aconole@redhat.com>
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by dpdk.org (Postfix) with ESMTP id 656E28E72
 for <dev@dpdk.org>; Fri, 11 Dec 2015 17:20:27 +0100 (CET)
Received: from int-mx13.intmail.prod.int.phx2.redhat.com
 (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26])
 by mx1.redhat.com (Postfix) with ESMTPS id BB217C0A848F
 for <dev@dpdk.org>; Fri, 11 Dec 2015 16:20:26 +0000 (UTC)
Received: from aconole.bos.com (dhcp-25-142.bos.redhat.com [10.18.25.142])
 by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 tBBGKQU5022492 for <dev@dpdk.org>; Fri, 11 Dec 2015 11:20:26 -0500
From: Aaron Conole <aconole@redhat.com>
To: dev@dpdk.org
Date: Fri, 11 Dec 2015 11:20:23 -0500
Message-Id: <1449850823-29017-1-git-send-email-aconole@redhat.com>
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26
Subject: [dpdk-dev] [PATCH 2.3] tools/dpdk_nic_bind.py: Verbosely warn the
	user on bind
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, 11 Dec 2015 16:20:27 -0000

DPDK ports are only detected during the EAL initialization. After that, any
new DPDK ports which are bound will not be visible to the application.

The dpdk_nic_bind.py can be a bit more helpful to let users know that DPDK
enabled applications will not find rebound ports until after they have been
restarted.

Signed-off-by: Aaron Conole <aconole@redhat.com>
---
 tools/dpdk_nic_bind.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py
index f02454e..ca39389 100755
--- a/tools/dpdk_nic_bind.py
+++ b/tools/dpdk_nic_bind.py
@@ -344,8 +344,10 @@ def bind_one(dev_id, driver, force):
             dev["Driver_str"] = "" # clear driver string
 
     # if we are binding to one of DPDK drivers, add PCI id's to that driver
+    bDpdkDriver = False
     if driver in dpdk_drivers:
         filename = "/sys/bus/pci/drivers/%s/new_id" % driver
+        bDpdkDriver = True
         try:
             f = open(filename, "w")
         except:
@@ -371,12 +373,18 @@ def bind_one(dev_id, driver, force):
     try:
         f.write(dev_id)
         f.close()
+        if bDpdkDriver:
+            print "Device rebound to dpdk driver."
+            print "Remember to restart any application that will use this port."
     except:
         # for some reason, closing dev_id after adding a new PCI ID to new_id
         # results in IOError. however, if the device was successfully bound,
         # we don't care for any errors and can safely ignore IOError
         tmp = get_pci_device_details(dev_id)
         if "Driver_str" in tmp and tmp["Driver_str"] == driver:
+            if bDpdkDriver:
+                print "Device rebound to dpdk driver."
+                print "Remember to restart any application that will use this port."
             return
         print "Error: bind failed for %s - Cannot bind to driver %s" % (dev_id, driver)
         if saved_driver is not None: # restore any previous driver
-- 
2.6.1.133.gf5b6079