7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * Softmac data-path switching:
28 *
29 * - Fast-path model
30 *
31 * When the softmac fast-path is used, a dedicated lower-stream
32 * will be opened over the legacy device for each IP/ARP (upper-)stream
33 * over the softMAC, and all DLPI messages (including control messages
34 * and data messages) will be exchanged between the upper-stream and
35 * the corresponding lower-stream directly. Therefore, the data
36 * demultiplexing, filtering and classification processing will be done
37 * by the lower-stream, and the GLDv3 DLS/MAC layer processing will be
38 * no longer needed.
39 *
40 * - Slow-path model
41 *
42 * Some GLDv3 features requires the GLDv3 DLS/MAC layer processing to
43 * not be bypassed to assure its function correctness. For example,
44 * softmac fast-path must be disabled to support GLDv3 VNIC functionality.
45 * In this case, a shared lower-stream will be opened over the legacy
46 * device, which is responsible for implementing the GLDv3 callbacks
747 DL_NOTE_REPLUMB_DONE) {
748 freemsg(mp);
749 return;
750 }
751 /*
752 * This is an indication from IP/ARP that the
753 * fastpath->slowpath switch is done.
754 */
755 freemsg(mp);
756 softmac_datapath_switch_done(sup);
757 return;
758 }
759 break;
760 }
761
762 /*
763 * No need to hold lock to check su_mode, since su_mode updating only
764 * operation is is serialized by softmac_wput_nondata_task().
765 */
766 if (sup->su_mode != SOFTMAC_FASTPATH) {
767 dld_wput(sup->su_wq, mp);
768 return;
769 }
770
771 /*
772 * Fastpath non-data message processing. Most of non-data messages
773 * can be directly passed down to the dedicated-lower-stream, aside
774 * from the following M_PROTO/M_PCPROTO messages.
775 */
776 switch (dbtype) {
777 case M_PROTO:
778 case M_PCPROTO:
779 switch (prim) {
780 case DL_BIND_REQ:
781 softmac_bind_req(sup, mp);
782 break;
783 case DL_UNBIND_REQ:
784 softmac_unbind_req(sup, mp);
785 break;
786 case DL_CAPABILITY_REQ:
787 softmac_capability_req(sup, mp);
969 sup->su_mode = SOFTMAC_SLOWPATH;
970
971 /*
972 * Destroy the dedicated-lower-stream. Note that slp is destroyed
973 * when lh is closed.
974 */
975 (void) ldi_close(sup->su_slp->sl_lh, FREAD|FWRITE, kcred);
976 sup->su_slp = NULL;
977 mutex_exit(&sup->su_mutex);
978 }
979
980 void
981 softmac_wput_data(softmac_upper_t *sup, mblk_t *mp)
982 {
983 /*
984 * No lock is required to access the su_mode field since the data
985 * traffic is quiesce by IP when the data-path mode is in the
986 * process of switching.
987 */
988 if (sup->su_mode != SOFTMAC_FASTPATH)
989 dld_wput(sup->su_wq, mp);
990 else
991 (void) softmac_fastpath_wput_data(sup, mp, NULL, 0);
992 }
993
994 /*ARGSUSED*/
995 static mac_tx_cookie_t
996 softmac_fastpath_wput_data(softmac_upper_t *sup, mblk_t *mp, uintptr_t f_hint,
997 uint16_t flag)
998 {
999 queue_t *wq = sup->su_slp->sl_wq;
1000
1001 /*
1002 * This function is called from IP, only the MAC_DROP_ON_NO_DESC
1003 * flag can be specified.
1004 */
1005 ASSERT((flag & ~MAC_DROP_ON_NO_DESC) == 0);
1006 ASSERT(mp->b_next == NULL);
1007
1008 /*
1009 * Check wether the dedicated-lower-stream is able to handle more
|
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * Copyright 2019, Joyent, Inc.
28 */
29
30 /*
31 * Softmac data-path switching:
32 *
33 * - Fast-path model
34 *
35 * When the softmac fast-path is used, a dedicated lower-stream
36 * will be opened over the legacy device for each IP/ARP (upper-)stream
37 * over the softMAC, and all DLPI messages (including control messages
38 * and data messages) will be exchanged between the upper-stream and
39 * the corresponding lower-stream directly. Therefore, the data
40 * demultiplexing, filtering and classification processing will be done
41 * by the lower-stream, and the GLDv3 DLS/MAC layer processing will be
42 * no longer needed.
43 *
44 * - Slow-path model
45 *
46 * Some GLDv3 features requires the GLDv3 DLS/MAC layer processing to
47 * not be bypassed to assure its function correctness. For example,
48 * softmac fast-path must be disabled to support GLDv3 VNIC functionality.
49 * In this case, a shared lower-stream will be opened over the legacy
50 * device, which is responsible for implementing the GLDv3 callbacks
751 DL_NOTE_REPLUMB_DONE) {
752 freemsg(mp);
753 return;
754 }
755 /*
756 * This is an indication from IP/ARP that the
757 * fastpath->slowpath switch is done.
758 */
759 freemsg(mp);
760 softmac_datapath_switch_done(sup);
761 return;
762 }
763 break;
764 }
765
766 /*
767 * No need to hold lock to check su_mode, since su_mode updating only
768 * operation is is serialized by softmac_wput_nondata_task().
769 */
770 if (sup->su_mode != SOFTMAC_FASTPATH) {
771 (void) dld_wput(sup->su_wq, mp);
772 return;
773 }
774
775 /*
776 * Fastpath non-data message processing. Most of non-data messages
777 * can be directly passed down to the dedicated-lower-stream, aside
778 * from the following M_PROTO/M_PCPROTO messages.
779 */
780 switch (dbtype) {
781 case M_PROTO:
782 case M_PCPROTO:
783 switch (prim) {
784 case DL_BIND_REQ:
785 softmac_bind_req(sup, mp);
786 break;
787 case DL_UNBIND_REQ:
788 softmac_unbind_req(sup, mp);
789 break;
790 case DL_CAPABILITY_REQ:
791 softmac_capability_req(sup, mp);
973 sup->su_mode = SOFTMAC_SLOWPATH;
974
975 /*
976 * Destroy the dedicated-lower-stream. Note that slp is destroyed
977 * when lh is closed.
978 */
979 (void) ldi_close(sup->su_slp->sl_lh, FREAD|FWRITE, kcred);
980 sup->su_slp = NULL;
981 mutex_exit(&sup->su_mutex);
982 }
983
984 void
985 softmac_wput_data(softmac_upper_t *sup, mblk_t *mp)
986 {
987 /*
988 * No lock is required to access the su_mode field since the data
989 * traffic is quiesce by IP when the data-path mode is in the
990 * process of switching.
991 */
992 if (sup->su_mode != SOFTMAC_FASTPATH)
993 (void) dld_wput(sup->su_wq, mp);
994 else
995 (void) softmac_fastpath_wput_data(sup, mp, NULL, 0);
996 }
997
998 /*ARGSUSED*/
999 static mac_tx_cookie_t
1000 softmac_fastpath_wput_data(softmac_upper_t *sup, mblk_t *mp, uintptr_t f_hint,
1001 uint16_t flag)
1002 {
1003 queue_t *wq = sup->su_slp->sl_wq;
1004
1005 /*
1006 * This function is called from IP, only the MAC_DROP_ON_NO_DESC
1007 * flag can be specified.
1008 */
1009 ASSERT((flag & ~MAC_DROP_ON_NO_DESC) == 0);
1010 ASSERT(mp->b_next == NULL);
1011
1012 /*
1013 * Check wether the dedicated-lower-stream is able to handle more
|