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