[dpdk-dev] [PATCH] doc/guides: add info on how to enable QAT

2016-08-30 Thread Eoin Breen
Signed-off-by: Eoin Breen 
---
 doc/guides/cryptodevs/qat.rst | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
index cae1958..db03470 100644
--- a/doc/guides/cryptodevs/qat.rst
+++ b/doc/guides/cryptodevs/qat.rst
@@ -78,6 +78,11 @@ Installation
 To use the DPDK QAT PMD an SRIOV-enabled QAT kernel driver is required. The
 VF devices exposed by this driver will be used by QAT PMD.

+To enable QAT in DPDK you must change the ./config/common_base file. Change the
+line 'CONFIG_RTE_LIBRTE_PMD_QAT=n' to 'CONFIG_RTE_LIBRTE_PMD_QAT=y' to do this.
+You must then configure and build dpdk, for example using the commands:
+make T=x86_64-native-linuxapp-gcc config; make
+
 If you are running on kernel 4.4 or greater, see instructions for
 `Installation using kernel.org driver`_ below. If you are on a kernel earlier
 than 4.4, see `Installation using 01.org QAT driver`_.
-- 
2.5.5

--
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.



[dpdk-dev] [PATCH v2] tools: add crypto device details

2016-08-25 Thread Eoin Breen
Adding the support to bind/unbind crypto devices with
dpdk-devbind.py script, as now it is not restricted
to network devices anymore.

Signed-off-by: Eoin Breen 
---
Changes since v1:
* Resolved coding issues

 tools/dpdk-devbind.py | 107 ++
 1 file changed, 99 insertions(+), 8 deletions(-)

diff --git a/tools/dpdk-devbind.py b/tools/dpdk-devbind.py
index b69ca2a..c7576b9 100755
--- a/tools/dpdk-devbind.py
+++ b/tools/dpdk-devbind.py
@@ -40,6 +40,7 @@ from os.path import exists, abspath, dirname, basename

 # The PCI base class for NETWORK devices
 NETWORK_BASE_CLASS = "02"
+CRYPTO_BASE_CLASS = "0b"

 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
@@ -299,6 +300,71 @@ def get_nic_details():
 devices[d]["Module_str"] = ",".join(modules)


