net/mlx5_core: Add base sriov support
[cascardo/linux.git] / include / linux / mroute.h
index 79aaa9f..bf9b322 100644 (file)
@@ -9,38 +9,28 @@
 #ifdef CONFIG_IP_MROUTE
 static inline int ip_mroute_opt(int opt)
 {
-       return (opt >= MRT_BASE) && (opt <= MRT_MAX);
+       return opt >= MRT_BASE && opt <= MRT_MAX;
 }
-#else
-static inline int ip_mroute_opt(int opt)
-{
-       return 0;
-}
-#endif
 
-#ifdef CONFIG_IP_MROUTE
-extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
-extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
-extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
-extern int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
-extern int ip_mr_init(void);
+int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
+int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
+int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
+int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
+int ip_mr_init(void);
 #else
-static inline
-int ip_mroute_setsockopt(struct sock *sock,
-                        int optname, char __user *optval, unsigned int optlen)
+static inline int ip_mroute_setsockopt(struct sock *sock, int optname,
+                                      char __user *optval, unsigned int optlen)
 {
        return -ENOPROTOOPT;
 }
 
-static inline
-int ip_mroute_getsockopt(struct sock *sock,
-                        int optname, char __user *optval, int __user *optlen)
+static inline int ip_mroute_getsockopt(struct sock *sock, int optname,
+                                      char __user *optval, int __user *optlen)
 {
        return -ENOPROTOOPT;
 }
 
-static inline
-int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
+static inline int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
 {
        return -ENOIOCTLCMD;
 }
@@ -49,6 +39,11 @@ static inline int ip_mr_init(void)
 {
        return 0;
 }
+
+static inline int ip_mroute_opt(int opt)
+{
+       return 0;
+}
 #endif
 
 struct vif_device {
@@ -64,6 +59,32 @@ struct vif_device {
 
 #define VIFF_STATIC 0x8000
 
+#define VIF_EXISTS(_mrt, _idx) ((_mrt)->vif_table[_idx].dev != NULL)
+#define MFC_LINES 64
+
+struct mr_table {
+       struct list_head        list;
+       possible_net_t          net;
+       u32                     id;
+       struct sock __rcu       *mroute_sk;
+       struct timer_list       ipmr_expire_timer;
+       struct list_head        mfc_unres_queue;
+       struct list_head        mfc_cache_array[MFC_LINES];
+       struct vif_device       vif_table[MAXVIFS];
+       int                     maxvif;
+       atomic_t                cache_resolve_queue_len;
+       bool                    mroute_do_assert;
+       bool                    mroute_do_pim;
+       int                     mroute_reg_vif_num;
+};
+
+/* mfc_flags:
+ * MFC_STATIC - the entry was added statically (not by a routing daemon)
+ */
+enum {
+       MFC_STATIC = BIT(0),
+};
+
 struct mfc_cache {
        struct list_head list;
        __be32 mfc_mcastgrp;                    /* Group the entry belongs to   */
@@ -89,19 +110,14 @@ struct mfc_cache {
        struct rcu_head rcu;
 };
 
-#define MFC_STATIC             1
-#define MFC_NOTIFY             2
-
-#define MFC_LINES              64
-
 #ifdef __BIG_ENDIAN
 #define MFC_HASH(a,b)  (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1))
 #else
 #define MFC_HASH(a,b)  ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
-#endif         
+#endif
 
 struct rtmsg;
-extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
-                         __be32 saddr, __be32 daddr,
-                         struct rtmsg *rtm, int nowait);
+int ipmr_get_route(struct net *net, struct sk_buff *skb,
+                  __be32 saddr, __be32 daddr,
+                  struct rtmsg *rtm, int nowait);
 #endif