|
1 This patch includes Solaris bridge specific changes to OVS. |
|
2 |
|
3 This patch has not been proposed upstream because we are not yet |
|
4 proposing Solaris specific requirements upstream. |
|
5 |
|
6 diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c |
|
7 index 6cd30b8..19ff759 100644 |
|
8 --- a/vswitchd/bridge.c |
|
9 +++ b/vswitchd/bridge.c |
|
10 @@ -943,6 +943,12 @@ port_configure(struct port *port) |
|
11 free(s.lacp_slaves); |
|
12 } |
|
13 |
|
14 +static boolean_t |
|
15 +bridge_is_system(const struct bridge *br) |
|
16 +{ |
|
17 + return (strcmp(br->type, "system") == 0); |
|
18 +} |
|
19 + |
|
20 /* Pick local port hardware address and datapath ID for 'br'. */ |
|
21 static void |
|
22 bridge_configure_datapath_id(struct bridge *br) |
|
23 @@ -954,6 +960,14 @@ bridge_configure_datapath_id(struct bridge *br) |
|
24 char *dpid_string; |
|
25 |
|
26 bridge_pick_local_hw_addr(br, ea, &hw_addr_iface); |
|
27 +#ifdef __sun |
|
28 + /* Solaris "system" bridges are implicitly created VNICs. They |
|
29 + * already have their ethernet addresses set, so there is no |
|
30 + * reason to set them. We prefer that they be "auto" generated. |
|
31 + */ |
|
32 + if (bridge_is_system(br)) |
|
33 + goto skip; |
|
34 +#endif |
|
35 local_iface = iface_from_ofp_port(br, OFPP_LOCAL); |
|
36 if (local_iface) { |
|
37 int error = netdev_set_etheraddr(local_iface->netdev, ea); |
|
38 @@ -964,6 +978,9 @@ bridge_configure_datapath_id(struct bridge *br) |
|
39 br->name, ovs_strerror(error)); |
|
40 } |
|
41 } |
|
42 +#ifdef __sun |
|
43 +skip: |
|
44 +#endif |
|
45 memcpy(br->ea, ea, ETH_ADDR_LEN); |
|
46 |
|
47 dpid = bridge_pick_datapath_id(br, ea, hw_addr_iface); |
|
48 @@ -1485,6 +1502,16 @@ iface_do_create(const struct bridge *br, |
|
49 goto error; |
|
50 } |
|
51 |
|
52 +#ifdef __sun |
|
53 + if (bridge_is_system(br) && netdev_is_uplink(netdev)) { |
|
54 + VLOG_INFO("bridge %s: uplink %s", br->name, iface_cfg->name); |
|
55 + error = netdev_configure_uplink(netdev, br->name); |
|
56 + if (error) { |
|
57 + goto error; |
|
58 + } |
|
59 + } |
|
60 +#endif |
|
61 + |
|
62 *ofp_portp = iface_pick_ofport(iface_cfg); |
|
63 error = ofproto_port_add(br->ofproto, netdev, ofp_portp); |
|
64 if (error) { |
|
65 @@ -1494,6 +1521,15 @@ iface_do_create(const struct bridge *br, |
|
66 VLOG_INFO("bridge %s: added interface %s on port %d", |
|
67 br->name, iface_cfg->name, *ofp_portp); |
|
68 |
|
69 +#ifdef __sun |
|
70 + if (bridge_is_system(br) && iface_is_internal(iface_cfg, br->cfg)) { |
|
71 + error = ofproto_configure_bridge_port(br->ofproto, br->name); |
|
72 + if (error) { |
|
73 + goto error; |
|
74 + } |
|
75 + } |
|
76 +#endif |
|
77 + |
|
78 if (port_cfg->vlan_mode && !strcmp(port_cfg->vlan_mode, "splinter")) { |
|
79 netdev_turn_flags_on(netdev, NETDEV_UP, NULL); |
|
80 } |
|
81 @@ -1620,10 +1656,31 @@ find_local_hw_addr(const struct bridge *br, uint8_t ea[ETH_ADDR_LEN], |
|
82 { |
|
83 struct hmapx mirror_output_ports; |
|
84 struct port *port; |
|
85 + int i; |
|
86 + struct iface *iface = NULL; |
|
87 + uint8_t iface_ea[ETH_ADDR_LEN]; |
|
88 bool found_addr = false; |
|
89 int error; |
|
90 - int i; |
|
91 |
|
92 +#ifdef __sun |
|
93 + /* |
|
94 + * Solaris does not currently support fake bridges. |
|
95 + */ |
|
96 + if (bridge_is_system(br)) { |
|
97 + if (fake_br == NULL) { |
|
98 + iface = iface_lookup(br, br->name); |
|
99 + if (iface != NULL) { |
|
100 + error = netdev_get_etheraddr(iface->netdev, iface_ea); |
|
101 + if (error == 0) { |
|
102 + memcpy(ea, iface_ea, ETH_ADDR_LEN); |
|
103 + *hw_addr_iface = iface; |
|
104 + found_addr = true; |
|
105 + } |
|
106 + } |
|
107 + } |
|
108 + goto skip; |
|
109 + } |
|
110 +#endif |
|
111 /* Mirror output ports don't participate in picking the local hardware |
|
112 * address. ofproto can't help us find out whether a given port is a |
|
113 * mirror output because we haven't configured mirrors yet, so we need to |
|
114 @@ -1639,9 +1696,7 @@ find_local_hw_addr(const struct bridge *br, uint8_t ea[ETH_ADDR_LEN], |
|
115 /* Otherwise choose the minimum non-local MAC address among all of the |
|
116 * interfaces. */ |
|
117 HMAP_FOR_EACH (port, hmap_node, &br->ports) { |
|
118 - uint8_t iface_ea[ETH_ADDR_LEN]; |
|
119 struct iface *candidate; |
|
120 - struct iface *iface; |
|
121 |
|
122 /* Mirror output ports don't participate. */ |
|
123 if (hmapx_contains(&mirror_output_ports, port->cfg)) { |
|
124 @@ -1708,13 +1763,15 @@ find_local_hw_addr(const struct bridge *br, uint8_t ea[ETH_ADDR_LEN], |
|
125 found_addr = true; |
|
126 } |
|
127 } |
|
128 + hmapx_destroy(&mirror_output_ports); |
|
129 +#ifdef __sun |
|
130 +skip: |
|
131 +#endif |
|
132 |
|
133 if (!found_addr) { |
|
134 memcpy(ea, br->default_ea, ETH_ADDR_LEN); |
|
135 *hw_addr_iface = NULL; |
|
136 } |
|
137 - |
|
138 - hmapx_destroy(&mirror_output_ports); |
|
139 } |
|
140 |
|
141 static void |
|
142 diff --git a/vswitchd/system-stats.c b/vswitchd/system-stats.c |
|
143 index 7789787..cee0255 100644 |
|
144 --- a/vswitchd/system-stats.c |
|
145 +++ b/vswitchd/system-stats.c |
|
146 @@ -29,6 +29,9 @@ |
|
147 #if HAVE_SYS_STATVFS_H |
|
148 #include <sys/statvfs.h> |
|
149 #endif |
|
150 +#ifdef __sun |
|
151 +#include <sys/loadavg.h> |
|
152 +#endif |
|
153 #include <unistd.h> |
|
154 |
|
155 #include "daemon.h" |