bus/vdev: move code from EAL into a new driver
[dpdk.git] / drivers / net / bonding / rte_eth_bond_pmd.c
index 3fbc1b1..fe23289 100644 (file)
@@ -43,7 +43,7 @@
 #include <rte_ip_frag.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
 #include <rte_alarm.h>
 #include <rte_cycles.h>
 
@@ -129,7 +129,7 @@ is_lacp_packets(uint16_t ethertype, uint8_t subtype, struct rte_mbuf *mbuf)
 {
        const uint16_t ether_type_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW);
 
-       return !((mbuf->ol_flags & PKT_RX_VLAN_PKT) ? mbuf->vlan_tci : 0) &&
+       return !((mbuf->ol_flags & PKT_RX_VLAN) ? mbuf->vlan_tci : 0) &&
                (ethertype == ether_type_slow_be &&
                (subtype == SLOW_SUBTYPE_MARKER || subtype == SLOW_SUBTYPE_LACP));
 }
@@ -2761,8 +2761,7 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode)
        }
 
        eth_dev->dev_ops = &default_dev_ops;
-       eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC |
-               RTE_ETH_DEV_DETACHABLE;
+       eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC;
 
        rte_spinlock_init(&internals->lock);
 
@@ -2841,6 +2840,7 @@ bond_probe(struct rte_vdev_device *dev)
        struct rte_kvargs *kvlist;
        uint8_t bonding_mode, socket_id/*, agg_mode*/;
        int  arg_count, port_id;
+       uint8_t agg_mode;
 
        if (!dev)
                return -EINVAL;
@@ -2898,6 +2898,25 @@ bond_probe(struct rte_vdev_device *dev)
        internals = rte_eth_devices[port_id].data->dev_private;
        internals->kvlist = kvlist;
 
+
+       if (rte_kvargs_count(kvlist, PMD_BOND_AGG_MODE_KVARG) == 1) {
+               if (rte_kvargs_process(kvlist,
+                               PMD_BOND_AGG_MODE_KVARG,
+                               &bond_ethdev_parse_slave_agg_mode_kvarg,
+                               &agg_mode) != 0) {
+                       RTE_LOG(ERR, EAL,
+                                       "Failed to parse agg selection mode for bonded device %s\n",
+                                       name);
+                       goto parse_error;
+               }
+
+               if (internals->mode == BONDING_MODE_8023AD)
+                       rte_eth_bond_8023ad_agg_selection_set(port_id,
+                                       agg_mode);
+       } else {
+               rte_eth_bond_8023ad_agg_selection_set(port_id, AGG_STABLE);
+       }
+
        RTE_LOG(INFO, EAL, "Create bonded device %s on port %d in mode %u on "
                        "socket %u.\n", name, port_id, bonding_mode, socket_id);
        return 0;
@@ -3064,7 +3083,6 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
                                        name);
                }
                if (internals->mode == BONDING_MODE_8023AD)
-                       if (agg_mode != 0)
                                rte_eth_bond_8023ad_agg_selection_set(port_id,
                                                agg_mode);
        }