raw/ifpga: add HE-LPBK AFU driver
[dpdk.git] / drivers / net / bonding / rte_eth_bond_api.c
index eb8d15d..4ac191c 100644 (file)
@@ -151,8 +151,8 @@ int
 rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
 {
        struct bond_dev_private *internals;
+       struct rte_eth_dev *bond_dev;
        char devargs[52];
-       uint16_t port_id;
        int ret;
 
        if (name == NULL) {
@@ -169,8 +169,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
        if (ret)
                return ret;
 
-       ret = rte_eth_dev_get_port_by_name(name, &port_id);
-       RTE_ASSERT(!ret);
+       bond_dev = rte_eth_dev_get_by_name(name);
+       RTE_ASSERT(bond_dev);
 
        /*
         * To make bond_ethdev_configure() happy we need to free the
@@ -178,11 +178,11 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
         *
         * Also see comment in bond_ethdev_configure().
         */
-       internals = rte_eth_devices[port_id].data->dev_private;
+       internals = bond_dev->data->dev_private;
        rte_kvargs_free(internals->kvlist);
        internals->kvlist = NULL;
 
-       return port_id;
+       return bond_dev->data->port_id;
 }
 
 int
@@ -204,7 +204,7 @@ slave_vlan_filter_set(uint16_t bonded_port_id, uint16_t slave_port_id)
 
        bonded_eth_dev = &rte_eth_devices[bonded_port_id];
        if ((bonded_eth_dev->data->dev_conf.rxmode.offloads &
-                       DEV_RX_OFFLOAD_VLAN_FILTER) == 0)
+                       RTE_ETH_RX_OFFLOAD_VLAN_FILTER) == 0)
                return 0;
 
        internals = bonded_eth_dev->data->dev_private;
@@ -290,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;
+       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;
@@ -374,7 +375,7 @@ eth_bond_slave_inherit_dev_info_rx_next(struct bond_dev_private *internals,
         * value. Thus, the new internal value of default Rx queue offloads
         * has to be masked by rx_queue_offload_capa to make sure that only
         * commonly supported offloads are preserved from both the previous
-        * value and the value being inhereted from the new slave device.
+        * value and the value being inherited from the new slave device.
         */
        rxconf_i->offloads = (rxconf_i->offloads | rxconf->offloads) &
                             internals->rx_queue_offload_capa;
@@ -385,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->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)
@@ -407,7 +413,7 @@ eth_bond_slave_inherit_dev_info_tx_next(struct bond_dev_private *internals,
         * value. Thus, the new internal value of default Tx queue offloads
         * has to be masked by tx_queue_offload_capa to make sure that only
         * commonly supported offloads are preserved from both the previous
-        * value and the value being inhereted from the new slave device.
+        * value and the value being inherited from the new slave device.
         */
        txconf_i->offloads = (txconf_i->offloads | txconf->offloads) &
                             internals->tx_queue_offload_capa;
@@ -560,6 +566,12 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
                                        slave_port_id);
                        return -1;
                }
+               if (slave_start(bonded_eth_dev, slave_eth_dev) != 0) {
+                       internals->slave_count--;
+                       RTE_BOND_LOG(ERR, "rte_bond_slaves_start: port=%d",
+                                       slave_port_id);
+                       return -1;
+               }
        }
 
        /* Update all slave devices MACs */
@@ -586,7 +598,7 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
                        return -1;
                }
 
-                if (link_props.link_status == ETH_LINK_UP) {
+               if (link_props.link_status == RTE_ETH_LINK_UP) {
                        if (internals->active_slave_count == 0 &&
                            !internals->user_defined_primary_port)
                                bond_ethdev_primary_set(internals,
@@ -662,7 +674,7 @@ __eth_bond_slave_remove_lock_free(uint16_t bonded_port_id,
                }
 
        if (slave_idx < 0) {
-               RTE_BOND_LOG(ERR, "Couldn't find slave in port list, slave count %d",
+               RTE_BOND_LOG(ERR, "Couldn't find slave in port list, slave count %u",
                                internals->slave_count);
                return -1;
        }
@@ -721,7 +733,7 @@ __eth_bond_slave_remove_lock_free(uint16_t bonded_port_id,
                internals->tx_offload_capa = 0;
                internals->rx_queue_offload_capa = 0;
                internals->tx_queue_offload_capa = 0;
-               internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK;
+               internals->flow_type_rss_offloads = RTE_ETH_RSS_PROTO_MASK;
                internals->reta_size = 0;
                internals->candidate_max_rx_pktlen = 0;
                internals->max_rx_pktlen = 0;