2018-03-12 19:51:55 +00:00
|
|
|
From: Felix Fietkau <nbd@nbd.name>
|
|
|
|
Date: Thu, 15 Mar 2018 20:49:58 +0100
|
|
|
|
Subject: [PATCH] net: 8021q: support hardware flow table offload
|
|
|
|
|
|
|
|
Add the VLAN ID and protocol information
|
|
|
|
|
|
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
---
|
|
|
|
|
|
|
|
--- a/net/8021q/vlan_dev.c
|
|
|
|
+++ b/net/8021q/vlan_dev.c
|
2018-05-08 21:17:36 +00:00
|
|
|
@@ -32,6 +32,10 @@
|
2018-04-15 21:00:49 +00:00
|
|
|
#include <linux/phy.h>
|
2018-03-12 19:51:55 +00:00
|
|
|
#include <net/arp.h>
|
|
|
|
#include <net/switchdev.h>
|
2018-05-17 05:53:57 +00:00
|
|
|
+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
|
2018-05-08 21:17:36 +00:00
|
|
|
+#include <linux/netfilter.h>
|
2018-03-12 19:51:55 +00:00
|
|
|
+#include <net/netfilter/nf_flow_table.h>
|
2018-05-08 21:17:36 +00:00
|
|
|
+#endif
|
2018-03-12 19:51:55 +00:00
|
|
|
|
|
|
|
#include "vlan.h"
|
|
|
|
#include "vlanproc.h"
|
2019-05-20 08:31:41 +00:00
|
|
|
@@ -768,6 +772,27 @@ static int vlan_dev_get_iflink(const str
|
2018-03-12 19:51:55 +00:00
|
|
|
return real_dev->ifindex;
|
|
|
|
}
|
|
|
|
|
2018-05-17 05:53:57 +00:00
|
|
|
+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
|
2018-03-12 19:51:55 +00:00
|
|
|
+static int vlan_dev_flow_offload_check(struct flow_offload_hw_path *path)
|
|
|
|
+{
|
|
|
|
+ struct net_device *dev = path->dev;
|
|
|
|
+ struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
|
|
|
|
+
|
|
|
|
+ if (path->flags & FLOW_OFFLOAD_PATH_VLAN)
|
|
|
|
+ return -EEXIST;
|
|
|
|
+
|
|
|
|
+ path->flags |= FLOW_OFFLOAD_PATH_VLAN;
|
|
|
|
+ path->vlan_proto = vlan->vlan_proto;
|
|
|
|
+ path->vlan_id = vlan->vlan_id;
|
|
|
|
+ path->dev = vlan->real_dev;
|
|
|
|
+
|
|
|
|
+ if (vlan->real_dev->netdev_ops->ndo_flow_offload_check)
|
|
|
|
+ return vlan->real_dev->netdev_ops->ndo_flow_offload_check(path);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
2018-05-08 21:17:36 +00:00
|
|
|
+#endif /* CONFIG_NF_FLOW_TABLE */
|
2018-03-12 19:51:55 +00:00
|
|
|
+
|
|
|
|
static const struct ethtool_ops vlan_ethtool_ops = {
|
|
|
|
.get_link_ksettings = vlan_ethtool_get_link_ksettings,
|
|
|
|
.get_drvinfo = vlan_ethtool_get_drvinfo,
|
2019-05-20 08:31:41 +00:00
|
|
|
@@ -805,6 +830,9 @@ static const struct net_device_ops vlan_
|
2018-03-12 19:51:55 +00:00
|
|
|
.ndo_fix_features = vlan_dev_fix_features,
|
|
|
|
.ndo_get_lock_subclass = vlan_dev_get_lock_subclass,
|
|
|
|
.ndo_get_iflink = vlan_dev_get_iflink,
|
2018-05-17 05:53:57 +00:00
|
|
|
+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
|
2018-03-12 19:51:55 +00:00
|
|
|
+ .ndo_flow_offload_check = vlan_dev_flow_offload_check,
|
2018-05-08 21:17:36 +00:00
|
|
|
+#endif
|
2018-03-12 19:51:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void vlan_dev_free(struct net_device *dev)
|