]> git.ipfire.org Git - people/ms/mstpd.git/blob - bridge_ctl.h
driver hooks for creating/deleting new MSTI
[people/ms/mstpd.git] / bridge_ctl.h
1 /*****************************************************************************
2 Copyright (c) 2006 EMC Corporation.
3 Copyright (c) 2011 Factor-SPE
4
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2 of the License, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc., 59
17 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 The full GNU General Public License is included in this distribution in the
20 file called LICENSE.
21
22 Authors: Srinivas Aji <Aji_Srinivas@emc.com>
23 Authors: Vitalii Demianets <vitas@nppfactor.kiev.ua>
24
25 ******************************************************************************/
26
27 #ifndef BRIDGE_CTL_H
28 #define BRIDGE_CTL_H
29
30 #include <stdbool.h>
31 #include <net/if.h>
32 #include <linux/if_ether.h>
33
34 typedef struct
35 {
36 int if_index;
37 __u8 macaddr[ETH_ALEN];
38 char name[IFNAMSIZ];
39
40 bool up, stp_up;
41 } sysdep_br_data_t;
42
43 typedef struct
44 {
45 int if_index;
46 __u8 macaddr[ETH_ALEN];
47 char name[IFNAMSIZ];
48
49 bool up;
50 int speed, duplex;
51 } sysdep_if_data_t;
52
53 #define GET_PORT_SPEED(port) ((port)->sysdeps.speed)
54 #define GET_PORT_DUPLEX(port) ((port)->sysdeps.duplex)
55
56 /* Logging macros for mstp.c - they use system dependent info */
57 #define ERROR_BRNAME(_br, _fmt, _args...) ERROR("%s " _fmt, \
58 _br->sysdeps.name, ##_args)
59 #define INFO_BRNAME(_br, _fmt, _args...) INFO("%s " _fmt, \
60 _br->sysdeps.name, ##_args)
61 #define LOG_BRNAME(_br, _fmt, _args...) LOG("%s " _fmt, \
62 _br->sysdeps.name, ##_args)
63 #define ERROR_PRTNAME(_br, _prt, _fmt, _args...) ERROR("%s:%s " _fmt, \
64 _br->sysdeps.name, _prt->sysdeps.name, ##_args)
65 #define INFO_PRTNAME(_br, _prt, _fmt, _args...) INFO("%s:%s " _fmt, \
66 _br->sysdeps.name, _prt->sysdeps.name, ##_args)
67 #define LOG_PRTNAME(_br, _prt, _fmt, _args...) LOG("%s:%s " _fmt, \
68 _br->sysdeps.name, _prt->sysdeps.name, ##_args)
69 #define ERROR_MSTINAME(_br,_prt,_ptp,_fmt,_args...) ERROR("%s:%s:%hu " _fmt, \
70 _br->sysdeps.name, _prt->sysdeps.name, __be16_to_cpu(ptp->MSTID), ##_args)
71 #define INFO_MSTINAME(_br,_prt,_ptp,_fmt,_args...) INFO("%s:%s:%hu " _fmt, \
72 _br->sysdeps.name, _prt->sysdeps.name, __be16_to_cpu(ptp->MSTID), ##_args)
73 #define LOG_MSTINAME(_br,_prt,_ptp,_fmt,_args...) LOG("%s:%s:%hu " _fmt, \
74 _br->sysdeps.name, _prt->sysdeps.name, __be16_to_cpu(ptp->MSTID), ##_args)
75 #define SMLOG_MSTINAME(_ptp, _fmt, _args...) \
76 PRINT(LOG_LEVEL_STATE_MACHINE_TRANSITION, "%s: %s:%s:%hu " _fmt, \
77 __PRETTY_FUNCTION__, _ptp->port->bridge->sysdeps.name, \
78 _ptp->port->sysdeps.name, __be16_to_cpu(ptp->MSTID), ##_args)
79
80 extern struct rtnl_handle rth_state;
81
82 int init_bridge_ops(void);
83
84 int bridge_notify(int br_index, int if_index, bool newlink, bool up);
85
86 void bridge_bpdu_rcv(int ifindex, const unsigned char *data, int len);
87
88 void bridge_one_second(void);
89
90 #endif /* BRIDGE_CTL_H */