Lines Matching defs:group
1161 * MAC is being stopped. Stop the default RX group
1166 * knows the the default group is always in
1170 * as a client) and group is in SHARED state.
1459 * used by the aggr driver to access and control the underlying HW Rx group
1461 * underlying HW Rx group/rings, it calls the following functions to
1508 * The mac client did not reserve any RX group, return directly.
1517 * This group must be reserved by this mac client.
1694 * from the group. In those cases, all of the rings will be torn down because
1722 mac_group_t *group = (mac_group_t *)gh;
1724 return (mac_group_addmac(group, addr));
1730 mac_group_t *group = (mac_group_t *)gh;
1732 return (mac_group_remmac(group, addr));
1736 * Set the RX group to be shared/reserved. Note that the group must be
1743 * If there is no change in the group state, just return.
1751 * Successfully reserved the group.
1754 * group, we enable the group level polling when available,
1768 * Set all rings of this group to software classified.
1769 * If the group has an overriding interrupt, then re-enable it.
2364 * to delete the group will wait till the group is physically
3737 mac_start_group(mac_group_t *group)
3741 if (group->mrg_start != NULL)
3742 rv = group->mrg_start(group->mrg_driver);
3748 mac_stop_group(mac_group_t *group)
3750 if (group->mrg_stop != NULL)
3751 group->mrg_stop(group->mrg_driver);
3755 * Called from mac_start() on the default Rx group. Broadcast and multicast
3756 * packets are received only on the default group. Hence the default group
3763 mac_start_group_and_rings(mac_group_t *group)
3768 ASSERT(group->mrg_state == MAC_GROUP_STATE_REGISTERED);
3769 if ((rv = mac_start_group(group)) != 0)
3772 for (ring = group->mrg_rings; ring != NULL; ring = ring->mr_next) {
3781 mac_stop_group_and_rings(group);
3785 /* Called from mac_stop on the default Rx group */
3787 mac_stop_group_and_rings(mac_group_t *group)
3791 for (ring = group->mrg_rings; ring != NULL; ring = ring->mr_next) {
3798 mac_stop_group(group);
3803 mac_init_ring(mac_impl_t *mip, mac_group_t *group, int index,
3819 * is unique only across the group the ring belongs to.
3821 * with single group (mrg_index = 0).
3823 ring->mr_index = group->mrg_index * group->mrg_info.mgi_count + index;
3824 ring->mr_type = group->mrg_type;
3825 ring->mr_gh = (mac_group_handle_t)group;
3828 ring->mr_next = group->mrg_rings;
3829 group->mrg_rings = ring;
3835 cap_rings->mr_rget(mip->mi_driver, group->mrg_type, group->mrg_index,
3855 * of a group of rings sharing an
3888 /* Update the ring count of the group */
3889 group->mrg_cur_count++;
3904 mac_init_group(mac_impl_t *mip, mac_group_t *group, int size,
3910 * Initialize all ring members of this group. Size of zero will not
3911 * enter the loop, so it's safe for initializing an empty group.
3914 (void) mac_init_ring(mip, group, index, cap_rings);
3921 mac_group_t *group;
3954 * If we have multiple TX rings, but only one TX group, we can
3957 * one group with all the rings (for all its ports), going
3964 * The -1 here is because we create a default TX group
3983 group = groups + g;
3985 /* Prepare basic information of the group */
3986 group->mrg_index = g;
3987 group->mrg_type = rtype;
3988 group->mrg_state = MAC_GROUP_STATE_UNINIT;
3989 group->mrg_mh = (mac_handle_t)mip;
3990 group->mrg_next = group + 1;
3997 * This is a pseudo group that we created, apart
4001 group->mrg_state = MAC_GROUP_STATE_REGISTERED;
4005 /* Query group information from driver */
4007 (mac_group_handle_t)group);
4027 * The first RX group must have non-zero
4064 * Note that an empty group is allowed, e.g., an aggr
4065 * would start with an empty group.
4069 /* unknown group type */
4079 * Driver must register group->mgi_addmac/remmac() for rx groups
4090 group->mrg_info = group_info;
4092 /* Update the group's status and group count. */
4093 mac_set_group_state(group, MAC_GROUP_STATE_REGISTERED);
4096 group->mrg_rings = NULL;
4097 group->mrg_cur_count = 0;
4098 mac_init_group(mip, group, group_info.mgi_count, cap_rings);
4101 /* The current group size should be equal to default value */
4102 ASSERT(group->mrg_cur_count == group_info.mgi_count);
4105 /* Build up a dummy group for free resources as a pool */
4106 group = groups + grpcnt;
4108 /* Prepare basic information of the group */
4109 group->mrg_index = -1;
4110 group->mrg_type = rtype;
4111 group->mrg_state = MAC_GROUP_STATE_UNINIT;
4112 group->mrg_mh = (mac_handle_t)mip;
4113 group->mrg_next = NULL;
4120 group->mrg_rings = NULL;
4121 group->mrg_cur_count = 0;
4122 mac_init_group(mip, group, ring_left, cap_rings);
4124 /* The current group size should be equal to ring_left */
4125 ASSERT(group->mrg_cur_count == ring_left);
4129 /* Update this group's status */
4130 mac_set_group_state(group, MAC_GROUP_STATE_REGISTERED);
4132 group->mrg_rings = NULL;
4155 * The default group cannot be reserved. It is used by
4156 * all the clients that do not have an exclusive group.
4168 group = groups + grpcnt;
4169 ring = group->mrg_rings;
4172 * have an empty Tx group which will get populated
4179 * pass the group to aggr so it can add Tx
4180 * rings to the group later.
4183 (mac_group_handle_t)group);
4186 * (rings will come later), set the group
4189 group->mrg_state = MAC_GROUP_STATE_REGISTERED;
4201 mip->mi_txrings_avail = group->mrg_cur_count - 1;
4207 * The default group cannot be reserved. It will be shared
4208 * by clients that do not have an exclusive group.
4231 mac_group_t *group;
4238 group = groups + g;
4239 for (ring = group->mrg_rings; ring != NULL;
4267 mac_group_t *group, *groups;
4300 for (group = groups; group != NULL; group = group->mrg_next) {
4303 if (group->mrg_cur_count == 0)
4306 ASSERT(group->mrg_rings != NULL);
4308 while ((ring = group->mrg_rings) != NULL) {
4309 group->mrg_rings = ring->mr_next;
4316 /* Free the block of group data strutures */
4321 * Associate a MAC address with a receive group.
4324 * any type of failure could cause unexpected results. A group can be added
4328 * always imply that the group is functioning abnormally.
4334 mac_group_addmac(mac_group_t *group, const uint8_t *addr)
4336 ASSERT(group->mrg_type == MAC_RING_TYPE_RX);
4337 ASSERT(group->mrg_info.mgi_addmac != NULL);
4339 return (group->mrg_info.mgi_addmac(group->mrg_info.mgi_driver, addr));
4343 * Remove the association between MAC address and receive group.
4346 mac_group_remmac(mac_group_t *group, const uint8_t *addr)
4348 ASSERT(group->mrg_type == MAC_RING_TYPE_RX);
4349 ASSERT(group->mrg_info.mgi_remmac != NULL);
4351 return (group->mrg_info.mgi_remmac(group->mrg_info.mgi_driver, addr));
4389 mac_group_t *group = (mac_group_t *)gh;
4390 mac_ring_t *ring = group->mrg_rings;
4392 for (ring = group->mrg_rings; ring != NULL; ring = ring->mr_next)
4399 * Add a ring to an existing group.
4408 i_mac_group_add_ring(mac_group_t *group, mac_ring_t *ring, int index)
4410 mac_impl_t *mip = (mac_impl_t *)group->mrg_mh;
4419 switch (group->mrg_type) {
4434 * group.
4436 ASSERT(mac_find_ring((mac_group_handle_t)group,
4442 * a driver to add a ring to an existing group, for example
4446 ring = mac_init_ring(mip, group, index, cap_rings);
4447 ASSERT(group->mrg_state > MAC_GROUP_STATE_UNINIT);
4451 * to add a ring to an existing group. In this case the
4457 ASSERT(group->mrg_driver == NULL ||
4464 * of the right for the target group.
4468 ASSERT(ring->mr_type == group->mrg_type);
4473 * initiated by the driver, and the target group is not the
4474 * group.
4476 if (group->mrg_driver != NULL) {
4477 cap_rings->mr_gaddring(group->mrg_driver,
4484 ring->mr_next = group->mrg_rings;
4485 group->mrg_rings = ring;
4486 ring->mr_gh = (mac_group_handle_t)group;
4487 group->mrg_cur_count++;
4491 * If the group has not been actively used, we're done.
4493 if (group->mrg_index != -1 &&
4494 group->mrg_state < MAC_GROUP_STATE_RESERVED)
4503 cap_rings->mr_gremring(group->mrg_driver,
4506 group->mrg_cur_count--;
4507 group->mrg_rings = ring->mr_next;
4524 * Setup SRS on top of the new ring if the group is
4527 if (group->mrg_state == MAC_GROUP_STATE_RESERVED) {
4530 mcip = MAC_GROUP_ONLY_CLIENT(group);
4532 * Even though this group is reserved we migth still
4534 * group with the primary mac client.
4550 mac_grp_client_t *mgcp = group->mrg_clients;
4555 if (MAC_GROUP_NO_CLIENT(group)) {
4562 * If the rings are being moved to a group that has
4625 * Remove a ring from it's current group. MAC internal function for dynamic
4631 i_mac_group_rem_ring(mac_group_t *group, mac_ring_t *ring,
4634 mac_impl_t *mip = (mac_impl_t *)group->mrg_mh;
4640 ASSERT(mac_find_ring((mac_group_handle_t)group,
4642 ASSERT((mac_group_t *)ring->mr_gh == group);
4643 ASSERT(ring->mr_type == group->mrg_type);
4680 * initial creation of a group when a share is
4683 * group has been reserved and populated.
4705 (group->mrg_rings != ring) ?
4706 (mac_ring_handle_t)group->mrg_rings :
4710 if (group->mrg_state != MAC_GROUP_STATE_RESERVED)
4713 mcip = MAC_GROUP_ONLY_CLIENT(group);
4737 * this group
4739 if (MAC_GROUP_NO_CLIENT(group))
4741 mgcp = group->mrg_clients;
4752 * clients in the group.
4754 if (group != defgrp) {
4762 * one ring in the group after this, we need
4766 if (group->mrg_cur_count == 2) {
4768 rem_ring = group->mrg_rings;
4807 * Remove the ring from the group.
4809 if (ring == group->mrg_rings)
4810 group->mrg_rings = ring->mr_next;
4814 pre = group->mrg_rings;
4819 group->mrg_cur_count--;
4823 ASSERT(group->mrg_driver == NULL ||
4829 if (group->mrg_driver != NULL) {
4830 cap_rings->mr_gremring(group->mrg_driver,
4843 * Move a ring to the target group. If needed, remove the ring from the group
4862 * Remove it from current group first.
4868 * Add it to the new group.
4873 * Failed to add ring back to source group. If
4947 * it to a reserved group or setting promiscuous mode. Won't try different
4948 * group is the group is non-NULL, so the caller must explictly share
4949 * default group when needed.
4952 * to add it to default group only need to activate it if its reference
4957 mac_add_macaddr(mac_impl_t *mip, mac_group_t *group, uint8_t *mac_addr,
4977 map->ma_group = group;
4987 ASSERT(map->ma_group == NULL || map->ma_group == group);
4989 map->ma_group = group;
4999 * Activate this MAC address by adding it to the reserved group.
5001 if (group != NULL) {
5002 err = mac_group_addmac(group, (const uint8_t *)mac_addr);
5024 if ((group == NULL) &&
5054 * address from an associated group or to turn off promiscuous mode.
5076 * it from its associated group, or turn off promiscuous mode
5147 * Need to replace the MAC address associated with a group.
5863 * On the Rx side, the reservation is at the granularity of the group
5867 * If a share is allocated to a MAC client, we allocate a TX group and an
5868 * RX group to the client, and assign TX rings and RX rings to these
5873 * to allocate individual rings out of a group and program the hw classifier
5887 * function swaps it with a new ring from the group of unassigned rings.
5892 mac_group_t *group;
5904 group = MAC_DEFAULT_TX_GROUP(mip);
5906 /* Can't take the default ring out of the default group */
5910 ASSERT(MAC_GROUP_NO_CLIENT(group));
5919 for (mgcp = group->mrg_clients; mgcp != NULL; mgcp = mgcp->mgc_next) {
5934 * For a reserved group with multiple clients, return the primary client.
5954 * the ring back to the default group so that we can give it to
5963 mac_group_t *group = (mac_group_t *)ring->mr_gh;
5972 mcip = MAC_GROUP_ONLY_CLIENT(group);
5974 mcip = mac_get_grp_primary(group);
5982 /* Need to put this mac client in the default group */
5983 if (mac_rx_switch_group(mcip, group, defgrp) != 0)
5988 * the default group.
6003 if (mac_group_mov_ring(mip, group, tring) != 0)
6024 * the default group, thereby freeing some rings.
6087 * The Tx ring is with a group reserved by a MAC client. See if
6090 ASSERT(group->mrg_state == MAC_GROUP_STATE_RESERVED);
6091 mcip = MAC_GROUP_ONLY_CLIENT(group);
6093 mcip = mac_get_grp_primary(group);
6098 ASSERT(group->mrg_cur_count == 1);
6099 /* Put this mac client in the default group */
6100 mac_tx_switch_group(mcip, group, defgrp);
6104 * the default group.
6125 if (mac_group_mov_ring(mip, group, tring) != 0) {
6141 * Populate a zero-ring group with rings. If the share is non-NULL,
6143 * Invoked after allocating a new RX or TX group through
6162 * First find the rings to allocate to the group.
6175 * group, we need to check if we can get this
6190 * Pick one ring from default group.
6193 * at index 0 to stay in the default group, since it is the
6231 /* move receive rings to new group */
6248 /* move the TX rings to the new group */
6272 /* add group to share */
6322 * Finds an available group and exclusively reserves it for a client.
6323 * The group is chosen to suit the flow's resource controls (bandwidth and
6325 * If the requestor is the pimary MAC then return the group with the
6355 * Check if a group already has this mac address (case of VLANs)
6356 * unless we are moving this MAC client from one group to another.
6366 * caller to use the default group.
6386 * We have explicitly asked for a group (with nrxrings,
6394 * We have asked for a software group.
6403 * it the default group so that the primary gets to
6409 /* The group that can donate rings */
6413 * The number of rings that the default group can donate.
6419 * Try to exclusively reserve a RX group.
6422 * client), try to reserve the a non-default RX group and give
6423 * it all the rings from the donor group, except the default ring
6426 * to reserve non-default RX group with the specified number of
6430 * try to reserve a non-default group with 1 ring, if available.
6439 * Check if this group could be a candidate group for
6440 * eviction if we need a group for this MAC client,
6441 * but there aren't any. A candidate group is one
6442 * that didn't ask for an exclusive group, but got
6444 * the donor group can donate) for the new MAC
6449 * If the primary/donor group is not the default
6450 * group, don't bother looking for a candidate group.
6452 * if the primary group can be vacated.
6473 * This group could already be SHARED by other multicast
6474 * flows on this client. In that case, the group would
6489 * Populate the group. Rings should be taken
6490 * from the donor group.
6495 * If the donor group can't donate, let's just walk and
6496 * see if someone can vacate a group, so that we have
6498 * identified a candiate group..
6524 * It's a dynamic group but the grouping operation
6529 /* We didn't find an exclusive group for this MAC client */
6536 * If we found a candidate group then we switch the
6538 * group and give the group to this MAC client. If
6540 * primary is in its own group and if it can make way
6552 * Switch the MAC client from the candidate group
6553 * to the default group.. If this group was the
6554 * donor group, then after the switch we need
6555 * to update the donor group too.
6575 * Now give this group with the required rings
6621 * This is called when there are no clients left for the group.
6622 * The group is stopped and marked MAC_GROUP_STATE_REGISTERED,
6623 * and if it is a non default group, the shares are removed and
6624 * all rings are assigned back to default group.
6627 mac_release_rx_group(mac_client_impl_t *mcip, mac_group_t *group)
6632 ASSERT(group != MAC_DEFAULT_RX_GROUP(mip));
6634 if (mip->mi_rx_donor_grp == group)
6639 * SRS etc on this group have also be quiesced.
6641 for (ring = group->mrg_rings; ring != NULL; ring = ring->mr_next) {
6643 ASSERT(group->mrg_state == MAC_GROUP_STATE_RESERVED);
6650 ASSERT(group->mrg_state < MAC_GROUP_STATE_RESERVED ||
6658 /* remove group from share */
6661 group->mrg_driver);
6668 * Rings were dynamically allocated to group.
6669 * Move rings back to default group.
6671 while ((ring = group->mrg_rings) != NULL) {
6676 mac_stop_group(group);
6678 * Possible improvement: See if we can assign the group just released
6686 * We remove the mac address for such clients from the group after quiescing
6688 * the primary's mac address is removed from the group after all the
6691 * added. While grp is the group where the clients reside, tgrp is
6692 * the group where the addresses have to be added.
6706 * If the clients are in a non-default group, we just have to
6707 * walk the group's client list. If it is in the default group
6777 " to group %p failed!!", (void *)mcip,
6795 * Switch the MAC client from one group to another. This means we need
6796 * to remove the MAC address from the group, remove the MAC client,
6797 * teardown the SRSs and revert the group state. Then, we add the client
6798 * to the destination group, set the SRSs, and add the MAC address to the
6799 * group.
6818 * The group might be reserved, but SRSs may not be set up, e.g.
6819 * primary and its vlans using a reserved group.
6863 * The default group will still take the multicast,
6875 * If the destination group is reserved, setup the SRSs etc.
6890 * Reserves a TX group for the specified share. Invoked by mac_tx_srs_setup()
6920 * to a group and return the group if so. The other way is also
6953 * We have explicitly asked for a group (with ntxrings,
6961 * We have asked for a software group.
6968 * The number of rings that the default group can donate.
6970 * this group.
6975 * Primary gets default group unless explicitly told not
6988 * get an exclusive group. A candidate group is one
6989 * that didn't ask for an exclusive group, but got
6991 * the default group can donate) for the new MAC
7012 * see if someone can vacate a group, so that we have
7025 /* The default group */
7028 * If we need an exclusive group and have identified a
7029 * candidate group we switch the MAC client from the
7030 * candidate group to the default group and give the
7031 * candidate group to this client.
7035 * Switch the MAC client from the candidate group
7036 * to the default group.
7047 * Give the candidate group with the specified number
7083 * We got an exclusive group, but it is not dynamic.
7149 * Disassociate a MAC client from a group, i.e go through the rings in the
7150 * group and delete all the soft rings tied to them.
7183 * Switch the MAC client from one group to another. This means we need
7184 * to remove the MAC client, teardown the SRSs and revert the group state.
7247 * the rings in the default group, except
7249 * this group won't be released since it is
7250 * the default group, so the rings won't
7271 * We could have VLANs sharing the non-default group with
7497 * We are adding or removing ring(s) from a group. The source for taking
7498 * rings is the default group. The destination for giving rings back is
7499 * the default group.
7502 mac_group_ring_modify(mac_client_impl_t *mcip, mac_group_t *group,
7514 boolean_t rx_group = group->mrg_type == MAC_RING_TYPE_RX;
7522 * If we are asked for just a group, we give 1 ring, else
7536 if (ringcnt == group->mrg_cur_count)
7539 if (group->mrg_cur_count > ringcnt) {
7540 modify = group->mrg_cur_count - ringcnt;
7542 if (mip->mi_rx_donor_grp == group) {
7549 ring = group->mrg_rings;
7559 (void) mac_group_mov_ring(mip, group,
7573 modify = ringcnt - group->mrg_cur_count;
7576 if (group != mip->mi_rx_donor_grp)
7580 * This is the donor group with all the remaining
7581 * rings. Default group now gets to be the donor
7600 if (tgrp == group || tgrp->mrg_state <
7621 if (tgrp == group || tgrp->mrg_state <
7646 if ((rv = i_mac_group_allocate_rings(mip, group->mrg_type, defgrp,
7647 group, mcip->mci_share, modify)) != 0) {
7899 * If the group is reserved we just go ahead and set the effective rings.
7900 * Additionally, for TX this could mean the default group has lost/gained
7901 * some rings, so if the default group is reserved, we need to adjust the
7902 * effective rings for the default group clients. For RX, if we are working
7903 * with the non-default group, we just need * to reset the effective props
7904 * for the default group clients.
7921 * If we have reserved a group, set the effective rings
7922 * to the ring count in the group.
7930 * We go through the clients in the shared group and
7933 * if some client is being moved to a group that is
7934 * already shared). The case where the default group is
7936 * there is a non-default group, the default group is always
7978 * If the group is not the default group and the default
7979 * group is reserved, the ring count in the default group
7993 * Check if the primary is in the default group. If so, see if we
7994 * can give it a an exclusive group now that another client is
7995 * being configured. We take the primary out of the default group
7997 * will land in the default ring in the default group which means
7998 * any client in the default group, even if it is the only on in
7999 * the group, will lose exclusive access to the rings, hence
8013 * Check if the primary is in the default group, if not
8015 * group OR set the RX rings property, return.
8021 * If the new client needs an exclusive group and we