SHA256
1
0
forked from pool/dpdk

Accepting request 399089 from home:ndas:branches:network

- Applied all the fixes recommended by upstream for 
  v2.2 stable release(bsc#981996).
	[+0008-app-testpmd-handle-SIGINT-and-SIGTERM.patch,
	+0009-bonding-copy-entire-config-structure-in-mode-4.patch,
	+0010-bonding-fix-active-slaves-with-no-primary.patch,
	+0011-bonding-do-not-ignore-multicast-in-mode-4.patch,
	+0012-bonding-do-not-activate-slave-twice.patch,
	+0013-bonding-fix-crash-when-no-slave-device.patch,
	+0014-bonding-fix-detach-of-bonded-device.patch,
	+0015-bonding-fix-detach-of-slave-devices.patch,
	+0016-eal-linux-support-built-in-kernel-modules.patch,
	+0017-examples-l3fwd-handle-SIGINT-and-SIGTERM.patch,
	+0018-fm10k-fix-VLAN-flag-in-scattered-Rx.patch,
	+0019-i40e-base-fix-driver-load-failure.patch,
	+0020-i40e-base-fix-missing-check-for-stopped-admin-queue.patch,
	+0021-i40e-fix-inverted-check-for-no-refcount.patch,
	+0022-i40e-fix-overflow.patch,
	+0023-i40e-fix-VLAN-filtering.patch,
	+0024-mempool-fix-leak-when-creation-fails.patch,
	+0025-pcap-fix-captured-frame-length.patch,
	+0026-port-fix-crash-for-ethdev-writer-nodrop.patch,
	+0027-port-fix-crash-for-ring-writer-nodrop.patch,
	+0028-tools-fix-unbinding-failure-handling.patch,
	+0029-tools-support-Python-3-in-bind-script.patch,
	+0030-tools-support-binding-to-built-in-kernel-modules.patch,
	+0031-vhost-fix-leak-of-fds-and-mmaps.patch,
	+0032-virtio-fix-crash-in-statistics-functions.patch,
	+0033-virtio-fix-descriptors-pointing-to-the-same-buffer.patch,
	+0034-virtio-fix-restart.patch]

OBS-URL: https://build.opensuse.org/request/show/399089
OBS-URL: https://build.opensuse.org/package/show/network/dpdk?expand=0&rev=3
This commit is contained in:
Nirmoy Das 2016-05-31 11:30:42 +00:00 committed by Git OBS Bridge
parent 07199cc622
commit d761fec5f6
29 changed files with 2144 additions and 0 deletions

View File

@ -0,0 +1,143 @@
From d3a274ce9dee28118b8647e0db72ef0f4b6a6323 Mon Sep 17 00:00:00 2001
From: Zhihong Wang <zhihong.wang@intel.com>
Date: Wed, 30 Dec 2015 16:59:49 -0500
Subject: [PATCH] app/testpmd: handle SIGINT and SIGTERM
Handle SIGINT and SIGTERM in testpmd.
Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
---
app/test-pmd/cmdline.c | 20 +++++++++++++-------
app/test-pmd/testpmd.c | 39 +++++++++++++++++++++++++++++++++------
app/test-pmd/testpmd.h | 1 +
3 files changed, 47 insertions(+), 13 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 73298c9..6d28c1b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -90,6 +90,8 @@
#include "testpmd.h"
+static struct cmdline *testpmd_cl;
+
static void cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue);
#ifdef RTE_NIC_BYPASS
@@ -9778,17 +9780,21 @@ cmdline_parse_ctx_t main_ctx[] = {
void
prompt(void)
{
- struct cmdline *cl;
-
/* initialize non-constant commands */
cmd_set_fwd_mode_init();
- cl = cmdline_stdin_new(main_ctx, "testpmd> ");
- if (cl == NULL) {
+ testpmd_cl = cmdline_stdin_new(main_ctx, "testpmd> ");
+ if (testpmd_cl == NULL)
return;
- }
- cmdline_interact(cl);
- cmdline_stdin_exit(cl);
+ cmdline_interact(testpmd_cl);
+ cmdline_stdin_exit(testpmd_cl);
+}
+
+void
+prompt_exit(void)
+{
+ if (testpmd_cl != NULL)
+ cmdline_quit(testpmd_cl);
}
static void
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 98ae46d..1319917 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1570,13 +1570,16 @@ pmd_test_exit(void)
if (test_done == 0)
stop_packet_forwarding();
- FOREACH_PORT(pt_id, ports) {
- printf("Stopping port %d...", pt_id);
- fflush(stdout);
- rte_eth_dev_close(pt_id);
- printf("done\n");
+ if (ports != NULL) {
+ no_link_check = 1;
+ FOREACH_PORT(pt_id, ports) {
+ printf("\nShutting down port %d...\n", pt_id);
+ fflush(stdout);
+ stop_port(pt_id);
+ close_port(pt_id);
+ }
}
- printf("bye...\n");
+ printf("\nBye...\n");
}
typedef void (*cmd_func_t)(void);
@@ -1984,12 +1987,35 @@ init_port(void)
ports[pid].enabled = 1;
}
+static void
+force_quit(void)
+{
+ pmd_test_exit();
+ prompt_exit();
+}
+
+static void
+signal_handler(int signum)
+{
+ if (signum == SIGINT || signum == SIGTERM) {
+ printf("\nSignal %d received, preparing to exit...\n",
+ signum);
+ force_quit();
+ /* exit with the expected status */
+ signal(signum, SIG_DFL);
+ kill(getpid(), signum);
+ }
+}
+
int
main(int argc, char** argv)
{
int diag;
uint8_t port_id;
+ signal(SIGINT, signal_handler);
+ signal(SIGTERM, signal_handler);
+
diag = rte_eal_init(argc, argv);
if (diag < 0)
rte_panic("Cannot init EAL\n");
@@ -2041,6 +2067,7 @@ main(int argc, char** argv)
start_packet_forwarding(0);
printf("Press enter to exit\n");
rc = read(0, &c, 1);
+ pmd_test_exit();
if (rc < 0)
return 1;
}
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index ee7de98..7ffc17b 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -462,6 +462,7 @@ unsigned int parse_item_list(char* str, const char* item_name,
unsigned int *parsed_items, int check_unique_values);
void launch_args_parse(int argc, char** argv);
void prompt(void);
+void prompt_exit(void);
void nic_stats_display(portid_t port_id);
void nic_stats_clear(portid_t port_id);
void nic_xstats_display(portid_t port_id);
--
2.6.2

View File

@ -0,0 +1,34 @@
From 786c990a11e6e6592dfdee02840877070aa3a79a Mon Sep 17 00:00:00 2001
From: Eric Kinzie <ekinzie@brocade.com>
Date: Tue, 1 Mar 2016 09:31:59 -0800
Subject: [PATCH] bonding: copy entire config structure in mode 4
Copy all needed fields from the mode8023ad_private structure in
bond_mode_8023ad_conf_get(). This help ensure that a subsequent call
to rte_eth_bond_8023ad_setup() is not passed uninitialized data that
would result in either incorrect behavior or a failed sanity check.
Fixes: 46fb43683679 ("bond: add mode 4")
Signed-off-by: Eric Kinzie <ekinzie@brocade.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
drivers/net/bonding/rte_eth_bond_8023ad.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index b3b30f6..1b7e93a 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -1019,6 +1019,7 @@ bond_mode_8023ad_conf_get(struct rte_eth_dev *dev,
conf->aggregate_wait_timeout_ms = mode4->aggregate_wait_timeout / ms_ticks;
conf->tx_period_ms = mode4->tx_period_timeout / ms_ticks;
conf->update_timeout_ms = mode4->update_timeout_us / 1000;
+ conf->rx_marker_period_ms = mode4->rx_marker_timeout / ms_ticks;
}
void
--
2.6.2

View File

@ -0,0 +1,43 @@
From 8997a10bfcad789d000debaac4cd85cd3db57997 Mon Sep 17 00:00:00 2001
From: Eric Kinzie <ekinzie@brocade.com>
Date: Tue, 1 Mar 2016 09:32:01 -0800
Subject: [PATCH] bonding: fix active slaves with no primary
If the link state of a slave is "up" when added, it is added to the list
of active slaves but, even if it is the only slave, is not selected as
the primary interface. Generally, handling of link state interrupts
selects an interface to be primary, but only if the active count is zero.
This change avoids the situation where there are active slaves but
no primary.
Fixes: 2efb58cbab6e ("bond: new link bonding library")
Signed-off-by: Eric Kinzie <ekinzie@brocade.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
drivers/net/bonding/rte_eth_bond_api.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index a0995ec..5292ae1 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -419,8 +419,13 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
if (bonded_eth_dev->data->dev_started) {
rte_eth_link_get_nowait(slave_port_id, &link_props);
- if (link_props.link_status == 1)
+ if (link_props.link_status == 1) {
+ if (internals->active_slave_count == 0 &&
+ !internals->user_defined_primary_port)
+ bond_ethdev_primary_set(internals,
+ slave_port_id);
activate_slave(bonded_eth_dev, slave_port_id);
+ }
}
return 0;
--
2.6.2

View File

