2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 18:07:40 +00:00

netdev-offload-dpdk: Support offload of set TCP/UDP ports 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:
Eli Britstein 2020-01-09 07:46:55 +00:00 committed by Ilya Maximets
parent d9a831c3bc
commit b9254f7b59
3 changed files with 46 additions and 2 deletions

View File

@ -394,6 +394,7 @@ Supported actions for hardware offload are:
- Drop. - Drop.
- Modification of Ethernet (mod_dl_src/mod_dl_dst). - Modification of Ethernet (mod_dl_src/mod_dl_dst).
- Modification of IPv4 (mod_nw_src/mod_nw_dst/mod_nw_ttl). - Modification of IPv4 (mod_nw_src/mod_nw_dst/mod_nw_ttl).
- Modification of TCP/UDP (mod_tp_src/mod_tp_dst).
Further Reading Further Reading
--------------- ---------------

4
NEWS
View File

@ -34,8 +34,8 @@ Post-v2.12.0
interval is increased to 60 seconds for the connection to the interval is increased to 60 seconds for the connection to the
replication server. This value is configurable with the unixctl replication server. This value is configurable with the unixctl
command - ovsdb-server/set-active-ovsdb-server-probe-interval. command - ovsdb-server/set-active-ovsdb-server-probe-interval.
* Add hardware offload support for output, drop and set actions of * Add hardware offload support for output, drop, set of MAC, IPv4 and
MAC and IPv4 (experimental). TCP/UDP ports actions (experimental).
- 'ovs-appctl dpctl/dump-flows' can now show offloaded=partial for - 'ovs-appctl dpctl/dump-flows' can now show offloaded=partial for
partially offloaded flows, dp:dpdk for fully offloaded by dpdk, and partially offloaded flows, dp:dpdk for fully offloaded by dpdk, and
type filter supports new filters: "dpdk" and "partially-offloaded". type filter supports new filters: "dpdk" and "partially-offloaded".

View File

@ -407,6 +407,19 @@ dump_flow_action(struct ds *s, const struct rte_flow_action *actions)
} else { } else {
ds_put_cstr(s, " Set-ttl = null\n"); ds_put_cstr(s, " Set-ttl = null\n");
} }
} else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_TP_SRC ||
actions->type == RTE_FLOW_ACTION_TYPE_SET_TP_DST) {
const struct rte_flow_action_set_tp *set_tp = actions->conf;
char *dirstr = actions->type == RTE_FLOW_ACTION_TYPE_SET_TP_DST
? "dst" : "src";
ds_put_format(s, "rte flow set-tcp/udp-port-%s action:\n", dirstr);
if (set_tp) {
ds_put_format(s, " Set-%s-tcp/udp-port: %"PRIu16"\n", dirstr,
ntohs(set_tp->port));
} else {
ds_put_format(s, " Set-%s-tcp/udp-port = null\n", dirstr);
}
} else { } else {
ds_put_format(s, "unknown rte flow action (%d)\n", actions->type); ds_put_format(s, "unknown rte flow action (%d)\n", actions->type);
} }
@ -876,6 +889,14 @@ BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv4) ==
MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_dst)); MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_dst));
BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ttl) == BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ttl) ==
MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_ttl)); MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_ttl));
BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_tp) ==
MEMBER_SIZEOF(struct ovs_key_tcp, tcp_src));
BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_tp) ==
MEMBER_SIZEOF(struct ovs_key_tcp, tcp_dst));
BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_tp) ==
MEMBER_SIZEOF(struct ovs_key_udp, udp_src));
BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_tp) ==
MEMBER_SIZEOF(struct ovs_key_udp, udp_dst));
static int static int
parse_set_actions(struct flow_actions *actions, parse_set_actions(struct flow_actions *actions,
@ -917,6 +938,28 @@ parse_set_actions(struct flow_actions *actions,
VLOG_DBG_RL(&rl, "Unsupported IPv4 set action"); VLOG_DBG_RL(&rl, "Unsupported IPv4 set action");
return -1; return -1;
} }
} else if (nl_attr_type(sa) == OVS_KEY_ATTR_TCP) {
const struct ovs_key_tcp *key = nl_attr_get(sa);
const struct ovs_key_tcp *mask = masked ? key + 1 : NULL;
add_set_flow_action(tcp_src, RTE_FLOW_ACTION_TYPE_SET_TP_SRC);
add_set_flow_action(tcp_dst, RTE_FLOW_ACTION_TYPE_SET_TP_DST);
if (mask && !is_all_zeros(mask, sizeof *mask)) {
VLOG_DBG_RL(&rl, "Unsupported TCP set action");
return -1;
}
} else if (nl_attr_type(sa) == OVS_KEY_ATTR_UDP) {
const struct ovs_key_udp *key = nl_attr_get(sa);
const struct ovs_key_udp *mask = masked ? key + 1 : NULL;
add_set_flow_action(udp_src, RTE_FLOW_ACTION_TYPE_SET_TP_SRC);
add_set_flow_action(udp_dst, RTE_FLOW_ACTION_TYPE_SET_TP_DST);
if (mask && !is_all_zeros(mask, sizeof *mask)) {
VLOG_DBG_RL(&rl, "Unsupported UDP set action");
return -1;
}
} else { } else {
VLOG_DBG_RL(&rl, VLOG_DBG_RL(&rl,
"Unsupported set action type %d", nl_attr_type(sa)); "Unsupported set action type %d", nl_attr_type(sa));