diff mbox series

[net-next,v3,1/4] net/sched: act_tunnel_key: add support for "don't fragment"

Message ID 579a1d30c2d8b417dcc19784cc27b87bab631b27.1680021219.git.dcaratti@redhat.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net/sched: act_tunnel_key: add support for TUNNEL_DONT_FRAGMENT | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 31 this patch: 31
netdev/cc_maintainers warning 3 maintainers not CCed: edumazet@google.com pabeni@redhat.com davem@davemloft.net
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 31 this patch: 31
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Davide Caratti March 28, 2023, 4:45 p.m. UTC
extend "act_tunnel_key" to allow specifying TUNNEL_DONT_FRAGMENT.

Suggested-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---
 include/uapi/linux/tc_act/tc_tunnel_key.h | 1 +
 net/sched/act_tunnel_key.c                | 5 +++++
 2 files changed, 6 insertions(+)

Comments

Pedro Tammela March 28, 2023, 9:25 p.m. UTC | #1
On 28/03/2023 13:45, Davide Caratti wrote:
> extend "act_tunnel_key" to allow specifying TUNNEL_DONT_FRAGMENT.
> 
> Suggested-by: Ilya Maximets <i.maximets@ovn.org>
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
> ---
>   include/uapi/linux/tc_act/tc_tunnel_key.h | 1 +
>   net/sched/act_tunnel_key.c                | 5 +++++
>   2 files changed, 6 insertions(+)
> 
> diff --git a/include/uapi/linux/tc_act/tc_tunnel_key.h b/include/uapi/linux/tc_act/tc_tunnel_key.h
> index 49ad4033951b..37c6f612f161 100644
> --- a/include/uapi/linux/tc_act/tc_tunnel_key.h
> +++ b/include/uapi/linux/tc_act/tc_tunnel_key.h
> @@ -34,6 +34,7 @@ enum {
>   					 */
>   	TCA_TUNNEL_KEY_ENC_TOS,		/* u8 */
>   	TCA_TUNNEL_KEY_ENC_TTL,		/* u8 */
> +	TCA_TUNNEL_KEY_NO_FRAG,		/* flag */
>   	__TCA_TUNNEL_KEY_MAX,
>   };
>   
> diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
> index 2d12d2626415..0c8aa7e686ea 100644
> --- a/net/sched/act_tunnel_key.c
> +++ b/net/sched/act_tunnel_key.c
> @@ -420,6 +420,9 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
>   		    nla_get_u8(tb[TCA_TUNNEL_KEY_NO_CSUM]))
>   			flags &= ~TUNNEL_CSUM;
>   
> +		if (nla_get_flag(tb[TCA_TUNNEL_KEY_NO_FRAG]))
> +			flags |= TUNNEL_DONT_FRAGMENT;
> +
>   		if (tb[TCA_TUNNEL_KEY_ENC_DST_PORT])
>   			dst_port = nla_get_be16(tb[TCA_TUNNEL_KEY_ENC_DST_PORT]);
>   
> @@ -747,6 +750,8 @@ static int tunnel_key_dump(struct sk_buff *skb, struct tc_action *a,
>   				   key->tp_dst)) ||
>   		    nla_put_u8(skb, TCA_TUNNEL_KEY_NO_CSUM,
>   			       !(key->tun_flags & TUNNEL_CSUM)) ||
> +		    ((key->tun_flags & TUNNEL_DONT_FRAGMENT) &&
> +		     nla_put_flag(skb, TCA_TUNNEL_KEY_NO_FRAG)) ||
>   		    tunnel_key_opts_dump(skb, info))
>   			goto nla_put_failure;
>   

LGTM,

Reviewed-by: Pedro Tammela <pctammela@mojatatu.com>
Jamal Hadi Salim March 28, 2023, 10:32 p.m. UTC | #2
Try 2 (some silly spam filter blocked earlier email)

On Tue, Mar 28, 2023 at 12:45 PM Davide Caratti <dcaratti@redhat.com> wrote:
>
> extend "act_tunnel_key" to allow specifying TUNNEL_DONT_FRAGMENT.
>
> Suggested-by: Ilya Maximets <i.maximets@ovn.org>
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>


Acked-by: Jamal  Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