@ -0,0 +1,53 @@
From 6698820b5f6d955b6af2b916e1074db236d4f5a2 Mon Sep 17 00:00:00 2001
From: Eric Kinzie <ekinzie@brocade.com>
Date: Tue, 1 Mar 2016 09:32:00 -0800
Subject: [PATCH] bonding: do not ignore multicast in mode 4
The bonding PMD in mode 4 puts all enslaved interfaces into promiscuous
mode in order to receive LACPDUs and must filter unwanted packets
after the traffic has been "collected". Allow broadcast and multicast
through so that ARP and IPv6 neighbor discovery continue to work.
Fixes: 46fb43683679 ("bond: add mode 4")
Signed-off-by: Eric Kinzie <ekinzie@brocade.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
app/test/test_link_bonding_mode4.c | 7 +++++--
drivers/net/bonding/rte_eth_bond_pmd.c | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c
index 713368d..31640cd 100644
--- a/app/test/test_link_bonding_mode4.c
+++ b/app/test/test_link_bonding_mode4.c
@@ -747,8 +747,11 @@ test_mode4_rx(void)
rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac);
ether_addr_copy(&bonded_mac, &dst_mac);
- /* Assert that dst address is not bonding address */
- dst_mac.addr_bytes[0]++;
+ /* Assert that dst address is not bonding address. Do not set the
+ * least significant bit of the zero byte as this would create a
+ * multicast address.
+ */
+ dst_mac.addr_bytes[0] += 2;
/* First try with promiscuous mode enabled.
* Add 2 packets to each slave. First with bonding MAC address, second with
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index b63c886..011150a 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -171,6 +171,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
* mode and packet address does not match. */
if (unlikely(hdr->ether_type == ether_type_slow_be ||
!collecting || (!promisc &&
+ !is_multicast_ether_addr(&hdr->d_addr) &&
!is_same_ether_addr(&bond_mac, &hdr->d_addr)))) {
if (hdr->ether_type == ether_type_slow_be) {
--
2.6.2

View File

@ -0,0 +1,41 @@
From 7a7122edf1c8d63e516d1b2c2eff6fa9b54e0f82 Mon Sep 17 00:00:00 2001
From: Eric Kinzie <ekinzie@brocade.com>
Date: Tue, 1 Mar 2016 09:32:02 -0800
Subject: [PATCH] bonding: do not activate slave twice
The current code for detecting link during slave addition can cause a
slave interface to be activated twice -- once during slave_configure()
and again at the end of __eth_bond_slave_add_lock_free(). This will
either cause the active slave count to be incorrect or will cause the
802.3ad activation function to panic. Ensure that the interface is not
activated more than once.
Fixes: 46fb43683679 ("bond: add mode 4")
Signed-off-by: Eric Kinzie <ekinzie@brocade.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
drivers/net/bonding/rte_eth_bond_api.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 5292ae1..c6c0ed8 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -424,7 +424,11 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
!internals->user_defined_primary_port)
bond_ethdev_primary_set(internals,
slave_port_id);
- activate_slave(bonded_eth_dev, slave_port_id);
+
+ if (find_slave_by_id(internals->active_slaves,
+ internals->active_slave_count,
+ slave_port_id) == internals->active_slave_count)
+ activate_slave(bonded_eth_dev, slave_port_id);
}
}
return 0;
--
2.6.2

View File

@ -0,0 +1,36 @@
From 2186fff3675d4e774cecc8f918c05063e0367d28 Mon Sep 17 00:00:00 2001
From: Bernard Iremonger <bernard.iremonger@intel.com>
Date: Mon, 7 Mar 2016 11:40:40 +0000
Subject: [PATCH] bonding: fix crash when no slave device
If a bonded device is created when there are no slave devices
there is a loop in bond_ethdev_promiscuous_enable() which results
in a segmentation fault.
The solution is to initialise the current_primary_port to an
invalid port value when the bonded port is created.
Fixes: 2efb58cbab6e ("bond: new link bonding library")
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index c6c0ed8..3fca764 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -231,7 +231,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
internals->port_id = eth_dev->data->port_id;
internals->mode = BONDING_MODE_INVALID;
- internals->current_primary_port = 0;
+ internals->current_primary_port = RTE_MAX_ETHPORTS + 1;
internals->balance_xmit_policy = BALANCE_XMIT_POLICY_LAYER2;
internals->xmit_hash = xmit_l2_hash;
internals->user_defined_mac = 0;
--
2.6.2

View File

