diff mbox series

[net,4/7] net: ip6_gre: Split up ip6gre_tnl_change()

Message ID 1cbdc5bcb10e467eea4c9dd32b867ddc28d4a337.1526567568.git.petrm@mellanox.com
State Accepted, archived
Delegated to: David Miller
Headers show
Series net: ip6_gre: Fixes in headroom handling | expand

Commit Message

Petr Machata May 17, 2018, 2:36 p.m. UTC
Split a reusable function ip6gre_tnl_copy_tnl_parm() from
ip6gre_tnl_change(). This will allow ERSPAN-specific code to
reuse the common parts while customizing the behavior for ERSPAN.

Signed-off-by: Petr Machata <petrm@mellanox.com>
---
 net/ipv6/ip6_gre.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

William Tu May 17, 2018, 7:45 p.m. UTC | #1
On Thu, May 17, 2018 at 7:36 AM, Petr Machata <petrm@mellanox.com> wrote:
> Split a reusable function ip6gre_tnl_copy_tnl_parm() from
> ip6gre_tnl_change(). This will allow ERSPAN-specific code to
> reuse the common parts while customizing the behavior for ERSPAN.
>
> Signed-off-by: Petr Machata <petrm@mellanox.com>
> ---

LGTM.
Acked-by: William Tu <u9012063@gmail.com>


>  net/ipv6/ip6_gre.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index 78ba6b9..307ac6d 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
> @@ -1109,8 +1109,8 @@ static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu)
>         ip6gre_tnl_link_config_route(t, set_mtu, ip6gre_calc_hlen(t));
>  }
>
> -static int ip6gre_tnl_change(struct ip6_tnl *t,
> -       const struct __ip6_tnl_parm *p, int set_mtu)
> +static void ip6gre_tnl_copy_tnl_parm(struct ip6_tnl *t,
> +                                    const struct __ip6_tnl_parm *p)
>  {
>         t->parms.laddr = p->laddr;
>         t->parms.raddr = p->raddr;
> @@ -1126,6 +1126,12 @@ static int ip6gre_tnl_change(struct ip6_tnl *t,
>         t->parms.o_flags = p->o_flags;
>         t->parms.fwmark = p->fwmark;
>         dst_cache_reset(&t->dst_cache);
> +}
> +
> +static int ip6gre_tnl_change(struct ip6_tnl *t, const struct __ip6_tnl_parm *p,
> +                            int set_mtu)
> +{
> +       ip6gre_tnl_copy_tnl_parm(t, p);
>         ip6gre_tnl_link_config(t, set_mtu);
>         return 0;
>  }
> --
> 2.4.11
>
Petr Machata May 17, 2018, 8:45 p.m. UTC | #2
Fixes: 5a963eb61b7c ("ip6_gre: Add ERSPAN native tunnel support")
diff mbox series

Patch

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 78ba6b9..307ac6d 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -1109,8 +1109,8 @@  static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu)
 	ip6gre_tnl_link_config_route(t, set_mtu, ip6gre_calc_hlen(t));
 }
 
-static int ip6gre_tnl_change(struct ip6_tnl *t,
-	const struct __ip6_tnl_parm *p, int set_mtu)
+static void ip6gre_tnl_copy_tnl_parm(struct ip6_tnl *t,
+				     const struct __ip6_tnl_parm *p)
 {
 	t->parms.laddr = p->laddr;
 	t->parms.raddr = p->raddr;
@@ -1126,6 +1126,12 @@  static int ip6gre_tnl_change(struct ip6_tnl *t,
 	t->parms.o_flags = p->o_flags;
 	t->parms.fwmark = p->fwmark;
 	dst_cache_reset(&t->dst_cache);
+}
+
+static int ip6gre_tnl_change(struct ip6_tnl *t, const struct __ip6_tnl_parm *p,
+			     int set_mtu)
+{
+	ip6gre_tnl_copy_tnl_parm(t, p);
 	ip6gre_tnl_link_config(t, set_mtu);
 	return 0;
 }