]>
Commit | Line | Data |
---|---|---|
be53a5c4 | 1 | /* |
72c642e5 | 2 | * Copyright (c) 2015 Nicira, Inc. |
be53a5c4 DF |
3 | * Copyright (c) 2014 Wind River Systems, Inc. |
4 | * Copyright (c) 2015 Avaya, Inc. | |
5 | * | |
6 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
7 | * you may not use this file except in compliance with the License. | |
8 | * You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, software | |
13 | * distributed under the License is distributed on an "AS IS" BASIS, | |
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | * See the License for the specific language governing permissions and | |
16 | * limitations under the License. | |
17 | */ | |
18 | ||
19 | #ifndef OVS_LLDP_H | |
20 | #define OVS_LLDP_H | |
21 | ||
22 | #include <stdint.h> | |
0477baa9 | 23 | #include "dp-packet.h" |
be53a5c4 DF |
24 | #include "hmap.h" |
25 | #include "list.h" | |
26 | #include "lldp/lldpd.h" | |
5617ae6a | 27 | #include "ovs-atomic.h" |
be53a5c4 DF |
28 | #include "packets.h" |
29 | #include "timer.h" | |
30 | ||
31 | /* Transmit every LLDPD_TX_INTERVAL seconds. */ | |
ac211bdd | 32 | #define LLDP_DEFAULT_TRANSMIT_INTERVAL_MS (LLDPD_TX_INTERVAL * 1000) |
be53a5c4 | 33 | |
be53a5c4 DF |
34 | struct flow; |
35 | struct netdev; | |
36 | struct smap; | |
37 | ||
be53a5c4 DF |
38 | /* Structure per LLDP instance (at the moment per port when enabled). |
39 | */ | |
40 | struct lldp { | |
41 | struct hmap_node hmap_node; /* Node in all_lldps list. */ | |
42 | struct lldpd *lldpd; | |
43 | char *name; /* Name of the port. */ | |
44 | struct timer tx_timer; /* Send LLDP when expired. */ | |
45 | struct hmap mappings_by_isid; /* "struct" indexed by ISID */ | |
46 | struct hmap mappings_by_aux; /* "struct" indexed by aux */ | |
47 | struct ovs_list active_mapping_queue; | |
48 | struct ovs_refcount ref_cnt; | |
19aef6ef | 49 | bool enabled; /* LLDP enabled on port */ |
be53a5c4 DF |
50 | }; |
51 | ||
52 | /* Configuration specific to Auto Attach. | |
53 | */ | |
54 | struct aa_settings { | |
55 | char *system_description; | |
56 | char *system_name; | |
57 | }; | |
58 | ||
59 | /* Configuration of Auto Attach mappings. | |
60 | */ | |
61 | struct aa_mapping_settings { | |
72c642e5 BP |
62 | uint32_t isid; |
63 | uint16_t vlan; | |
be53a5c4 DF |
64 | }; |
65 | ||
66 | enum bridge_aa_vlan_oper { | |
67 | BRIDGE_AA_VLAN_OPER_UNDEF, | |
68 | BRIDGE_AA_VLAN_OPER_ADD, | |
69 | BRIDGE_AA_VLAN_OPER_REMOVE | |
70 | }; | |
71 | ||
72 | /* Bridge Auto Attach operations. Mostly for adding/removing VLAN on | |
73 | * the trunk port connected to the Auto Attach server. | |
74 | */ | |
75 | struct bridge_aa_vlan { | |
76 | struct ovs_list list_node; | |
77 | char *port_name; | |
72c642e5 | 78 | uint16_t vlan; |
be53a5c4 DF |
79 | enum bridge_aa_vlan_oper oper; |
80 | }; | |
81 | ||
82 | void lldp_init(void); | |
83 | long long int lldp_wait(struct lldp *lldp); | |
84 | long long int lldp_wake_time(const struct lldp *lldp); | |
85 | void lldp_run(struct lldpd *cfg); | |
86 | bool lldp_should_send_packet(struct lldp *cfg); | |
19aef6ef DF |
87 | bool lldp_should_process_flow(struct lldp *lldp, const struct flow *flow); |
88 | bool lldp_configure(struct lldp *lldp, const struct smap *cfg); | |
0477baa9 DF |
89 | void lldp_process_packet(struct lldp *cfg, const struct dp_packet *); |
90 | void lldp_put_packet(struct lldp *lldp, struct dp_packet *packet, | |
74ff3298 | 91 | const struct eth_addr eth_src); |
be53a5c4 DF |
92 | void lldpd_assign_cfg_to_protocols(struct lldpd *cfg); |
93 | struct lldp * lldp_create(const struct netdev *netdev, const uint32_t mtu, | |
94 | const struct smap *cfg); | |
95 | struct lldp * lldp_ref(const struct lldp *lldp_); | |
96 | void lldp_unref(struct lldp *lldp); | |
97 | ||
98 | int aa_get_vlan_queued(struct ovs_list *list); | |
99 | unsigned int aa_get_vlan_queue_size(void); | |
100 | int aa_configure(const struct aa_settings *s); | |
101 | int aa_mapping_register(void *aux, const struct aa_mapping_settings *s); | |
102 | int aa_mapping_unregister(void *aux); | |
103 | ||
104 | /* Used by unit tests */ | |
105 | struct lldp * lldp_create_dummy(void); | |
106 | ||
107 | #endif /* OVS_LLDP_H */ |