@ -0,0 +1,50 @@
From 6e02723754fb2b341701ac438486b2dfea98b523 Mon Sep 17 00:00:00 2001
From: Bernard Iremonger <bernard.iremonger@intel.com>
Date: Wed, 10 Feb 2016 10:13:44 +0000
Subject: [PATCH] bonding: fix detach of bonded device
Check that the bonded device has no slaves before detaching it.
Fixes: 8d30fe7fa737 ("bonding: support port hotplug")
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
drivers/net/bonding/rte_eth_bond_api.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 8a000c8..484a6f3 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -277,6 +277,7 @@ int
rte_eth_bond_free(const char *name)
{
struct rte_eth_dev *eth_dev = NULL;
+ struct bond_dev_private *internals;
/* now free all data allocation - for eth_dev structure,
* dummy pci driver and internal (private) data
@@ -287,6 +288,10 @@ rte_eth_bond_free(const char *name)
if (eth_dev == NULL)
return -ENODEV;
+ internals = eth_dev->data->dev_private;
+ if (internals->slave_count != 0)
+ return -EBUSY;
+
if (eth_dev->data->dev_started == 1) {
bond_ethdev_stop(eth_dev);
bond_ethdev_close(eth_dev);
--
2.6.2

View File

@ -0,0 +1,147 @@
From df3e8ad73f4c92b4eb8f49ff33271d4a09e6a04a Mon Sep 17 00:00:00 2001
From: Bernard Iremonger <bernard.iremonger@intel.com>
Date: Wed, 10 Feb 2016 10:13:45 +0000
Subject: [PATCH] bonding: fix detach of slave devices
Ensure that a bonded slave device is not detached,
until it is removed from the bonded device.
Fixes: 2efb58cbab6e ("bond: new link bonding library")
Fixes: a45b288ef21a ("bond: support link status polling")
Fixes: 494adb7f63f2 ("ethdev: add device fields from PCI layer")
Fixes: b1fb53a39d88 ("ethdev: remove some PCI specific handling")
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
drivers/net/bonding/rte_eth_bond_api.c | 33 +++++++++++----------------------
lib/librte_ether/rte_ethdev.c | 8 ++++++--
lib/librte_ether/rte_ethdev.h | 2 ++
3 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 484a6f3..a0995ec 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -314,38 +314,23 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
{
struct rte_eth_dev *bonded_eth_dev, *slave_eth_dev;
struct bond_dev_private *internals;
- struct bond_dev_private *temp_internals;
struct rte_eth_link link_props;
struct rte_eth_dev_info dev_info;
- int i, j;
-
if (valid_slave_port_id(slave_port_id) != 0)
return -1;
bonded_eth_dev = &rte_eth_devices[bonded_port_id];
internals = bonded_eth_dev->data->dev_private;
- /* Verify that new slave device is not already a slave of another
- * bonded device */
- for (i = rte_eth_dev_count()-1; i >= 0; i--) {
- if (check_for_bonded_ethdev(&rte_eth_devices[i]) == 0) {
- temp_internals = rte_eth_devices[i].data->dev_private;
-
- for (j = 0; j < temp_internals->slave_count; j++) {
- /* Device already a slave of a bonded device */
- if (temp_internals->slaves[j].port_id == slave_port_id) {
- RTE_BOND_LOG(ERR, "Slave port %d is already a slave",
- slave_port_id);
- return -1;
- }
- }
- }
- }
-
slave_eth_dev = &rte_eth_devices[slave_port_id];
+ if (slave_eth_dev->data->dev_flags & RTE_ETH_DEV_BONDED_SLAVE) {
+ RTE_BOND_LOG(ERR, "Slave device is already a slave of a bonded device");
+ return -1;
+ }
/* Add slave details to bonded device */
+ slave_eth_dev->data->dev_flags |= RTE_ETH_DEV_BONDED_SLAVE;
slave_add(internals, slave_eth_dev);
rte_eth_dev_info_get(slave_port_id, &dev_info);
@@ -385,6 +370,7 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
if (internals->link_props_set) {
if (link_properties_valid(&(bonded_eth_dev->data->dev_link),
&(slave_eth_dev->data->dev_link))) {
+ slave_eth_dev->data->dev_flags &= (~RTE_ETH_DEV_BONDED_SLAVE);
RTE_BOND_LOG(ERR,
"Slave port %d link speed/duplex not supported",
slave_port_id);
@@ -416,6 +402,7 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
if (bonded_eth_dev->data->dev_started) {
if (slave_configure(bonded_eth_dev, slave_eth_dev) != 0) {
+ slave_eth_dev->data->dev_flags &= (~RTE_ETH_DEV_BONDED_SLAVE);
RTE_BOND_LOG(ERR, "rte_bond_slaves_configure: port=%d",
slave_port_id);
return -1;
@@ -468,7 +455,7 @@ __eth_bond_slave_remove_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
{
struct rte_eth_dev *bonded_eth_dev;
struct bond_dev_private *internals;
-
+ struct rte_eth_dev *slave_eth_dev;
int i, slave_idx;
if (valid_slave_port_id(slave_port_id) != 0)
@@ -508,7 +495,9 @@ __eth_bond_slave_remove_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
mac_address_set(&rte_eth_devices[slave_port_id],
&(internals->slaves[slave_idx].persisted_mac_addr));
- slave_remove(internals, &rte_eth_devices[slave_port_id]);
+ slave_eth_dev = &rte_eth_devices[slave_port_id];
+ slave_remove(internals, slave_eth_dev);
+ slave_eth_dev->data->dev_flags &= (~RTE_ETH_DEV_BONDED_SLAVE);
/* first slave in the active list will be the primary by default,
* otherwise use first device in list */
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index f0e7473..db35102 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -495,7 +495,11 @@ rte_eth_dev_is_detachable(uint8_t port_id)
return -ENOTSUP;
}
dev_flags = rte_eth_devices[port_id].data->dev_flags;
- return !(dev_flags & RTE_ETH_DEV_DETACHABLE);
+ if ((dev_flags & RTE_ETH_DEV_DETACHABLE) &&
+ (!(dev_flags & RTE_ETH_DEV_BONDED_SLAVE)))
+ return 0;
+ else
+ return 1;
}
/* attach the new physical device, then store port_id of the device */
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index d867976..b5704e1 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1662,6 +1662,8 @@ struct rte_eth_dev_data {
#define RTE_ETH_DEV_DETACHABLE 0x0001
/** Device supports link state interrupt */
#define RTE_ETH_DEV_INTR_LSC 0x0002
+/** Device is a bonded slave */
+#define RTE_ETH_DEV_BONDED_SLAVE 0x0004
/**
* @internal
--
2.6.2

View File

@ -0,0 +1,83 @@
From 6e7caa1ad9d597fed0a49468af25ae6e68b8c443 Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
Date: Thu, 28 Jan 2016 14:13:54 +0100
Subject: [PATCH] eal/linux: support built-in kernel modules
Currently rte_eal_check_module() detects Linux kernel modules via reading
/proc/modules. Built-in ones aren't listed there and therefore they are not
being found.
Add support for checking built-in modules with parsing the sysfs files
This commit obsoletes the /proc/modules parsing approach.
Signed-off-by: Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
Acked-by: David Marchand <david.marchand@6wind.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
lib/librte_eal/linuxapp/eal/eal.c | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 635ec36..4d3e0de 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -49,6 +49,7 @@
#include <errno.h>
#include <sys/mman.h>
#include <sys/queue.h>
+#include <sys/stat.h>
#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
#include <sys/io.h>
#endif
@@ -901,27 +902,33 @@ int rte_eal_has_hugepages(void)
int
rte_eal_check_module(const char *module_name)
{
- char mod_name[30]; /* Any module names can be longer than 30 bytes? */
- int ret = 0;
+ char sysfs_mod_name[PATH_MAX];
+ struct stat st;
int n;
if (NULL == module_name)
return -1;
- FILE *fd = fopen("/proc/modules", "r");
- if (NULL == fd) {
- RTE_LOG(ERR, EAL, "Open /proc/modules failed!"
- " error %i (%s)\n", errno, strerror(errno));
+ /* Check if there is sysfs mounted */
+ if (stat("/sys/module", &st) != 0) {
+ RTE_LOG(DEBUG, EAL, "sysfs is not mounted! error %i (%s)\n",
+ errno, strerror(errno));
return -1;
}
- while (!feof(fd)) {
- n = fscanf(fd, "%29s %*[^\n]", mod_name);
- if ((n == 1) && !strcmp(mod_name, module_name)) {
- ret = 1;
- break;
- }
+
+ /* A module might be built-in, therefore try sysfs */
+ n = snprintf(sysfs_mod_name, PATH_MAX, "/sys/module/%s", module_name);
+ if (n < 0 || n > PATH_MAX) {
+ RTE_LOG(DEBUG, EAL, "Could not format module path\n");
+ return -1;
}
- fclose(fd);
- return ret;
+ if (stat(sysfs_mod_name, &st) != 0) {
+ RTE_LOG(DEBUG, EAL, "Module %s not found! error %i (%s)\n",
+ sysfs_mod_name, errno, strerror(errno));
+ return 0;
+ }
+
+ /* Module has been found */
+ return 1;
}
--
2.6.2

View File

@ -0,0 +1,128 @@
From 308df2bfba3d238fc1d2d16cc10c84681803b408 Mon Sep 17 00:00:00 2001
From: Zhihong Wang <zhihong.wang@intel.com>
Date: Wed, 30 Dec 2015 16:59:51 -0500
Subject: [PATCH] examples/l3fwd: handle SIGINT and SIGTERM
Handle SIGINT and SIGTERM in l3fwd.
Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
examples/l3fwd/main.c | 46 ++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 42 insertions(+), 4 deletions(-)
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 5b0c2dd..21a5782 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -41,6 +41,8 @@
#include <stdarg.h>
#include <errno.h>
#include <getopt.h>
+#include <signal.h>
+#include <stdbool.h>
#include <rte_common.h>
#include <rte_vect.h>
@@ -75,6 +77,8 @@
#include <cmdline_parse.h>
#include <cmdline_parse_etheraddr.h>
+static volatile bool force_quit;
+
#define APP_LOOKUP_EXACT_MATCH 0
#define APP_LOOKUP_LPM 1
#define DO_RFC_1812_CHECKS
@@ -1553,7 +1557,7 @@ main_loop(__attribute__((unused)) void *dummy)
portid, queueid);
}
- while (1) {
+ while (!force_quit) {
cur_tsc = rte_rdtsc();
@@ -1781,6 +1785,8 @@ main_loop(__attribute__((unused)) void *dummy)
}
}
+
+ return 0;
}
static int
@@ -2516,8 +2522,12 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
printf("\nChecking link status");
fflush(stdout);
for (count = 0; count <= MAX_CHECK_TIME; count++) {
+ if (force_quit)
+ return;
all_ports_up = 1;
for (portid = 0; portid < port_num; portid++) {
+ if (force_quit)
+ return;
if ((port_mask & (1 << portid)) == 0)
continue;
memset(&link, 0, sizeof(link));
@@ -2559,6 +2569,16 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
}
}
+static void
+signal_handler(int signum)
+{
+ if (signum == SIGINT || signum == SIGTERM) {
+ printf("\n\nSignal %d received, preparing to exit...\n",
+ signum);
+ force_quit = true;
+ }
+}
+
int
main(int argc, char **argv)
{
@@ -2579,6 +2599,10 @@ main(int argc, char **argv)
argc -= ret;
argv += ret;
+ force_quit = false;
+ signal(SIGINT, signal_handler);
+ signal(SIGTERM, signal_handler);
+
/* pre-init dst MACs for all ports to 02:00:00:00:00:xx */
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {
dest_eth_addr[portid] = ETHER_LOCAL_ADMIN_ADDR + ((uint64_t)portid << 40);
@@ -2733,12 +2757,26 @@ main(int argc, char **argv)
check_all_ports_link_status((uint8_t)nb_ports, enabled_port_mask);
+ ret = 0;
/* launch per-lcore init on every lcore */
rte_eal_mp_remote_launch(main_loop, NULL, CALL_MASTER);
RTE_LCORE_FOREACH_SLAVE(lcore_id) {
- if (rte_eal_wait_lcore(lcore_id) < 0)
- return -1;
+ if (rte_eal_wait_lcore(lcore_id) < 0) {
+ ret = -1;
+ break;
+ }
}
- return 0;
+ /* stop ports */
+ for (portid = 0; portid < nb_ports; portid++) {
+ if ((enabled_port_mask & (1 << portid)) == 0)
+ continue;
+ printf("Closing port %d...", portid);
+ rte_eth_dev_stop(portid);
+ rte_eth_dev_close(portid);
+ printf(" Done\n");
+ }
+ printf("Bye...\n");
+
+ return ret;
}
--
2.6.2

View File

@ -0,0 +1,32 @@
From 7656a546c0609f3205558a5d48352c82607d38d3 Mon Sep 17 00:00:00 2001
From: Xiao Wang <xiao.w.wang@intel.com>
Date: Fri, 18 Dec 2015 11:09:18 +0800
Subject: [PATCH] fm10k: fix VLAN flag in scattered Rx
In fm10k_recv_scattered_pkts function, a packet is stored in a linked list,
offload flags such as PKT_RX_VLAN_PKT should be set in the first segment.
Fixes: 6b59a3bc82b1 ("fm10k: fix VLAN in Rx mbuf")
Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
Acked-by: Shaopeng He <shaopeng.he@intel.com>
---
drivers/net/fm10k/fm10k_rxtx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index e958865..de31cad 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -305,7 +305,7 @@ fm10k_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
* So, always PKT_RX_VLAN_PKT flag is set and vlan_tci
* is valid for each RX packet's mbuf.
*/
- mbuf->ol_flags |= PKT_RX_VLAN_PKT;
+ first_seg->ol_flags |= PKT_RX_VLAN_PKT;
first_seg->vlan_tci = desc.w.vlan;
/* Prefetch data of first segment, if configured to do so. */
--
2.6.2

View File

@ -0,0 +1,41 @@
From 8a8807369ffafef90c410279b4b2645d2d7a7483 Mon Sep 17 00:00:00 2001
From: Helin Zhang <helin.zhang@intel.com>
Date: Tue, 8 Mar 2016 16:14:28 +0800
Subject: [PATCH] i40e/base: fix driver load failure
Fix the driver load failure with linking with some
PHY types, as the amount of time it takes for the
GLGEN_RSTAT_DEVSTATE to be set increases greatly on those PHY
types, which can lead to a timeout.
Fixes: 9aeefed05538 ("i40e/base: support ESS")
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
---
drivers/net/i40e/base/i40e_common.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index a4cf5cf..925bb1c 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1316,11 +1316,11 @@ enum i40e_status_code i40e_pf_reset(struct i40e_hw *hw)
grst_del = (rd32(hw, I40E_GLGEN_RSTCTL) &
I40E_GLGEN_RSTCTL_GRSTDEL_MASK) >>
I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT;
-#ifdef I40E_ESS_SUPPORT
+
/* It can take upto 15 secs for GRST steady state */
grst_del = grst_del * 20; /* bump it to 16 secs max to be safe */
-#endif
- for (cnt = 0; cnt < grst_del + 10; cnt++) {
+
+ for (cnt = 0; cnt < grst_del; cnt++) {
reg = rd32(hw, I40E_GLGEN_RSTAT);
if (!(reg & I40E_GLGEN_RSTAT_DEVSTATE_MASK))
break;
--
2.6.2

View File

@ -0,0 +1,49 @@
From 9f44dd3d8ad447c7f797a9564d30a15e5ab7f72b Mon Sep 17 00:00:00 2001
From: Helin Zhang <helin.zhang@intel.com>
Date: Tue, 8 Mar 2016 16:14:14 +0800
Subject: [PATCH] i40e/base: fix missing check for stopped admin queue
It's possible that while waiting for the spinlock, another
entity (that owns the spinlock) has shut down the admin queue.
If it then attempts to use the queue, it will panic.
It adds a check for this condition on the receive side. This
matches an existing check on the send queue side.
Fixes: 8db9e2a1b232 ("i40e: base driver")
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
---
drivers/net/i40e/base/i40e_adminq.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c
index 998582c..e1a162e 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -1035,6 +1035,13 @@ enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw,
/* take the lock before we start messing with the ring */
i40e_acquire_spinlock(&hw->aq.arq_spinlock);
+ if (hw->aq.arq.count == 0) {
+ i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
+ "AQRX: Admin queue not initialized.\n");
+ ret_code = I40E_ERR_QUEUE_EMPTY;
+ goto clean_arq_element_err;
+ }
+
/* set next_to_use to head */
#ifdef PF_DRIVER
#ifdef INTEGRATED_VF
@@ -1113,6 +1120,7 @@ clean_arq_element_out:
/* Set pending if needed, unlock and return */
if (pending != NULL)
*pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
+clean_arq_element_err:
i40e_release_spinlock(&hw->aq.arq_spinlock);
#ifdef PF_DRIVER
--
2.6.2

View File

@ -0,0 +1,33 @@
From 097e920c32bf19cf918cc071525f33b0abdeebaf Mon Sep 17 00:00:00 2001
From: Rich Lane <rich.lane@bigswitch.com>
Date: Wed, 23 Dec 2015 00:08:00 -0800
Subject: [PATCH] i40e: fix inverted check for no refcount
The no-refcount path was being taken without the application opting
in to it.
Fixes: 4861cde46116 ("i40e: new poll mode driver")
Reported-by: Mike Stolarchuk <mike.stolarchuk@bigswitch.com>
Signed-off-by: Rich Lane <rich.lane@bigswitch.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
---
drivers/net/i40e/i40e_rxtx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index c10eeff..d777c9b 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -1756,7 +1756,7 @@ i40e_tx_free_bufs(struct i40e_tx_queue *txq)
for (i = 0; i < txq->tx_rs_thresh; i++)
rte_prefetch0((txep + i)->mbuf);
- if (!(txq->txq_flags & (uint32_t)ETH_TXQ_FLAGS_NOREFCOUNT)) {
+ if (txq->txq_flags & (uint32_t)ETH_TXQ_FLAGS_NOREFCOUNT) {
for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {
rte_mempool_put(txep->mbuf->pool, txep->mbuf);
txep->mbuf = NULL;
--
2.6.2

View File

@ -0,0 +1,42 @@
From c7a4ff80722e9237a4c504106d21ba5ca27d8df2 Mon Sep 17 00:00:00 2001
From: Helin Zhang <helin.zhang@intel.com>
Date: Sat, 12 Mar 2016 00:50:58 +0800
Subject: [PATCH] i40e: fix overflow
The array 'ptype_table' was defined in depth of 'UINT8_MAX' which
is 255, while the querying index could be from 0 to 255. The issue
can be fixed with expanding the array to one more element.
Fixes: 9571ea028489 ("i40e: replace some offload flags with unified packet type")
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
drivers/net/i40e/i40e_rxtx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 8931b8e..c10eeff 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -192,7 +192,7 @@ i40e_get_iee15888_flags(struct rte_mbuf *mb, uint64_t qword)
static inline uint32_t
i40e_rxd_pkt_type_mapping(uint8_t ptype)
{
- static const uint32_t ptype_table[UINT8_MAX] __rte_cache_aligned = {
+ static const uint32_t type_table[UINT8_MAX + 1] __rte_cache_aligned = {
/* L2 types */
/* [0] reserved */
[1] = RTE_PTYPE_L2_ETHER,
@@ -718,7 +718,7 @@ i40e_rxd_pkt_type_mapping(uint8_t ptype)
/* All others reserved */
};
- return ptype_table[ptype];
+ return type_table[ptype];
}
#define I40E_RX_DESC_EXT_STATUS_FLEXBH_MASK 0x03
--
2.6.2

View File

@ -0,0 +1,147 @@
From 330aa319382aec9ea595f9ebcb9a3c44647ad66c Mon Sep 17 00:00:00 2001
From: Julien Meunier <julien.meunier@6wind.com>
Date: Thu, 4 Feb 2016 12:02:16 +0100
Subject: [PATCH] i40e: fix VLAN filtering
VLAN filtering was always performed, even if hw_vlan_filter was
disabled. During device initialization, default filter
RTE_MACVLAN_PERFECT_MATCH was applied. In this situation, all incoming
VLAN frames were dropped by the card (increase of the register RUPP - Rx
Unsupported Protocol).
In order to restore default behavior, if HW VLAN filtering is activated,
set a filter to match MAC and VLAN. If not, set a filter to only match
MAC.
Fixes: 4861cde46116 ("i40e: new poll mode driver")
Fixes: 912b595146d6 ("i40e: mac vlan filter")
Signed-off-by: Julien Meunier <julien.meunier@6wind.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 73 ++++++++++++++++++++++++++++++++++++++++--
drivers/net/i40e/i40e_ethdev.h | 1 +
2 files changed, 72 insertions(+), 2 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 2f676f6..87d8f4b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2412,6 +2412,13 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask)
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_vsi *vsi = pf->main_vsi;
+ if (mask & ETH_VLAN_FILTER_MASK) {
+ if (dev->data->dev_conf.rxmode.hw_vlan_filter)
+ i40e_vsi_config_vlan_filter(vsi, TRUE);
+ else
+ i40e_vsi_config_vlan_filter(vsi, FALSE);
+ }
+
if (mask & ETH_VLAN_STRIP_MASK) {
/* Enable or disable VLAN stripping */
if (dev->data->dev_conf.rxmode.hw_vlan_strip)
@@ -2663,7 +2670,10 @@ i40e_macaddr_add(struct rte_eth_dev *dev,
}
(void)rte_memcpy(&mac_filter.mac_addr, mac_addr, ETHER_ADDR_LEN);
- mac_filter.filter_type = RTE_MACVLAN_PERFECT_MATCH;
+ if (dev->data->dev_conf.rxmode.hw_vlan_filter)
+ mac_filter.filter_type = RTE_MACVLAN_PERFECT_MATCH;
+ else
+ mac_filter.filter_type = RTE_MAC_PERFECT_MATCH;
if (pool == 0)
vsi = pf->main_vsi;
@@ -4236,6 +4246,63 @@ fail_mem:
return NULL;
}
+/* Configure vlan filter on or off */
+int
+i40e_vsi_config_vlan_filter(struct i40e_vsi *vsi, bool on)
+{
+ int i, num;
+ struct i40e_mac_filter *f;
+ struct i40e_mac_filter_info *mac_filter;
+ enum rte_mac_filter_type desired_filter;
+ int ret = I40E_SUCCESS;
+
+ if (on) {
+ /* Filter to match MAC and VLAN */
+ desired_filter = RTE_MACVLAN_PERFECT_MATCH;
+ } else {
+ /* Filter to match only MAC */
+ desired_filter = RTE_MAC_PERFECT_MATCH;
+ }
+
+ num = vsi->mac_num;
+
+ mac_filter = rte_zmalloc("mac_filter_info_data",
+ num * sizeof(*mac_filter), 0);
+ if (mac_filter == NULL) {
+ PMD_DRV_LOG(ERR, "failed to allocate memory");
+ return I40E_ERR_NO_MEMORY;
+ }
+
+ i = 0;
+
+ /* Remove all existing mac */
+ TAILQ_FOREACH(f, &vsi->mac_list, next) {
+ mac_filter[i] = f->mac_info;
+ ret = i40e_vsi_delete_mac(vsi, &f->mac_info.mac_addr);
+ if (ret) {
+ PMD_DRV_LOG(ERR, "Update VSI failed to %s vlan filter",
+ on ? "enable" : "disable");
+ goto DONE;
+ }
+ i++;
+ }
+
+ /* Override with new filter */
+ for (i = 0; i < num; i++) {
+ mac_filter[i].filter_type = desired_filter;
+ ret = i40e_vsi_add_mac(vsi, &mac_filter[i]);
+ if (ret) {
+ PMD_DRV_LOG(ERR, "Update VSI failed to %s vlan filter",
+ on ? "enable" : "disable");
+ goto DONE;
+ }
+ }
+
+DONE:
+ rte_free(mac_filter);
+ return ret;
+}
+
/* Configure vlan stripping on or off */
int
i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on)
@@ -4283,9 +4350,11 @@ i40e_dev_init_vlan(struct rte_eth_dev *dev)
{
struct rte_eth_dev_data *data = dev->data;
int ret;
+ int mask = 0;
/* Apply vlan offload setting */
- i40e_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK);
+ mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK;
+ i40e_vlan_offload_set(dev, mask);
/* Apply double-vlan setting, not implemented yet */
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 6edd7dd..db6173a 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -551,6 +551,7 @@ void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);
int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
struct i40e_vsi_vlan_pvid_info *info);
int i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on);
+int i40e_vsi_config_vlan_filter(struct i40e_vsi *vsi, bool on);
uint64_t i40e_config_hena(uint64_t flags);
uint64_t i40e_parse_hena(uint64_t flags);
enum i40e_status_code i40e_fdir_setup_tx_resources(struct i40e_pf *pf);
--
2.6.2

View File

@ -0,0 +1,89 @@
From 86f36ff9578b5f3d697c8fcf6072dcb70e2b246f Mon Sep 17 00:00:00 2001
From: Olivier Matz <olivier.matz@6wind.com>
Date: Tue, 16 Feb 2016 15:40:10 +0100
Subject: [PATCH] mempool: fix leak when creation fails
Since commits ff909fe21f and 4e32101f9b, it is now possible to free
memzones and rings.
The rte_mempool_create() should be modified to take advantage of this
and not leak memory when an allocation fails.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
lib/librte_mempool/rte_mempool.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index aff5f6d..f8781e1 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -438,8 +438,8 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
char rg_name[RTE_RING_NAMESIZE];
struct rte_mempool_list *mempool_list;
struct rte_mempool *mp = NULL;
- struct rte_tailq_entry *te;
- struct rte_ring *r;
+ struct rte_tailq_entry *te = NULL;
+ struct rte_ring *r = NULL;
const struct rte_memzone *mz;
size_t mempool_size;
int mz_flags = RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY;
@@ -511,7 +511,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
snprintf(rg_name, sizeof(rg_name), RTE_MEMPOOL_MZ_FORMAT, name);
r = rte_ring_create(rg_name, rte_align32pow2(n+1), socket_id, rg_flags);
if (r == NULL)
- goto exit;
+ goto exit_unlock;
/*
* reserve a memory zone for this mempool: private data is
@@ -536,7 +536,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
te = rte_zmalloc("MEMPOOL_TAILQ_ENTRY", sizeof(*te), 0);
if (te == NULL) {
RTE_LOG(ERR, MEMPOOL, "Cannot allocate tailq entry!\n");
- goto exit;
+ goto exit_unlock;
}
/*
@@ -561,15 +561,8 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
snprintf(mz_name, sizeof(mz_name), RTE_MEMPOOL_MZ_FORMAT, name);
mz = rte_memzone_reserve(mz_name, mempool_size, socket_id, mz_flags);
-
- /*
- * no more memory: in this case we loose previously reserved
- * space for the ring as we cannot free it
- */
- if (mz == NULL) {
- rte_free(te);
- goto exit;
- }
+ if (mz == NULL)
+ goto exit_unlock;
if (rte_eal_has_hugepages()) {
startaddr = (void*)mz->addr;
@@ -633,11 +626,16 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
TAILQ_INSERT_TAIL(mempool_list, te, next);
rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
-
-exit:
rte_rwlock_write_unlock(RTE_EAL_MEMPOOL_RWLOCK);
return mp;
+
+exit_unlock:
+ rte_rwlock_write_unlock(RTE_EAL_MEMPOOL_RWLOCK);
+ rte_ring_free(r);
+ rte_free(te);
+
+ return NULL;
}
/* Return the number of entries in the mempool */
--
2.6.2

View File

@ -0,0 +1,58 @@
From c6fb0e55585206a89f6db396de860e6e844cad06 Mon Sep 17 00:00:00 2001
From: Dror Birkman <dror.birkman@lightcyber.com>
Date: Thu, 28 Jan 2016 13:09:50 +0200
Subject: [PATCH] pcap: fix captured frame length
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The actual captured length is header.caplen, whereas header.len is
the original length on the wire.
Fixes: 4c173302c307 ("pcap: add new driver")
Signed-off-by: Dror Birkman <dror.birkman@lightcyber.com>
Acked-by: Nicolás Pernas Maradei <nicolas.pernas.maradei@emutex.com>
---
drivers/net/pcap/rte_eth_pcap.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index f9230eb..1d121f8 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -220,25 +220,25 @@ eth_pcap_rx(void *queue,
buf_size = (uint16_t)(rte_pktmbuf_data_room_size(pcap_q->mb_pool) -
RTE_PKTMBUF_HEADROOM);
- if (header.len <= buf_size) {
+ if (header.caplen <= buf_size) {
/* pcap packet will fit in the mbuf, go ahead and copy */
rte_memcpy(rte_pktmbuf_mtod(mbuf, void *), packet,
- header.len);
- mbuf->data_len = (uint16_t)header.len;
+ header.caplen);
+ mbuf->data_len = (uint16_t)header.caplen;
} else {
/* Try read jumbo frame into multi mbufs. */
if (unlikely(eth_pcap_rx_jumbo(pcap_q->mb_pool,
mbuf,
packet,
- header.len) == -1))
+ header.caplen) == -1))
break;
}
- mbuf->pkt_len = (uint16_t)header.len;
+ mbuf->pkt_len = (uint16_t)header.caplen;
mbuf->port = pcap_q->in_port;
bufs[num_rx] = mbuf;
num_rx++;
- rx_bytes += header.len;
+ rx_bytes += header.caplen;
}
pcap_q->rx_pkts += num_rx;
pcap_q->rx_bytes += rx_bytes;
--
2.6.2

View File

@ -0,0 +1,49 @@
From 04f366906ab395c8047bebfc1ddea244dfcb40f5 Mon Sep 17 00:00:00 2001
From: Jasvinder Singh <jasvinder.singh@intel.com>
Date: Wed, 2 Mar 2016 21:19:29 +0000
Subject: [PATCH] port: fix crash for ethdev writer nodrop
Error log:
[APP] Initializing PIPELINE0 ...
pipeline> [APP] Initializing PIPELINE1 ...
[PIPELINE1] Pass-through
Segmentation fault (core dumped)
Fixes: 304c8091e90a ("port: add ethdev writer nodrop")
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
lib/librte_port/rte_port_ethdev.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/librte_port/rte_port_ethdev.c b/lib/librte_port/rte_port_ethdev.c
index 1f0c81c..1c34602 100644
--- a/lib/librte_port/rte_port_ethdev.c
+++ b/lib/librte_port/rte_port_ethdev.c
@@ -390,16 +390,20 @@ send_burst_nodrop(struct rte_port_ethdev_writer_nodrop *p)
p->tx_buf_count);
/* We sent all the packets in a first try */
- if (nb_tx >= p->tx_buf_count)
+ if (nb_tx >= p->tx_buf_count) {
+ p->tx_buf_count = 0;
return;
+ }
for (i = 0; i < p->n_retries; i++) {
nb_tx += rte_eth_tx_burst(p->port_id, p->queue_id,
p->tx_buf + nb_tx, p->tx_buf_count - nb_tx);
/* We sent all the packets in more than one try */
- if (nb_tx >= p->tx_buf_count)
+ if (nb_tx >= p->tx_buf_count) {
+ p->tx_buf_count = 0;
return;
+ }
}
/* We didn't send the packets in maximum allowed attempts */
--
2.6.2

