1419 mac_protect_init(mcip);
1420
1421 /* the subflow table will be created dynamically */
1422 mcip->mci_subflow_tab = NULL;
1423
1424 mcip->mci_misc_stat.mms_multircv = 0;
1425 mcip->mci_misc_stat.mms_brdcstrcv = 0;
1426 mcip->mci_misc_stat.mms_multixmt = 0;
1427 mcip->mci_misc_stat.mms_brdcstxmt = 0;
1428
1429 /* Create an initial flow */
1430
1431 err = mac_flow_create(NULL, NULL, mcip->mci_name, NULL,
1432 mcip->mci_state_flags & MCIS_IS_VNIC ? FLOW_VNIC_MAC :
1433 FLOW_PRIMARY_MAC, &flent);
1434 if (err != 0)
1435 goto done;
1436 mcip->mci_flent = flent;
1437 FLOW_MARK(flent, FE_MC_NO_DATAPATH);
1438 flent->fe_mcip = mcip;
1439 /*
1440 * Place initial creation reference on the flow. This reference
1441 * is released in the corresponding delete action viz.
1442 * mac_unicast_remove after waiting for all transient refs to
1443 * to go away. The wait happens in mac_flow_wait.
1444 */
1445 FLOW_REFHOLD(flent);
1446
1447 /*
1448 * Do this ahead of the mac_bcast_add() below so that the mi_nclients
1449 * will have the right value for mac_rx_srs_setup().
1450 */
1451 mac_client_add(mcip);
1452
1453 mcip->mci_share = 0;
1454 if (share_desired)
1455 i_mac_share_alloc(mcip);
1456
1457 /*
1458 * We will do mimimal datapath setup to allow a MAC client to
2420 * Trigger a renegotiation of the capabilities when the number of
2421 * active clients changes from 1 to 2, since some of the capabilities
2422 * might have to be disabled. Also send a MAC_NOTE_LINK notification
2423 * to all the MAC clients whenever physical link is DOWN.
2424 */
2425 if (mip->mi_nactiveclients == 2) {
2426 mac_capab_update((mac_handle_t)mip);
2427 mac_virtual_link_update(mip);
2428 }
2429 /*
2430 * Now that the setup is complete, clear the INCIPIENT flag.
2431 * The flag was set to avoid incoming packets seeing inconsistent
2432 * structures while the setup was in progress. Clear the mci_tx_flag
2433 * by calling mac_tx_client_block. It is possible that
2434 * mac_unicast_remove was called prior to this mac_unicast_add which
2435 * could have set the MCI_TX_QUIESCE flag.
2436 */
2437 if (flent->fe_rx_ring_group != NULL)
2438 mac_rx_group_unmark(flent->fe_rx_ring_group, MR_INCIPIENT);
2439 FLOW_UNMARK(flent, FE_INCIPIENT);
2440 FLOW_UNMARK(flent, FE_MC_NO_DATAPATH);
2441 mac_tx_client_unblock(mcip);
2442 return (0);
2443 bail:
2444 if (bcast_added)
2445 mac_bcast_delete(mcip, mip->mi_type->mt_brdcst_addr, vid);
2446
2447 if (nactiveclients_added)
2448 mip->mi_nactiveclients--;
2449
2450 if (mac_started)
2451 mac_stop((mac_handle_t)mip);
2452
2453 return (err);
2454 }
2455
2456 /*
2457 * Return the passive primary MAC client, if present. The passive client is
2458 * a stand-by client that has the same unicast address as another that is
2459 * currenly active. Once the active client goes away, the passive client
2460 * becomes active.
|
1419 mac_protect_init(mcip);
1420
1421 /* the subflow table will be created dynamically */
1422 mcip->mci_subflow_tab = NULL;
1423
1424 mcip->mci_misc_stat.mms_multircv = 0;
1425 mcip->mci_misc_stat.mms_brdcstrcv = 0;
1426 mcip->mci_misc_stat.mms_multixmt = 0;
1427 mcip->mci_misc_stat.mms_brdcstxmt = 0;
1428
1429 /* Create an initial flow */
1430
1431 err = mac_flow_create(NULL, NULL, mcip->mci_name, NULL,
1432 mcip->mci_state_flags & MCIS_IS_VNIC ? FLOW_VNIC_MAC :
1433 FLOW_PRIMARY_MAC, &flent);
1434 if (err != 0)
1435 goto done;
1436 mcip->mci_flent = flent;
1437 FLOW_MARK(flent, FE_MC_NO_DATAPATH);
1438 flent->fe_mcip = mcip;
1439
1440 /*
1441 * Place initial creation reference on the flow. This reference
1442 * is released in the corresponding delete action viz.
1443 * mac_unicast_remove after waiting for all transient refs to
1444 * to go away. The wait happens in mac_flow_wait.
1445 */
1446 FLOW_REFHOLD(flent);
1447
1448 /*
1449 * Do this ahead of the mac_bcast_add() below so that the mi_nclients
1450 * will have the right value for mac_rx_srs_setup().
1451 */
1452 mac_client_add(mcip);
1453
1454 mcip->mci_share = 0;
1455 if (share_desired)
1456 i_mac_share_alloc(mcip);
1457
1458 /*
1459 * We will do mimimal datapath setup to allow a MAC client to
2421 * Trigger a renegotiation of the capabilities when the number of
2422 * active clients changes from 1 to 2, since some of the capabilities
2423 * might have to be disabled. Also send a MAC_NOTE_LINK notification
2424 * to all the MAC clients whenever physical link is DOWN.
2425 */
2426 if (mip->mi_nactiveclients == 2) {
2427 mac_capab_update((mac_handle_t)mip);
2428 mac_virtual_link_update(mip);
2429 }
2430 /*
2431 * Now that the setup is complete, clear the INCIPIENT flag.
2432 * The flag was set to avoid incoming packets seeing inconsistent
2433 * structures while the setup was in progress. Clear the mci_tx_flag
2434 * by calling mac_tx_client_block. It is possible that
2435 * mac_unicast_remove was called prior to this mac_unicast_add which
2436 * could have set the MCI_TX_QUIESCE flag.
2437 */
2438 if (flent->fe_rx_ring_group != NULL)
2439 mac_rx_group_unmark(flent->fe_rx_ring_group, MR_INCIPIENT);
2440 FLOW_UNMARK(flent, FE_INCIPIENT);
2441
2442 /*
2443 * If this is an aggr port client, don't enable the flow's
2444 * datapath at this stage. Otherwise, bcast traffic could
2445 * arrive while the aggr port is in the process of
2446 * initializing. Instead, the flow's datapath is started later
2447 * when mac_client_set_flow_cb() is called.
2448 */
2449 if ((mcip->mci_state_flags & MCIS_IS_AGGR_PORT) == 0)
2450 FLOW_UNMARK(flent, FE_MC_NO_DATAPATH);
2451
2452 mac_tx_client_unblock(mcip);
2453 return (0);
2454 bail:
2455 if (bcast_added)
2456 mac_bcast_delete(mcip, mip->mi_type->mt_brdcst_addr, vid);
2457
2458 if (nactiveclients_added)
2459 mip->mi_nactiveclients--;
2460
2461 if (mac_started)
2462 mac_stop((mac_handle_t)mip);
2463
2464 return (err);
2465 }
2466
2467 /*
2468 * Return the passive primary MAC client, if present. The passive client is
2469 * a stand-by client that has the same unicast address as another that is
2470 * currenly active. Once the active client goes away, the passive client
2471 * becomes active.
|