X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbonding%2Frte_eth_bond_flow.c;h=417f76bf60fd441f0fb2c9bf932305abf37f9793;hb=61ede39537f45e561dc80eaa23621ce3d2cf9e73;hp=8093c04f57bd08ef33d56913479873fd76ffd90c;hpb=49dad9028e2ac2c9576c41bda13ae62814cb6e97;p=dpdk.git diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c index 8093c04f57..417f76bf60 100644 --- a/drivers/net/bonding/rte_eth_bond_flow.c +++ b/drivers/net/bonding/rte_eth_bond_flow.c @@ -2,13 +2,16 @@ * Copyright 2018 Mellanox Technologies, Ltd */ +#include +#include #include +#include #include #include #include -#include "rte_eth_bond_private.h" +#include "eth_bond_private.h" static struct rte_flow * bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr, @@ -16,19 +19,33 @@ bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr, const struct rte_flow_action *actions) { struct rte_flow *flow; - size_t fdsz; + const struct rte_flow_conv_rule rule = { + .attr_ro = attr, + .pattern_ro = items, + .actions_ro = actions, + }; + struct rte_flow_error error; + int ret; - fdsz = rte_flow_copy(NULL, 0, attr, items, actions); - flow = rte_zmalloc_socket(NULL, sizeof(struct rte_flow) + fdsz, + ret = rte_flow_conv(RTE_FLOW_CONV_OP_RULE, NULL, 0, &rule, &error); + if (ret < 0) { + RTE_BOND_LOG(ERR, "Unable to process flow rule (%s): %s", + error.message ? error.message : "unspecified", + strerror(rte_errno)); + return NULL; + } + flow = rte_zmalloc_socket(NULL, offsetof(struct rte_flow, rule) + ret, RTE_CACHE_LINE_SIZE, numa_node); if (unlikely(flow == NULL)) { RTE_BOND_LOG(ERR, "Could not allocate new flow"); return NULL; } - flow->fd = (void *)((uintptr_t)flow + sizeof(*flow)); - if (unlikely(rte_flow_copy(flow->fd, fdsz, attr, items, actions) != - fdsz)) { - RTE_BOND_LOG(ERR, "Failed to copy flow description"); + ret = rte_flow_conv(RTE_FLOW_CONV_OP_RULE, &flow->rule, ret, &rule, + &error); + if (ret < 0) { + RTE_BOND_LOG(ERR, "Failed to copy flow rule (%s): %s", + error.message ? error.message : "unspecified", + strerror(rte_errno)); rte_free(flow); return NULL; } @@ -152,6 +169,7 @@ bond_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *err) static int bond_flow_query_count(struct rte_eth_dev *dev, struct rte_flow *flow, + const struct rte_flow_action *action, struct rte_flow_query_count *count, struct rte_flow_error *err) { @@ -165,7 +183,7 @@ bond_flow_query_count(struct rte_eth_dev *dev, struct rte_flow *flow, rte_memcpy(&slave_count, count, sizeof(slave_count)); for (i = 0; i < internals->slave_count; i++) { ret = rte_flow_query(internals->slaves[i].port_id, - flow->flows[i], RTE_FLOW_ACTION_TYPE_COUNT, + flow->flows[i], action, &slave_count, err); if (unlikely(ret != 0)) { RTE_BOND_LOG(ERR, "Failed to query flow on" @@ -182,12 +200,12 @@ bond_flow_query_count(struct rte_eth_dev *dev, struct rte_flow *flow, static int bond_flow_query(struct rte_eth_dev *dev, struct rte_flow *flow, - enum rte_flow_action_type type, void *arg, + const struct rte_flow_action *action, void *arg, struct rte_flow_error *err) { - switch (type) { + switch (action->type) { case RTE_FLOW_ACTION_TYPE_COUNT: - return bond_flow_query_count(dev, flow, arg, err); + return bond_flow_query_count(dev, flow, action, arg, err); default: return rte_flow_error_set(err, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, arg,