View File

@ -0,0 +1,74 @@
From fa11a8a7251e14eca0a4190128732386f13551bd Mon Sep 17 00:00:00 2001
From: Jasvinder Singh <jasvinder.singh@intel.com>
Date: Wed, 2 Mar 2016 21:19:58 +0000
Subject: [PATCH] port: fix crash for ring writer nodrop
Error log:
[APP] Initializing PIPELINE0 ...
pipeline> [APP] Initializing PIPELINE1 ...
[PIPELINE1] Pass-through
[APP] Initializing PIPELINE2 ...
[PIPELINE2] Pass-through
Segmentation fault (core dumped)
Fixes: 5f4cd47309d6 ("port: add ring writer nodrop")
Fixes: d58f69c54172 ("port: add ring multi reader or writer")
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
lib/librte_port/rte_port_ring.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/lib/librte_port/rte_port_ring.c b/lib/librte_port/rte_port_ring.c
index 755dfc1..b847fea 100644
--- a/lib/librte_port/rte_port_ring.c
+++ b/lib/librte_port/rte_port_ring.c
@@ -520,16 +520,20 @@ send_burst_nodrop(struct rte_port_ring_writer_nodrop *p)
p->tx_buf_count);
/* We sent all the packets in a first try */
- if (nb_tx >= p->tx_buf_count)
+ if (nb_tx >= p->tx_buf_count) {
+ p->tx_buf_count = 0;
return;
+ }
for (i = 0; i < p->n_retries; i++) {
nb_tx += rte_ring_sp_enqueue_burst(p->ring,
(void **) (p->tx_buf + nb_tx), p->tx_buf_count - nb_tx);
/* We sent all the packets in more than one try */
- if (nb_tx >= p->tx_buf_count)
+ if (nb_tx >= p->tx_buf_count) {
+ p->tx_buf_count = 0;
return;
+ }
}
/* We didn't send the packets in maximum allowed attempts */
@@ -549,16 +553,20 @@ send_burst_mp_nodrop(struct rte_port_ring_writer_nodrop *p)
p->tx_buf_count);
/* We sent all the packets in a first try */
- if (nb_tx >= p->tx_buf_count)
+ if (nb_tx >= p->tx_buf_count) {
+ p->tx_buf_count = 0;
return;
+ }
for (i = 0; i < p->n_retries; i++) {
nb_tx += rte_ring_mp_enqueue_burst(p->ring,
(void **) (p->tx_buf + nb_tx), p->tx_buf_count - nb_tx);
/* We sent all the packets in more than one try */
- if (nb_tx >= p->tx_buf_count)
+ if (nb_tx >= p->tx_buf_count) {
+ p->tx_buf_count = 0;
return;
+ }
}
/* We didn't send the packets in maximum allowed attempts */
--
2.6.2

