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
5#ifndef _NET_DSA_8021Q_H5#ifndef _NET_DSA_8021Q_H
6#define _NET_DSA_8021Q_H6#define _NET_DSA_8021Q_H
7 7
8#include <linux/refcount.h>
9#include <linux/types.h>
10#include <net/dsa.h>8#include <net/dsa.h>
11 9#include <linux/types.h>
12struct dsa_switch;
13struct dsa_port;
14struct sk_buff;
15struct net_device;
16
17struct dsa_tag_8021q_vlan {
18 struct list_head list;
19 int port;
20 u16 vid;
21 refcount_t refcount;
22};
23
24struct 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};
30 10
31int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto);11int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto);
32 12
@@ -38,15 +18,6 @@ int dsa_tag_8021q_bridge_join(struct dsa_switch *ds, int port, · 5 unmodified lines
38void dsa_tag_8021q_bridge_leave(struct dsa_switch *ds, int port,18void dsa_tag_8021q_bridge_leave(struct dsa_switch *ds, int port,
39 struct dsa_bridge bridge);19 struct dsa_bridge bridge);
40 20
41struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
42 u16 tpid, u16 tci);
43
44void dsa_8021q_rcv(struct sk_buff *skb, int *source_port, int *switch_id,
45 int *vbid);
46
47struct net_device *dsa_tag_8021q_find_port_by_vbid(struct net_device *master,
48 int vbid);
49
50u16 dsa_tag_8021q_bridge_vid(unsigned int bridge_num);21u16 dsa_tag_8021q_bridge_vid(unsigned int bridge_num);
51 22
52u16 dsa_tag_8021q_standalone_vid(const struct dsa_port *dp);23u16 dsa_tag_8021q_standalone_vid(const struct dsa_port *dp);
include/net/dsa.h+1−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
22#include <net/devlink.h>22#include <net/devlink.h>
23#include <net/switchdev.h>23#include <net/switchdev.h>
24 24
25struct dsa_8021q_context;
25struct tc_action;26struct tc_action;
26struct phy_device;27struct phy_device;
27struct fixed_phy_status;28struct fixed_phy_status;
net/dsa/dsa_priv.h+0−8
@@ -13,15 +13,7 @@ · 12 unmodified lines
13 13
14#define DSA_MAX_NUM_OFFLOADING_BRIDGES BITS_PER_LONG14#define DSA_MAX_NUM_OFFLOADING_BRIDGES BITS_PER_LONG
15 15
16struct dsa_notifier_tag_8021q_vlan_info;
17
18/* netlink.c */16/* netlink.c */
19extern struct rtnl_link_ops dsa_link_ops __read_mostly;17extern struct rtnl_link_ops dsa_link_ops __read_mostly;
20 18
21/* tag_8021q.c */
22int dsa_switch_tag_8021q_vlan_add(struct dsa_switch *ds,
23 struct dsa_notifier_tag_8021q_vlan_info *info);
24int dsa_switch_tag_8021q_vlan_del(struct dsa_switch *ds,
25 struct dsa_notifier_tag_8021q_vlan_info *info);
26
27#endif19#endif
net/dsa/port.c+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
16#include "port.h"16#include "port.h"
17#include "slave.h"17#include "slave.h"
18#include "switch.h"18#include "switch.h"
19#include "tag_8021q.h"
19 20
20/**21/**
21 * dsa_port_notify - Notify the switching fabric of changes to a port22 * 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
17#include "port.h"17#include "port.h"
18#include "slave.h"18#include "slave.h"
19#include "switch.h"19#include "switch.h"
20#include "tag_8021q.h"
20 21
21static unsigned int dsa_switch_fastest_ageing_time(struct dsa_switch *ds,22static unsigned int dsa_switch_fastest_ageing_time(struct dsa_switch *ds,
22 unsigned int ageing_time)23 unsigned int ageing_time)
net/dsa/tag_8021q.c+15−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
11#include "port.h"11#include "port.h"
12#include "switch.h"12#include "switch.h"
13#include "tag.h"13#include "tag.h"
14#include "tag_8021q.h"
14 15
15/* Binary structure of the fake 12-bit VID field (when the TPID is16/* Binary structure of the fake 12-bit VID field (when the TPID is
16 * ETH_P_DSA_8021Q):17 * ETH_P_DSA_8021Q):
@@ -63,6 +64,20 @@ · 46 unmodified lines
63#define DSA_8021Q_PORT(x) (((x) << DSA_8021Q_PORT_SHIFT) & \64#define DSA_8021Q_PORT(x) (((x) << DSA_8021Q_PORT_SHIFT) & \
64 DSA_8021Q_PORT_MASK)65 DSA_8021Q_PORT_MASK)
65 66
67struct dsa_tag_8021q_vlan {
68 struct list_head list;
69 int port;
70 u16 vid;
71 refcount_t refcount;
72};
73
74struct 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
66u16 dsa_tag_8021q_bridge_vid(unsigned int bridge_num)81u16 dsa_tag_8021q_bridge_vid(unsigned int bridge_num)
67{82{
68 /* The VBID value of 0 is reserved for precise TX, but it is also83 /* 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
10struct sk_buff;
11struct net_device;
12
13struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
14 u16 tpid, u16 tci);
15
16void dsa_8021q_rcv(struct sk_buff *skb, int *source_port, int *switch_id,
17 int *vbid);
18
19struct net_device *dsa_tag_8021q_find_port_by_vbid(struct net_device *master,
20 int vbid);
21
22int dsa_switch_tag_8021q_vlan_add(struct dsa_switch *ds,
23 struct dsa_notifier_tag_8021q_vlan_info *info);
24int 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
12#include <linux/dsa/ocelot.h>12#include <linux/dsa/ocelot.h>
13 13
14#include "tag.h"14#include "tag.h"
15#include "tag_8021q.h"
15 16
16#define OCELOT_8021Q_NAME "ocelot-8021q"17#define OCELOT_8021Q_NAME "ocelot-8021q"
17 18
net/dsa/tag_sja1105.c+1−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
7#include <linux/packing.h>7#include <linux/packing.h>
8 8
9#include "tag.h"9#include "tag.h"
10#include "tag_8021q.h"
10 11
11#define SJA1105_NAME "sja1105"12#define SJA1105_NAME "sja1105"
12#define SJA1110_NAME "sja1110"13#define SJA1110_NAME "sja1110"