switchdev: pass pointer to fib_info instead of copy
[cascardo/linux.git] / net / switchdev / switchdev.c
index b7e01d8..59658b2 100644 (file)
@@ -1188,6 +1188,7 @@ int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi,
                .obj.id = SWITCHDEV_OBJ_ID_IPV4_FIB,
                .dst = dst,
                .dst_len = dst_len,
+               .fi = fi,
                .tos = tos,
                .type = type,
                .nlflags = nlflags,
@@ -1196,8 +1197,6 @@ int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi,
        struct net_device *dev;
        int err = 0;
 
-       memcpy(&ipv4_fib.fi, fi, sizeof(ipv4_fib.fi));
-
        /* Don't offload route if using custom ip rules or if
         * IPv4 FIB offloading has been disabled completely.
         */
@@ -1242,6 +1241,7 @@ int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi,
                .obj.id = SWITCHDEV_OBJ_ID_IPV4_FIB,
                .dst = dst,
                .dst_len = dst_len,
+               .fi = fi,
                .tos = tos,
                .type = type,
                .nlflags = 0,
@@ -1250,8 +1250,6 @@ int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi,
        struct net_device *dev;
        int err = 0;
 
-       memcpy(&ipv4_fib.fi, fi, sizeof(ipv4_fib.fi));
-
        if (!(fi->fib_flags & RTNH_F_OFFLOAD))
                return 0;