6 * You may not use this file except in compliance with the License.
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 #include <sys/types.h>
28 #include <inet/common.h>
29 #include <sys/stropts.h>
30 #include <sys/modctl.h>
31 #include <sys/dld.h>
32 #include <sys/softmac_impl.h>
33
34 dev_info_t *softmac_dip = NULL;
35 static kmem_cache_t *softmac_upper_cachep;
36
37 /*
38 * This function is a generic open(9E) entry point into the softmac for
39 * both the softmac module and the softmac driver.
40 */
41 static int softmac_cmn_open(queue_t *, dev_t *, int, int, cred_t *);
42
43 /*
44 * The following softmac_mod_xxx() functions are (9E) entry point functions for
45 * the softmac module.
645 softmac_wput_nondata(sup, mp);
646 break;
647 }
648 return (0);
649 }
650
651 static int
652 softmac_drv_wsrv(queue_t *wq)
653 {
654 softmac_upper_t *sup = dld_str_private(wq);
655
656 ASSERT(wq->q_next == NULL);
657
658 mutex_enter(&sup->su_mutex);
659 if (sup->su_mode != SOFTMAC_FASTPATH) {
660 /*
661 * Bump su_tx_inprocess so that su_mode won't change.
662 */
663 sup->su_tx_inprocess++;
664 mutex_exit(&sup->su_mutex);
665 dld_wsrv(wq);
666 mutex_enter(&sup->su_mutex);
667 if (--sup->su_tx_inprocess == 0)
668 cv_signal(&sup->su_cv);
669 } else if (sup->su_tx_busy && SOFTMAC_CANPUTNEXT(sup->su_slp->sl_wq)) {
670 /*
671 * The flow-conctol of the dedicated-lower-stream is
672 * relieved. If DLD_CAPAB_DIRECT is enabled, call tx_notify
673 * callback to relieve the flow-control of the specific client,
674 * otherwise relieve the flow-control of all the upper-stream
675 * using the traditional STREAM mechanism.
676 */
677 if (sup->su_tx_notify_func != NULL) {
678 sup->su_tx_inprocess++;
679 mutex_exit(&sup->su_mutex);
680 sup->su_tx_notify_func(sup->su_tx_notify_arg,
681 (mac_tx_cookie_t)sup);
682 mutex_enter(&sup->su_mutex);
683 if (--sup->su_tx_inprocess == 0)
684 cv_signal(&sup->su_cv);
685 }
|
6 * You may not use this file except in compliance with the License.
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 #include <sys/types.h>
31 #include <inet/common.h>
32 #include <sys/stropts.h>
33 #include <sys/modctl.h>
34 #include <sys/dld.h>
35 #include <sys/softmac_impl.h>
36
37 dev_info_t *softmac_dip = NULL;
38 static kmem_cache_t *softmac_upper_cachep;
39
40 /*
41 * This function is a generic open(9E) entry point into the softmac for
42 * both the softmac module and the softmac driver.
43 */
44 static int softmac_cmn_open(queue_t *, dev_t *, int, int, cred_t *);
45
46 /*
47 * The following softmac_mod_xxx() functions are (9E) entry point functions for
48 * the softmac module.
648 softmac_wput_nondata(sup, mp);
649 break;
650 }
651 return (0);
652 }
653
654 static int
655 softmac_drv_wsrv(queue_t *wq)
656 {
657 softmac_upper_t *sup = dld_str_private(wq);
658
659 ASSERT(wq->q_next == NULL);
660
661 mutex_enter(&sup->su_mutex);
662 if (sup->su_mode != SOFTMAC_FASTPATH) {
663 /*
664 * Bump su_tx_inprocess so that su_mode won't change.
665 */
666 sup->su_tx_inprocess++;
667 mutex_exit(&sup->su_mutex);
668 (void) dld_wsrv(wq);
669 mutex_enter(&sup->su_mutex);
670 if (--sup->su_tx_inprocess == 0)
671 cv_signal(&sup->su_cv);
672 } else if (sup->su_tx_busy && SOFTMAC_CANPUTNEXT(sup->su_slp->sl_wq)) {
673 /*
674 * The flow-conctol of the dedicated-lower-stream is
675 * relieved. If DLD_CAPAB_DIRECT is enabled, call tx_notify
676 * callback to relieve the flow-control of the specific client,
677 * otherwise relieve the flow-control of all the upper-stream
678 * using the traditional STREAM mechanism.
679 */
680 if (sup->su_tx_notify_func != NULL) {
681 sup->su_tx_inprocess++;
682 mutex_exit(&sup->su_mutex);
683 sup->su_tx_notify_func(sup->su_tx_notify_arg,
684 (mac_tx_cookie_t)sup);
685 mutex_enter(&sup->su_mutex);
686 if (--sup->su_tx_inprocess == 0)
687 cv_signal(&sup->su_cv);
688 }
|