Lines Matching refs:mac

60 fcoe_open_mac(fcoe_mac_t *mac, int force_promisc, fcoeio_stat_t *err_detail)  in fcoe_open_mac()  argument
73 ret = mac_open_by_linkid(mac->fm_linkid, &mac->fm_handle); in fcoe_open_mac()
76 mac->fm_linkid, ret); in fcoe_open_mac()
80 (void) sprintf(cli_name, "%s-%d", "fcoe", mac->fm_linkid); in fcoe_open_mac()
82 ret = mac_client_open(mac->fm_handle, in fcoe_open_mac()
83 &mac->fm_cli_handle, cli_name, fm_open_flag); in fcoe_open_mac()
85 (void) fcoe_close_mac(mac); in fcoe_open_mac()
92 mac_unicast_primary_get(mac->fm_handle, mac->fm_primary_addr); in fcoe_open_mac()
93 bcopy(mac->fm_primary_addr, mac->fm_current_addr, in fcoe_open_mac()
96 if (mac_unicast_add(mac->fm_cli_handle, NULL, MAC_UNICAST_PRIMARY, in fcoe_open_mac()
97 &mac->fm_unicst_handle, 0, &diag)) { in fcoe_open_mac()
98 (void) fcoe_close_mac(mac); in fcoe_open_mac()
103 mac->fm_force_promisc = B_TRUE; in fcoe_open_mac()
107 mac_sdu_get(mac->fm_handle, NULL, &mac->fm_eport.eport_mtu); in fcoe_open_mac()
108 if (mac->fm_eport.eport_mtu < FCOE_MIN_MTU_SIZE) { in fcoe_open_mac()
109 if (!fcoe_enable_p2pmode || mac->fm_eport.eport_mtu < 1500) { in fcoe_open_mac()
115 (void) fcoe_close_mac(mac); in fcoe_open_mac()
121 mac->fm_eport.eport_link_speed = in fcoe_open_mac()
122 mac_client_stat_get(mac->fm_cli_handle, MAC_STAT_IFSPEED); in fcoe_open_mac()
124 cv_init(&mac->fm_tx_cv, NULL, CV_DRIVER, NULL); in fcoe_open_mac()
125 mutex_init(&mac->fm_mutex, NULL, MUTEX_DRIVER, NULL); in fcoe_open_mac()
126 mac->fm_running = B_TRUE; in fcoe_open_mac()
133 fcoe_close_mac(fcoe_mac_t *mac) in fcoe_close_mac() argument
137 if (mac->fm_handle == NULL) { in fcoe_close_mac()
141 if (mac->fm_running) { in fcoe_close_mac()
142 cv_destroy(&mac->fm_tx_cv); in fcoe_close_mac()
143 mutex_destroy(&mac->fm_mutex); in fcoe_close_mac()
144 mac->fm_running = B_FALSE; in fcoe_close_mac()
147 if (mac->fm_promisc_handle != NULL) { in fcoe_close_mac()
148 mac_promisc_remove(mac->fm_promisc_handle); in fcoe_close_mac()
149 mac->fm_promisc_handle = NULL; in fcoe_close_mac()
151 mac_rx_clear(mac->fm_cli_handle); in fcoe_close_mac()
154 if (mac->fm_notify_handle != NULL) { in fcoe_close_mac()
155 ret = mac_notify_remove(mac->fm_notify_handle, B_TRUE); in fcoe_close_mac()
157 mac->fm_notify_handle = NULL; in fcoe_close_mac()
160 if (mac->fm_unicst_handle != NULL) { in fcoe_close_mac()
161 (void) mac_unicast_remove(mac->fm_cli_handle, in fcoe_close_mac()
162 mac->fm_unicst_handle); in fcoe_close_mac()
163 mac->fm_unicst_handle = NULL; in fcoe_close_mac()
166 mac_client_close(mac->fm_cli_handle, 0); in fcoe_close_mac()
167 mac->fm_cli_handle = NULL; in fcoe_close_mac()
169 (void) mac_close(mac->fm_handle); in fcoe_close_mac()
170 mac->fm_handle = NULL; in fcoe_close_mac()
176 fcoe_enable_callback(fcoe_mac_t *mac) in fcoe_enable_callback() argument
183 if (mac->fm_force_promisc) { in fcoe_enable_callback()
184 ret = mac_promisc_add(mac->fm_cli_handle, in fcoe_enable_callback()
185 MAC_CLIENT_PROMISC_FILTERED, fcoe_rx, mac, in fcoe_enable_callback()
186 &mac->fm_promisc_handle, in fcoe_enable_callback()
190 mac->fm_linkid, ret); in fcoe_enable_callback()
194 mac_rx_set(mac->fm_cli_handle, fcoe_rx, mac); in fcoe_enable_callback()
198 mac->fm_link_state = in fcoe_enable_callback()
199 mac_stat_get(mac->fm_handle, MAC_STAT_LINK_UP)? in fcoe_enable_callback()
202 mac->fm_eport.eport_link_speed = in fcoe_enable_callback()
203 mac_client_stat_get(mac->fm_cli_handle, MAC_STAT_IFSPEED); in fcoe_enable_callback()
208 mac->fm_notify_handle = mac_notify_add(mac->fm_handle, in fcoe_enable_callback()
209 fcoe_mac_notify, (void *)mac); in fcoe_enable_callback()
214 fcoe_disable_callback(fcoe_mac_t *mac) in fcoe_disable_callback() argument
218 if (mac->fm_promisc_handle) { in fcoe_disable_callback()
219 mac_promisc_remove(mac->fm_promisc_handle); in fcoe_disable_callback()
220 mac->fm_promisc_handle = NULL; in fcoe_disable_callback()
222 mac_rx_clear(mac->fm_cli_handle); in fcoe_disable_callback()
225 if (mac->fm_notify_handle) { in fcoe_disable_callback()
226 ret = mac_notify_remove(mac->fm_notify_handle, B_TRUE); in fcoe_disable_callback()
228 mac->fm_notify_handle = NULL; in fcoe_disable_callback()
231 ret = fcoe_mac_set_address(&mac->fm_eport, in fcoe_disable_callback()
232 mac->fm_primary_addr, B_FALSE); in fcoe_disable_callback()
233 FCOE_SET_DEFAULT_FPORT_ADDR(mac->fm_eport.eport_efh_dst); in fcoe_disable_callback()
241 fcoe_mac_t *mac = (fcoe_mac_t *)arg; in fcoe_rx() local
263 frm = fcoe_allocate_frame(&mac->fm_eport, frame_size, mp); in fcoe_rx()
276 fcoe_mac_t *mac = (fcoe_mac_t *)arg; in fcoe_mac_notify() local
289 if (mac_stat_get(mac->fm_handle, MAC_STAT_LINK_UP) != 0) { in fcoe_mac_notify()
290 if (mac->fm_link_state == FCOE_MAC_LINK_STATE_UP) { in fcoe_mac_notify()
294 mac->fm_eport.eport_link_speed = in fcoe_mac_notify()
295 mac_client_stat_get(mac->fm_cli_handle, in fcoe_mac_notify()
297 (void) fcoe_mac_set_address(&mac->fm_eport, in fcoe_mac_notify()
298 mac->fm_primary_addr, B_FALSE); in fcoe_mac_notify()
301 mac->fm_eport.eport_efh_dst); in fcoe_mac_notify()
303 mac->fm_link_state = FCOE_MAC_LINK_STATE_UP; in fcoe_mac_notify()
306 mac->fm_linkid, arg, type); in fcoe_mac_notify()
307 fcoe_mac_notify_link_up(mac); in fcoe_mac_notify()
309 if (mac->fm_link_state == FCOE_MAC_LINK_STATE_DOWN) { in fcoe_mac_notify()
312 mac->fm_link_state = FCOE_MAC_LINK_STATE_DOWN; in fcoe_mac_notify()
315 mac->fm_linkid, arg, type); in fcoe_mac_notify()
316 fcoe_mac_notify_link_down(mac); in fcoe_mac_notify()
324 mutex_enter(&mac->fm_mutex); in fcoe_mac_notify()
325 cv_broadcast(&mac->fm_tx_cv); in fcoe_mac_notify()
326 mutex_exit(&mac->fm_mutex); in fcoe_mac_notify()
341 fcoe_mac_t *mac = EPORT2MAC(eport); in fcoe_mac_set_address() local
344 if (bcmp(addr, mac->fm_current_addr, 6) == 0) { in fcoe_mac_set_address()
348 mutex_enter(&mac->fm_mutex); in fcoe_mac_set_address()
349 if (mac->fm_promisc_handle == NULL) { in fcoe_mac_set_address()
350 ret = mac_unicast_primary_set(mac->fm_handle, addr); in fcoe_mac_set_address()
352 mutex_exit(&mac->fm_mutex); in fcoe_mac_set_address()
354 "failed %x", mac->fm_linkid, ret); in fcoe_mac_set_address()
359 bcopy(addr, mac->fm_current_addr, ETHERADDRL); in fcoe_mac_set_address()
361 bcopy(mac->fm_primary_addr, in fcoe_mac_set_address()
362 mac->fm_current_addr, ETHERADDRL); in fcoe_mac_set_address()
364 mutex_exit(&mac->fm_mutex); in fcoe_mac_set_address()