summaryrefslogtreecommitdiff
path: root/net/8021q
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-07-08 03:23:57 -0700
committerDavid S. Miller <davem@davemloft.net>2008-07-08 03:23:57 -0700
commit22d1ba74bbafa96d3f425cc12714d3fe8675183f (patch)
tree5fdc18001037a667e95229dbc34130b7210e8c8c /net/8021q
parent7750f403cbe56971336d575b354365190b4e3227 (diff)
downloadlinux-3.10-22d1ba74bbafa96d3f425cc12714d3fe8675183f.tar.gz
linux-3.10-22d1ba74bbafa96d3f425cc12714d3fe8675183f.tar.bz2
linux-3.10-22d1ba74bbafa96d3f425cc12714d3fe8675183f.zip
vlan: move struct vlan_dev_info to private header
Hide struct vlan_dev_info from drivers to prevent them from growing more creative ways to use it. Provide accessors for the two drivers that currently use it. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q')
-rw-r--r--net/8021q/vlan.c4
-rw-r--r--net/8021q/vlan.h50
-rw-r--r--net/8021q/vlan_core.c12
-rw-r--r--net/8021q/vlan_dev.c5
4 files changed, 62 insertions, 9 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 8141e2dc510..7a2625d2f9a 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -543,7 +543,6 @@ static struct notifier_block vlan_notifier_block __read_mostly = {
static int vlan_ioctl_handler(struct net *net, void __user *arg)
{
int err;
- unsigned short vid = 0;
struct vlan_ioctl_args args;
struct net_device *dev = NULL;
@@ -644,8 +643,7 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
case GET_VLAN_VID_CMD:
err = 0;
- vlan_dev_get_vid(dev, &vid);
- args.u.VID = vid;
+ args.u.VID = vlan_dev_vlan_id(dev);
if (copy_to_user(arg, &args,
sizeof(struct vlan_ioctl_args)))
err = -EFAULT;
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index 7cc1a97c42f..14c421e033f 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -3,6 +3,55 @@
#include <linux/if_vlan.h>
+
+/**
+ * struct vlan_priority_tci_mapping - vlan egress priority mappings
+ * @priority: skb priority
+ * @vlan_qos: vlan priority: (skb->priority << 13) & 0xE000
+ * @next: pointer to next struct
+ */
+struct vlan_priority_tci_mapping {
+ u32 priority;
+ unsigned short vlan_qos;
+ struct vlan_priority_tci_mapping *next;
+};
+
+/**
+ * struct vlan_dev_info - VLAN private device data
+ * @nr_ingress_mappings: number of ingress priority mappings
+ * @ingress_priority_map: ingress priority mappings
+ * @nr_egress_mappings: number of egress priority mappings
+ * @egress_priority_map: hash of egress priority mappings
+ * @vlan_id: VLAN identifier
+ * @flags: device flags
+ * @real_dev: underlying netdevice
+ * @real_dev_addr: address of underlying netdevice
+ * @dent: proc dir entry
+ * @cnt_inc_headroom_on_tx: statistic - number of skb expansions on TX
+ * @cnt_encap_on_xmit: statistic - number of skb encapsulations on TX
+ */
+struct vlan_dev_info {
+ unsigned int nr_ingress_mappings;
+ u32 ingress_priority_map[8];
+ unsigned int nr_egress_mappings;
+ struct vlan_priority_tci_mapping *egress_priority_map[16];
+
+ unsigned short vlan_id;
+ unsigned short flags;
+
+ struct net_device *real_dev;
+ unsigned char real_dev_addr[ETH_ALEN];
+
+ struct proc_dir_entry *dent;
+ unsigned long cnt_inc_headroom_on_tx;
+ unsigned long cnt_encap_on_xmit;
+};
+
+static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev)
+{
+ return netdev_priv(dev);
+}
+
#define VLAN_GRP_HASH_SHIFT 5
#define VLAN_GRP_HASH_SIZE (1 << VLAN_GRP_HASH_SHIFT)
#define VLAN_GRP_HASH_MASK (VLAN_GRP_HASH_SIZE - 1)
@@ -30,7 +79,6 @@ int vlan_dev_set_egress_priority(const struct net_device *dev,
u32 skb_prio, short vlan_prio);
int vlan_dev_change_flags(const struct net_device *dev, u32 flag, u32 mask);
void vlan_dev_get_realdev_name(const struct net_device *dev, char *result);
-void vlan_dev_get_vid(const struct net_device *dev, unsigned short *result);
int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id);
void vlan_setup(struct net_device *dev);
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 85c94edb000..f980b9154cc 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -46,3 +46,15 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
return (polling ? netif_receive_skb(skb) : netif_rx(skb));
}
EXPORT_SYMBOL(__vlan_hwaccel_rx);
+
+struct net_device *vlan_dev_real_dev(const struct net_device *dev)
+{
+ return vlan_dev_info(dev)->real_dev;
+}
+EXPORT_SYMBOL_GPL(vlan_dev_real_dev);
+
+u16 vlan_dev_vlan_id(const struct net_device *dev)
+{
+ return vlan_dev_info(dev)->vlan_id;
+}
+EXPORT_SYMBOL_GPL(vlan_dev_vlan_id);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 722697d31e4..2aab294c574 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -531,11 +531,6 @@ void vlan_dev_get_realdev_name(const struct net_device *dev, char *result)
strncpy(result, vlan_dev_info(dev)->real_dev->name, 23);
}
-void vlan_dev_get_vid(const struct net_device *dev, unsigned short *result)
-{
- *result = vlan_dev_info(dev)->vlan_id;
-}
-
static int vlan_dev_open(struct net_device *dev)
{
struct vlan_dev_info *vlan = vlan_dev_info(dev);