History

net: dsa: move tag_8021q headers to their proper place

tag_8021q definitions are all over the place. Some are exported to linux/dsa/8021q.h (visible by DSA core, taggers, switch drivers and everyone else), and some are in dsa_priv.h. Move the structures that don't need external visibility into tag_8021q.c, and the ones which don't need the world or switch drivers to see them into tag_8021q.h. We also have the tag_8021q.h inclusion from switch.c, which is basically the entire reason why tag_8021q.c was built into DSA in commit 8b6e638b4be2 ("net: dsa: build tag_8021q.c as part of DSA core"). I still don't know how to better deal with that, so leave it alone.

Vladimir Oltean committed 3 years ago

Commit 19d05ea1 parent 8e396fe9 files · +48 −38Browse files

Unified · Split

9 files
  1. include/linux/dsa/8021q.h +1 −30
  2. include/net/dsa.h +1 −0
  3. net/dsa/dsa_priv.h +0 −8
  4. net/dsa/port.c +1 −0
  5. net/dsa/switch.c +1 −0
  6. net/dsa/tag_8021q.c +15 −0
  7. net/dsa/tag_8021q.h +27 −0
  8. net/dsa/tag_ocelot_8021q.c +1 −0
  9. net/dsa/tag_sja1105.c +1 −0
include/linux/dsa/8021q.h+1−30
@@ -5,28 +5,8 @@ · 4 unmodified lines
55 #ifndef _NET_DSA_8021Q_H
66 #define _NET_DSA_8021Q_H
77
8−#include <linux/refcount.h>
9−#include <linux/types.h>
108 #include <net/dsa.h>
11−
12−struct dsa_switch;
13−struct dsa_port;
14−struct sk_buff;
15−struct net_device;
16−
17−struct dsa_tag_8021q_vlan {
18− struct list_head list;
19− int port;
20− u16 vid;
21− refcount_t refcount;
22−};
23−
24−struct dsa_8021q_context {
25− struct dsa_switch *ds;
26− struct list_head vlans;
27− /* EtherType of RX VID, used for filtering on master interface */
28− __be16 proto;
29−};
9+#include <linux/types.h>
3010
3111 int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto);
3212
@@ -38,15 +18,6 @@ int dsa_tag_8021q_bridge_join(struct dsa_switch *ds, int port, · 5 unmodified lines
3818 void dsa_tag_8021q_bridge_leave(struct dsa_switch *ds, int port,
3919 struct dsa_bridge bridge);
4020
41−struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
42− u16 tpid, u16 tci);
43−
44−void dsa_8021q_rcv(struct sk_buff *skb, int *source_port, int *switch_id,
45− int *vbid);
46−
47−struct net_device *dsa_tag_8021q_find_port_by_vbid(struct net_device *master,
48− int vbid);
49−
5021 u16 dsa_tag_8021q_bridge_vid(unsigned int bridge_num);
5122
5223 u16 dsa_tag_8021q_standalone_vid(const struct dsa_port *dp);
include/net/dsa.h+1−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <net/devlink.h>
2323 #include <net/switchdev.h>
2424
25+struct dsa_8021q_context;
2526 struct tc_action;
2627 struct phy_device;
2728 struct fixed_phy_status;
net/dsa/dsa_priv.h+0−8
@@ -13,15 +13,7 @@ · 12 unmodified lines
1313
1414 #define DSA_MAX_NUM_OFFLOADING_BRIDGES BITS_PER_LONG
1515
16−struct dsa_notifier_tag_8021q_vlan_info;
17−
1816 /* netlink.c */
1917 extern struct rtnl_link_ops dsa_link_ops __read_mostly;
2018
21−/* tag_8021q.c */
22−int dsa_switch_tag_8021q_vlan_add(struct dsa_switch *ds,
23− struct dsa_notifier_tag_8021q_vlan_info *info);
24−int dsa_switch_tag_8021q_vlan_del(struct dsa_switch *ds,
25− struct dsa_notifier_tag_8021q_vlan_info *info);
26−
2719 #endif
net/dsa/port.c+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include "port.h"
1717 #include "slave.h"
1818 #include "switch.h"
19+#include "tag_8021q.h"
1920
2021 /**
2122 * dsa_port_notify - Notify the switching fabric of changes to a port
net/dsa/switch.c+1−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include "port.h"
1818 #include "slave.h"
1919 #include "switch.h"
20+#include "tag_8021q.h"
2021
2122 static unsigned int dsa_switch_fastest_ageing_time(struct dsa_switch *ds,
2223 unsigned int ageing_time)
net/dsa/tag_8021q.c+15−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include "port.h"
1212 #include "switch.h"
1313 #include "tag.h"
14+#include "tag_8021q.h"
1415
1516 /* Binary structure of the fake 12-bit VID field (when the TPID is
1617 * ETH_P_DSA_8021Q):
@@ -63,6 +64,20 @@ · 46 unmodified lines
6364 #define DSA_8021Q_PORT(x) (((x) << DSA_8021Q_PORT_SHIFT) & \
6465 DSA_8021Q_PORT_MASK)
6566
67+struct dsa_tag_8021q_vlan {
68+ struct list_head list;
69+ int port;
70+ u16 vid;
71+ refcount_t refcount;
72+};
73+
74+struct dsa_8021q_context {
75+ struct dsa_switch *ds;
76+ struct list_head vlans;
77+ /* EtherType of RX VID, used for filtering on master interface */
78+ __be16 proto;
79+};
80+
6681 u16 dsa_tag_8021q_bridge_vid(unsigned int bridge_num)
6782 {
6883 /* The VBID value of 0 is reserved for precise TX, but it is also
net/dsa/tag_8021q.h+27−0
@@ -0,0 +1,27 @@
1+/* SPDX-License-Identifier: GPL-2.0-or-later */
2+
3+#ifndef __DSA_TAG_8021Q_H
4+#define __DSA_TAG_8021Q_H
5+
6+#include <net/dsa.h>
7+
8+#include "switch.h"
9+
10+struct sk_buff;
11+struct net_device;
12+
13+struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
14+ u16 tpid, u16 tci);
15+
16+void dsa_8021q_rcv(struct sk_buff *skb, int *source_port, int *switch_id,
17+ int *vbid);
18+
19+struct net_device *dsa_tag_8021q_find_port_by_vbid(struct net_device *master,
20+ int vbid);
21+
22+int dsa_switch_tag_8021q_vlan_add(struct dsa_switch *ds,
23+ struct dsa_notifier_tag_8021q_vlan_info *info);
24+int dsa_switch_tag_8021q_vlan_del(struct dsa_switch *ds,
25+ struct dsa_notifier_tag_8021q_vlan_info *info);
26+
27+#endif
net/dsa/tag_ocelot_8021q.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/dsa/ocelot.h>
1313
1414 #include "tag.h"
15+#include "tag_8021q.h"
1516
1617 #define OCELOT_8021Q_NAME "ocelot-8021q"
1718
net/dsa/tag_sja1105.c+1−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #include <linux/packing.h>
88
99 #include "tag.h"
10+#include "tag_8021q.h"
1011
1112 #define SJA1105_NAME "sja1105"
1213 #define SJA1110_NAME "sja1110"