git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/i40e: fix Rx packet statistics
[dpdk.git]
/
drivers
/
net
/
bonding
/
rte_eth_bond_api.c
diff --git
a/drivers/net/bonding/rte_eth_bond_api.c
b/drivers/net/bonding/rte_eth_bond_api.c
index
d77dc40
..
5140ef1
100644
(file)
--- a/
drivers/net/bonding/rte_eth_bond_api.c
+++ b/
drivers/net/bonding/rte_eth_bond_api.c
@@
-6,7
+6,7
@@
#include <rte_mbuf.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
#include <rte_malloc.h>
-#include <
rte_
ethdev_driver.h>
+#include <ethdev_driver.h>
#include <rte_tcp.h>
#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_tcp.h>
#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
@@
-56,19
+56,25
@@
check_for_master_bonded_ethdev(const struct rte_eth_dev *eth_dev)
}
int
}
int
-valid_slave_port_id(
uint16_t port_id, uint8_t mode
)
+valid_slave_port_id(
struct bond_dev_private *internals, uint16_t slave_port_id
)
{
{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(
slave_
port_id, -1);
- /* Verify that port_id refers to a non bonded port */
- if (check_for_bonded_ethdev(&rte_eth_devices[port_id]) == 0 &&
- mode == BONDING_MODE_8023AD) {
+ /* Verify that
slave_
port_id refers to a non bonded port */
+ if (check_for_bonded_ethdev(&rte_eth_devices[
slave_
port_id]) == 0 &&
+
internals->
mode == BONDING_MODE_8023AD) {
RTE_BOND_LOG(ERR, "Cannot add slave to bonded device in 802.3ad"
" mode as slave is also a bonded device, only "
"physical devices can be support in this mode.");
return -1;
}
RTE_BOND_LOG(ERR, "Cannot add slave to bonded device in 802.3ad"
" mode as slave is also a bonded device, only "
"physical devices can be support in this mode.");
return -1;
}
+ if (internals->port_id == slave_port_id) {
+ RTE_BOND_LOG(ERR,
+ "Cannot add the bonded device itself as its slave.");
+ return -1;
+ }
+
return 0;
}
return 0;
}
@@
-129,12
+135,6
@@
deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id)
RTE_ASSERT(active_count < RTE_DIM(internals->active_slaves));
internals->active_slave_count = active_count;
RTE_ASSERT(active_count < RTE_DIM(internals->active_slaves));
internals->active_slave_count = active_count;
- /* Resetting active_slave when reaches to max
- * no of slaves in active list
- */
- if (internals->active_slave >= active_count)
- internals->active_slave = 0;
-
if (eth_dev->data->dev_started) {
if (internals->mode == BONDING_MODE_8023AD) {
bond_mode_8023ad_start(eth_dev);
if (eth_dev->data->dev_started) {
if (internals->mode == BONDING_MODE_8023AD) {
bond_mode_8023ad_start(eth_dev);
@@
-243,7
+243,12
@@
slave_rte_flow_prepare(uint16_t slave_id, struct bond_dev_private *internals)
uint16_t slave_port_id = internals->slaves[slave_id].port_id;
if (internals->flow_isolated_valid != 0) {
uint16_t slave_port_id = internals->slaves[slave_id].port_id;
if (internals->flow_isolated_valid != 0) {
- rte_eth_dev_stop(slave_port_id);
+ if (rte_eth_dev_stop(slave_port_id) != 0) {
+ RTE_BOND_LOG(ERR, "Failed to stop device on port %u",
+ slave_port_id);
+ return -1;
+ }
+
if (rte_flow_isolate(slave_port_id, internals->flow_isolated,
&ferror)) {
RTE_BOND_LOG(ERR, "rte_flow_isolate failed for slave"
if (rte_flow_isolate(slave_port_id, internals->flow_isolated,
&ferror)) {
RTE_BOND_LOG(ERR, "rte_flow_isolate failed for slave"
@@
-285,6
+290,7
@@
eth_bond_slave_inherit_dev_info_rx_first(struct bond_dev_private *internals,
struct rte_eth_rxconf *rxconf_i = &internals->default_rxconf;
internals->reta_size = di->reta_size;
struct rte_eth_rxconf *rxconf_i = &internals->default_rxconf;
internals->reta_size = di->reta_size;
+ internals->rss_key_len = di->hash_key_size;
/* Inherit Rx offload capabilities from the first slave device */
internals->rx_offload_capa = di->rx_offload_capa;
/* Inherit Rx offload capabilities from the first slave device */
internals->rx_offload_capa = di->rx_offload_capa;
@@
-380,6
+386,11
@@
eth_bond_slave_inherit_dev_info_rx_next(struct bond_dev_private *internals,
*/
if (internals->reta_size > di->reta_size)
internals->reta_size = di->reta_size;
*/
if (internals->reta_size > di->reta_size)
internals->reta_size = di->reta_size;
+ if (internals->rss_key_len > di->hash_key_size) {
+ RTE_BOND_LOG(WARNING, "slave has different rss key size, "
+ "configuring rss may fail");
+ internals->rss_key_len = di->hash_key_size;
+ }
if (!internals->max_rx_pktlen &&
di->max_rx_pktlen < internals->candidate_max_rx_pktlen)
if (!internals->max_rx_pktlen &&
di->max_rx_pktlen < internals->candidate_max_rx_pktlen)
@@
-457,7
+468,7
@@
__eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
bonded_eth_dev = &rte_eth_devices[bonded_port_id];
internals = bonded_eth_dev->data->dev_private;
bonded_eth_dev = &rte_eth_devices[bonded_port_id];
internals = bonded_eth_dev->data->dev_private;
- if (valid_slave_port_id(
slave_port_id, internals->mode
) != 0)
+ if (valid_slave_port_id(
internals, slave_port_id
) != 0)
return -1;
slave_eth_dev = &rte_eth_devices[slave_port_id];
return -1;
slave_eth_dev = &rte_eth_devices[slave_port_id];
@@
-606,13
+617,15
@@
rte_eth_bond_slave_add(uint16_t bonded_port_id, uint16_t slave_port_id)
int retval;
int retval;
- /* Verify that port id's are valid bonded and slave ports */
if (valid_bonded_port_id(bonded_port_id) != 0)
return -1;
bonded_eth_dev = &rte_eth_devices[bonded_port_id];
internals = bonded_eth_dev->data->dev_private;
if (valid_bonded_port_id(bonded_port_id) != 0)
return -1;
bonded_eth_dev = &rte_eth_devices[bonded_port_id];
internals = bonded_eth_dev->data->dev_private;
+ if (valid_slave_port_id(internals, slave_port_id) != 0)
+ return -1;
+
rte_spinlock_lock(&internals->lock);
retval = __eth_bond_slave_add_lock_free(bonded_port_id, slave_port_id);
rte_spinlock_lock(&internals->lock);
retval = __eth_bond_slave_add_lock_free(bonded_port_id, slave_port_id);
@@
-636,7
+649,7
@@
__eth_bond_slave_remove_lock_free(uint16_t bonded_port_id,
bonded_eth_dev = &rte_eth_devices[bonded_port_id];
internals = bonded_eth_dev->data->dev_private;
bonded_eth_dev = &rte_eth_devices[bonded_port_id];
internals = bonded_eth_dev->data->dev_private;
- if (valid_slave_port_id(
slave_port_id, internals->mode
) < 0)
+ if (valid_slave_port_id(
internals, slave_port_id
) < 0)
return -1;
/* first remove from active slave list */
return -1;
/* first remove from active slave list */
@@
-698,6
+711,7
@@
__eth_bond_slave_remove_lock_free(uint16_t bonded_port_id,
internals->current_primary_port = internals->slaves[0].port_id;
else
internals->primary_port = 0;
internals->current_primary_port = internals->slaves[0].port_id;
else
internals->primary_port = 0;
+ mac_address_slaves_update(bonded_eth_dev);
}
if (internals->active_slave_count < 1) {
}
if (internals->active_slave_count < 1) {
@@
-783,7
+797,7
@@
rte_eth_bond_primary_set(uint16_t bonded_port_id, uint16_t slave_port_id)
internals = rte_eth_devices[bonded_port_id].data->dev_private;
internals = rte_eth_devices[bonded_port_id].data->dev_private;
- if (valid_slave_port_id(
slave_port_id, internals->mode
) != 0)
+ if (valid_slave_port_id(
internals, slave_port_id
) != 0)
return -1;
internals->user_defined_primary_port = 1;
return -1;
internals->user_defined_primary_port = 1;