]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
mlxsw: spectrum: Move mlxsw_sp_ipip_netdev_{s, d}addr{, 4}()
authorPetr Machata <petrm@mellanox.com>
Fri, 3 Nov 2017 09:03:31 +0000 (10:03 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 4 Nov 2017 00:15:17 +0000 (09:15 +0900)
These functions ideologically belong to the IPIP module, and some
follow-up work will benefit from their presence there.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.h

index 702fe945227c213d7e5f4d75815fb600825db5e3..8a9fbb64f4add0bb5c4eb59747e1defb3cec849f 100644 (file)
@@ -68,6 +68,59 @@ static u32 mlxsw_sp_ipip_netdev_okey(const struct net_device *ol_dev)
                be32_to_cpu(tun->parms.o_key) : 0;
 }
 
+static __be32
+mlxsw_sp_ipip_netdev_saddr4(const struct net_device *ol_dev)
+{
+       struct ip_tunnel *tun = netdev_priv(ol_dev);
+
+       return tun->parms.iph.saddr;
+}
+
+union mlxsw_sp_l3addr
+mlxsw_sp_ipip_netdev_saddr(enum mlxsw_sp_l3proto proto,
+                          const struct net_device *ol_dev)
+{
+       switch (proto) {
+       case MLXSW_SP_L3_PROTO_IPV4:
+               return (union mlxsw_sp_l3addr) {
+                       .addr4 = mlxsw_sp_ipip_netdev_saddr4(ol_dev),
+               };
+       case MLXSW_SP_L3_PROTO_IPV6:
+               break;
+       }
+
+       WARN_ON(1);
+       return (union mlxsw_sp_l3addr) {
+               .addr4 = 0,
+       };
+}
+
+static __be32 mlxsw_sp_ipip_netdev_daddr4(const struct net_device *ol_dev)
+{
+       struct ip_tunnel *tun = netdev_priv(ol_dev);
+
+       return tun->parms.iph.daddr;
+}
+
+static union mlxsw_sp_l3addr
+mlxsw_sp_ipip_netdev_daddr(enum mlxsw_sp_l3proto proto,
+                          const struct net_device *ol_dev)
+{
+       switch (proto) {
+       case MLXSW_SP_L3_PROTO_IPV4:
+               return (union mlxsw_sp_l3addr) {
+                       .addr4 = mlxsw_sp_ipip_netdev_daddr4(ol_dev),
+               };
+       case MLXSW_SP_L3_PROTO_IPV6:
+               break;
+       }
+
+       WARN_ON(1);
+       return (union mlxsw_sp_l3addr) {
+               .addr4 = 0,
+       };
+}
+
 static int
 mlxsw_sp_ipip_nexthop_update_gre4(struct mlxsw_sp *mlxsw_sp, u32 adj_index,
                                  struct mlxsw_sp_ipip_entry *ipip_entry)
index 6fb49129ce8783e07746512c28575b1cdc61401a..87becd152a5cd3612974a6e30a7d7bbf283f032b 100644 (file)
 #include "spectrum_router.h"
 #include <net/ip_fib.h>
 
+union mlxsw_sp_l3addr
+mlxsw_sp_ipip_netdev_saddr(enum mlxsw_sp_l3proto proto,
+                          const struct net_device *ol_dev);
+
 enum mlxsw_sp_ipip_type {
        MLXSW_SP_IPIP_TYPE_GRE4,
        MLXSW_SP_IPIP_TYPE_MAX,
index 97f062a4ca64dc5ce84422540711d083f10b87b9..ec90c6b6d1264a4ae26ad28d370f6b7096038160 100644 (file)
@@ -1016,59 +1016,6 @@ mlxsw_sp_ipip_entry_dealloc(struct mlxsw_sp_ipip_entry *ipip_entry)
        kfree(ipip_entry);
 }
 
-static __be32
-mlxsw_sp_ipip_netdev_saddr4(const struct net_device *ol_dev)
-{
-       struct ip_tunnel *tun = netdev_priv(ol_dev);
-
-       return tun->parms.iph.saddr;
-}
-
-union mlxsw_sp_l3addr
-mlxsw_sp_ipip_netdev_saddr(enum mlxsw_sp_l3proto proto,
-                          const struct net_device *ol_dev)
-{
-       switch (proto) {
-       case MLXSW_SP_L3_PROTO_IPV4:
-               return (union mlxsw_sp_l3addr) {
-                       .addr4 = mlxsw_sp_ipip_netdev_saddr4(ol_dev),
-               };
-       case MLXSW_SP_L3_PROTO_IPV6:
-               break;
-       };
-
-       WARN_ON(1);
-       return (union mlxsw_sp_l3addr) {
-               .addr4 = 0,
-       };
-}
-
-__be32 mlxsw_sp_ipip_netdev_daddr4(const struct net_device *ol_dev)
-{
-       struct ip_tunnel *tun = netdev_priv(ol_dev);
-
-       return tun->parms.iph.daddr;
-}
-
-union mlxsw_sp_l3addr
-mlxsw_sp_ipip_netdev_daddr(enum mlxsw_sp_l3proto proto,
-                          const struct net_device *ol_dev)
-{
-       switch (proto) {
-       case MLXSW_SP_L3_PROTO_IPV4:
-               return (union mlxsw_sp_l3addr) {
-                       .addr4 = mlxsw_sp_ipip_netdev_daddr4(ol_dev),
-               };
-       case MLXSW_SP_L3_PROTO_IPV6:
-               break;
-       };
-
-       WARN_ON(1);
-       return (union mlxsw_sp_l3addr) {
-               .addr4 = 0,
-       };
-}
-
 static bool mlxsw_sp_l3addr_eq(const union mlxsw_sp_l3addr *addr1,
                               const union mlxsw_sp_l3addr *addr2)
 {
index 39e5811ed26380e289c259ab875466fb6150fceb..8120b01a9c366d64ce05d8d16ae70adefdfce12b 100644 (file)
@@ -103,13 +103,6 @@ mlxsw_sp_neigh_entry_counter_update(struct mlxsw_sp *mlxsw_sp,
                                    struct mlxsw_sp_neigh_entry *neigh_entry,
                                    bool adding);
 bool mlxsw_sp_neigh_ipv6_ignore(struct mlxsw_sp_neigh_entry *neigh_entry);
-union mlxsw_sp_l3addr
-mlxsw_sp_ipip_netdev_saddr(enum mlxsw_sp_l3proto proto,
-                          const struct net_device *ol_dev);
-union mlxsw_sp_l3addr
-mlxsw_sp_ipip_netdev_daddr(enum mlxsw_sp_l3proto proto,
-                          const struct net_device *ol_dev);
-__be32 mlxsw_sp_ipip_netdev_daddr4(const struct net_device *ol_dev);
 struct mlxsw_sp_nexthop *mlxsw_sp_nexthop_next(struct mlxsw_sp_router *router,
                                               struct mlxsw_sp_nexthop *nh);
 bool mlxsw_sp_nexthop_offload(struct mlxsw_sp_nexthop *nh);