131997bf2SAndrew Thompson /* $NetBSD: if_bridgevar.h,v 1.4 2003/07/08 07:13:50 itojun Exp $ */ 231997bf2SAndrew Thompson 331997bf2SAndrew Thompson /* 4fe267a55SPedro F. Giffuni * SPDX-License-Identifier: BSD-4-Clause 5fe267a55SPedro F. Giffuni * 631997bf2SAndrew Thompson * Copyright 2001 Wasabi Systems, Inc. 731997bf2SAndrew Thompson * All rights reserved. 831997bf2SAndrew Thompson * 931997bf2SAndrew Thompson * Written by Jason R. Thorpe for Wasabi Systems, Inc. 1031997bf2SAndrew Thompson * 1131997bf2SAndrew Thompson * Redistribution and use in source and binary forms, with or without 1231997bf2SAndrew Thompson * modification, are permitted provided that the following conditions 1331997bf2SAndrew Thompson * are met: 1431997bf2SAndrew Thompson * 1. Redistributions of source code must retain the above copyright 1531997bf2SAndrew Thompson * notice, this list of conditions and the following disclaimer. 1631997bf2SAndrew Thompson * 2. Redistributions in binary form must reproduce the above copyright 1731997bf2SAndrew Thompson * notice, this list of conditions and the following disclaimer in the 1831997bf2SAndrew Thompson * documentation and/or other materials provided with the distribution. 1931997bf2SAndrew Thompson * 3. All advertising materials mentioning features or use of this software 2031997bf2SAndrew Thompson * must display the following acknowledgement: 2131997bf2SAndrew Thompson * This product includes software developed for the NetBSD Project by 2231997bf2SAndrew Thompson * Wasabi Systems, Inc. 2331997bf2SAndrew Thompson * 4. The name of Wasabi Systems, Inc. may not be used to endorse 2431997bf2SAndrew Thompson * or promote products derived from this software without specific prior 2531997bf2SAndrew Thompson * written permission. 2631997bf2SAndrew Thompson * 2731997bf2SAndrew Thompson * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 2831997bf2SAndrew Thompson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2931997bf2SAndrew Thompson * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 3031997bf2SAndrew Thompson * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 3131997bf2SAndrew Thompson * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 3231997bf2SAndrew Thompson * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 3331997bf2SAndrew Thompson * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3431997bf2SAndrew Thompson * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3531997bf2SAndrew Thompson * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3631997bf2SAndrew Thompson * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3731997bf2SAndrew Thompson * POSSIBILITY OF SUCH DAMAGE. 3831997bf2SAndrew Thompson */ 3931997bf2SAndrew Thompson 4031997bf2SAndrew Thompson /* 4131997bf2SAndrew Thompson * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) 4231997bf2SAndrew Thompson * All rights reserved. 4331997bf2SAndrew Thompson * 4431997bf2SAndrew Thompson * Redistribution and use in source and binary forms, with or without 4531997bf2SAndrew Thompson * modification, are permitted provided that the following conditions 4631997bf2SAndrew Thompson * are met: 4731997bf2SAndrew Thompson * 1. Redistributions of source code must retain the above copyright 4831997bf2SAndrew Thompson * notice, this list of conditions and the following disclaimer. 4931997bf2SAndrew Thompson * 2. Redistributions in binary form must reproduce the above copyright 5031997bf2SAndrew Thompson * notice, this list of conditions and the following disclaimer in the 5131997bf2SAndrew Thompson * documentation and/or other materials provided with the distribution. 5231997bf2SAndrew Thompson * 3. All advertising materials mentioning features or use of this software 5331997bf2SAndrew Thompson * must display the following acknowledgement: 5431997bf2SAndrew Thompson * This product includes software developed by Jason L. Wright 5531997bf2SAndrew Thompson * 4. The name of the author may not be used to endorse or promote products 5631997bf2SAndrew Thompson * derived from this software without specific prior written permission. 5731997bf2SAndrew Thompson * 5831997bf2SAndrew Thompson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 5931997bf2SAndrew Thompson * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 6031997bf2SAndrew Thompson * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 6131997bf2SAndrew Thompson * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 6231997bf2SAndrew Thompson * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 6331997bf2SAndrew Thompson * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 6431997bf2SAndrew Thompson * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 6531997bf2SAndrew Thompson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 6631997bf2SAndrew Thompson * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 6731997bf2SAndrew Thompson * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 6831997bf2SAndrew Thompson * POSSIBILITY OF SUCH DAMAGE. 6931997bf2SAndrew Thompson * 7031997bf2SAndrew Thompson * OpenBSD: if_bridge.h,v 1.14 2001/03/22 03:48:29 jason Exp 7131997bf2SAndrew Thompson */ 7231997bf2SAndrew Thompson 7331997bf2SAndrew Thompson /* 7431997bf2SAndrew Thompson * Data structure and control definitions for bridge interfaces. 7531997bf2SAndrew Thompson */ 7631997bf2SAndrew Thompson 77*f6aedb95SLexi Winter #ifndef _NET_IF_BRIDGEVAR_H_ 78*f6aedb95SLexi Winter #define _NET_IF_BRIDGEVAR_H_ 79*f6aedb95SLexi Winter 80e9167358SKristof Provost #include <sys/types.h> 8131997bf2SAndrew Thompson #include <sys/callout.h> 8231997bf2SAndrew Thompson #include <sys/queue.h> 83fd6238a6SAndrew Thompson #include <sys/condvar.h> 8431997bf2SAndrew Thompson 85e9167358SKristof Provost #include <net/ethernet.h> 86e9167358SKristof Provost #include <net/if.h> 87e9167358SKristof Provost 8831997bf2SAndrew Thompson /* 8931997bf2SAndrew Thompson * Commands used in the SIOCSDRVSPEC ioctl. Note the lookup of the 9031997bf2SAndrew Thompson * bridge interface itself is keyed off the ifdrv structure. 9131997bf2SAndrew Thompson */ 9231997bf2SAndrew Thompson #define BRDGADD 0 /* add bridge member (ifbreq) */ 9331997bf2SAndrew Thompson #define BRDGDEL 1 /* delete bridge member (ifbreq) */ 9431997bf2SAndrew Thompson #define BRDGGIFFLGS 2 /* get member if flags (ifbreq) */ 9531997bf2SAndrew Thompson #define BRDGSIFFLGS 3 /* set member if flags (ifbreq) */ 9631997bf2SAndrew Thompson #define BRDGSCACHE 4 /* set cache size (ifbrparam) */ 9731997bf2SAndrew Thompson #define BRDGGCACHE 5 /* get cache size (ifbrparam) */ 9831997bf2SAndrew Thompson #define BRDGGIFS 6 /* get member list (ifbifconf) */ 9931997bf2SAndrew Thompson #define BRDGRTS 7 /* get address list (ifbaconf) */ 10031997bf2SAndrew Thompson #define BRDGSADDR 8 /* set static address (ifbareq) */ 10131997bf2SAndrew Thompson #define BRDGSTO 9 /* set cache timeout (ifbrparam) */ 10231997bf2SAndrew Thompson #define BRDGGTO 10 /* get cache timeout (ifbrparam) */ 10331997bf2SAndrew Thompson #define BRDGDADDR 11 /* delete address (ifbareq) */ 10431997bf2SAndrew Thompson #define BRDGFLUSH 12 /* flush address cache (ifbreq) */ 10531997bf2SAndrew Thompson 10631997bf2SAndrew Thompson #define BRDGGPRI 13 /* get priority (ifbrparam) */ 10731997bf2SAndrew Thompson #define BRDGSPRI 14 /* set priority (ifbrparam) */ 10831997bf2SAndrew Thompson #define BRDGGHT 15 /* get hello time (ifbrparam) */ 10931997bf2SAndrew Thompson #define BRDGSHT 16 /* set hello time (ifbrparam) */ 11031997bf2SAndrew Thompson #define BRDGGFD 17 /* get forward delay (ifbrparam) */ 11131997bf2SAndrew Thompson #define BRDGSFD 18 /* set forward delay (ifbrparam) */ 11231997bf2SAndrew Thompson #define BRDGGMA 19 /* get max age (ifbrparam) */ 11331997bf2SAndrew Thompson #define BRDGSMA 20 /* set max age (ifbrparam) */ 11431997bf2SAndrew Thompson #define BRDGSIFPRIO 21 /* set if priority (ifbreq) */ 11531997bf2SAndrew Thompson #define BRDGSIFCOST 22 /* set if path cost (ifbreq) */ 11691f6764eSAndrew Thompson #define BRDGADDS 23 /* add bridge span member (ifbreq) */ 11791f6764eSAndrew Thompson #define BRDGDELS 24 /* delete bridge span member (ifbreq) */ 11851383c37SAndrew Thompson #define BRDGPARAM 25 /* get bridge STP params (ifbropreq) */ 11951383c37SAndrew Thompson #define BRDGGRTE 26 /* get cache drops (ifbrparam) */ 12051383c37SAndrew Thompson #define BRDGGIFSSTP 27 /* get member STP params list 12151383c37SAndrew Thompson * (ifbpstpconf) */ 1223fab7669SAndrew Thompson #define BRDGSPROTO 28 /* set protocol (ifbrparam) */ 1233fab7669SAndrew Thompson #define BRDGSTXHC 29 /* set tx hold count (ifbrparam) */ 1245f33ec7bSAndrew Thompson #define BRDGSIFAMAX 30 /* set max interface addrs (ifbreq) */ 12531997bf2SAndrew Thompson 12631997bf2SAndrew Thompson /* 12731997bf2SAndrew Thompson * Generic bridge control request. 12831997bf2SAndrew Thompson */ 12931997bf2SAndrew Thompson struct ifbreq { 13031997bf2SAndrew Thompson char ifbr_ifsname[IFNAMSIZ]; /* member if name */ 13131997bf2SAndrew Thompson uint32_t ifbr_ifsflags; /* member if flags */ 1323fab7669SAndrew Thompson uint32_t ifbr_stpflags; /* member if STP flags */ 1333fab7669SAndrew Thompson uint32_t ifbr_path_cost; /* member if STP cost */ 13431997bf2SAndrew Thompson uint8_t ifbr_portno; /* member if port number */ 1353fab7669SAndrew Thompson uint8_t ifbr_priority; /* member if STP priority */ 1363fab7669SAndrew Thompson uint8_t ifbr_proto; /* member if STP protocol */ 1373fab7669SAndrew Thompson uint8_t ifbr_role; /* member if STP role */ 1383fab7669SAndrew Thompson uint8_t ifbr_state; /* member if STP state */ 1395f33ec7bSAndrew Thompson uint32_t ifbr_addrcnt; /* member if addr number */ 1405f33ec7bSAndrew Thompson uint32_t ifbr_addrmax; /* member if addr max */ 1415f33ec7bSAndrew Thompson uint32_t ifbr_addrexceeded; /* member if addr violations */ 1425f33ec7bSAndrew Thompson uint8_t pad[32]; 14331997bf2SAndrew Thompson }; 14431997bf2SAndrew Thompson 14531997bf2SAndrew Thompson /* BRDGGIFFLAGS, BRDGSIFFLAGS */ 1466c32e05cSAndrew Thompson #define IFBIF_LEARNING 0x0001 /* if can learn */ 1476c32e05cSAndrew Thompson #define IFBIF_DISCOVER 0x0002 /* if sends packets w/ unknown dest. */ 1486c32e05cSAndrew Thompson #define IFBIF_STP 0x0004 /* if participates in spanning tree */ 1496c32e05cSAndrew Thompson #define IFBIF_SPAN 0x0008 /* if is a span port */ 1506c32e05cSAndrew Thompson #define IFBIF_STICKY 0x0010 /* if learned addresses stick */ 1516c32e05cSAndrew Thompson #define IFBIF_BSTP_EDGE 0x0020 /* member stp edge port */ 1526c32e05cSAndrew Thompson #define IFBIF_BSTP_AUTOEDGE 0x0040 /* member stp autoedge enabled */ 15378709605SAndrew Thompson #define IFBIF_BSTP_PTP 0x0080 /* member stp point to point */ 15478709605SAndrew Thompson #define IFBIF_BSTP_AUTOPTP 0x0100 /* member stp autoptp enabled */ 155daacddcaSShteryana Shopova #define IFBIF_BSTP_ADMEDGE 0x0200 /* member stp admin edge enabled */ 156daacddcaSShteryana Shopova #define IFBIF_BSTP_ADMCOST 0x0400 /* member stp admin path cost */ 15785ce7297SAndrew Thompson #define IFBIF_PRIVATE 0x0800 /* if is a private segment */ 15831997bf2SAndrew Thompson 1596c32e05cSAndrew Thompson #define IFBIFBITS "\020\001LEARNING\002DISCOVER\003STP\004SPAN" \ 16085ce7297SAndrew Thompson "\005STICKY\014PRIVATE\006EDGE\007AUTOEDGE\010PTP" \ 16185ce7297SAndrew Thompson "\011AUTOPTP" 16278709605SAndrew Thompson #define IFBIFMASK ~(IFBIF_BSTP_EDGE|IFBIF_BSTP_AUTOEDGE|IFBIF_BSTP_PTP| \ 16378709605SAndrew Thompson IFBIF_BSTP_AUTOPTP|IFBIF_BSTP_ADMEDGE| \ 164daacddcaSShteryana Shopova IFBIF_BSTP_ADMCOST) /* not saved */ 16531997bf2SAndrew Thompson 16631997bf2SAndrew Thompson /* BRDGFLUSH */ 16731997bf2SAndrew Thompson #define IFBF_FLUSHDYN 0x00 /* flush learned addresses only */ 16831997bf2SAndrew Thompson #define IFBF_FLUSHALL 0x01 /* flush all addresses */ 16931997bf2SAndrew Thompson 17031997bf2SAndrew Thompson /* 17131997bf2SAndrew Thompson * Interface list structure. 17231997bf2SAndrew Thompson */ 17331997bf2SAndrew Thompson struct ifbifconf { 17431997bf2SAndrew Thompson uint32_t ifbic_len; /* buffer size */ 17531997bf2SAndrew Thompson union { 17631997bf2SAndrew Thompson caddr_t ifbicu_buf; 17731997bf2SAndrew Thompson struct ifbreq *ifbicu_req; 17831997bf2SAndrew Thompson } ifbic_ifbicu; 17931997bf2SAndrew Thompson #define ifbic_buf ifbic_ifbicu.ifbicu_buf 18031997bf2SAndrew Thompson #define ifbic_req ifbic_ifbicu.ifbicu_req 18131997bf2SAndrew Thompson }; 18231997bf2SAndrew Thompson 18331997bf2SAndrew Thompson /* 18431997bf2SAndrew Thompson * Bridge address request. 18531997bf2SAndrew Thompson */ 18631997bf2SAndrew Thompson struct ifbareq { 18731997bf2SAndrew Thompson char ifba_ifsname[IFNAMSIZ]; /* member if name */ 18831997bf2SAndrew Thompson unsigned long ifba_expire; /* address expire time */ 18931997bf2SAndrew Thompson uint8_t ifba_flags; /* address flags */ 19031997bf2SAndrew Thompson uint8_t ifba_dst[ETHER_ADDR_LEN];/* destination address */ 19122dcc3c1SAndrew Thompson uint16_t ifba_vlan; /* vlan id */ 19231997bf2SAndrew Thompson }; 19331997bf2SAndrew Thompson 19431997bf2SAndrew Thompson #define IFBAF_TYPEMASK 0x03 /* address type mask */ 19531997bf2SAndrew Thompson #define IFBAF_DYNAMIC 0x00 /* dynamically learned address */ 19631997bf2SAndrew Thompson #define IFBAF_STATIC 0x01 /* static address */ 1973df7fad0SAndrew Thompson #define IFBAF_STICKY 0x02 /* sticky address */ 19831997bf2SAndrew Thompson 1993df7fad0SAndrew Thompson #define IFBAFBITS "\020\1STATIC\2STICKY" 20031997bf2SAndrew Thompson 20131997bf2SAndrew Thompson /* 20231997bf2SAndrew Thompson * Address list structure. 20331997bf2SAndrew Thompson */ 20431997bf2SAndrew Thompson struct ifbaconf { 20531997bf2SAndrew Thompson uint32_t ifbac_len; /* buffer size */ 20631997bf2SAndrew Thompson union { 20731997bf2SAndrew Thompson caddr_t ifbacu_buf; 20831997bf2SAndrew Thompson struct ifbareq *ifbacu_req; 20931997bf2SAndrew Thompson } ifbac_ifbacu; 21031997bf2SAndrew Thompson #define ifbac_buf ifbac_ifbacu.ifbacu_buf 21131997bf2SAndrew Thompson #define ifbac_req ifbac_ifbacu.ifbacu_req 21231997bf2SAndrew Thompson }; 21331997bf2SAndrew Thompson 21431997bf2SAndrew Thompson /* 21531997bf2SAndrew Thompson * Bridge parameter structure. 21631997bf2SAndrew Thompson */ 21731997bf2SAndrew Thompson struct ifbrparam { 21831997bf2SAndrew Thompson union { 21931997bf2SAndrew Thompson uint32_t ifbrpu_int32; 22031997bf2SAndrew Thompson uint16_t ifbrpu_int16; 22131997bf2SAndrew Thompson uint8_t ifbrpu_int8; 22231997bf2SAndrew Thompson } ifbrp_ifbrpu; 22331997bf2SAndrew Thompson }; 22431997bf2SAndrew Thompson #define ifbrp_csize ifbrp_ifbrpu.ifbrpu_int32 /* cache size */ 22531997bf2SAndrew Thompson #define ifbrp_ctime ifbrp_ifbrpu.ifbrpu_int32 /* cache time (sec) */ 22631997bf2SAndrew Thompson #define ifbrp_prio ifbrp_ifbrpu.ifbrpu_int16 /* bridge priority */ 2273fab7669SAndrew Thompson #define ifbrp_proto ifbrp_ifbrpu.ifbrpu_int8 /* bridge protocol */ 2283fab7669SAndrew Thompson #define ifbrp_txhc ifbrp_ifbrpu.ifbrpu_int8 /* bpdu tx holdcount */ 22931997bf2SAndrew Thompson #define ifbrp_hellotime ifbrp_ifbrpu.ifbrpu_int8 /* hello time (sec) */ 23031997bf2SAndrew Thompson #define ifbrp_fwddelay ifbrp_ifbrpu.ifbrpu_int8 /* fwd time (sec) */ 23131997bf2SAndrew Thompson #define ifbrp_maxage ifbrp_ifbrpu.ifbrpu_int8 /* max age (sec) */ 23251383c37SAndrew Thompson #define ifbrp_cexceeded ifbrp_ifbrpu.ifbrpu_int32 /* # of cache dropped 23351383c37SAndrew Thompson * adresses */ 23451383c37SAndrew Thompson /* 23551383c37SAndrew Thompson * Bridge current operational parameters structure. 23651383c37SAndrew Thompson */ 23751383c37SAndrew Thompson struct ifbropreq { 2383fab7669SAndrew Thompson uint8_t ifbop_holdcount; 23951383c37SAndrew Thompson uint8_t ifbop_maxage; 24051383c37SAndrew Thompson uint8_t ifbop_hellotime; 24151383c37SAndrew Thompson uint8_t ifbop_fwddelay; 2423fab7669SAndrew Thompson uint8_t ifbop_protocol; 2433fab7669SAndrew Thompson uint16_t ifbop_priority; 24451383c37SAndrew Thompson uint16_t ifbop_root_port; 24551383c37SAndrew Thompson uint32_t ifbop_root_path_cost; 2466c32e05cSAndrew Thompson uint64_t ifbop_bridgeid; 24751383c37SAndrew Thompson uint64_t ifbop_designated_root; 2486c32e05cSAndrew Thompson uint64_t ifbop_designated_bridge; 24951383c37SAndrew Thompson struct timeval ifbop_last_tc_time; 25051383c37SAndrew Thompson }; 25151383c37SAndrew Thompson 25251383c37SAndrew Thompson /* 25351383c37SAndrew Thompson * Bridge member operational STP params structure. 25451383c37SAndrew Thompson */ 25551383c37SAndrew Thompson struct ifbpstpreq { 25651383c37SAndrew Thompson uint8_t ifbp_portno; /* bp STP port number */ 25751383c37SAndrew Thompson uint32_t ifbp_fwd_trans; /* bp STP fwd transitions */ 25851383c37SAndrew Thompson uint32_t ifbp_design_cost; /* bp STP designated cost */ 25951383c37SAndrew Thompson uint32_t ifbp_design_port; /* bp STP designated port */ 26051383c37SAndrew Thompson uint64_t ifbp_design_bridge; /* bp STP designated bridge */ 26151383c37SAndrew Thompson uint64_t ifbp_design_root; /* bp STP designated root */ 26251383c37SAndrew Thompson }; 26351383c37SAndrew Thompson 26451383c37SAndrew Thompson /* 26551383c37SAndrew Thompson * Bridge STP ports list structure. 26651383c37SAndrew Thompson */ 26751383c37SAndrew Thompson struct ifbpstpconf { 26851383c37SAndrew Thompson uint32_t ifbpstp_len; /* buffer size */ 26951383c37SAndrew Thompson union { 27051383c37SAndrew Thompson caddr_t ifbpstpu_buf; 27151383c37SAndrew Thompson struct ifbpstpreq *ifbpstpu_req; 27251383c37SAndrew Thompson } ifbpstp_ifbpstpu; 27351383c37SAndrew Thompson #define ifbpstp_buf ifbpstp_ifbpstpu.ifbpstpu_buf 27451383c37SAndrew Thompson #define ifbpstp_req ifbpstp_ifbpstpu.ifbpstpu_req 27551383c37SAndrew Thompson }; 27631997bf2SAndrew Thompson 277e5539fb6SRyan Moeller #define STP_STATES \ 278e5539fb6SRyan Moeller "disabled", \ 279e5539fb6SRyan Moeller "listening", \ 280e5539fb6SRyan Moeller "learning", \ 281e5539fb6SRyan Moeller "forwarding", \ 282e5539fb6SRyan Moeller "blocking", \ 283e5539fb6SRyan Moeller "discarding" 284e5539fb6SRyan Moeller 285e5539fb6SRyan Moeller #define STP_PROTOS \ 28688be0e11SJonah Caplan "stp", \ 28788be0e11SJonah Caplan "-", \ 288e5539fb6SRyan Moeller "rstp" 289e5539fb6SRyan Moeller 290e5539fb6SRyan Moeller #define STP_ROLES \ 29188be0e11SJonah Caplan "disabled", \ 29288be0e11SJonah Caplan "root", \ 29388be0e11SJonah Caplan "designated", \ 29488be0e11SJonah Caplan "alternate", \ 295e5539fb6SRyan Moeller "backup" 296e5539fb6SRyan Moeller 297e5539fb6SRyan Moeller #define PV2ID(pv, epri, eaddr) do { \ 298e5539fb6SRyan Moeller epri = pv >> 48; \ 299e5539fb6SRyan Moeller eaddr[0] = pv >> 40; \ 300e5539fb6SRyan Moeller eaddr[1] = pv >> 32; \ 301e5539fb6SRyan Moeller eaddr[2] = pv >> 24; \ 302e5539fb6SRyan Moeller eaddr[3] = pv >> 16; \ 303e5539fb6SRyan Moeller eaddr[4] = pv >> 8; \ 304e5539fb6SRyan Moeller eaddr[5] = pv >> 0; \ 305e5539fb6SRyan Moeller } while (0) 306e5539fb6SRyan Moeller 30731997bf2SAndrew Thompson #ifdef _KERNEL 30831997bf2SAndrew Thompson 309fd6238a6SAndrew Thompson #define BRIDGE_INPUT(_ifp, _m) do { \ 3105c30b378SMatt Macy KASSERT((_ifp)->if_bridge_input != NULL, \ 311fd6238a6SAndrew Thompson ("%s: if_bridge not loaded!", __func__)); \ 3125c30b378SMatt Macy _m = (*(_ifp)->if_bridge_input)(_ifp, _m); \ 313d862b165SMark Johnston if (_m != NULL) { \ 314fd6238a6SAndrew Thompson _ifp = _m->m_pkthdr.rcvif; \ 315d862b165SMark Johnston m->m_flags &= ~M_BRIDGE_INJECT; \ 316d862b165SMark Johnston } \ 317fd6238a6SAndrew Thompson } while (0) 318fd6238a6SAndrew Thompson 319fd6238a6SAndrew Thompson #define BRIDGE_OUTPUT(_ifp, _m, _err) do { \ 3205c30b378SMatt Macy KASSERT((_ifp)->if_bridge_output != NULL, \ 321fd6238a6SAndrew Thompson ("%s: if_bridge not loaded!", __func__)); \ 3225c30b378SMatt Macy _err = (*(_ifp)->if_bridge_output)(_ifp, _m, NULL, NULL); \ 323fd6238a6SAndrew Thompson } while (0) 324fd6238a6SAndrew Thompson 325fd6238a6SAndrew Thompson extern void (*bridge_dn_p)(struct mbuf *, struct ifnet *); 32685967694SLexi Winter extern bool (*bridge_same_p)(const void *, const void *); 32785967694SLexi Winter extern void *(*bridge_get_softc_p)(struct ifnet *); 32831997bf2SAndrew Thompson 32931997bf2SAndrew Thompson #endif /* _KERNEL */ 330*f6aedb95SLexi Winter 331*f6aedb95SLexi Winter #endif /* _NET_IF_BRIDGEVAR_H_ */ 332