net/bonding: fix setting VLAN ID on slave ports
[dpdk.git] / drivers / net / bonding / rte_eth_bond_api.c
index b73cb73..d5b7260 100644 (file)
@@ -211,9 +211,12 @@ slave_vlan_filter_set(uint16_t bonded_port_id, uint16_t slave_port_id)
                for (i = 0, mask = 1;
                     i < RTE_BITMAP_SLAB_BIT_SIZE;
                     i ++, mask <<= 1) {
-                       if (unlikely(slab & mask))
+                       if (unlikely(slab & mask)) {
+                               uint16_t vlan_id = pos + i;
+
                                res = rte_eth_dev_vlan_filter(slave_port_id,
-                                                             (uint16_t)pos, 1);
+                                                             vlan_id, 1);
+                       }
                }
                found = rte_bitmap_scan(internals->vlan_filter_bmp,
                                        &pos, &slab);
@@ -259,8 +262,13 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
        if (internals->slave_count < 1) {
                /* if MAC is not user defined then use MAC of first slave add to
                 * bonded device */
-               if (!internals->user_defined_mac)
-                       mac_address_set(bonded_eth_dev, slave_eth_dev->data->mac_addrs);
+               if (!internals->user_defined_mac) {
+                       if (mac_address_set(bonded_eth_dev,
+                                           slave_eth_dev->data->mac_addrs)) {
+                               RTE_BOND_LOG(ERR, "Failed to set MAC address");
+                               return -1;
+                       }
+               }
 
                /* Inherit eth dev link properties from first slave */
                link_properties_set(bonded_eth_dev,
@@ -665,12 +673,15 @@ rte_eth_bond_xmit_policy_set(uint16_t bonded_port_id, uint8_t policy)
        switch (policy) {
        case BALANCE_XMIT_POLICY_LAYER2:
                internals->balance_xmit_policy = policy;
+               internals->burst_xmit_hash = burst_xmit_l2_hash;
                break;
        case BALANCE_XMIT_POLICY_LAYER23:
                internals->balance_xmit_policy = policy;
+               internals->burst_xmit_hash = burst_xmit_l23_hash;
                break;
        case BALANCE_XMIT_POLICY_LAYER34:
                internals->balance_xmit_policy = policy;
+               internals->burst_xmit_hash = burst_xmit_l34_hash;
                break;
 
        default: