Message ID | 20200621111924.12397-4-elibr@mellanox.com |
---|---|
State | Changes Requested |
Headers | show |
Series | netdev datapath offload: Support IPv6 and VXLAN encap | expand |
On 6/21/20 1:19 PM, Eli Britstein wrote: Some trivial commit message here? > Signed-off-by: Eli Britstein <elibr@mellanox.com> > Reviewed-by: Roni Bar Yanai <roniba@mellanox.com> > --- > Documentation/howto/dpdk.rst | 1 + > NEWS | 2 ++ > lib/netdev-offload-dpdk.c | 35 +++++++++++++++++++++++++++++++++++ > 3 files changed, 38 insertions(+) > > diff --git a/Documentation/howto/dpdk.rst b/Documentation/howto/dpdk.rst > index 8a0eee80c..1756a7149 100644 > --- a/Documentation/howto/dpdk.rst > +++ b/Documentation/howto/dpdk.rst > @@ -395,6 +395,7 @@ Supported actions for hardware offload are: > - Modification of Ethernet (mod_dl_src/mod_dl_dst). > - Modification of IPv4 (mod_nw_src/mod_nw_dst/mod_nw_ttl). > - Modification of TCP/UDP (mod_tp_src/mod_tp_dst). > +- Modification of IPv6 (set_field:<ADDR>->ipv6_src/ipv6_dst/mod_nw_ttl). > > Further Reading > --------------- > diff --git a/NEWS b/NEWS > index 07e23316c..7df8b134d 100644 > --- a/NEWS > +++ b/NEWS > @@ -10,6 +10,8 @@ Post-v2.13.0 > * Deprecated DPDK pdump packet capture support removed. > * Deprecated DPDK ring ports (dpdkr) are no longer supported. > * Add hardware offload support for matching IPv6 protocol. > + * Add hardware offload support for set of IPv6 TCP/UDP ports > + actions (experimental). > - Linux datapath: > * Support for kernel versions up to 5.5.x. > - AF_XDP: > diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c > index 6b12e9ae3..dd5e71e36 100644 > --- a/lib/netdev-offload-dpdk.c > +++ b/lib/netdev-offload-dpdk.c > @@ -458,6 +458,23 @@ dump_flow_action(struct ds *s, const struct rte_flow_action *actions) > } else { > ds_put_format(s, " Set-%s-tcp/udp-port = null\n", dirstr); > } > + } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC || > + actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_DST) { > + const struct rte_flow_action_set_ipv6 *set_ipv6 = actions->conf; > + > + char *dirstr = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_DST > + ? "dst" : "src"; > + > + ds_put_format(s, "rte flow set-ipv6-%s action:\n", dirstr); > + if (set_ipv6) { > + char addr_str[INET6_ADDRSTRLEN]; > + > + ipv6_string_mapped(addr_str, > + (struct in6_addr *)&set_ipv6->ipv6_addr); > + ds_put_format(s, " Set-ipv6-%s: %s\n", dirstr, addr_str); It seems like using ipv6_format_mapped() will result in lower number of lines and will also avoid introducing an array: ds_put_format(s, " Set-ipv6-%s: ", dirstr); ipv6_format_mapped((struct in6_addr *) &set_ipv6->ipv6_addr, s); ds_put_cstr(s, "\n"); Same, actually might be applicable to the matching code from the previous patch. It actually takes less number of lines even with extra ones like: ds_put_cstr(", src="); > + } else { > + ds_put_format(s, " Set-ipv6-%s = null\n", dirstr); > + } > } else { > ds_put_format(s, "unknown rte flow action (%d)\n", actions->type); > } > @@ -1004,6 +1021,12 @@ 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)); > +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv6) == > + MEMBER_SIZEOF(struct ovs_key_ipv6, ipv6_src)); > +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv6) == > + MEMBER_SIZEOF(struct ovs_key_ipv6, ipv6_dst)); > +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ttl) == > + MEMBER_SIZEOF(struct ovs_key_ipv6, ipv6_hlimit)); > 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) == > @@ -1053,6 +1076,18 @@ parse_set_actions(struct flow_actions *actions, > VLOG_DBG_RL(&rl, "Unsupported IPv4 set action"); > return -1; > } > + } else if (nl_attr_type(sa) == OVS_KEY_ATTR_IPV6) { > + const struct ovs_key_ipv6 *key = nl_attr_get(sa); > + const struct ovs_key_ipv6 *mask = masked ? key + 1 : NULL; > + > + add_set_flow_action(ipv6_src, RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC); > + add_set_flow_action(ipv6_dst, RTE_FLOW_ACTION_TYPE_SET_IPV6_DST); > + add_set_flow_action(ipv6_hlimit, RTE_FLOW_ACTION_TYPE_SET_TTL); > + > + if (mask && !is_all_zeros(mask, sizeof *mask)) { > + VLOG_DBG_RL(&rl, "Unsupported IPv6 set action"); > + 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; >
On 6/29/2020 2:02 AM, Ilya Maximets wrote: > On 6/21/20 1:19 PM, Eli Britstein wrote: > > Some trivial commit message here? OK. > >> Signed-off-by: Eli Britstein <elibr@mellanox.com> >> Reviewed-by: Roni Bar Yanai <roniba@mellanox.com> >> --- >> Documentation/howto/dpdk.rst | 1 + >> NEWS | 2 ++ >> lib/netdev-offload-dpdk.c | 35 +++++++++++++++++++++++++++++++++++ >> 3 files changed, 38 insertions(+) >> >> diff --git a/Documentation/howto/dpdk.rst b/Documentation/howto/dpdk.rst >> index 8a0eee80c..1756a7149 100644 >> --- a/Documentation/howto/dpdk.rst >> +++ b/Documentation/howto/dpdk.rst >> @@ -395,6 +395,7 @@ Supported actions for hardware offload are: >> - Modification of Ethernet (mod_dl_src/mod_dl_dst). >> - Modification of IPv4 (mod_nw_src/mod_nw_dst/mod_nw_ttl). >> - Modification of TCP/UDP (mod_tp_src/mod_tp_dst). >> +- Modification of IPv6 (set_field:<ADDR>->ipv6_src/ipv6_dst/mod_nw_ttl). >> >> Further Reading >> --------------- >> diff --git a/NEWS b/NEWS >> index 07e23316c..7df8b134d 100644 >> --- a/NEWS >> +++ b/NEWS >> @@ -10,6 +10,8 @@ Post-v2.13.0 >> * Deprecated DPDK pdump packet capture support removed. >> * Deprecated DPDK ring ports (dpdkr) are no longer supported. >> * Add hardware offload support for matching IPv6 protocol. >> + * Add hardware offload support for set of IPv6 TCP/UDP ports >> + actions (experimental). >> - Linux datapath: >> * Support for kernel versions up to 5.5.x. >> - AF_XDP: >> diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c >> index 6b12e9ae3..dd5e71e36 100644 >> --- a/lib/netdev-offload-dpdk.c >> +++ b/lib/netdev-offload-dpdk.c >> @@ -458,6 +458,23 @@ dump_flow_action(struct ds *s, const struct rte_flow_action *actions) >> } else { >> ds_put_format(s, " Set-%s-tcp/udp-port = null\n", dirstr); >> } >> + } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC || >> + actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_DST) { >> + const struct rte_flow_action_set_ipv6 *set_ipv6 = actions->conf; >> + >> + char *dirstr = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_DST >> + ? "dst" : "src"; >> + >> + ds_put_format(s, "rte flow set-ipv6-%s action:\n", dirstr); >> + if (set_ipv6) { >> + char addr_str[INET6_ADDRSTRLEN]; >> + >> + ipv6_string_mapped(addr_str, >> + (struct in6_addr *)&set_ipv6->ipv6_addr); >> + ds_put_format(s, " Set-ipv6-%s: %s\n", dirstr, addr_str); > It seems like using ipv6_format_mapped() will result in lower number of > lines and will also avoid introducing an array: > > ds_put_format(s, " Set-ipv6-%s: ", dirstr); > ipv6_format_mapped((struct in6_addr *) &set_ipv6->ipv6_addr, s); > ds_put_cstr(s, "\n"); OK. I'll use ipv6_format_addr. > > Same, actually might be applicable to the matching code from the previous patch. > It actually takes less number of lines even with extra ones like: > ds_put_cstr(", src="); Following the suggestion about testpmd format, I'll change the order of commits to do the testpmd format first. For testpmd format, ipv6_format_mapped (or ipv6_format_addr) is not applicable, so I'll keep it there. > > >> + } else { >> + ds_put_format(s, " Set-ipv6-%s = null\n", dirstr); >> + } >> } else { >> ds_put_format(s, "unknown rte flow action (%d)\n", actions->type); >> } >> @@ -1004,6 +1021,12 @@ 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)); >> +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv6) == >> + MEMBER_SIZEOF(struct ovs_key_ipv6, ipv6_src)); >> +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv6) == >> + MEMBER_SIZEOF(struct ovs_key_ipv6, ipv6_dst)); >> +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ttl) == >> + MEMBER_SIZEOF(struct ovs_key_ipv6, ipv6_hlimit)); >> 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) == >> @@ -1053,6 +1076,18 @@ parse_set_actions(struct flow_actions *actions, >> VLOG_DBG_RL(&rl, "Unsupported IPv4 set action"); >> return -1; >> } >> + } else if (nl_attr_type(sa) == OVS_KEY_ATTR_IPV6) { >> + const struct ovs_key_ipv6 *key = nl_attr_get(sa); >> + const struct ovs_key_ipv6 *mask = masked ? key + 1 : NULL; >> + >> + add_set_flow_action(ipv6_src, RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC); >> + add_set_flow_action(ipv6_dst, RTE_FLOW_ACTION_TYPE_SET_IPV6_DST); >> + add_set_flow_action(ipv6_hlimit, RTE_FLOW_ACTION_TYPE_SET_TTL); >> + >> + if (mask && !is_all_zeros(mask, sizeof *mask)) { >> + VLOG_DBG_RL(&rl, "Unsupported IPv6 set action"); >> + 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; >>
diff --git a/Documentation/howto/dpdk.rst b/Documentation/howto/dpdk.rst index 8a0eee80c..1756a7149 100644 --- a/Documentation/howto/dpdk.rst +++ b/Documentation/howto/dpdk.rst @@ -395,6 +395,7 @@ Supported actions for hardware offload are: - Modification of Ethernet (mod_dl_src/mod_dl_dst). - Modification of IPv4 (mod_nw_src/mod_nw_dst/mod_nw_ttl). - Modification of TCP/UDP (mod_tp_src/mod_tp_dst). +- Modification of IPv6 (set_field:<ADDR>->ipv6_src/ipv6_dst/mod_nw_ttl). Further Reading --------------- diff --git a/NEWS b/NEWS index 07e23316c..7df8b134d 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ Post-v2.13.0 * Deprecated DPDK pdump packet capture support removed. * Deprecated DPDK ring ports (dpdkr) are no longer supported. * Add hardware offload support for matching IPv6 protocol. + * Add hardware offload support for set of IPv6 TCP/UDP ports + actions (experimental). - Linux datapath: * Support for kernel versions up to 5.5.x. - AF_XDP: diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index 6b12e9ae3..dd5e71e36 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -458,6 +458,23 @@ dump_flow_action(struct ds *s, const struct rte_flow_action *actions) } else { ds_put_format(s, " Set-%s-tcp/udp-port = null\n", dirstr); } + } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC || + actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_DST) { + const struct rte_flow_action_set_ipv6 *set_ipv6 = actions->conf; + + char *dirstr = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_DST + ? "dst" : "src"; + + ds_put_format(s, "rte flow set-ipv6-%s action:\n", dirstr); + if (set_ipv6) { + char addr_str[INET6_ADDRSTRLEN]; + + ipv6_string_mapped(addr_str, + (struct in6_addr *)&set_ipv6->ipv6_addr); + ds_put_format(s, " Set-ipv6-%s: %s\n", dirstr, addr_str); + } else { + ds_put_format(s, " Set-ipv6-%s = null\n", dirstr); + } } else { ds_put_format(s, "unknown rte flow action (%d)\n", actions->type); } @@ -1004,6 +1021,12 @@ 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)); +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv6) == + MEMBER_SIZEOF(struct ovs_key_ipv6, ipv6_src)); +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv6) == + MEMBER_SIZEOF(struct ovs_key_ipv6, ipv6_dst)); +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ttl) == + MEMBER_SIZEOF(struct ovs_key_ipv6, ipv6_hlimit)); 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) == @@ -1053,6 +1076,18 @@ parse_set_actions(struct flow_actions *actions, VLOG_DBG_RL(&rl, "Unsupported IPv4 set action"); return -1; } + } else if (nl_attr_type(sa) == OVS_KEY_ATTR_IPV6) { + const struct ovs_key_ipv6 *key = nl_attr_get(sa); + const struct ovs_key_ipv6 *mask = masked ? key + 1 : NULL; + + add_set_flow_action(ipv6_src, RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC); + add_set_flow_action(ipv6_dst, RTE_FLOW_ACTION_TYPE_SET_IPV6_DST); + add_set_flow_action(ipv6_hlimit, RTE_FLOW_ACTION_TYPE_SET_TTL); + + if (mask && !is_all_zeros(mask, sizeof *mask)) { + VLOG_DBG_RL(&rl, "Unsupported IPv6 set action"); + 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;