Beispiel #1
0
int
altq_priq_getqstats(struct pf_altq *a, void *ubuf, int *nbytes)
{
    struct ifclassq *ifq = NULL;
    struct priq_if *pif;
    struct priq_classstats stats;
    int error = 0;

    lck_mtx_assert(pf_lock, LCK_MTX_ASSERT_OWNED);

    if ((unsigned)*nbytes < sizeof (stats))
        return (EINVAL);

    if ((pif = altq_lookup(a->ifname, ALTQT_PRIQ)) == NULL)
        return (EBADF);

    ifq = pif->pif_ifq;
    IFCQ_LOCK_ASSERT_HELD(ifq);	/* lock held by altq_lookup */
    error = priq_get_class_stats(pif, a->qid, &stats);
    IFCQ_UNLOCK(ifq);
    if (error != 0)
        return (error);

    if ((error = copyout((caddr_t)&stats, (user_addr_t)(uintptr_t)ubuf,
                         sizeof (stats))) != 0)
        return (error);

    *nbytes = sizeof (stats);

    return (0);
}
Beispiel #2
0
int
fairq_destroy(struct fairq_if *fif)
{
	struct ifclassq *ifq = fif->fif_ifq;
	int err;

	IFCQ_LOCK(ifq);
	err = fairq_destroy_locked(fif);
	IFCQ_UNLOCK(ifq);

	return (err);
}
Beispiel #3
0
int
qfq_destroy(struct qfq_if *qif)
{
	struct ifclassq *ifq = qif->qif_ifq;
	int err;

	IFCQ_LOCK(ifq);
	err = qfq_destroy_locked(qif);
	IFCQ_UNLOCK(ifq);

	return (err);
}
Beispiel #4
0
int
priq_destroy(struct priq_if *pif)
{
	struct ifclassq *ifq = pif->pif_ifq;
	int err;

	IFCQ_LOCK(ifq);
	err = priq_destroy_locked(pif);
	IFCQ_UNLOCK(ifq);

	return (err);
}
Beispiel #5
0
int
tcq_destroy(struct tcq_if *tif)
{
	struct ifclassq *ifq = tif->tif_ifq;
	int err;

	IFCQ_LOCK(ifq);
	err = tcq_destroy_locked(tif);
	IFCQ_UNLOCK(ifq);

	return (err);
}
Beispiel #6
0
int
altq_priq_remove_queue(struct pf_altq *a)
{
    struct priq_if *pif;
    int err;

    lck_mtx_assert(pf_lock, LCK_MTX_ASSERT_OWNED);

    if ((pif = a->altq_disc) == NULL)
        return (EINVAL);

    IFCQ_LOCK(pif->pif_ifq);
    err = priq_remove_queue(pif, a->qid);
    IFCQ_UNLOCK(pif->pif_ifq);

    return (err);
}
Beispiel #7
0
int
altq_priq_pfattach(struct pf_altq *a)
{
    struct ifnet *ifp;
    int error;

    lck_mtx_assert(pf_lock, LCK_MTX_ASSERT_OWNED);

    if ((ifp = ifunit(a->ifname)) == NULL || a->altq_disc == NULL)
        return (EINVAL);

    IFCQ_LOCK(&ifp->if_snd);
    error = altq_attach(IFCQ_ALTQ(&ifp->if_snd), ALTQT_PRIQ, a->altq_disc,
                        altq_priq_enqueue, altq_priq_dequeue, NULL, altq_priq_request);
    IFCQ_UNLOCK(&ifp->if_snd);

    return (error);
}
Beispiel #8
0
int
altq_priq_add_queue(struct pf_altq *a)
{
    struct priq_if *pif;
    int err;

    lck_mtx_assert(pf_lock, LCK_MTX_ASSERT_OWNED);

    if ((pif = a->altq_disc) == NULL)
        return (EINVAL);

    IFCQ_LOCK(pif->pif_ifq);
    err = priq_add_queue(pif, a->priority, a->qlimit,
                         a->pq_u.priq_opts.flags, a->qid, NULL);
    IFCQ_UNLOCK(pif->pif_ifq);

    return (err);
}
Beispiel #9
0
int
altq_fairq_add_queue(struct pf_altq *a)
{
	struct fairq_if *fif;
	struct fairq_opts *opts = &a->pq_u.fairq_opts;
	int err;

	lck_mtx_assert(pf_lock, LCK_MTX_ASSERT_OWNED);

	if ((fif = a->altq_disc) == NULL)
		return (EINVAL);

	IFCQ_LOCK(fif->fif_ifq);
	err = fairq_add_queue(fif, a->priority, a->qlimit, a->bandwidth,
	    opts->nbuckets, opts->flags, opts->hogs_m1, opts->lssc_m1,
	    opts->lssc_d, opts->lssc_m2, a->qid, NULL);
	IFCQ_UNLOCK(fif->fif_ifq);

	return (err);
}