Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * net/dsa/dsa_priv.h - Hardware switch handling
0004  * Copyright (c) 2008-2009 Marvell Semiconductor
0005  */
0006 
0007 #ifndef __DSA_PRIV_H
0008 #define __DSA_PRIV_H
0009 
0010 #include <linux/if_bridge.h>
0011 #include <linux/if_vlan.h>
0012 #include <linux/phy.h>
0013 #include <linux/netdevice.h>
0014 #include <linux/netpoll.h>
0015 #include <net/dsa.h>
0016 #include <net/gro_cells.h>
0017 
0018 #define DSA_MAX_NUM_OFFLOADING_BRIDGES      BITS_PER_LONG
0019 
0020 enum {
0021     DSA_NOTIFIER_AGEING_TIME,
0022     DSA_NOTIFIER_BRIDGE_JOIN,
0023     DSA_NOTIFIER_BRIDGE_LEAVE,
0024     DSA_NOTIFIER_FDB_ADD,
0025     DSA_NOTIFIER_FDB_DEL,
0026     DSA_NOTIFIER_HOST_FDB_ADD,
0027     DSA_NOTIFIER_HOST_FDB_DEL,
0028     DSA_NOTIFIER_LAG_FDB_ADD,
0029     DSA_NOTIFIER_LAG_FDB_DEL,
0030     DSA_NOTIFIER_LAG_CHANGE,
0031     DSA_NOTIFIER_LAG_JOIN,
0032     DSA_NOTIFIER_LAG_LEAVE,
0033     DSA_NOTIFIER_MDB_ADD,
0034     DSA_NOTIFIER_MDB_DEL,
0035     DSA_NOTIFIER_HOST_MDB_ADD,
0036     DSA_NOTIFIER_HOST_MDB_DEL,
0037     DSA_NOTIFIER_VLAN_ADD,
0038     DSA_NOTIFIER_VLAN_DEL,
0039     DSA_NOTIFIER_HOST_VLAN_ADD,
0040     DSA_NOTIFIER_HOST_VLAN_DEL,
0041     DSA_NOTIFIER_MTU,
0042     DSA_NOTIFIER_TAG_PROTO,
0043     DSA_NOTIFIER_TAG_PROTO_CONNECT,
0044     DSA_NOTIFIER_TAG_PROTO_DISCONNECT,
0045     DSA_NOTIFIER_TAG_8021Q_VLAN_ADD,
0046     DSA_NOTIFIER_TAG_8021Q_VLAN_DEL,
0047     DSA_NOTIFIER_MASTER_STATE_CHANGE,
0048 };
0049 
0050 /* DSA_NOTIFIER_AGEING_TIME */
0051 struct dsa_notifier_ageing_time_info {
0052     unsigned int ageing_time;
0053 };
0054 
0055 /* DSA_NOTIFIER_BRIDGE_* */
0056 struct dsa_notifier_bridge_info {
0057     const struct dsa_port *dp;
0058     struct dsa_bridge bridge;
0059     bool tx_fwd_offload;
0060     struct netlink_ext_ack *extack;
0061 };
0062 
0063 /* DSA_NOTIFIER_FDB_* */
0064 struct dsa_notifier_fdb_info {
0065     const struct dsa_port *dp;
0066     const unsigned char *addr;
0067     u16 vid;
0068     struct dsa_db db;
0069 };
0070 
0071 /* DSA_NOTIFIER_LAG_FDB_* */
0072 struct dsa_notifier_lag_fdb_info {
0073     struct dsa_lag *lag;
0074     const unsigned char *addr;
0075     u16 vid;
0076     struct dsa_db db;
0077 };
0078 
0079 /* DSA_NOTIFIER_MDB_* */
0080 struct dsa_notifier_mdb_info {
0081     const struct dsa_port *dp;
0082     const struct switchdev_obj_port_mdb *mdb;
0083     struct dsa_db db;
0084 };
0085 
0086 /* DSA_NOTIFIER_LAG_* */
0087 struct dsa_notifier_lag_info {
0088     const struct dsa_port *dp;
0089     struct dsa_lag lag;
0090     struct netdev_lag_upper_info *info;
0091 };
0092 
0093 /* DSA_NOTIFIER_VLAN_* */
0094 struct dsa_notifier_vlan_info {
0095     const struct dsa_port *dp;
0096     const struct switchdev_obj_port_vlan *vlan;
0097     struct netlink_ext_ack *extack;
0098 };
0099 
0100 /* DSA_NOTIFIER_MTU */
0101 struct dsa_notifier_mtu_info {
0102     const struct dsa_port *dp;
0103     int mtu;
0104 };
0105 
0106 /* DSA_NOTIFIER_TAG_PROTO_* */
0107 struct dsa_notifier_tag_proto_info {
0108     const struct dsa_device_ops *tag_ops;
0109 };
0110 
0111 /* DSA_NOTIFIER_TAG_8021Q_VLAN_* */
0112 struct dsa_notifier_tag_8021q_vlan_info {
0113     const struct dsa_port *dp;
0114     u16 vid;
0115 };
0116 
0117 /* DSA_NOTIFIER_MASTER_STATE_CHANGE */
0118 struct dsa_notifier_master_state_info {
0119     const struct net_device *master;
0120     bool operational;
0121 };
0122 
0123 struct dsa_switchdev_event_work {
0124     struct net_device *dev;
0125     struct net_device *orig_dev;
0126     struct work_struct work;
0127     unsigned long event;
0128     /* Specific for SWITCHDEV_FDB_ADD_TO_DEVICE and
0129      * SWITCHDEV_FDB_DEL_TO_DEVICE
0130      */
0131     unsigned char addr[ETH_ALEN];
0132     u16 vid;
0133     bool host_addr;
0134 };
0135 
0136 enum dsa_standalone_event {
0137     DSA_UC_ADD,
0138     DSA_UC_DEL,
0139     DSA_MC_ADD,
0140     DSA_MC_DEL,
0141 };
0142 
0143 struct dsa_standalone_event_work {
0144     struct work_struct work;
0145     struct net_device *dev;
0146     enum dsa_standalone_event event;
0147     unsigned char addr[ETH_ALEN];
0148     u16 vid;
0149 };
0150 
0151 struct dsa_slave_priv {
0152     /* Copy of CPU port xmit for faster access in slave transmit hot path */
0153     struct sk_buff *    (*xmit)(struct sk_buff *skb,
0154                     struct net_device *dev);
0155 
0156     struct gro_cells    gcells;
0157 
0158     /* DSA port data, such as switch, port index, etc. */
0159     struct dsa_port     *dp;
0160 
0161 #ifdef CONFIG_NET_POLL_CONTROLLER
0162     struct netpoll      *netpoll;
0163 #endif
0164 
0165     /* TC context */
0166     struct list_head    mall_tc_list;
0167 };
0168 
0169 /* dsa.c */
0170 const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol);
0171 void dsa_tag_driver_put(const struct dsa_device_ops *ops);
0172 const struct dsa_device_ops *dsa_find_tagger_by_name(const char *buf);
0173 
0174 bool dsa_db_equal(const struct dsa_db *a, const struct dsa_db *b);
0175 
0176 bool dsa_schedule_work(struct work_struct *work);
0177 const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops);
0178 
0179 static inline int dsa_tag_protocol_overhead(const struct dsa_device_ops *ops)
0180 {
0181     return ops->needed_headroom + ops->needed_tailroom;
0182 }
0183 
0184 /* master.c */
0185 int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp);
0186 void dsa_master_teardown(struct net_device *dev);
0187 
0188 static inline struct net_device *dsa_master_find_slave(struct net_device *dev,
0189                                int device, int port)
0190 {
0191     struct dsa_port *cpu_dp = dev->dsa_ptr;
0192     struct dsa_switch_tree *dst = cpu_dp->dst;
0193     struct dsa_port *dp;
0194 
0195     list_for_each_entry(dp, &dst->ports, list)
0196         if (dp->ds->index == device && dp->index == port &&
0197             dp->type == DSA_PORT_TYPE_USER)
0198             return dp->slave;
0199 
0200     return NULL;
0201 }
0202 
0203 /* port.c */
0204 void dsa_port_set_tag_protocol(struct dsa_port *cpu_dp,
0205                    const struct dsa_device_ops *tag_ops);
0206 int dsa_port_set_state(struct dsa_port *dp, u8 state, bool do_fast_age);
0207 int dsa_port_set_mst_state(struct dsa_port *dp,
0208                const struct switchdev_mst_state *state,
0209                struct netlink_ext_ack *extack);
0210 int dsa_port_enable_rt(struct dsa_port *dp, struct phy_device *phy);
0211 int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy);
0212 void dsa_port_disable_rt(struct dsa_port *dp);
0213 void dsa_port_disable(struct dsa_port *dp);
0214 int dsa_port_bridge_join(struct dsa_port *dp, struct net_device *br,
0215              struct netlink_ext_ack *extack);
0216 void dsa_port_pre_bridge_leave(struct dsa_port *dp, struct net_device *br);
0217 void dsa_port_bridge_leave(struct dsa_port *dp, struct net_device *br);
0218 int dsa_port_lag_change(struct dsa_port *dp,
0219             struct netdev_lag_lower_state_info *linfo);
0220 int dsa_port_lag_join(struct dsa_port *dp, struct net_device *lag_dev,
0221               struct netdev_lag_upper_info *uinfo,
0222               struct netlink_ext_ack *extack);
0223 void dsa_port_pre_lag_leave(struct dsa_port *dp, struct net_device *lag_dev);
0224 void dsa_port_lag_leave(struct dsa_port *dp, struct net_device *lag_dev);
0225 int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
0226                 struct netlink_ext_ack *extack);
0227 bool dsa_port_skip_vlan_configuration(struct dsa_port *dp);
0228 int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock);
0229 int dsa_port_mst_enable(struct dsa_port *dp, bool on,
0230             struct netlink_ext_ack *extack);
0231 int dsa_port_vlan_msti(struct dsa_port *dp,
0232                const struct switchdev_vlan_msti *msti);
0233 int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu);
0234 int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
0235              u16 vid);
0236 int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr,
0237              u16 vid);
0238 int dsa_port_standalone_host_fdb_add(struct dsa_port *dp,
0239                      const unsigned char *addr, u16 vid);
0240 int dsa_port_standalone_host_fdb_del(struct dsa_port *dp,
0241                      const unsigned char *addr, u16 vid);
0242 int dsa_port_bridge_host_fdb_add(struct dsa_port *dp, const unsigned char *addr,
0243                  u16 vid);
0244 int dsa_port_bridge_host_fdb_del(struct dsa_port *dp, const unsigned char *addr,
0245                  u16 vid);
0246 int dsa_port_lag_fdb_add(struct dsa_port *dp, const unsigned char *addr,
0247              u16 vid);
0248 int dsa_port_lag_fdb_del(struct dsa_port *dp, const unsigned char *addr,
0249              u16 vid);
0250 int dsa_port_fdb_dump(struct dsa_port *dp, dsa_fdb_dump_cb_t *cb, void *data);
0251 int dsa_port_mdb_add(const struct dsa_port *dp,
0252              const struct switchdev_obj_port_mdb *mdb);
0253 int dsa_port_mdb_del(const struct dsa_port *dp,
0254              const struct switchdev_obj_port_mdb *mdb);
0255 int dsa_port_standalone_host_mdb_add(const struct dsa_port *dp,
0256                      const struct switchdev_obj_port_mdb *mdb);
0257 int dsa_port_standalone_host_mdb_del(const struct dsa_port *dp,
0258                      const struct switchdev_obj_port_mdb *mdb);
0259 int dsa_port_bridge_host_mdb_add(const struct dsa_port *dp,
0260                  const struct switchdev_obj_port_mdb *mdb);
0261 int dsa_port_bridge_host_mdb_del(const struct dsa_port *dp,
0262                  const struct switchdev_obj_port_mdb *mdb);
0263 int dsa_port_pre_bridge_flags(const struct dsa_port *dp,
0264                   struct switchdev_brport_flags flags,
0265                   struct netlink_ext_ack *extack);
0266 int dsa_port_bridge_flags(struct dsa_port *dp,
0267               struct switchdev_brport_flags flags,
0268               struct netlink_ext_ack *extack);
0269 int dsa_port_vlan_add(struct dsa_port *dp,
0270               const struct switchdev_obj_port_vlan *vlan,
0271               struct netlink_ext_ack *extack);
0272 int dsa_port_vlan_del(struct dsa_port *dp,
0273               const struct switchdev_obj_port_vlan *vlan);
0274 int dsa_port_host_vlan_add(struct dsa_port *dp,
0275                const struct switchdev_obj_port_vlan *vlan,
0276                struct netlink_ext_ack *extack);
0277 int dsa_port_host_vlan_del(struct dsa_port *dp,
0278                const struct switchdev_obj_port_vlan *vlan);
0279 int dsa_port_mrp_add(const struct dsa_port *dp,
0280              const struct switchdev_obj_mrp *mrp);
0281 int dsa_port_mrp_del(const struct dsa_port *dp,
0282              const struct switchdev_obj_mrp *mrp);
0283 int dsa_port_mrp_add_ring_role(const struct dsa_port *dp,
0284                    const struct switchdev_obj_ring_role_mrp *mrp);
0285 int dsa_port_mrp_del_ring_role(const struct dsa_port *dp,
0286                    const struct switchdev_obj_ring_role_mrp *mrp);
0287 int dsa_port_phylink_create(struct dsa_port *dp);
0288 int dsa_port_link_register_of(struct dsa_port *dp);
0289 void dsa_port_link_unregister_of(struct dsa_port *dp);
0290 int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr);
0291 void dsa_port_hsr_leave(struct dsa_port *dp, struct net_device *hsr);
0292 int dsa_port_tag_8021q_vlan_add(struct dsa_port *dp, u16 vid, bool broadcast);
0293 void dsa_port_tag_8021q_vlan_del(struct dsa_port *dp, u16 vid, bool broadcast);
0294 void dsa_port_set_host_flood(struct dsa_port *dp, bool uc, bool mc);
0295 
0296 /* slave.c */
0297 extern const struct dsa_device_ops notag_netdev_ops;
0298 extern struct notifier_block dsa_slave_switchdev_notifier;
0299 extern struct notifier_block dsa_slave_switchdev_blocking_notifier;
0300 
0301 void dsa_slave_mii_bus_init(struct dsa_switch *ds);
0302 int dsa_slave_create(struct dsa_port *dp);
0303 void dsa_slave_destroy(struct net_device *slave_dev);
0304 int dsa_slave_suspend(struct net_device *slave_dev);
0305 int dsa_slave_resume(struct net_device *slave_dev);
0306 int dsa_slave_register_notifier(void);
0307 void dsa_slave_unregister_notifier(void);
0308 void dsa_slave_setup_tagger(struct net_device *slave);
0309 int dsa_slave_change_mtu(struct net_device *dev, int new_mtu);
0310 int dsa_slave_manage_vlan_filtering(struct net_device *dev,
0311                     bool vlan_filtering);
0312 
0313 static inline struct dsa_port *dsa_slave_to_port(const struct net_device *dev)
0314 {
0315     struct dsa_slave_priv *p = netdev_priv(dev);
0316 
0317     return p->dp;
0318 }
0319 
0320 static inline struct net_device *
0321 dsa_slave_to_master(const struct net_device *dev)
0322 {
0323     struct dsa_port *dp = dsa_slave_to_port(dev);
0324 
0325     return dp->cpu_dp->master;
0326 }
0327 
0328 /* If under a bridge with vlan_filtering=0, make sure to send pvid-tagged
0329  * frames as untagged, since the bridge will not untag them.
0330  */
0331 static inline struct sk_buff *dsa_untag_bridge_pvid(struct sk_buff *skb)
0332 {
0333     struct dsa_port *dp = dsa_slave_to_port(skb->dev);
0334     struct net_device *br = dsa_port_bridge_dev_get(dp);
0335     struct net_device *dev = skb->dev;
0336     struct net_device *upper_dev;
0337     u16 vid, pvid, proto;
0338     int err;
0339 
0340     if (!br || br_vlan_enabled(br))
0341         return skb;
0342 
0343     err = br_vlan_get_proto(br, &proto);
0344     if (err)
0345         return skb;
0346 
0347     /* Move VLAN tag from data to hwaccel */
0348     if (!skb_vlan_tag_present(skb) && skb->protocol == htons(proto)) {
0349         skb = skb_vlan_untag(skb);
0350         if (!skb)
0351             return NULL;
0352     }
0353 
0354     if (!skb_vlan_tag_present(skb))
0355         return skb;
0356 
0357     vid = skb_vlan_tag_get_id(skb);
0358 
0359     /* We already run under an RCU read-side critical section since
0360      * we are called from netif_receive_skb_list_internal().
0361      */
0362     err = br_vlan_get_pvid_rcu(dev, &pvid);
0363     if (err)
0364         return skb;
0365 
0366     if (vid != pvid)
0367         return skb;
0368 
0369     /* The sad part about attempting to untag from DSA is that we
0370      * don't know, unless we check, if the skb will end up in
0371      * the bridge's data path - br_allowed_ingress() - or not.
0372      * For example, there might be an 8021q upper for the
0373      * default_pvid of the bridge, which will steal VLAN-tagged traffic
0374      * from the bridge's data path. This is a configuration that DSA
0375      * supports because vlan_filtering is 0. In that case, we should
0376      * definitely keep the tag, to make sure it keeps working.
0377      */
0378     upper_dev = __vlan_find_dev_deep_rcu(br, htons(proto), vid);
0379     if (upper_dev)
0380         return skb;
0381 
0382     __vlan_hwaccel_clear_tag(skb);
0383 
0384     return skb;
0385 }
0386 
0387 /* For switches without hardware support for DSA tagging to be able
0388  * to support termination through the bridge.
0389  */
0390 static inline struct net_device *
0391 dsa_find_designated_bridge_port_by_vid(struct net_device *master, u16 vid)
0392 {
0393     struct dsa_port *cpu_dp = master->dsa_ptr;
0394     struct dsa_switch_tree *dst = cpu_dp->dst;
0395     struct bridge_vlan_info vinfo;
0396     struct net_device *slave;
0397     struct dsa_port *dp;
0398     int err;
0399 
0400     list_for_each_entry(dp, &dst->ports, list) {
0401         if (dp->type != DSA_PORT_TYPE_USER)
0402             continue;
0403 
0404         if (!dp->bridge)
0405             continue;
0406 
0407         if (dp->stp_state != BR_STATE_LEARNING &&
0408             dp->stp_state != BR_STATE_FORWARDING)
0409             continue;
0410 
0411         /* Since the bridge might learn this packet, keep the CPU port
0412          * affinity with the port that will be used for the reply on
0413          * xmit.
0414          */
0415         if (dp->cpu_dp != cpu_dp)
0416             continue;
0417 
0418         slave = dp->slave;
0419 
0420         err = br_vlan_get_info_rcu(slave, vid, &vinfo);
0421         if (err)
0422             continue;
0423 
0424         return slave;
0425     }
0426 
0427     return NULL;
0428 }
0429 
0430 /* If the ingress port offloads the bridge, we mark the frame as autonomously
0431  * forwarded by hardware, so the software bridge doesn't forward in twice, back
0432  * to us, because we already did. However, if we're in fallback mode and we do
0433  * software bridging, we are not offloading it, therefore the dp->bridge
0434  * pointer is not populated, and flooding needs to be done by software (we are
0435  * effectively operating in standalone ports mode).
0436  */
0437 static inline void dsa_default_offload_fwd_mark(struct sk_buff *skb)
0438 {
0439     struct dsa_port *dp = dsa_slave_to_port(skb->dev);
0440 
0441     skb->offload_fwd_mark = !!(dp->bridge);
0442 }
0443 
0444 /* Helper for removing DSA header tags from packets in the RX path.
0445  * Must not be called before skb_pull(len).
0446  *                                                                 skb->data
0447  *                                                                         |
0448  *                                                                         v
0449  * |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
0450  * +-----------------------+-----------------------+---------------+-------+
0451  * |    Destination MAC    |      Source MAC       |  DSA header   | EType |
0452  * +-----------------------+-----------------------+---------------+-------+
0453  *                                                 |               |
0454  * <----- len ----->                               <----- len ----->
0455  *                 |
0456  *       >>>>>>>   v
0457  *       >>>>>>>   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
0458  *       >>>>>>>   +-----------------------+-----------------------+-------+
0459  *       >>>>>>>   |    Destination MAC    |      Source MAC       | EType |
0460  *                 +-----------------------+-----------------------+-------+
0461  *                                                                         ^
0462  *                                                                         |
0463  *                                                                 skb->data
0464  */
0465 static inline void dsa_strip_etype_header(struct sk_buff *skb, int len)
0466 {
0467     memmove(skb->data - ETH_HLEN, skb->data - ETH_HLEN - len, 2 * ETH_ALEN);
0468 }
0469 
0470 /* Helper for creating space for DSA header tags in TX path packets.
0471  * Must not be called before skb_push(len).
0472  *
0473  * Before:
0474  *
0475  *       <<<<<<<   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
0476  * ^     <<<<<<<   +-----------------------+-----------------------+-------+
0477  * |     <<<<<<<   |    Destination MAC    |      Source MAC       | EType |
0478  * |               +-----------------------+-----------------------+-------+
0479  * <----- len ----->
0480  * |
0481  * |
0482  * skb->data
0483  *
0484  * After:
0485  *
0486  * |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
0487  * +-----------------------+-----------------------+---------------+-------+
0488  * |    Destination MAC    |      Source MAC       |  DSA header   | EType |
0489  * +-----------------------+-----------------------+---------------+-------+
0490  * ^                                               |               |
0491  * |                                               <----- len ----->
0492  * skb->data
0493  */
0494 static inline void dsa_alloc_etype_header(struct sk_buff *skb, int len)
0495 {
0496     memmove(skb->data, skb->data + len, 2 * ETH_ALEN);
0497 }
0498 
0499 /* On RX, eth_type_trans() on the DSA master pulls ETH_HLEN bytes starting from
0500  * skb_mac_header(skb), which leaves skb->data pointing at the first byte after
0501  * what the DSA master perceives as the EtherType (the beginning of the L3
0502  * protocol). Since DSA EtherType header taggers treat the EtherType as part of
0503  * the DSA tag itself, and the EtherType is 2 bytes in length, the DSA header
0504  * is located 2 bytes behind skb->data. Note that EtherType in this context
0505  * means the first 2 bytes of the DSA header, not the encapsulated EtherType
0506  * that will become visible after the DSA header is stripped.
0507  */
0508 static inline void *dsa_etype_header_pos_rx(struct sk_buff *skb)
0509 {
0510     return skb->data - 2;
0511 }
0512 
0513 /* On TX, skb->data points to skb_mac_header(skb), which means that EtherType
0514  * header taggers start exactly where the EtherType is (the EtherType is
0515  * treated as part of the DSA header).
0516  */
0517 static inline void *dsa_etype_header_pos_tx(struct sk_buff *skb)
0518 {
0519     return skb->data + 2 * ETH_ALEN;
0520 }
0521 
0522 /* switch.c */
0523 int dsa_switch_register_notifier(struct dsa_switch *ds);
0524 void dsa_switch_unregister_notifier(struct dsa_switch *ds);
0525 
0526 static inline bool dsa_switch_supports_uc_filtering(struct dsa_switch *ds)
0527 {
0528     return ds->ops->port_fdb_add && ds->ops->port_fdb_del &&
0529            ds->fdb_isolation && !ds->vlan_filtering_is_global &&
0530            !ds->needs_standalone_vlan_filtering;
0531 }
0532 
0533 static inline bool dsa_switch_supports_mc_filtering(struct dsa_switch *ds)
0534 {
0535     return ds->ops->port_mdb_add && ds->ops->port_mdb_del &&
0536            ds->fdb_isolation && !ds->vlan_filtering_is_global &&
0537            !ds->needs_standalone_vlan_filtering;
0538 }
0539 
0540 /* dsa2.c */
0541 void dsa_lag_map(struct dsa_switch_tree *dst, struct dsa_lag *lag);
0542 void dsa_lag_unmap(struct dsa_switch_tree *dst, struct dsa_lag *lag);
0543 struct dsa_lag *dsa_tree_lag_find(struct dsa_switch_tree *dst,
0544                   const struct net_device *lag_dev);
0545 int dsa_tree_notify(struct dsa_switch_tree *dst, unsigned long e, void *v);
0546 int dsa_broadcast(unsigned long e, void *v);
0547 int dsa_tree_change_tag_proto(struct dsa_switch_tree *dst,
0548                   struct net_device *master,
0549                   const struct dsa_device_ops *tag_ops,
0550                   const struct dsa_device_ops *old_tag_ops);
0551 void dsa_tree_master_admin_state_change(struct dsa_switch_tree *dst,
0552                     struct net_device *master,
0553                     bool up);
0554 void dsa_tree_master_oper_state_change(struct dsa_switch_tree *dst,
0555                        struct net_device *master,
0556                        bool up);
0557 unsigned int dsa_bridge_num_get(const struct net_device *bridge_dev, int max);
0558 void dsa_bridge_num_put(const struct net_device *bridge_dev,
0559             unsigned int bridge_num);
0560 struct dsa_bridge *dsa_tree_bridge_find(struct dsa_switch_tree *dst,
0561                     const struct net_device *br);
0562 
0563 /* tag_8021q.c */
0564 int dsa_switch_tag_8021q_vlan_add(struct dsa_switch *ds,
0565                   struct dsa_notifier_tag_8021q_vlan_info *info);
0566 int dsa_switch_tag_8021q_vlan_del(struct dsa_switch *ds,
0567                   struct dsa_notifier_tag_8021q_vlan_info *info);
0568 
0569 extern struct list_head dsa_tree_list;
0570 
0571 #endif