kernel: fix an issue with infinite stack traces on MIPS
[oweals/openwrt.git] / target / linux / generic / pending-4.14 / 643-net-bridge-support-hardware-flow-table-offload.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Thu, 15 Mar 2018 20:50:37 +0100
3 Subject: [PATCH] net: bridge: support hardware flow table offload
4
5 Look up the real device and pass it on
6
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 ---
9
10 --- a/net/bridge/br_device.c
11 +++ b/net/bridge/br_device.c
12 @@ -18,6 +18,8 @@
13  #include <linux/ethtool.h>
14  #include <linux/list.h>
15  #include <linux/netfilter_bridge.h>
16 +#include <linux/netfilter.h>
17 +#include <net/netfilter/nf_flow_table.h>
18  
19  #include <linux/uaccess.h>
20  #include "br_private.h"
21 @@ -340,6 +342,26 @@ static const struct ethtool_ops br_ethto
22         .get_link       = ethtool_op_get_link,
23  };
24  
25 +static int br_flow_offload_check(struct flow_offload_hw_path *path)
26 +{
27 +       struct net_device *dev = path->dev;
28 +       struct net_bridge *br = netdev_priv(dev);
29 +       struct net_bridge_fdb_entry *dst;
30 +
31 +       if (!(path->flags & FLOW_OFFLOAD_PATH_ETHERNET))
32 +               return -EINVAL;
33 +
34 +       dst = br_fdb_find_rcu(br, path->eth_dest, path->vlan_id);
35 +       if (!dst || !dst->dst)
36 +               return -ENOENT;
37 +
38 +       path->dev = dst->dst->dev;
39 +       if (path->dev->netdev_ops->ndo_flow_offload_check)
40 +               return path->dev->netdev_ops->ndo_flow_offload_check(path);
41 +
42 +       return 0;
43 +}
44 +
45  static const struct net_device_ops br_netdev_ops = {
46         .ndo_open                = br_dev_open,
47         .ndo_stop                = br_dev_stop,
48 @@ -367,6 +389,7 @@ static const struct net_device_ops br_ne
49         .ndo_bridge_setlink      = br_setlink,
50         .ndo_bridge_dellink      = br_dellink,
51         .ndo_features_check      = passthru_features_check,
52 +       .ndo_flow_offload_check  = br_flow_offload_check,
53  };
54  
55  static struct device_type br_type = {