altq_cbq.c (f0a26983) altq_cbq.c (3c4cd924)
1/* $KAME: altq_cbq.c,v 1.20 2004/04/17 10:54:48 kjc Exp $ */
2/* $DragonFly: src/sys/net/altq/altq_cbq.c,v 1.7 2008/05/14 11:59:23 sephe Exp $ */
3
4/*
5 * Copyright (c) Sun Microsystems, Inc. 1993-1998 All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 600 unchanged lines hidden (view full) ---

609
610 if (cbqp->cbq_qlen > 0) {
611 struct ifnet *ifp = ifq->altq_ifp;
612 struct ifaltq_subque *ifsq = &ifq->altq_subq[CBQ_SUBQ_INDEX];
613
614 /* Release the altq lock to avoid deadlock */
615 CBQ_UNLOCK(ifq);
616
1/* $KAME: altq_cbq.c,v 1.20 2004/04/17 10:54:48 kjc Exp $ */
2/* $DragonFly: src/sys/net/altq/altq_cbq.c,v 1.7 2008/05/14 11:59:23 sephe Exp $ */
3
4/*
5 * Copyright (c) Sun Microsystems, Inc. 1993-1998 All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 600 unchanged lines hidden (view full) ---

609
610 if (cbqp->cbq_qlen > 0) {
611 struct ifnet *ifp = ifq->altq_ifp;
612 struct ifaltq_subque *ifsq = &ifq->altq_subq[CBQ_SUBQ_INDEX];
613
614 /* Release the altq lock to avoid deadlock */
615 CBQ_UNLOCK(ifq);
616
617 ifnet_serialize_tx(ifp);
617 ifnet_serialize_tx(ifp, ifsq);
618 if (ifp->if_start && !ifsq_is_oactive(ifsq))
619 (*ifp->if_start)(ifp, ifsq);
618 if (ifp->if_start && !ifsq_is_oactive(ifsq))
619 (*ifp->if_start)(ifp, ifsq);
620 ifnet_deserialize_tx(ifp);
620 ifnet_deserialize_tx(ifp, ifsq);
621
622 CBQ_LOCK(ifq);
623 }
624}
625
626static void
627cbq_purge(cbq_state_t *cbqp)
628{
629 struct rm_class *cl;
630 int i;
631 for (i = 0; i < CBQ_MAX_CLASSES; i++) {
632 if ((cl = cbqp->cbq_class_tbl[i]) != NULL)
633 rmc_dropall(cl);
634 }
635 if (ifq_is_enabled(cbqp->ifnp.ifq_))
636 cbqp->ifnp.ifq_->altq_subq[CBQ_SUBQ_INDEX].ifq_len = 0;
637}
638
639#endif /* ALTQ_CBQ */
621
622 CBQ_LOCK(ifq);
623 }
624}
625
626static void
627cbq_purge(cbq_state_t *cbqp)
628{
629 struct rm_class *cl;
630 int i;
631 for (i = 0; i < CBQ_MAX_CLASSES; i++) {
632 if ((cl = cbqp->cbq_class_tbl[i]) != NULL)
633 rmc_dropall(cl);
634 }
635 if (ifq_is_enabled(cbqp->ifnp.ifq_))
636 cbqp->ifnp.ifq_->altq_subq[CBQ_SUBQ_INDEX].ifq_len = 0;
637}
638
639#endif /* ALTQ_CBQ */