+def get_crypto_details():
+'''This function populates the "devices" dictionary. The keys used are
+the pci addresses (domain:bus:slot.func). The values are themselves
+dictionaries - one for each NIC.'''
+global devices
+global dpdk_drivers
+
+# clear any old data
+# devices = {}
+# first loop through and read details for all devices
+# request machine readable format, with numeric IDs
+dev = {}
+dev_lines = check_output(["lspci", "-Dvmmn"]).splitlines()
+for dev_line in dev_lines:
+if (len(dev_line) == 0):
+if (dev["Class"][0:2] == CRYPTO_BASE_CLASS):
+# convert device and vendor ids to numbers, then add to global
+dev["Vendor"] = int(dev["Vendor"], 16)
+dev["Device"] = int(dev["Device"], 16)
+# use dict to make copy of dev
+devices[dev["Slot"]] = dict(dev)
+else:
+name, value = dev_line.decode().split("\t", 1)
+dev[name.rstrip(":")] = value
+# check what is the interface if any for an ssh connection if
+# any to this host, so we can mark it later.
+ssh_if = []
+route = check_output(["ip", "-o", "route"])
+# filter out all lines for 169.254 routes
+route = "\n".join(filter(lambda ln: not ln.startswith("169.254"),
+ route.decode().splitlines()))
+rt_info = route.split()
+for i in range(len(rt_info) - 1):
+if rt_info[i] == "dev":
+ssh_if.append(rt_info[i+1])
+
+# based on the basic info, get extended text details
+for d in devices.keys():
+# get additional info and add it to existing data
+devices[d] = devices[d].copy()
+devices[d].update(get_pci_device_details(d).items())
+
+for _if in ssh_if:
+if _if in devices[d]["Interface"].split(","):
+devices[d]["Ssh_if"] = True
+devices[d]["Active"] = "*Active*"
+break
+
+# add igb_uio to list of supporting modules if needed
+if "Module_str" in devices[d]:
+for driver in dpdk_drivers:
+if driver not in devices[d]["Module_str"]:
+devices[d]["Module_str"] = \
+devices[d]["Module_str"] + ",%s" % driver
+else:
+devices[d]["Module_str"] = ",".join(dpdk_drivers)
+
+# make sure the driver and module strings do not have any duplicates
+if has_driver(d):
+modules = devices[d]["Module_str"].split(",")
+if devices[d]["Driver_str"] in modules:
+modules.remove(devices[d]["Driver_str"])
+devices[d]["Module_str"] = ",".join(modules)
+
+
 def dev_id_from_dev_name(dev_name):
 '''Take a device "name" - a string passed in by user to identify a NIC
 device, and determine the device id - i.e. the domain:bus:slot.func - for
@@ -480,15 +546,16 @@ def show_status():
 dpdk_drv = []
 no_drv = []

-# split our list of devices into the three categories above
+# split our list of network devices into the three categories above
 for d in devices.keys():
-if not has_driver(d):
-no_drv.append(devices[d])
-continue
-if devices[d]["Driver_str"] in dpdk_drivers:
-dpdk_drv.append(devices[d])
-else:
-kernel_drv.append(devices[d])
+if (NETWORK_BASE_CLASS in devices[d]["Class"]):
+if not has_driver(d):
+no_drv.append(devices[d])
+continue
+if devices[d]["Driver_str"] in dpdk_drivers:
+

[dpdk-dev] [PATCH] tools: add crypto device details

2016-08-25 Thread Eoin Breen
Adding the support to bind/unbind crypto devices with
dpdk-devbind.py script, as now it is not restricted
to network devices anymore.

Signed-off-by: Eoin Breen 
---
 tools/dpdk-devbind.py | 106 ++
 1 file changed, 98 insertions(+), 8 deletions(-)

diff --git a/tools/dpdk-devbind.py b/tools/dpdk-devbind.py
index b69ca2a..39fc5c0 100755
--- a/tools/dpdk-devbind.py
+++ b/tools/dpdk-devbind.py
@@ -40,6 +40,7 @@ from os.path import exists, abspath, dirname, basename

 # The PCI base class for NETWORK devices
 NETWORK_BASE_CLASS = "02"
+CRYPTO_BASE_CLASS = "0b"

 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
@@ -298,6 +299,70 @@ def get_nic_details():
 modules.remove(devices[d]["Driver_str"])
 devices[d]["Module_str"] = ",".join(modules)

+def get_crypto_details():
+'''This function populates the "devices" dictionary. The keys used are
+the pci addresses (domain:bus:slot.func). The values are themselves
+dictionaries - one for each NIC.'''
+global devices
+global dpdk_drivers
+
+# clear any old data
+# devices = {}
+# first loop through and read details for all devices
+# request machine readable format, with numeric IDs
+dev = {}
+dev_lines = check_output(["lspci", "-Dvmmn"]).splitlines()
+for dev_line in dev_lines:
+if (len(dev_line) == 0):
+if (dev["Class"][0:2] == CRYPTO_BASE_CLASS):
+# convert device and vendor ids to numbers, then add to global
+dev["Vendor"] = int(dev["Vendor"], 16)
+dev["Device"] = int(dev["Device"], 16)
+# use dict to make copy of dev
+devices[dev["Slot"]] = dict(dev)
+else:
+name, value = dev_line.decode().split("\t", 1)
+dev[name.rstrip(":")] = value
+# check what is the interface if any for an ssh connection if
+# any to this host, so we can mark it later.
+ssh_if = []
+route = check_output(["ip", "-o", "route"])
+# filter out all lines for 169.254 routes
+route = "\n".join(filter(lambda ln: not ln.startswith("169.254"),
+ route.decode().splitlines()))
+rt_info = route.split()
+for i in range(len(rt_info) - 1):
+if rt_info[i] == "dev":
+ssh_if.append(rt_info[i+1])
+
+# based on the basic info, get extended text details
+for d in devices.keys():
+# get additional info and add it to existing data
+devices[d] = devices[d].copy()
+devices[d].update(get_pci_device_details(d).items())
+
+for _if in ssh_if:
+if _if in devices[d]["Interface"].split(","):
+devices[d]["Ssh_if"] = True
+devices[d]["Active"] = "*Active*"
+break
+
+# add igb_uio to list of supporting modules if needed
+if "Module_str" in devices[d]:
+for driver in dpdk_drivers:
+if driver not in devices[d]["Module_str"]:
+devices[d]["Module_str"] = \
+devices[d]["Module_str"] + ",%s" % driver
+else:
+devices[d]["Module_str"] = ",".join(dpdk_drivers)
+
+# make sure the driver and module strings do not have any duplicates
+if has_driver(d):
+modules = devices[d]["Module_str"].split(",")
+if devices[d]["Driver_str"] in modules:
+modules.remove(devices[d]["Driver_str"])
+devices[d]["Module_str"] = ",".join(modules)
+

 def dev_id_from_dev_name(dev_name):
 '''Take a device "name" - a string passed in by user to identify a NIC
@@ -480,15 +545,16 @@ def show_status():
 dpdk_drv = []
 no_drv = []

-# split our list of devices into the three categories above
+# split our list of network devices into the three categories above
 for d in devices.keys():
-if not has_driver(d):
-no_drv.append(devices[d])
-continue
-if devices[d]["Driver_str"] in dpdk_drivers:
-dpdk_drv.append(devices[d])
-else:
-kernel_drv.append(devices[d])
+if (NETWORK_BASE_CLASS in devices[d]["Class"]):
+if not has_driver(d):
+no_drv.append(devices[d])
+continue
+if devices[d]["Driver_str"] in dpdk_drivers:
+dpdk_drv.append(devices[d])
+else: