summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJia Yu <jyu@vmware.com>2014-11-27 21:23:37 +0000
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-11-27 22:50:06 +0100
commit4f1e87a332877fd606883585ae03e23526ba9a85 (patch)
tree411537c9cf9395725977f8092a221e5104a84e5e
parent0c8396e6d786768cccc0078ae96231997141a4e5 (diff)
downloaddpdk-4f1e87a332877fd606883585ae03e23526ba9a85.zip
dpdk-4f1e87a332877fd606883585ae03e23526ba9a85.tar.gz
dpdk-4f1e87a332877fd606883585ae03e23526ba9a85.tar.xz
bond: set offload capabilities flags
Before the fix, bond device's offload capabilities are unset. This fix takes the minimum common set of slave devices' capabilities as bond device's capabilities. For simplicity, we ensure all slave devices to have a capability before bond device can claim this capability, even if some slave devices are unused (i.e. linked down, standby). Signed-off-by: Jia Yu <jyu@vmware.com> Signed-off-by: Declan Doherty <declan.doherty@intel.com>
-rw-r--r--lib/librte_pmd_bond/rte_eth_bond_api.c18
-rw-r--r--lib/librte_pmd_bond/rte_eth_bond_pmd.c5
-rw-r--r--lib/librte_pmd_bond/rte_eth_bond_private.h3
3 files changed, 25 insertions, 1 deletions
diff --git a/lib/librte_pmd_bond/rte_eth_bond_api.c b/lib/librte_pmd_bond/rte_eth_bond_api.c
index c8fb42c..ef5ddf4 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_api.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_api.c
@@ -279,6 +279,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
internals->slave_count = 0;
internals->active_slave_count = 0;
+ internals->rx_offload_capa = 0;
+ internals->tx_offload_capa = 0;
memset(internals->active_slaves, 0, sizeof(internals->active_slaves));
memset(internals->slaves, 0, sizeof(internals->slaves));
@@ -314,6 +316,7 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
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;
@@ -345,6 +348,9 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
/* Add slave details to bonded device */
slave_add(internals, slave_eth_dev);
+ memset(&dev_info, 0, sizeof(dev_info));
+ rte_eth_dev_info_get(slave_port_id, &dev_info);
+
if (internals->slave_count < 1) {
/* if MAC is not user defined then use MAC of first slave add to
* bonded device */
@@ -357,6 +363,11 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
/* Make primary slave */
internals->primary_port = slave_port_id;
+
+ /* Take the first dev's offload capabilities */
+ internals->rx_offload_capa = dev_info.rx_offload_capa;
+ internals->tx_offload_capa = dev_info.tx_offload_capa;
+
} else {
/* Check slave link properties are supported if props are set,
* all slaves must be the same */
@@ -372,6 +383,8 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
link_properties_set(bonded_eth_dev,
&(slave_eth_dev->data->dev_link));
}
+ internals->rx_offload_capa &= dev_info.rx_offload_capa;
+ internals->tx_offload_capa &= dev_info.tx_offload_capa;
}
internals->slave_count++;
@@ -497,7 +510,10 @@ __eth_bond_slave_remove_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
memset(rte_eth_devices[bonded_port_id].data->mac_addrs, 0,
sizeof(*(rte_eth_devices[bonded_port_id].data->mac_addrs)));
}
-
+ if (internals->slave_count == 0) {
+ internals->rx_offload_capa = 0;
+ internals->tx_offload_capa = 0;
+ }
return 0;
}
diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index 32bbd41..bb2b909 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -1167,6 +1167,8 @@ static int bond_ethdev_configure(struct rte_eth_dev *dev);
static void
bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
+ struct bond_dev_private *internals = dev->data->dev_private;
+
dev_info->driver_name = driver_name;
dev_info->max_mac_addrs = 1;
@@ -1177,6 +1179,9 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->min_rx_bufsize = 0;
dev_info->pci_dev = dev->pci_dev;
+
+ dev_info->rx_offload_capa = internals->rx_offload_capa;
+ dev_info->tx_offload_capa = internals->tx_offload_capa;
}
static int
diff --git a/lib/librte_pmd_bond/rte_eth_bond_private.h b/lib/librte_pmd_bond/rte_eth_bond_private.h
index 2ba2d62..f913c5b 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_private.h
+++ b/lib/librte_pmd_bond/rte_eth_bond_private.h
@@ -147,6 +147,9 @@ struct bond_dev_private {
struct mode8023ad_private mode4;
+ uint32_t rx_offload_capa; /** Rx offload capability */
+ uint32_t tx_offload_capa; /** Tx offload capability */
+
struct rte_kvargs *kvlist;
uint8_t slave_update_idx;
};