Print this page
11493 aggr needs support for multiple pseudo rx groups
Portions contributed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/mac/mac_provider.c
          +++ new/usr/src/uts/common/io/mac/mac_provider.c
↓ open down ↓ 691 lines elided ↑ open up ↑
 692  692   * This is the upward reentry point for packets arriving from the bridging
 693  693   * module and from mac_rx for links not part of a bridge.
 694  694   */
 695  695  void
 696  696  mac_rx_common(mac_handle_t mh, mac_resource_handle_t mrh, mblk_t *mp_chain)
 697  697  {
 698  698          mac_impl_t              *mip = (mac_impl_t *)mh;
 699  699          mac_ring_t              *mr = (mac_ring_t *)mrh;
 700  700          mac_soft_ring_set_t     *mac_srs;
 701  701          mblk_t                  *bp = mp_chain;
 702      -        boolean_t               hw_classified = B_FALSE;
 703  702  
 704  703          /*
 705  704           * If there are any promiscuous mode callbacks defined for
 706  705           * this MAC, pass them a copy if appropriate.
 707  706           */
 708  707          if (mip->mi_promisc_list != NULL)
 709  708                  mac_promisc_dispatch(mip, mp_chain, NULL);
 710  709  
 711  710          if (mr != NULL) {
 712  711                  /*
 713  712                   * If the SRS teardown has started, just return. The 'mr'
 714      -                 * continues to be valid until the driver unregisters the mac.
      713 +                 * continues to be valid until the driver unregisters the MAC.
 715  714                   * Hardware classified packets will not make their way up
 716  715                   * beyond this point once the teardown has started. The driver
 717  716                   * is never passed a pointer to a flow entry or SRS or any
 718  717                   * structure that can be freed much before mac_unregister.
 719  718                   */
 720  719                  mutex_enter(&mr->mr_lock);
 721  720                  if ((mr->mr_state != MR_INUSE) || (mr->mr_flag &
 722  721                      (MR_INCIPIENT | MR_CONDEMNED | MR_QUIESCE))) {
 723  722                          mutex_exit(&mr->mr_lock);
 724  723                          freemsgchain(mp_chain);
 725  724                          return;
 726  725                  }
 727      -                if (mr->mr_classify_type == MAC_HW_CLASSIFIER) {
 728      -                        hw_classified = B_TRUE;
      726 +
      727 +                /*
      728 +                 * The ring is in passthru mode; pass the chain up to
      729 +                 * the pseudo ring.
      730 +                 */
      731 +                if (mr->mr_classify_type == MAC_PASSTHRU_CLASSIFIER) {
 729  732                          MR_REFHOLD_LOCKED(mr);
      733 +                        mutex_exit(&mr->mr_lock);
      734 +                        mr->mr_pt_fn(mr->mr_pt_arg1, mr->mr_pt_arg2, mp_chain,
      735 +                            B_FALSE);
      736 +                        MR_REFRELE(mr);
      737 +                        return;
 730  738                  }
 731      -                mutex_exit(&mr->mr_lock);
 732  739  
 733  740                  /*
      741 +                 * The passthru callback should only be set when in
      742 +                 * MAC_PASSTHRU_CLASSIFIER mode.
      743 +                 */
      744 +                ASSERT3P(mr->mr_pt_fn, ==, NULL);
      745 +
      746 +                /*
 734  747                   * We check if an SRS is controlling this ring.
 735  748                   * If so, we can directly call the srs_lower_proc
 736  749                   * routine otherwise we need to go through mac_rx_classify
 737  750                   * to reach the right place.
 738  751                   */
 739      -                if (hw_classified) {
      752 +                if (mr->mr_classify_type == MAC_HW_CLASSIFIER) {
      753 +                        MR_REFHOLD_LOCKED(mr);
      754 +                        mutex_exit(&mr->mr_lock);
      755 +                        ASSERT3P(mr->mr_srs, !=, NULL);
 740  756                          mac_srs = mr->mr_srs;
      757 +
 741  758                          /*
 742      -                         * This is supposed to be the fast path.
 743      -                         * All packets received though here were steered by
 744      -                         * the hardware classifier, and share the same
 745      -                         * MAC header info.
      759 +                         * This is the fast path. All packets received
      760 +                         * on this ring are hardware classified and
      761 +                         * share the same MAC header info.
 746  762                           */
 747  763                          mac_srs->srs_rx.sr_lower_proc(mh,
 748  764                              (mac_resource_handle_t)mac_srs, mp_chain, B_FALSE);
 749  765                          MR_REFRELE(mr);
 750  766                          return;
 751  767                  }
      768 +
      769 +                mutex_exit(&mr->mr_lock);
 752  770                  /* We'll fall through to software classification */
 753  771          } else {
 754  772                  flow_entry_t *flent;
 755  773                  int err;
 756  774  
 757  775                  rw_enter(&mip->mi_rw_lock, RW_READER);
 758  776                  if (mip->mi_single_active_client != NULL) {
 759  777                          flent = mip->mi_single_active_client->mci_flent_list;
 760  778                          FLOW_TRY_REFHOLD(flent, err);
 761  779                          rw_exit(&mip->mi_rw_lock);
↓ open down ↓ 777 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX