kernel: fix build error in flow offload code with CONFIG_NETFILTER=n
authorFelix Fietkau <nbd@nbd.name>
Tue, 8 May 2018 21:17:36 +0000 (23:17 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 12 May 2018 20:28:00 +0000 (22:28 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
target/linux/generic/pending-4.14/642-net-8021q-support-hardware-flow-table-offload.patch
target/linux/generic/pending-4.14/643-net-bridge-support-hardware-flow-table-offload.patch
target/linux/generic/pending-4.14/644-net-pppoe-support-hardware-flow-table-offload.patch

index ca340fc8e5f654c1a8087deff1d929f746fea293..c5b3bf35b54f5b9b4f13b3ec574a84289cfdf27d 100644 (file)
@@ -9,22 +9,22 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/net/8021q/vlan_dev.c
 +++ b/net/8021q/vlan_dev.c
 
 --- a/net/8021q/vlan_dev.c
 +++ b/net/8021q/vlan_dev.c
-@@ -29,9 +29,11 @@
- #include <linux/net_tstamp.h>
- #include <linux/etherdevice.h>
- #include <linux/ethtool.h>
-+#include <linux/netfilter.h>
+@@ -32,6 +32,10 @@
  #include <linux/phy.h>
  #include <net/arp.h>
  #include <net/switchdev.h>
  #include <linux/phy.h>
  #include <net/arp.h>
  #include <net/switchdev.h>
++#ifdef CONFIG_NF_FLOW_TABLE
++#include <linux/netfilter.h>
 +#include <net/netfilter/nf_flow_table.h>
 +#include <net/netfilter/nf_flow_table.h>
++#endif
  
  #include "vlan.h"
  #include "vlanproc.h"
  
  #include "vlan.h"
  #include "vlanproc.h"
-@@ -766,6 +768,25 @@ static int vlan_dev_get_iflink(const str
+@@ -766,6 +770,27 @@ static int vlan_dev_get_iflink(const str
        return real_dev->ifindex;
  }
  
        return real_dev->ifindex;
  }
  
++#ifdef CONFIG_NF_FLOW_TABLE
 +static int vlan_dev_flow_offload_check(struct flow_offload_hw_path *path)
 +{
 +      struct net_device *dev = path->dev;
 +static int vlan_dev_flow_offload_check(struct flow_offload_hw_path *path)
 +{
 +      struct net_device *dev = path->dev;
@@ -43,15 +43,18 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +
 +      return 0;
 +}
 +
 +      return 0;
 +}
++#endif /* CONFIG_NF_FLOW_TABLE */
 +
  static const struct ethtool_ops vlan_ethtool_ops = {
        .get_link_ksettings     = vlan_ethtool_get_link_ksettings,
        .get_drvinfo            = vlan_ethtool_get_drvinfo,
 +
  static const struct ethtool_ops vlan_ethtool_ops = {
        .get_link_ksettings     = vlan_ethtool_get_link_ksettings,
        .get_drvinfo            = vlan_ethtool_get_drvinfo,
-@@ -803,6 +824,7 @@ static const struct net_device_ops vlan_
+@@ -803,6 +828,9 @@ static const struct net_device_ops vlan_
        .ndo_fix_features       = vlan_dev_fix_features,
        .ndo_get_lock_subclass  = vlan_dev_get_lock_subclass,
        .ndo_get_iflink         = vlan_dev_get_iflink,
        .ndo_fix_features       = vlan_dev_fix_features,
        .ndo_get_lock_subclass  = vlan_dev_get_lock_subclass,
        .ndo_get_iflink         = vlan_dev_get_iflink,
++#ifdef CONFIG_NF_FLOW_TABLE
 +      .ndo_flow_offload_check = vlan_dev_flow_offload_check,
 +      .ndo_flow_offload_check = vlan_dev_flow_offload_check,
++#endif
  };
  
  static void vlan_dev_free(struct net_device *dev)
  };
  
  static void vlan_dev_free(struct net_device *dev)
index 3158714f541037615fc027e26b9f0cb34c7dfd41..409f6bec2ccba1d9e02140d990155f2a306fd42e 100644 (file)
@@ -9,19 +9,22 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/net/bridge/br_device.c
 +++ b/net/bridge/br_device.c
 
 --- a/net/bridge/br_device.c
 +++ b/net/bridge/br_device.c
-@@ -18,6 +18,8 @@
+@@ -18,6 +18,10 @@
  #include <linux/ethtool.h>
  #include <linux/list.h>
  #include <linux/netfilter_bridge.h>
  #include <linux/ethtool.h>
  #include <linux/list.h>
  #include <linux/netfilter_bridge.h>
++#ifdef CONFIG_NF_FLOW_TABLE
 +#include <linux/netfilter.h>
 +#include <net/netfilter/nf_flow_table.h>
 +#include <linux/netfilter.h>
 +#include <net/netfilter/nf_flow_table.h>
++#endif
  
  #include <linux/uaccess.h>
  #include "br_private.h"
  
  #include <linux/uaccess.h>
  #include "br_private.h"
-@@ -340,6 +342,26 @@ static const struct ethtool_ops br_ethto
+@@ -340,6 +344,28 @@ static const struct ethtool_ops br_ethto
        .get_link       = ethtool_op_get_link,
  };
  
        .get_link       = ethtool_op_get_link,
  };
  
++#ifdef CONFIG_NF_FLOW_TABLE
 +static int br_flow_offload_check(struct flow_offload_hw_path *path)
 +{
 +      struct net_device *dev = path->dev;
 +static int br_flow_offload_check(struct flow_offload_hw_path *path)
 +{
 +      struct net_device *dev = path->dev;
@@ -41,15 +44,18 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +
 +      return 0;
 +}
 +
 +      return 0;
 +}
++#endif /* CONFIG_NF_FLOW_TABLE */
 +
  static const struct net_device_ops br_netdev_ops = {
        .ndo_open                = br_dev_open,
        .ndo_stop                = br_dev_stop,
 +
  static const struct net_device_ops br_netdev_ops = {
        .ndo_open                = br_dev_open,
        .ndo_stop                = br_dev_stop,
-@@ -367,6 +389,7 @@ static const struct net_device_ops br_ne
+@@ -367,6 +393,9 @@ static const struct net_device_ops br_ne
        .ndo_bridge_setlink      = br_setlink,
        .ndo_bridge_dellink      = br_dellink,
        .ndo_features_check      = passthru_features_check,
        .ndo_bridge_setlink      = br_setlink,
        .ndo_bridge_dellink      = br_dellink,
        .ndo_features_check      = passthru_features_check,
++#ifdef CONFIG_NF_FLOW_TABLE
 +      .ndo_flow_offload_check  = br_flow_offload_check,
 +      .ndo_flow_offload_check  = br_flow_offload_check,
++#endif
  };
  
  static struct device_type br_type = {
  };
  
  static struct device_type br_type = {
index 9565412c00453148be7eccc108b07d2a59a6f5bb..3331d5956e6aced60624d588b48efa843676eab9 100644 (file)
@@ -9,20 +9,23 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/drivers/net/ppp/ppp_generic.c
 +++ b/drivers/net/ppp/ppp_generic.c
 
 --- a/drivers/net/ppp/ppp_generic.c
 +++ b/drivers/net/ppp/ppp_generic.c
-@@ -56,6 +56,9 @@
+@@ -56,6 +56,11 @@
  #include <net/net_namespace.h>
  #include <net/netns/generic.h>
  
  #include <net/net_namespace.h>
  #include <net/netns/generic.h>
  
++#ifdef CONFIG_NF_FLOW_TABLE
 +#include <linux/netfilter.h>
 +#include <net/netfilter/nf_flow_table.h>
 +#include <linux/netfilter.h>
 +#include <net/netfilter/nf_flow_table.h>
++#endif
 +
  #define PPP_VERSION   "2.4.2"
  
  /*
 +
  #define PPP_VERSION   "2.4.2"
  
  /*
-@@ -1382,12 +1385,33 @@ static void ppp_dev_priv_destructor(stru
+@@ -1382,12 +1387,37 @@ static void ppp_dev_priv_destructor(stru
                ppp_destroy_interface(ppp);
  }
  
                ppp_destroy_interface(ppp);
  }
  
++#ifdef CONFIG_NF_FLOW_TABLE
 +static int ppp_flow_offload_check(struct flow_offload_hw_path *path)
 +{
 +      struct ppp *ppp = netdev_priv(path->dev);
 +static int ppp_flow_offload_check(struct flow_offload_hw_path *path)
 +{
 +      struct ppp *ppp = netdev_priv(path->dev);
@@ -42,6 +45,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +
 +      return chan->ops->flow_offload_check(chan, path);
 +}
 +
 +      return chan->ops->flow_offload_check(chan, path);
 +}
++#endif /* CONFIG_NF_FLOW_TABLE */
 +
  static const struct net_device_ops ppp_netdev_ops = {
        .ndo_init        = ppp_dev_init,
 +
  static const struct net_device_ops ppp_netdev_ops = {
        .ndo_init        = ppp_dev_init,
@@ -49,25 +53,31 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        .ndo_start_xmit  = ppp_start_xmit,
        .ndo_do_ioctl    = ppp_net_ioctl,
        .ndo_get_stats64 = ppp_get_stats64,
        .ndo_start_xmit  = ppp_start_xmit,
        .ndo_do_ioctl    = ppp_net_ioctl,
        .ndo_get_stats64 = ppp_get_stats64,
++#ifdef CONFIG_NF_FLOW_TABLE
 +      .ndo_flow_offload_check = ppp_flow_offload_check,
 +      .ndo_flow_offload_check = ppp_flow_offload_check,
++#endif
  };
  
  static struct device_type ppp_type = {
 --- a/drivers/net/ppp/pppoe.c
 +++ b/drivers/net/ppp/pppoe.c
  };
  
  static struct device_type ppp_type = {
 --- a/drivers/net/ppp/pppoe.c
 +++ b/drivers/net/ppp/pppoe.c
-@@ -77,6 +77,8 @@
- #include <linux/file.h>
+@@ -78,6 +78,11 @@
  #include <linux/proc_fs.h>
  #include <linux/seq_file.h>
  #include <linux/proc_fs.h>
  #include <linux/seq_file.h>
++#ifdef CONFIG_NF_FLOW_TABLE
 +#include <linux/netfilter.h>
 +#include <net/netfilter/nf_flow_table.h>
 +#include <linux/netfilter.h>
 +#include <net/netfilter/nf_flow_table.h>
++#endif
++
  #include <linux/nsproxy.h>
  #include <net/net_namespace.h>
  #include <linux/nsproxy.h>
  #include <net/net_namespace.h>
-@@ -970,8 +972,32 @@ static int pppoe_xmit(struct ppp_channel
+ #include <net/netns/generic.h>
+@@ -970,8 +975,36 @@ static int pppoe_xmit(struct ppp_channel
        return __pppoe_xmit(sk, skb);
  }
  
        return __pppoe_xmit(sk, skb);
  }
  
++#ifdef CONFIG_NF_FLOW_TABLE
 +static int pppoe_flow_offload_check(struct ppp_channel *chan,
 +                                  struct flow_offload_hw_path *path)
 +{
 +static int pppoe_flow_offload_check(struct ppp_channel *chan,
 +                                  struct flow_offload_hw_path *path)
 +{
@@ -90,21 +100,26 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +
 +      return 0;
 +}
 +
 +      return 0;
 +}
++#endif /* CONFIG_NF_FLOW_TABLE */
 +
  static const struct ppp_channel_ops pppoe_chan_ops = {
        .start_xmit = pppoe_xmit,
 +
  static const struct ppp_channel_ops pppoe_chan_ops = {
        .start_xmit = pppoe_xmit,
++#ifdef CONFIG_NF_FLOW_TABLE
 +      .flow_offload_check = pppoe_flow_offload_check,
 +      .flow_offload_check = pppoe_flow_offload_check,
++#endif
  };
  
  static int pppoe_recvmsg(struct socket *sock, struct msghdr *m,
 --- a/include/linux/ppp_channel.h
 +++ b/include/linux/ppp_channel.h
  };
  
  static int pppoe_recvmsg(struct socket *sock, struct msghdr *m,
 --- a/include/linux/ppp_channel.h
 +++ b/include/linux/ppp_channel.h
-@@ -32,6 +32,8 @@ struct ppp_channel_ops {
+@@ -32,6 +32,10 @@ struct ppp_channel_ops {
        int     (*start_xmit)(struct ppp_channel *, struct sk_buff *);
        /* Handle an ioctl call that has come in via /dev/ppp. */
        int     (*ioctl)(struct ppp_channel *, unsigned int, unsigned long);
 +
        int     (*start_xmit)(struct ppp_channel *, struct sk_buff *);
        /* Handle an ioctl call that has come in via /dev/ppp. */
        int     (*ioctl)(struct ppp_channel *, unsigned int, unsigned long);
 +
++#ifdef CONFIG_NF_FLOW_TABLE
 +      int     (*flow_offload_check)(struct ppp_channel *, struct flow_offload_hw_path *);
 +      int     (*flow_offload_check)(struct ppp_channel *, struct flow_offload_hw_path *);
++#endif
  };
  
  struct ppp_channel {
  };
  
  struct ppp_channel {