View File

@ -0,0 +1,29 @@
From da82ee17e6ea99bf2931383ac33b0caccaaaefce Mon Sep 17 00:00:00 2001
From: Jeff Shaw <jeffrey.b.shaw@intel.com>
Date: Mon, 8 Feb 2016 16:33:46 -0800
Subject: [PATCH] tools: fix unbinding failure handling
We should call sys.exit(), not divide sys by exit().
Signed-off-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
tools/dpdk_nic_bind.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py
index f02454e..a1923c5 100755
--- a/tools/dpdk_nic_bind.py
+++ b/tools/dpdk_nic_bind.py
@@ -317,7 +317,7 @@ def unbind_one(dev_id, force):
f = open(filename, "a")
except:
print "Error: unbind failed for %s - Cannot open %s" % (dev_id, filename)
- sys/exit(1)
+ sys.exit(1)
f.write(dev_id)
f.close()
--
2.6.2

View File

@ -0,0 +1,253 @@
From 16c1814c802c205f6d3c32e3d3d10de9f87e7f22 Mon Sep 17 00:00:00 2001
From: Dawid Jurczak <dawid_jurek@vp.pl>
Date: Wed, 27 Jan 2016 20:59:44 +0100
Subject: [PATCH] tools: support Python 3 in bind script
This patch fixes syntax errors during binding ethernet device
on systems where Python 3 is default.
Backward compatibility with Python 2 is preserved.
Signed-off-by: Dawid Jurczak <dawid_jurek@vp.pl>
---
tools/dpdk_nic_bind.py | 74 +++++++++++++++++++++++++-------------------------
1 file changed, 37 insertions(+), 37 deletions(-)
diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py
index a1923c5..dfefdae 100755
--- a/tools/dpdk_nic_bind.py
+++ b/tools/dpdk_nic_bind.py
@@ -54,7 +54,7 @@ args = []
def usage():
'''Print usage information for the program'''
argv0 = basename(sys.argv[0])
- print """
+ print ("""
Usage:
------
@@ -110,7 +110,7 @@ To unbind 0000:01:00.0 from using any driver
To bind 0000:02:00.0 and 0000:02:00.1 to the ixgbe kernel driver
%(argv0)s -b ixgbe 02:00.0 02:00.1
- """ % locals() # replace items from local variables
+ """ % locals()) # replace items from local variables
# This is roughly compatible with check_output function in subprocess module
# which is only available in python 2.7.
@@ -156,7 +156,7 @@ def check_modules():
'''Checks that igb_uio is loaded'''
global dpdk_drivers
- fd = file("/proc/modules")
+ fd = open("/proc/modules", 'r')
loaded_mods = fd.readlines()
fd.close()
@@ -176,10 +176,10 @@ def check_modules():
# check if we have at least one loaded module
if True not in [mod["Found"] for mod in mods] and b_flag is not None:
if b_flag in dpdk_drivers:
- print "Error - no supported modules(DPDK driver) are loaded"
+ print ("Error - no supported modules(DPDK driver) are loaded")
sys.exit(1)
else:
- print "Warning - no supported modules(DPDK driver) are loaded"
+ print ("Warning - no supported modules(DPDK driver) are loaded")
# change DPDK driver list to only contain drivers that are loaded
dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]]
@@ -198,7 +198,7 @@ def get_pci_device_details(dev_id):
for line in extra_info:
if len(line) == 0:
continue
- name, value = line.split("\t", 1)
+ name, value = line.decode().split("\t", 1)
name = name.strip(":") + "_str"
device[name] = value
# check for a unix interface name
@@ -234,7 +234,7 @@ def get_nic_details():
dev["Device"] = int(dev["Device"],16)
devices[dev["Slot"]] = dict(dev) # use dict to make copy of dev
else:
- name, value = dev_line.split("\t", 1)
+ name, value = dev_line.decode().split("\t", 1)
dev[name.rstrip(":")] = value
# check what is the interface if any for an ssh connection if
@@ -243,17 +243,17 @@ def get_nic_details():
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.splitlines()))
+ route.decode().splitlines()))
rt_info = route.split()
- for i in xrange(len(rt_info) - 1):
+ 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] = dict(devices[d].items() +
- get_pci_device_details(d).items())
+ 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(","):
@@ -293,22 +293,22 @@ def dev_id_from_dev_name(dev_name):
if dev_name in devices[d]["Interface"].split(","):
return devices[d]["Slot"]
# if nothing else matches - error
- print "Unknown device: %s. " \
- "Please specify device in \"bus:slot.func\" format" % dev_name
+ print ("Unknown device: %s. " \
+ "Please specify device in \"bus:slot.func\" format" % dev_name)
sys.exit(1)
def unbind_one(dev_id, force):
'''Unbind the device identified by "dev_id" from its current driver'''
dev = devices[dev_id]
if not has_driver(dev_id):
- print "%s %s %s is not currently managed by any driver\n" % \
- (dev["Slot"], dev["Device_str"], dev["Interface"])
+ print ("%s %s %s is not currently managed by any driver\n" % \
+ (dev["Slot"], dev["Device_str"], dev["Interface"]))
return
# prevent us disconnecting ourselves
if dev["Ssh_if"] and not force:
- print "Routing table indicates that interface %s is active" \
- ". Skipping unbind" % (dev_id)
+ print ("Routing table indicates that interface %s is active" \
+ ". Skipping unbind" % (dev_id))
return
# write to /sys to unbind
@@ -316,7 +316,7 @@ def unbind_one(dev_id, force):
try:
f = open(filename, "a")
except:
- print "Error: unbind failed for %s - Cannot open %s" % (dev_id, filename)
+ print ("Error: unbind failed for %s - Cannot open %s" % (dev_id, filename))
sys.exit(1)
f.write(dev_id)
f.close()
@@ -329,14 +329,14 @@ def bind_one(dev_id, driver, force):
# prevent disconnection of our ssh session
if dev["Ssh_if"] and not force:
- print "Routing table indicates that interface %s is active" \
- ". Not modifying" % (dev_id)
+ print ("Routing table indicates that interface %s is active" \
+ ". Not modifying" % (dev_id))
return
# unbind any existing drivers we don't want
if has_driver(dev_id):
if dev["Driver_str"] == driver:
- print "%s already bound to driver %s, skipping\n" % (dev_id, driver)
+ print ("%s already bound to driver %s, skipping\n" % (dev_id, driver))
return
else:
saved_driver = dev["Driver_str"]
@@ -349,14 +349,14 @@ def bind_one(dev_id, driver, force):
try:
f = open(filename, "w")
except:
- print "Error: bind failed for %s - Cannot open %s" % (dev_id, filename)
+ print ("Error: bind failed for %s - Cannot open %s" % (dev_id, filename))
return
try:
f.write("%04x %04x" % (dev["Vendor"], dev["Device"]))
f.close()
except:
- print "Error: bind failed for %s - Cannot write new PCI ID to " \
- "driver %s" % (dev_id, driver)
+ print ("Error: bind failed for %s - Cannot write new PCI ID to " \
+ "driver %s" % (dev_id, driver))
return
# do the bind by writing to /sys
@@ -364,7 +364,7 @@ def bind_one(dev_id, driver, force):
try:
f = open(filename, "a")
except:
- print "Error: bind failed for %s - Cannot open %s" % (dev_id, filename)
+ print ("Error: bind failed for %s - Cannot open %s" % (dev_id, filename))
if saved_driver is not None: # restore any previous driver
bind_one(dev_id, saved_driver, force)
return
@@ -378,7 +378,7 @@ def bind_one(dev_id, driver, force):
tmp = get_pci_device_details(dev_id)
if "Driver_str" in tmp and tmp["Driver_str"] == driver:
return
- print "Error: bind failed for %s - Cannot bind to driver %s" % (dev_id, driver)
+ print ("Error: bind failed for %s - Cannot bind to driver %s" % (dev_id, driver))
if saved_driver is not None: # restore any previous driver
bind_one(dev_id, saved_driver, force)
return
@@ -423,8 +423,8 @@ def display_devices(title, dev_list, extra_params = None):
%()s fields in it for replacement by the named fields in each device's
dictionary.'''
strings = [] # this holds the strings to print. We sort before printing
- print "\n%s" % title
- print "="*len(title)
+ print ("\n%s" % title)
+ print ("="*len(title))
if len(dev_list) == 0:
strings.append("<none>")
else:
@@ -436,7 +436,7 @@ def display_devices(title, dev_list, extra_params = None):
strings.append("%s '%s'" % (dev["Slot"], dev["Device_str"]))
# sort before printing, so that the entries appear in PCI order
strings.sort()
- print "\n".join(strings) # print one per line
+ print ("\n".join(strings)) # print one per line
def show_status():
'''Function called when the script is passed the "--status" option. Displays
@@ -480,9 +480,9 @@ def parse_args():
opts, args = getopt.getopt(sys.argv[1:], "b:us",
["help", "usage", "status", "force",
"bind=", "unbind"])
- except getopt.GetoptError, error:
- print str(error)
- print "Run '%s --usage' for further information" % sys.argv[0]
+ except (getopt.GetoptError, error):
+ print (str(error))
+ print ("Run '%s --usage' for further information" % sys.argv[0])
sys.exit(1)
for opt, arg in opts:
@@ -495,7 +495,7 @@ def parse_args():
force_flag = True
if opt == "-b" or opt == "-u" or opt == "--bind" or opt == "--unbind":
if b_flag is not None:
- print "Error - Only one bind or unbind may be specified\n"
+ print ("Error - Only one bind or unbind may be specified\n")
sys.exit(1)
if opt == "-u" or opt == "--unbind":
b_flag = "none"
@@ -510,13 +510,13 @@ def do_arg_actions():
global args
if b_flag is None and not status_flag:
- print "Error: No action specified for devices. Please give a -b or -u option"
- print "Run '%s --usage' for further information" % sys.argv[0]
+ print ("Error: No action specified for devices. Please give a -b or -u option")
+ print ("Run '%s --usage' for further information" % sys.argv[0])
sys.exit(1)
if b_flag is not None and len(args) == 0:
- print "Error: No devices specified."
- print "Run '%s --usage' for further information" % sys.argv[0]
+ print ("Error: No devices specified.")
+ print ("Run '%s --usage' for further information" % sys.argv[0])
sys.exit(1)
if b_flag == "none" or b_flag == "None":
--
2.6.2

