net/bonding: add other aggregator modes
[dpdk.git] / drivers / net / bonding / rte_eth_bond_args.c
index 4f12050..bb634c6 100644 (file)
@@ -48,6 +48,7 @@ const char *pmd_bond_init_valid_arguments[] = {
        PMD_BOND_XMIT_POLICY_KVARG,
        PMD_BOND_SOCKET_ID_KVARG,
        PMD_BOND_MAC_ADDR_KVARG,
+       PMD_BOND_AGG_MODE_KVARG,
        "driver",
        NULL
 };
@@ -190,6 +191,38 @@ bond_ethdev_parse_slave_mode_kvarg(const char *key __rte_unused,
        }
 }
 
+int
+bond_ethdev_parse_slave_agg_mode_kvarg(const char *key __rte_unused,
+               const char *value, void *extra_args)
+{
+       uint8_t *agg_mode;
+
+       if (value == NULL || extra_args == NULL)
+               return -1;
+
+       agg_mode = extra_args;
+
+       errno = 0;
+       if (strncmp(value, "stable", 6) == 0)
+               *agg_mode = AGG_STABLE;
+
+       if (strncmp(value, "bandwidth", 9) == 0)
+               *agg_mode = AGG_BANDWIDTH;
+
+       if (strncmp(value, "count", 5) == 0)
+               *agg_mode = AGG_COUNT;
+
+       switch (*agg_mode) {
+       case AGG_STABLE:
+       case AGG_BANDWIDTH:
+       case AGG_COUNT:
+               return 0;
+       default:
+               RTE_BOND_LOG(ERR, "Invalid agg mode value stable/bandwidth/count");
+               return -1;
+       }
+}
+
 int
 bond_ethdev_parse_socket_id_kvarg(const char *key __rte_unused,
                const char *value, void *extra_args)