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>

@@ -697,11 +697,10 @@
 {
         mac_impl_t              *mip = (mac_impl_t *)mh;
         mac_ring_t              *mr = (mac_ring_t *)mrh;
         mac_soft_ring_set_t     *mac_srs;
         mblk_t                  *bp = mp_chain;
-        boolean_t               hw_classified = B_FALSE;
 
         /*
          * If there are any promiscuous mode callbacks defined for
          * this MAC, pass them a copy if appropriate.
          */

@@ -709,11 +708,11 @@
                 mac_promisc_dispatch(mip, mp_chain, NULL);
 
         if (mr != NULL) {
                 /*
                  * If the SRS teardown has started, just return. The 'mr'
-                 * continues to be valid until the driver unregisters the mac.
+                 * continues to be valid until the driver unregisters the MAC.
                  * Hardware classified packets will not make their way up
                  * beyond this point once the teardown has started. The driver
                  * is never passed a pointer to a flow entry or SRS or any
                  * structure that can be freed much before mac_unregister.
                  */

@@ -722,35 +721,54 @@
                     (MR_INCIPIENT | MR_CONDEMNED | MR_QUIESCE))) {
                         mutex_exit(&mr->mr_lock);
                         freemsgchain(mp_chain);
                         return;
                 }
-                if (mr->mr_classify_type == MAC_HW_CLASSIFIER) {
-                        hw_classified = B_TRUE;
+
+                /*
+                 * The ring is in passthru mode; pass the chain up to
+                 * the pseudo ring.
+                 */
+                if (mr->mr_classify_type == MAC_PASSTHRU_CLASSIFIER) {
                         MR_REFHOLD_LOCKED(mr);
-                }
                 mutex_exit(&mr->mr_lock);
+                        mr->mr_pt_fn(mr->mr_pt_arg1, mr->mr_pt_arg2, mp_chain,
+                            B_FALSE);
+                        MR_REFRELE(mr);
+                        return;
+                }
 
                 /*
+                 * The passthru callback should only be set when in
+                 * MAC_PASSTHRU_CLASSIFIER mode.
+                 */
+                ASSERT3P(mr->mr_pt_fn, ==, NULL);
+
+                /*
                  * We check if an SRS is controlling this ring.
                  * If so, we can directly call the srs_lower_proc
                  * routine otherwise we need to go through mac_rx_classify
                  * to reach the right place.
                  */
-                if (hw_classified) {
+                if (mr->mr_classify_type == MAC_HW_CLASSIFIER) {
+                        MR_REFHOLD_LOCKED(mr);
+                        mutex_exit(&mr->mr_lock);
+                        ASSERT3P(mr->mr_srs, !=, NULL);
                         mac_srs = mr->mr_srs;
+
                         /*
-                         * This is supposed to be the fast path.
-                         * All packets received though here were steered by
-                         * the hardware classifier, and share the same
-                         * MAC header info.
+                         * This is the fast path. All packets received
+                         * on this ring are hardware classified and
+                         * share the same MAC header info.
                          */
                         mac_srs->srs_rx.sr_lower_proc(mh,
                             (mac_resource_handle_t)mac_srs, mp_chain, B_FALSE);
                         MR_REFRELE(mr);
                         return;
                 }
+
+                mutex_exit(&mr->mr_lock);
                 /* We'll fall through to software classification */
         } else {
                 flow_entry_t *flent;
                 int err;