>
> ---
>  include/uapi/linux/tc_act/tc_tunnel_key.h | 1 +
>  net/sched/act_tunnel_key.c                | 5 +++++
>  2 files changed, 6 insertions(+)
>
> diff --git a/include/uapi/linux/tc_act/tc_tunnel_key.h b/include/uapi/linux/tc_act/tc_tunnel_key.h
> index 49ad4033951b..37c6f612f161 100644
> --- a/include/uapi/linux/tc_act/tc_tunnel_key.h
> +++ b/include/uapi/linux/tc_act/tc_tunnel_key.h
> @@ -34,6 +34,7 @@ enum {
>                                          */
>         TCA_TUNNEL_KEY_ENC_TOS,         /* u8 */
>         TCA_TUNNEL_KEY_ENC_TTL,         /* u8 */
> +       TCA_TUNNEL_KEY_NO_FRAG,         /* flag */
>         __TCA_TUNNEL_KEY_MAX,
>  };
>
> diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
> index 2d12d2626415..0c8aa7e686ea 100644
> --- a/net/sched/act_tunnel_key.c
> +++ b/net/sched/act_tunnel_key.c
> @@ -420,6 +420,9 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
>                     nla_get_u8(tb[TCA_TUNNEL_KEY_NO_CSUM]))
>                         flags &= ~TUNNEL_CSUM;
>
> +               if (nla_get_flag(tb[TCA_TUNNEL_KEY_NO_FRAG]))
> +                       flags |= TUNNEL_DONT_FRAGMENT;
> +
>                 if (tb[TCA_TUNNEL_KEY_ENC_DST_PORT])
>                         dst_port = nla_get_be16(tb[TCA_TUNNEL_KEY_ENC_DST_PORT]);
>
> @@ -747,6 +750,8 @@ static int tunnel_key_dump(struct sk_buff *skb, struct tc_action *a,
>                                    key->tp_dst)) ||
>                     nla_put_u8(skb, TCA_TUNNEL_KEY_NO_CSUM,
>                                !(key->tun_flags & TUNNEL_CSUM)) ||
> +                   ((key->tun_flags & TUNNEL_DONT_FRAGMENT) &&
> +                    nla_put_flag(skb, TCA_TUNNEL_KEY_NO_FRAG)) ||
>                     tunnel_key_opts_dump(skb, info))
>                         goto nla_put_failure;
>
> --
> 2.39.2
>
diff mbox series

Patch

diff --git a/include/uapi/linux/tc_act/tc_tunnel_key.h b/include/uapi/linux/tc_act/tc_tunnel_key.h
index 49ad4033951b..37c6f612f161 100644
--- a/include/uapi/linux/tc_act/tc_tunnel_key.h
+++ b/include/uapi/linux/tc_act/tc_tunnel_key.h
@@ -34,6 +34,7 @@  enum {
 					 */
 	TCA_TUNNEL_KEY_ENC_TOS,		/* u8 */
 	TCA_TUNNEL_KEY_ENC_TTL,		/* u8 */
+	TCA_TUNNEL_KEY_NO_FRAG,		/* flag */
 	__TCA_TUNNEL_KEY_MAX,
 };
 
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index 2d12d2626415..0c8aa7e686ea 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -420,6 +420,9 @@  static int tunnel_key_init(struct net *net, struct nlattr *nla,
 		    nla_get_u8(tb[TCA_TUNNEL_KEY_NO_CSUM]))
 			flags &= ~TUNNEL_CSUM;
 
+		if (nla_get_flag(tb[TCA_TUNNEL_KEY_NO_FRAG]))
+			flags |= TUNNEL_DONT_FRAGMENT;
+
 		if (tb[TCA_TUNNEL_KEY_ENC_DST_PORT])
 			dst_port = nla_get_be16(tb[TCA_TUNNEL_KEY_ENC_DST_PORT]);
 
@@ -747,6 +750,8 @@  static int tunnel_key_dump(struct sk_buff *skb, struct tc_action *a,
 				   key->tp_dst)) ||
 		    nla_put_u8(skb, TCA_TUNNEL_KEY_NO_CSUM,
 			       !(key->tun_flags & TUNNEL_CSUM)) ||
+		    ((key->tun_flags & TUNNEL_DONT_FRAGMENT) &&
+		     nla_put_flag(skb, TCA_TUNNEL_KEY_NO_FRAG)) ||
 		    tunnel_key_opts_dump(skb, info))
 			goto nla_put_failure;