Skip to content

Commit 5aaf69e

Browse files
yangbolu1991henrikbrixandersen
authored andcommitted
net: ethernet: make inclusion relation clear for DSA and Ethernet headers
DSA is part of Ethernet and will utilize more Ethernet definitions for more features support. So, it's proper to let DSA header include Ethernet header with moving some DSA definiton from DSA header to Ethernet header and adding DSA header including in c files using DSA definition. Signed-off-by: Yangbo Lu <[email protected]>
1 parent 0501be8 commit 5aaf69e

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

drivers/ethernet/dsa/dsa_nxp_imx_netc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <zephyr/logging/log.h>
88
LOG_MODULE_REGISTER(dsa_netc, CONFIG_ETHERNET_LOG_LEVEL);
99

10-
#include <zephyr/net/ethernet.h>
10+
#include <zephyr/net/dsa_core.h>
1111
#include <zephyr/drivers/pinctrl.h>
1212
#include <zephyr/drivers/ethernet/nxp_imx_netc.h>
1313
#include <zephyr/dt-bindings/ethernet/dsa_tag_proto.h>

include/zephyr/net/dsa_core.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <zephyr/devicetree.h>
1616
#include <zephyr/net/net_if.h>
1717
#include <zephyr/net/phy.h>
18+
#include <zephyr/net/ethernet.h>
1819

1920
/**
2021
* @brief Distributed Switch Architecture (DSA)
@@ -33,12 +34,6 @@
3334
#define DSA_PORT_MAX_COUNT 0
3435
#endif
3536

36-
#if defined(CONFIG_DSA_TAG_SIZE)
37-
#define DSA_TAG_SIZE CONFIG_DSA_TAG_SIZE
38-
#else
39-
#define DSA_TAG_SIZE 0
40-
#endif
41-
4237
/** @endcond */
4338

4439
#ifdef __cplusplus
@@ -147,14 +142,6 @@ struct dsa_port_config {
147142

148143
/** @cond INTERNAL_HIDDEN */
149144

150-
enum dsa_port_type {
151-
NON_DSA_PORT,
152-
DSA_CONDUIT_PORT,
153-
DSA_USER_PORT,
154-
DSA_CPU_PORT,
155-
DSA_PORT,
156-
};
157-
158145
/*
159146
* DSA port init
160147
*

include/zephyr/net/ethernet.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828

2929
#if defined(CONFIG_NET_DSA_DEPRECATED)
3030
#include <zephyr/net/dsa.h>
31-
#else
32-
#include <zephyr/net/dsa_core.h>
3331
#endif
3432

3533
#if defined(CONFIG_NET_ETHERNET_BRIDGE)
@@ -131,6 +129,12 @@ struct net_eth_addr {
131129

132130
#define _NET_ETH_MAX_FRAME_SIZE (NET_ETH_MTU + _NET_ETH_MAX_HDR_SIZE)
133131

132+
#if defined(CONFIG_DSA_TAG_SIZE)
133+
#define DSA_TAG_SIZE CONFIG_DSA_TAG_SIZE
134+
#else
135+
#define DSA_TAG_SIZE 0
136+
#endif
137+
134138
#define NET_ETH_MAX_FRAME_SIZE (_NET_ETH_MAX_FRAME_SIZE + DSA_TAG_SIZE)
135139
#define NET_ETH_MAX_HDR_SIZE (_NET_ETH_MAX_HDR_SIZE + DSA_TAG_SIZE)
136140

@@ -206,6 +210,16 @@ enum ethernet_hw_caps {
206210

207211
/** @cond INTERNAL_HIDDEN */
208212

213+
#if !defined(CONFIG_NET_DSA_DEPRECATED)
214+
enum dsa_port_type {
215+
NON_DSA_PORT,
216+
DSA_CONDUIT_PORT,
217+
DSA_USER_PORT,
218+
DSA_CPU_PORT,
219+
DSA_PORT,
220+
};
221+
#endif
222+
209223
enum ethernet_config_type {
210224
ETHERNET_CONFIG_TYPE_MAC_ADDRESS,
211225
ETHERNET_CONFIG_TYPE_QAV_PARAM,

subsys/net/ip/net_core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ LOG_MODULE_REGISTER(net_core, CONFIG_NET_CORE_LOG_LEVEL);
3232
#include <zephyr/net/gptp.h>
3333
#include <zephyr/net/websocket.h>
3434
#include <zephyr/net/ethernet.h>
35+
#if defined(CONFIG_NET_DSA) && !defined(CONFIG_NET_DSA_DEPRECATED)
36+
#include <zephyr/net/dsa_core.h>
37+
#endif
3538
#include <zephyr/net/capture.h>
3639

3740
#if defined(CONFIG_NET_LLDP)

subsys/net/l2/ethernet/ethernet.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ LOG_MODULE_REGISTER(net_ethernet, CONFIG_NET_L2_ETHERNET_LOG_LEVEL);
1313
#include <zephyr/net/net_mgmt.h>
1414
#include <zephyr/net/ethernet.h>
1515
#include <zephyr/net/ethernet_mgmt.h>
16+
#if defined(CONFIG_NET_DSA) && !defined(CONFIG_NET_DSA_DEPRECATED)
17+
#include <zephyr/net/dsa_core.h>
18+
#endif
1619
#include <zephyr/net/gptp.h>
1720
#include <zephyr/random/random.h>
1821

0 commit comments

Comments
 (0)