View File

@ -0,0 +1,69 @@
From bb9f408550d13af6c1da104b0d9d9b9837f69bde Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
Date: Thu, 28 Jan 2016 14:13:53 +0100
Subject: [PATCH] tools: support binding to built-in kernel modules
Currently dpdk_nic_bind.py detects Linux kernel modules via reading
/proc/modules. Built-in ones aren't listed there and therefore they are
not being found by the script.
Add support for checking built-in modules with parsing the sysfs files.
This commit obsoletes the /proc/modules parsing approach.
Signed-off-by: Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
tools/dpdk_nic_bind.py | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py
index dfefdae..14c5311 100755
--- a/tools/dpdk_nic_bind.py
+++ b/tools/dpdk_nic_bind.py
@@ -156,22 +156,32 @@ def check_modules():
'''Checks that igb_uio is loaded'''
global dpdk_drivers
- fd = open("/proc/modules", 'r')
- loaded_mods = fd.readlines()
- fd.close()
-
# list of supported modules
mods = [{"Name" : driver, "Found" : False} for driver in dpdk_drivers]
# first check if module is loaded
- for line in loaded_mods:
+ try:
+ # Get list of sysfs modules (both built-in and dynamically loaded)
+ sysfs_path = '/sys/module/'
+
+ # Get the list of directories in sysfs_path
+ sysfs_mods = [os.path.join(sysfs_path, o) for o
+ in os.listdir(sysfs_path)
+ if os.path.isdir(os.path.join(sysfs_path, o))]
+
+ # Extract the last element of '/sys/module/abc' in the array
+ sysfs_mods = [a.split('/')[-1] for a in sysfs_mods]
+
+ # special case for vfio_pci (module is named vfio-pci,
+ # but its .ko is named vfio_pci)
+ sysfs_mods = map(lambda a:
+ a if a != 'vfio_pci' else 'vfio-pci', sysfs_mods)
+
for mod in mods:
- if line.startswith(mod["Name"]):
- mod["Found"] = True
- # special case for vfio_pci (module is named vfio-pci,
- # but its .ko is named vfio_pci)
- elif line.replace("_", "-").startswith(mod["Name"]):
+ if mod["Name"] in sysfs_mods:
mod["Found"] = True
+ except:
+ pass
# check if we have at least one loaded module
if True not in [mod["Found"] for mod in mods] and b_flag is not None:
--
2.6.2

