Skip to content

Commit 6c84a58

Browse files
ffainellidavem330
authored andcommitted
net: dsa: loop: Move data structures to header
In preparation for adding support for a mockup data path, move the driver data structures to include/linux/dsa/loop.h such that we can share them between net/dsa/ and drivers/net/dsa/ later on. Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 916a8d1 commit 6c84a58

File tree

2 files changed

+41
-31
lines changed

2 files changed

+41
-31
lines changed

drivers/net/dsa/dsa_loop.c

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,48 +14,18 @@
1414
#include <linux/workqueue.h>
1515
#include <linux/module.h>
1616
#include <linux/if_bridge.h>
17+
#include <linux/dsa/loop.h>
1718
#include <net/dsa.h>
1819

1920
#include "dsa_loop.h"
2021

21-
struct dsa_loop_vlan {
22-
u16 members;
23-
u16 untagged;
24-
};
25-
26-
struct dsa_loop_mib_entry {
27-
char name[ETH_GSTRING_LEN];
28-
unsigned long val;
29-
};
30-
31-
enum dsa_loop_mib_counters {
32-
DSA_LOOP_PHY_READ_OK,
33-
DSA_LOOP_PHY_READ_ERR,
34-
DSA_LOOP_PHY_WRITE_OK,
35-
DSA_LOOP_PHY_WRITE_ERR,
36-
__DSA_LOOP_CNT_MAX,
37-
};
38-
3922
static struct dsa_loop_mib_entry dsa_loop_mibs[] = {
4023
[DSA_LOOP_PHY_READ_OK] = { "phy_read_ok", },
4124
[DSA_LOOP_PHY_READ_ERR] = { "phy_read_err", },
4225
[DSA_LOOP_PHY_WRITE_OK] = { "phy_write_ok", },
4326
[DSA_LOOP_PHY_WRITE_ERR] = { "phy_write_err", },
4427
};
4528

46-
struct dsa_loop_port {
47-
struct dsa_loop_mib_entry mib[__DSA_LOOP_CNT_MAX];
48-
u16 pvid;
49-
};
50-
51-
struct dsa_loop_priv {
52-
struct mii_bus *bus;
53-
unsigned int port_base;
54-
struct dsa_loop_vlan vlans[VLAN_N_VID];
55-
struct net_device *netdev;
56-
struct dsa_loop_port ports[DSA_MAX_PORTS];
57-
};
58-
5929
static struct phy_device *phydevs[PHY_MAX_ADDR];
6030

6131
static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds,

include/linux/dsa/loop.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef DSA_LOOP_H
3+
#define DSA_LOOP_H
4+
5+
#include <linux/types.h>
6+
#include <linux/ethtool.h>
7+
#include <net/dsa.h>
8+
9+
struct dsa_loop_vlan {
10+
u16 members;
11+
u16 untagged;
12+
};
13+
14+
struct dsa_loop_mib_entry {
15+
char name[ETH_GSTRING_LEN];
16+
unsigned long val;
17+
};
18+
19+
enum dsa_loop_mib_counters {
20+
DSA_LOOP_PHY_READ_OK,
21+
DSA_LOOP_PHY_READ_ERR,
22+
DSA_LOOP_PHY_WRITE_OK,
23+
DSA_LOOP_PHY_WRITE_ERR,
24+
__DSA_LOOP_CNT_MAX,
25+
};
26+
27+
struct dsa_loop_port {
28+
struct dsa_loop_mib_entry mib[__DSA_LOOP_CNT_MAX];
29+
u16 pvid;
30+
};
31+
32+
struct dsa_loop_priv {
33+
struct mii_bus *bus;
34+
unsigned int port_base;
35+
struct dsa_loop_vlan vlans[VLAN_N_VID];
36+
struct net_device *netdev;
37+
struct dsa_loop_port ports[DSA_MAX_PORTS];
38+
};
39+
40+
#endif /* DSA_LOOP_H */

0 commit comments

Comments
 (0)