1 /* 2 * Copyright (c) 2021 BayLibre SAS 3 * Copyright (c) 2024 Nordic Semiconductor 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8 #ifndef __BRIDGE_H 9 #define __BRIDGE_H 10 net_eth_iface_is_bridged(struct ethernet_context * ctx)11static inline bool net_eth_iface_is_bridged(struct ethernet_context *ctx) 12 { 13 #if defined(CONFIG_NET_ETHERNET_BRIDGE) 14 struct eth_bridge_iface_context *br_ctx; 15 16 if (ctx->bridge == NULL) { 17 return false; 18 } 19 20 br_ctx = net_if_get_device(ctx->bridge)->data; 21 if (br_ctx->is_setup) { 22 return true; 23 } 24 25 return false; 26 #else 27 return false; 28 #endif 29 } 30 net_eth_get_bridge(struct ethernet_context * ctx)31static inline struct net_if *net_eth_get_bridge(struct ethernet_context *ctx) 32 { 33 #if defined(CONFIG_NET_ETHERNET_BRIDGE) 34 return ctx->bridge; 35 #else 36 return NULL; 37 #endif 38 } 39 40 #endif /* __BRIDGE_H */ 41