View File

@ -0,0 +1,151 @@
From ca67ed289a76f38d6c4a4021985a36eaf1d77e28 Mon Sep 17 00:00:00 2001
From: Rich Lane <rich.lane@bigswitch.com>
Date: Wed, 10 Feb 2016 10:40:55 -0800
Subject: [PATCH] vhost: fix leak of fds and mmaps
The common vhost code only supported a single mmap per device. vhost-user
worked around this by saving the address/length/fd of each mmap after the end
of the rte_virtio_memory struct. This only works if the vhost-user code frees
dev->mem, since the common code is unaware of the extra info. The
VHOST_USER_RESET_OWNER message is one situation where the common code frees
dev->mem and leaks the fds and mappings. This happens every time I shut down a
VM.
The new code calls back into the implementation (vhost-user or vhost-cuse) to
clean up these resources.
The vhost-cuse changes are only compile tested.
Signed-off-by: Rich Lane <rich.lane@bigswitch.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
lib/librte_vhost/vhost-net.h | 6 ++++++
lib/librte_vhost/vhost_cuse/virtio-net-cdev.c | 12 ++++++++++++
lib/librte_vhost/vhost_user/vhost-net-user.c | 1 -
lib/librte_vhost/vhost_user/virtio-net-user.c | 25 ++++++++++---------------
lib/librte_vhost/vhost_user/virtio-net-user.h | 1 -
lib/librte_vhost/virtio-net.c | 8 +-------
6 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/lib/librte_vhost/vhost-net.h b/lib/librte_vhost/vhost-net.h
index c69b60b..affbd1a 100644
--- a/lib/librte_vhost/vhost-net.h
+++ b/lib/librte_vhost/vhost-net.h
@@ -115,4 +115,10 @@ struct vhost_net_device_ops {
struct vhost_net_device_ops const *get_virtio_net_callbacks(void);
+
+/*
+ * Backend-specific cleanup. Defined by vhost-cuse and vhost-user.
+ */
+void vhost_backend_cleanup(struct virtio_net *dev);
+
#endif /* _VHOST_NET_CDEV_H_ */
diff --git a/lib/librte_vhost/vhost_cuse/virtio-net-cdev.c b/lib/librte_vhost/vhost_cuse/virtio-net-cdev.c
index ae2c3fa..374c884 100644
--- a/lib/librte_vhost/vhost_cuse/virtio-net-cdev.c
+++ b/lib/librte_vhost/vhost_cuse/virtio-net-cdev.c
@@ -421,3 +421,15 @@ int cuse_set_backend(struct vhost_device_ctx ctx, struct vhost_vring_file *file)
return ops->set_backend(ctx, file);
}
+
+void
+vhost_backend_cleanup(struct virtio_net *dev)
+{
+ /* Unmap QEMU memory file if mapped. */
+ if (dev->mem) {
+ munmap((void *)(uintptr_t)dev->mem->mapped_address,
+ (size_t)dev->mem->mapped_size);
+ free(dev->mem);
+ dev->mem = NULL;
+ }
+}
diff --git a/lib/librte_vhost/vhost_user/vhost-net-user.c b/lib/librte_vhost/vhost_user/vhost-net-user.c
index cb18396..6ed7669 100644
--- a/lib/librte_vhost/vhost_user/vhost-net-user.c
+++ b/lib/librte_vhost/vhost_user/vhost-net-user.c
@@ -348,7 +348,6 @@ vserver_message_handler(int connfd, void *dat, int *remove)
close(connfd);
*remove = 1;
free(cfd_ctx);
- user_destroy_device(ctx);
ops->destroy_device(ctx);
return;
diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vhost/vhost_user/virtio-net-user.c
index 4270c98..ffce0d6 100644
--- a/lib/librte_vhost/vhost_user/virtio-net-user.c
+++ b/lib/librte_vhost/vhost_user/virtio-net-user.c
@@ -94,6 +94,16 @@ free_mem_region(struct virtio_net *dev)
}
}
+void
+vhost_backend_cleanup(struct virtio_net *dev)
+{
+ if (dev->mem) {
+ free_mem_region(dev);
+ free(dev->mem);
+ dev->mem = NULL;
+ }
+}
+
int
user_set_mem_table(struct vhost_device_ctx ctx, struct VhostUserMsg *pmsg)
{
@@ -345,21 +355,6 @@ user_set_vring_enable(struct vhost_device_ctx ctx,
}
void
-user_destroy_device(struct vhost_device_ctx ctx)
-{
- struct virtio_net *dev = get_device(ctx);
-
- if (dev && (dev->flags & VIRTIO_DEV_RUNNING))
- notify_ops->destroy_device(dev);
-
- if (dev && dev->mem) {
- free_mem_region(dev);
- free(dev->mem);
- dev->mem = NULL;
- }
-}
-
-void
user_set_protocol_features(struct vhost_device_ctx ctx,
uint64_t protocol_features)
{
diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.h b/lib/librte_vhost/vhost_user/virtio-net-user.h
index 28213f3..559bb46 100644
--- a/lib/librte_vhost/vhost_user/virtio-net-user.h
+++ b/lib/librte_vhost/vhost_user/virtio-net-user.h
@@ -61,5 +61,4 @@ int user_get_vring_base(struct vhost_device_ctx, struct vhost_vring_state *);
int user_set_vring_enable(struct vhost_device_ctx ctx,
struct vhost_vring_state *state);
-void user_destroy_device(struct vhost_device_ctx);
#endif
diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index 9059b11..196e1cf 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -207,13 +207,7 @@ cleanup_device(struct virtio_net *dev, int destroy)
{
uint32_t i;
- /* Unmap QEMU memory file if mapped. */
- if (dev->mem) {
- munmap((void *)(uintptr_t)dev->mem->mapped_address,
- (size_t)dev->mem->mapped_size);
- free(dev->mem);
- dev->mem = NULL;
- }
+ vhost_backend_cleanup(dev);
for (i = 0; i < dev->virt_qp_nb; i++) {
cleanup_vq(dev->virtqueue[i * VIRTIO_QNUM + VIRTIO_RXQ], destroy);
--
2.6.2

View File

@ -0,0 +1,50 @@
From c680a4a88c4312068f60937a7ba51eac8211c9a6 Mon Sep 17 00:00:00 2001
From: Bernard Iremonger <bernard.iremonger@intel.com>
Date: Wed, 23 Dec 2015 09:45:19 +0000
Subject: [PATCH] virtio: fix crash in statistics functions
This initialisation of nb_rx_queues and nb_tx_queues has been removed
from eth_virtio_dev_init.
The nb_rx_queues and nb_tx_queues were being initialised in
eth_virtio_dev_init before the tx_queues and rx_queues arrays were
allocated.
The arrays are allocated when the ethdev port is configured and the
nb_tx_queues and nb_rx_queues are initialised.
If any of the following functions were called before the ethdev
port was configured there was a segmentation fault because
rx_queues and tx_queues were NULL:
rte_eth_stats_get
rte_eth_stats_reset
rte_eth_xstats_get
rte_eth_xstats_reset
Fixes: 823ad647950a ("virtio: support multiple queues")
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
drivers/net/virtio/virtio_ethdev.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index ec18fd0..ebefdb4 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1131,9 +1131,6 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
hw->max_tx_queues = 1;
}
- eth_dev->data->nb_rx_queues = hw->max_rx_queues;
- eth_dev->data->nb_tx_queues = hw->max_tx_queues;
-
PMD_INIT_LOG(DEBUG, "hw->max_rx_queues=%d hw->max_tx_queues=%d",
hw->max_rx_queues, hw->max_tx_queues);
PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x",
--
2.6.2

View File

@ -0,0 +1,34 @@
From 3b1e3e4e362453df8cecbc6d481444be8b84326e Mon Sep 17 00:00:00 2001
From: Huawei Xie <huawei.xie@intel.com>
Date: Fri, 11 Dec 2015 00:07:32 +0800
Subject: [PATCH] virtio: fix descriptors pointing to the same buffer
The virtio_net_hdr desc all pointed to the same buffer. It doesn't cause
issue because in the simple TX mode we don't use the header. This patch
makes the header desc point to different buffer.
Fixes: b4ae9c505f2e ("virtio: optimize ring layout")
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
drivers/net/virtio/virtio_rxtx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index e96352c..a7a58be 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -353,7 +353,7 @@ virtio_dev_vring_start(struct virtqueue *vq, int queue_type)
vq->vq_ring.desc[i + mid_idx].next = i;
vq->vq_ring.desc[i + mid_idx].addr =
vq->virtio_net_hdr_mem +
- mid_idx * vq->hw->vtnet_hdr_size;
+ i * vq->hw->vtnet_hdr_size;
vq->vq_ring.desc[i + mid_idx].len =
vq->hw->vtnet_hdr_size;
vq->vq_ring.desc[i + mid_idx].flags =
--
2.6.2

View File

@ -0,0 +1,69 @@
From 9a0615af7746485d73d10561cc0743bc2fcd4bf7 Mon Sep 17 00:00:00 2001
From: Jianfeng Tan <jianfeng.tan@intel.com>
Date: Mon, 11 Jan 2016 14:16:13 +0800
Subject: [PATCH] virtio: fix restart
Fix the issue that virtio device cannot be started after stopped.
The field, hw->started, should be changed by virtio_dev_start/stop instead
of virtio_dev_close.
Fixes: a85786dc816f ("virtio: fix states handling during initialization")
Reported-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
---
drivers/net/virtio/virtio_ethdev.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 06bddd7..ec18fd0 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -478,11 +478,13 @@ virtio_dev_close(struct rte_eth_dev *dev)
PMD_INIT_LOG(DEBUG, "virtio_dev_close");
+ if (hw->started == 1)
+ virtio_dev_stop(dev);
+
/* reset the NIC */
if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)
vtpci_irq_config(hw, VIRTIO_MSI_NO_VECTOR);
vtpci_reset(hw);
- hw->started = 0;
virtio_dev_free_mbufs(dev);
virtio_free_queues(dev);
}
@@ -1159,10 +1161,9 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
if (rte_eal_process_type() == RTE_PROC_SECONDARY)
return -EPERM;
- if (hw->started == 1) {
- virtio_dev_stop(eth_dev);
- virtio_dev_close(eth_dev);
- }
+ /* Close it anyway since there's no way to know if closed */
+ virtio_dev_close(eth_dev);
+
pci_dev = eth_dev->pci_dev;
eth_dev->dev_ops = NULL;
@@ -1364,9 +1365,12 @@ static void
virtio_dev_stop(struct rte_eth_dev *dev)
{
struct rte_eth_link link;
+ struct virtio_hw *hw = dev->data->dev_private;
PMD_INIT_LOG(DEBUG, "stop");
+ hw->started = 0;
+
if (dev->data->dev_conf.intr_conf.lsc)
rte_intr_disable(&dev->pci_dev->intr_handle);
--
2.6.2

View File

@ -1,3 +1,37 @@
-------------------------------------------------------------------
Fri May 27 12:28:02 CEST 2016 - ndas@suse.de
- Applied all the fixes recommended by upstream for
v2.2 stable release(bsc#981996).
[+0008-app-testpmd-handle-SIGINT-and-SIGTERM.patch,
+0009-bonding-copy-entire-config-structure-in-mode-4.patch,
+0010-bonding-fix-active-slaves-with-no-primary.patch,
+0011-bonding-do-not-ignore-multicast-in-mode-4.patch,
+0012-bonding-do-not-activate-slave-twice.patch,
+0013-bonding-fix-crash-when-no-slave-device.patch,
+0014-bonding-fix-detach-of-bonded-device.patch,
+0015-bonding-fix-detach-of-slave-devices.patch,
+0016-eal-linux-support-built-in-kernel-modules.patch,
+0017-examples-l3fwd-handle-SIGINT-and-SIGTERM.patch,
+0018-fm10k-fix-VLAN-flag-in-scattered-Rx.patch,
+0019-i40e-base-fix-driver-load-failure.patch,
+0020-i40e-base-fix-missing-check-for-stopped-admin-queue.patch,
+0021-i40e-fix-inverted-check-for-no-refcount.patch,
+0022-i40e-fix-overflow.patch,
+0023-i40e-fix-VLAN-filtering.patch,
+0024-mempool-fix-leak-when-creation-fails.patch,
+0025-pcap-fix-captured-frame-length.patch,
+0026-port-fix-crash-for-ethdev-writer-nodrop.patch,
+0027-port-fix-crash-for-ring-writer-nodrop.patch,
+0028-tools-fix-unbinding-failure-handling.patch,
+0029-tools-support-Python-3-in-bind-script.patch,
+0030-tools-support-binding-to-built-in-kernel-modules.patch,
+0031-vhost-fix-leak-of-fds-and-mmaps.patch,
+0032-virtio-fix-crash-in-statistics-functions.patch,
+0033-virtio-fix-descriptors-pointing-to-the-same-buffer.patch,
+0034-virtio-fix-restart.patch]
-------------------------------------------------------------------
Thu Apr 28 14:39:36 CEST 2016 - ndas@suse.de

View File

@ -44,6 +44,61 @@ Patch5: 0005-d293dac-vhost-claim-support-of-guest-announce.patch
Patch6: 0006-d639996-vhost-enable-log_shmfd-protocol-feature.patch
#PATCH-FIX-UPSTREAM 0007-ixgbe-fix-VLAN-filter-missing-brackets.patch
Patch7: 0007-ixgbe-fix-VLAN-filter-missing-brackets.patch
#PATCH-FIX-UPSTREAM 0008-app-testpmd-handle-SIGINT-and-SIGTERM.patch
Patch8: 0008-app-testpmd-handle-SIGINT-and-SIGTERM.patch
#PATCH-FIX-UPSTREAM 0009-bonding-copy-entire-config-structure-in-mode-4.patch
Patch9: 0009-bonding-copy-entire-config-structure-in-mode-4.patch
#PATCH-FIX-UPSTREAM 0010-bonding-fix-active-slaves-with-no-primary.patch
Patch10: 0010-bonding-fix-active-slaves-with-no-primary.patch
#PATCH-FIX-UPSTREAM 0011-bonding-do-not-ignore-multicast-in-mode-4.patch
Patch11: 0011-bonding-do-not-ignore-multicast-in-mode-4.patch
#PATCH-FIX-UPSTREAM 0012-bonding-do-not-activate-slave-twice.patch
Patch12: 0012-bonding-do-not-activate-slave-twice.patch
#PATCH-FIX-UPSTREAM 0013-bonding-fix-crash-when-no-slave-device.patch
Patch13: 0013-bonding-fix-crash-when-no-slave-device.patch
#PATCH-FIX-UPSTREAM 0014-bonding-fix-detach-of-bonded-device.patch
Patch14: 0014-bonding-fix-detach-of-bonded-device.patch
#PATCH-FIX-UPSTREAM 0015-bonding-fix-detach-of-slave-devices.patch
Patch15: 0015-bonding-fix-detach-of-slave-devices.patch
#PATCH-FIX-UPSTREAM 0016-eal-linux-support-built-in-kernel-modules.patch
Patch16: 0016-eal-linux-support-built-in-kernel-modules.patch
#PATCH-FIX-UPSTREAM 0017-examples-l3fwd-handle-SIGINT-and-SIGTERM.patch
Patch17: 0017-examples-l3fwd-handle-SIGINT-and-SIGTERM.patch
#PATCH-FIX-UPSTREAM 0018-fm10k-fix-VLAN-flag-in-scattered-Rx.patch
Patch18: 0018-fm10k-fix-VLAN-flag-in-scattered-Rx.patch
#PATCH-FIX-UPSTREAM 0019-i40e-base-fix-driver-load-failure.patch
Patch19: 0019-i40e-base-fix-driver-load-failure.patch
#PATCH-FIX-UPSTREAM 0020-i40e-base-fix-missing-check-for-stopped-admin-queue.patch
Patch20: 0020-i40e-base-fix-missing-check-for-stopped-admin-queue.patch
#PATCH-FIX-UPSTREAM 0021-i40e-fix-inverted-check-for-no-refcount.patch
Patch21: 0021-i40e-fix-inverted-check-for-no-refcount.patch
#PATCH-FIX-UPSTREAM 0022-i40e-fix-overflow.patch
Patch22: 0022-i40e-fix-overflow.patch
#PATCH-FIX-UPSTREAM 0023-i40e-fix-VLAN-filtering.patch
Patch23: 0023-i40e-fix-VLAN-filtering.patch
#PATCH-FIX-UPSTREAM 0024-mempool-fix-leak-when-creation-fails.patch
Patch24: 0024-mempool-fix-leak-when-creation-fails.patch
#PATCH-FIX-UPSTREAM 0025-pcap-fix-captured-frame-length.patch
Patch25: 0025-pcap-fix-captured-frame-length.patch
#PATCH-FIX-UPSTREAM 0026-port-fix-crash-for-ethdev-writer-nodrop.patch
Patch26: 0026-port-fix-crash-for-ethdev-writer-nodrop.patch
#PATCH-FIX-UPSTREAM 0027-port-fix-crash-for-ring-writer-nodrop.patch
Patch27: 0027-port-fix-crash-for-ring-writer-nodrop.patch
#PATCH-FIX-UPSTREAM 0028-tools-fix-unbinding-failure-handling.patch
Patch28: 0028-tools-fix-unbinding-failure-handling.patch
#PATCH-FIX-UPSTREAM 0029-tools-support-Python-3-in-bind-script.patch
Patch29: 0029-tools-support-Python-3-in-bind-script.patch
#PATCH-FIX-UPSTREAM 0030-tools-support-binding-to-built-in-kernel-modules.patch
Patch30: 0030-tools-support-binding-to-built-in-kernel-modules.patch
#PATCH-FIX-UPSTREAM 0031-vhost-fix-leak-of-fds-and-mmaps.patch
Patch31: 0031-vhost-fix-leak-of-fds-and-mmaps.patch
#PATCH-FIX-UPSTREAM 0032-virtio-fix-crash-in-statistics-functions.patch
Patch32: 0032-virtio-fix-crash-in-statistics-functions.patch
#PATCH-FIX-UPSTREAM 0033-virtio-fix-descriptors-pointing-to-the-same-buffer.patch
Patch33: 0033-virtio-fix-descriptors-pointing-to-the-same-buffer.patch
#PATCH-FIX-UPSTREAM 0034-virtio-fix-restart.patch
Patch34: 0034-virtio-fix-restart.patch
# PATCH-FIX-UPSTREAM: 0099-mk-fix-gcc-5-version-on-suse.patch
Patch99: 0099-mk-fix-gcc-5-version-on-suse.patch
BuildRequires: doxygen
@ -115,6 +170,34 @@ as L2 and L3 forwarding.
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch99 -p1 -z .rtetoolchain
%build