mirror of
https://github.com/openvswitch/ovs
synced 2025-09-05 00:35:33 +00:00
netdev-offload-dpdk: Support offload of set IPv4 actions.
Signed-off-by: Eli Britstein <elibr@mellanox.com> Reviewed-by: Oz Shlomo <ozsh@mellanox.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
committed by
Ilya Maximets
parent
ae32e08d63
commit
d9a831c3bc
@@ -384,6 +384,29 @@ dump_flow_action(struct ds *s, const struct rte_flow_action *actions)
|
||||
} else {
|
||||
ds_put_format(s, " Set-mac-%s = null\n", dirstr);
|
||||
}
|
||||
} else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC ||
|
||||
actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV4_DST) {
|
||||
const struct rte_flow_action_set_ipv4 *set_ipv4 = actions->conf;
|
||||
char *dirstr = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV4_DST
|
||||
? "dst" : "src";
|
||||
|
||||
ds_put_format(s, "rte flow set-ipv4-%s action:\n", dirstr);
|
||||
if (set_ipv4) {
|
||||
ds_put_format(s,
|
||||
" Set-ipv4-%s: "IP_FMT"\n", dirstr,
|
||||
IP_ARGS(set_ipv4->ipv4_addr));
|
||||
} else {
|
||||
ds_put_format(s, " Set-ipv4-%s = null\n", dirstr);
|
||||
}
|
||||
} else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_TTL) {
|
||||
const struct rte_flow_action_set_ttl *set_ttl = actions->conf;
|
||||
|
||||
ds_put_cstr(s, "rte flow set-ttl action:\n");
|
||||
if (set_ttl) {
|
||||
ds_put_format(s, " Set-ttl: %d\n", set_ttl->ttl_value);
|
||||
} else {
|
||||
ds_put_cstr(s, " Set-ttl = null\n");
|
||||
}
|
||||
} else {
|
||||
ds_put_format(s, "unknown rte flow action (%d)\n", actions->type);
|
||||
}
|
||||
@@ -847,6 +870,12 @@ BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_mac) ==
|
||||
MEMBER_SIZEOF(struct ovs_key_ethernet, eth_src));
|
||||
BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_mac) ==
|
||||
MEMBER_SIZEOF(struct ovs_key_ethernet, eth_dst));
|
||||
BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv4) ==
|
||||
MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_src));
|
||||
BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv4) ==
|
||||
MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_dst));
|
||||
BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ttl) ==
|
||||
MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_ttl));
|
||||
|
||||
static int
|
||||
parse_set_actions(struct flow_actions *actions,
|
||||
@@ -876,6 +905,18 @@ parse_set_actions(struct flow_actions *actions,
|
||||
VLOG_DBG_RL(&rl, "Unsupported ETHERNET set action");
|
||||
return -1;
|
||||
}
|
||||
} else if (nl_attr_type(sa) == OVS_KEY_ATTR_IPV4) {
|
||||
const struct ovs_key_ipv4 *key = nl_attr_get(sa);
|
||||
const struct ovs_key_ipv4 *mask = masked ? key + 1 : NULL;
|
||||
|
||||
add_set_flow_action(ipv4_src, RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC);
|
||||
add_set_flow_action(ipv4_dst, RTE_FLOW_ACTION_TYPE_SET_IPV4_DST);
|
||||
add_set_flow_action(ipv4_ttl, RTE_FLOW_ACTION_TYPE_SET_TTL);
|
||||
|
||||
if (mask && !is_all_zeros(mask, sizeof *mask)) {
|
||||
VLOG_DBG_RL(&rl, "Unsupported IPv4 set action");
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
VLOG_DBG_RL(&rl,
|
||||
"Unsupported set action type %d", nl_attr_type(sa));
|
||||
|
Reference in New Issue
Block a user