[ovs-dev] [PATCH 20/20] netdev-offload-dpdk-flow: Support offload of set TCP/UDP ports actions
Eli Britstein
elibr at mellanox.com
Wed Nov 20 15:28:26 UTC 2019
Signed-off-by: Eli Britstein <elibr at mellanox.com>
Reviewed-by: Oz Shlomo <ozsh at mellanox.com>
---
NEWS | 4 ++--
lib/netdev-offload-dpdk-flow.c | 48 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index ef947234d..60f950ace 100644
--- a/NEWS
+++ b/NEWS
@@ -11,8 +11,8 @@ Post-v2.12.0
* Add option to enable, disable and query TCP sequence checking in
conntrack.
- DPDK:
- * Add hardware offload support for output, drop, set of MAC, IPv4
- and tunnel push-output actions.
+ * Add hardware offload support for output, drop, set of MAC, IPv4,
+ TCP/UDP ports and tunnel push-output actions.
v2.12.0 - 03 Sep 2019
---------------------
diff --git a/lib/netdev-offload-dpdk-flow.c b/lib/netdev-offload-dpdk-flow.c
index b50fee312..958ea5cc2 100644
--- a/lib/netdev-offload-dpdk-flow.c
+++ b/lib/netdev-offload-dpdk-flow.c
@@ -351,6 +351,20 @@ ds_put_flow_action(struct ds *s, const struct rte_flow_action *actions)
} else {
ds_put_cstr(s, " Raw-encap = 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 {
ds_put_format(s, "unknown rte flow action (%d)\n", actions->type);
}
@@ -767,6 +781,40 @@ netdev_dpdk_flow_add_set_actions(struct flow_actions *actions,
return -1;
}
+ if (add_set_flow_action(actions, sa_info_arr,
+ ARRAY_SIZE(sa_info_arr))) {
+ 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 ?
+ get_mask(sa, struct ovs_key_tcp) : NULL;
+ struct rte_flow_action_set_tp *src = xzalloc(sizeof *src);
+ struct rte_flow_action_set_tp *dst = xzalloc(sizeof *dst);
+ struct set_action_info sa_info_arr[] = {
+ SA_INFO(tcp_src, src->port,
+ RTE_FLOW_ACTION_TYPE_SET_TP_SRC),
+ SA_INFO(tcp_dst, dst->port,
+ RTE_FLOW_ACTION_TYPE_SET_TP_DST),
+ };
+
+ if (add_set_flow_action(actions, sa_info_arr,
+ ARRAY_SIZE(sa_info_arr))) {
+ 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 ?
+ get_mask(sa, struct ovs_key_udp) : NULL;
+ struct rte_flow_action_set_tp *src = xzalloc(sizeof *src);
+ struct rte_flow_action_set_tp *dst = xzalloc(sizeof *dst);
+ struct set_action_info sa_info_arr[] = {
+ SA_INFO(udp_src, src->port,
+ RTE_FLOW_ACTION_TYPE_SET_TP_SRC),
+ SA_INFO(udp_dst, dst->port,
+ RTE_FLOW_ACTION_TYPE_SET_TP_DST),
+ };
+
if (add_set_flow_action(actions, sa_info_arr,
ARRAY_SIZE(sa_info_arr))) {
return -1;
--
2.14.5
More information about the dev
mailing list