Module Name: src
Committed By: joe
Date: Wed Jan 8 13:00:05 UTC 2025
Modified Files:
src/sys/altq: altq_blue.c altq_cbq.c altq_cdnr.c altq_classq.h
altq_conf.c altq_fifoq.c altq_hfsc.c altq_jobs.c altq_priq.c
altq_red.c altq_rio.c altq_rmclass.c altq_subr.c altq_wfq.c
Log Message:
return: remove parenthesis from return statements
To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/altq/altq_blue.c
cvs rdiff -u -r1.41 -r1.42 src/sys/altq/altq_cbq.c
cvs rdiff -u -r1.22 -r1.23 src/sys/altq/altq_cdnr.c src/sys/altq/altq_conf.c
cvs rdiff -u -r1.8 -r1.9 src/sys/altq/altq_classq.h
cvs rdiff -u -r1.18 -r1.19 src/sys/altq/altq_fifoq.c
cvs rdiff -u -r1.30 -r1.31 src/sys/altq/altq_hfsc.c
cvs rdiff -u -r1.13 -r1.14 src/sys/altq/altq_jobs.c
cvs rdiff -u -r1.28 -r1.29 src/sys/altq/altq_priq.c
cvs rdiff -u -r1.35 -r1.36 src/sys/altq/altq_red.c
cvs rdiff -u -r1.25 -r1.26 src/sys/altq/altq_rio.c
cvs rdiff -u -r1.31 -r1.32 src/sys/altq/altq_rmclass.c
cvs rdiff -u -r1.33 -r1.34 src/sys/altq/altq_subr.c
cvs rdiff -u -r1.23 -r1.24 src/sys/altq/altq_wfq.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/altq/altq_blue.c
diff -u src/sys/altq/altq_blue.c:1.26 src/sys/altq/altq_blue.c:1.27
--- src/sys/altq/altq_blue.c:1.26 Tue Sep 21 14:30:15 2021
+++ src/sys/altq/altq_blue.c Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_blue.c,v 1.26 2021/09/21 14:30:15 christos Exp $ */
+/* $NetBSD: altq_blue.c,v 1.27 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_blue.c,v 1.15 2005/04/13 03:44:24 suz Exp $ */
/*
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_blue.c,v 1.26 2021/09/21 14:30:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_blue.c,v 1.27 2025/01/08 13:00:04 joe Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -347,7 +347,7 @@ blue_detach(blue_queue_t *rqp)
free(rqp->rq_q, M_DEVBUF);
free(rqp->rq_blue, M_DEVBUF);
free(rqp, M_DEVBUF);
- return (error);
+ return error;
}
/*
@@ -376,7 +376,7 @@ blue_init(blue_t *rp, int flags, int pkt
}
microtime(&rp->blue_last);
- return (0);
+ return 0;
}
/*
@@ -492,10 +492,10 @@ blue_addq(blue_t *rp, class_queue_t *q,
rp->blue_stats.drop_bytes += m->m_pkthdr.len;
#endif
m_freem(m);
- return (-1);
+ return -1;
}
/* successfully queued */
- return (0);
+ return 0;
}
/*
@@ -507,7 +507,7 @@ drop_early(blue_t *rp)
{
if ((cprng_fast32() % rp->blue_max_pmark) < rp->blue_pmark) {
/* drop or mark */
- return (1);
+ return 1;
}
/* no drop/mark */
return (0);
@@ -524,7 +524,7 @@ mark_ecn(struct mbuf *m, struct altq_pkt
if (pktattr == NULL ||
(pktattr->pattr_af != AF_INET && pktattr->pattr_af != AF_INET6))
- return (0);
+ return 0;
/* verify that pattr_hdr is within the mbuf data */
for (m0 = m; m0 != NULL; m0 = m0->m_next)
@@ -534,7 +534,7 @@ mark_ecn(struct mbuf *m, struct altq_pkt
if (m0 == NULL) {
/* ick, pattr_hdr is stale */
pktattr->pattr_af = AF_UNSPEC;
- return (0);
+ return 0;
}
switch (pktattr->pattr_af) {
@@ -566,7 +566,7 @@ mark_ecn(struct mbuf *m, struct altq_pkt
sum = (sum >> 16) + (sum & 0xffff);
sum += (sum >> 16); /* add carry */
ip->ip_sum = htons(~sum & 0xffff);
- return (1);
+ return 1;
}
break;
#ifdef INET6
@@ -596,7 +596,7 @@ mark_ecn(struct mbuf *m, struct altq_pkt
}
/* not marked */
- return (0);
+ return 0;
}
/*
@@ -640,7 +640,7 @@ blue_getq(blue_t *rp, class_queue_t *q)
rp->blue_stats.xmit_packets++;
rp->blue_stats.xmit_bytes += m->m_pkthdr.len;
#endif
- return (m);
+ return m;
}
static int
@@ -655,7 +655,7 @@ blue_request(struct ifaltq *ifq, int req
ifq->ifq_len = 0;
break;
}
- return (0);
+ return 0;
}
Index: src/sys/altq/altq_cbq.c
diff -u src/sys/altq/altq_cbq.c:1.41 src/sys/altq/altq_cbq.c:1.42
--- src/sys/altq/altq_cbq.c:1.41 Thu Sep 26 02:39:09 2024
+++ src/sys/altq/altq_cbq.c Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_cbq.c,v 1.41 2024/09/26 02:39:09 ozaki-r Exp $ */
+/* $NetBSD: altq_cbq.c,v 1.42 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_cbq.c,v 1.21 2005/04/13 03:44:24 suz Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.41 2024/09/26 02:39:09 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.42 2025/01/08 13:00:04 joe Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -132,7 +132,7 @@ cbq_class_destroy(cbq_state_t *cbqp, str
if (cl == cbqp->ifnp.ctl_)
cbqp->ifnp.ctl_ = NULL;
#endif
- return (0);
+ return 0;
}
/* convert class handle to class pointer */
@@ -143,7 +143,7 @@ clh_to_clp(cbq_state_t *cbqp, u_int32_t
struct rm_class *cl;
if (chandle == 0)
- return (NULL);
+ return NULL;
/*
* first, try optimistically the slot matching the lower bits of
* the handle. if it fails, do the linear table search.
@@ -155,8 +155,8 @@ clh_to_clp(cbq_state_t *cbqp, u_int32_t
for (i = 0; i < CBQ_MAX_CLASSES; i++)
if ((cl = cbqp->cbq_class_tbl[i]) != NULL &&
cl->stats_.handle == chandle)
- return (cl);
- return (NULL);
+ return cl;
+ return NULL;
}
static int
@@ -193,7 +193,7 @@ cbq_clear_interface(cbq_state_t *cbqp)
}
} while (again);
- return (0);
+ return 0;
}
static int
@@ -206,7 +206,7 @@ cbq_request(struct ifaltq *ifq, int req,
cbq_purge(cbqp);
break;
}
- return (0);
+ return 0;
}
/* copy the stats info in rm_class to class_states_t */
@@ -255,7 +255,7 @@ cbq_pfattach(struct pf_altq *a)
error = altq_attach(&ifp->if_snd, ALTQT_CBQ, a->altq_disc,
cbq_enqueue, cbq_dequeue, cbq_request, NULL, NULL);
splx(s);
- return (error);
+ return error;
}
int
@@ -265,14 +265,14 @@ cbq_add_altq(struct pf_altq *a)
struct ifnet *ifp;
if ((ifp = ifunit(a->ifname)) == NULL)
- return (EINVAL);
+ return EINVAL;
if (!ALTQ_IS_READY(&ifp->if_snd))
- return (ENODEV);
+ return ENODEV;
/* allocate and initialize cbq_state_t */
cbqp = malloc(sizeof(cbq_state_t), M_DEVBUF, M_WAITOK|M_ZERO);
if (cbqp == NULL)
- return (ENOMEM);
+ return ENOMEM;
(void)memset(cbqp, 0, sizeof(cbq_state_t));
CALLOUT_INIT(&cbqp->cbq_callout);
cbqp->cbq_qlen = 0;
@@ -281,7 +281,7 @@ cbq_add_altq(struct pf_altq *a)
/* keep the state in pf_altq */
a->altq_disc = cbqp;
- return (0);
+ return 0;
}
int
@@ -290,7 +290,7 @@ cbq_remove_altq(struct pf_altq *a)
cbq_state_t *cbqp;
if ((cbqp = a->altq_disc) == NULL)
- return (EINVAL);
+ return EINVAL;
a->altq_disc = NULL;
cbq_clear_interface(cbqp);
@@ -303,7 +303,7 @@ cbq_remove_altq(struct pf_altq *a)
/* deallocate cbq_state_t */
free(cbqp, M_DEVBUF);
- return (0);
+ return 0;
}
#define NSEC_TO_PSEC(s) ((uint64_t)(s) * 1000)
@@ -317,9 +317,9 @@ cbq_add_queue(struct pf_altq *a)
int i, error;
if ((cbqp = a->altq_disc) == NULL)
- return (EINVAL);
+ return EINVAL;
if (a->qid == 0)
- return (EINVAL);
+ return EINVAL;
/*
* find a free slot in the class table. if the slot matching
@@ -338,7 +338,7 @@ cbq_add_queue(struct pf_altq *a)
opts = &a->pq_u.cbq_opts;
/* check parameters */
if (a->priority >= CBQ_MAXPRI)
- return (EINVAL);
+ return EINVAL;
/* Get pointers to parent and borrow classes. */
parent = clh_to_clp(cbqp, a->parent_qid);
@@ -353,12 +353,12 @@ cbq_add_queue(struct pf_altq *a)
*/
if (parent == NULL && (opts->flags & CBQCLF_ROOTCLASS) == 0) {
printf("cbq_add_queue: no parent class!\n");
- return (EINVAL);
+ return EINVAL;
}
if ((borrow != parent) && (borrow != NULL)) {
printf("cbq_add_class: borrow class != parent\n");
- return (EINVAL);
+ return EINVAL;
}
/*
@@ -366,17 +366,17 @@ cbq_add_queue(struct pf_altq *a)
*/
if ((opts->flags & CBQCLF_ROOTCLASS) != 0) {
if (parent != NULL)
- return (EINVAL);
+ return EINVAL;
if (cbqp->ifnp.root_)
- return (EINVAL);
+ return EINVAL;
}
if ((opts->flags & CBQCLF_DEFCLASS) != 0) {
if (cbqp->ifnp.default_)
- return (EINVAL);
+ return EINVAL;
}
if ((opts->flags & CBQCLF_CLASSMASK) == 0) {
if (a->qid == 0)
- return (EINVAL);
+ return EINVAL;
}
/*
@@ -389,7 +389,7 @@ cbq_add_queue(struct pf_altq *a)
opts->maxidle, opts->minidle, opts->offtime,
opts->flags);
if (error != 0)
- return (error);
+ return error;
cl = cbqp->ifnp.root_;
} else {
cl = rmc_newclass(a->priority,
@@ -399,7 +399,7 @@ cbq_add_queue(struct pf_altq *a)
opts->pktsize, opts->flags);
}
if (cl == NULL)
- return (ENOMEM);
+ return ENOMEM;
/* return handle to user space. */
cl->stats_.handle = a->qid;
@@ -411,7 +411,7 @@ cbq_add_queue(struct pf_altq *a)
if ((opts->flags & CBQCLF_DEFCLASS) != 0)
cbqp->ifnp.default_ = cl;
- return (0);
+ return 0;
}
int
@@ -422,14 +422,14 @@ cbq_remove_queue(struct pf_altq *a)
int i;
if ((cbqp = a->altq_disc) == NULL)
- return (EINVAL);
+ return EINVAL;
if ((cl = clh_to_clp(cbqp, a->qid)) == NULL)
- return (EINVAL);
+ return EINVAL;
/* if we are a parent class, then return an error. */
if (is_a_parent_class(cl))
- return (EINVAL);
+ return EINVAL;
/* delete the class */
rmc_delete_class(&cbqp->ifnp, cl);
@@ -447,7 +447,7 @@ cbq_remove_queue(struct pf_altq *a)
break;
}
- return (0);
+ return 0;
}
int
@@ -459,19 +459,19 @@ cbq_getqstats(struct pf_altq *a, void *u
int error = 0;
if ((cbqp = altq_lookup(a->ifname, ALTQT_CBQ)) == NULL)
- return (EBADF);
+ return EBADF;
if ((cl = clh_to_clp(cbqp, a->qid)) == NULL)
- return (EINVAL);
+ return EINVAL;
if (*nbytes < sizeof(stats))
- return (EINVAL);
+ return EINVAL;
memset(&stats, 0, sizeof(stats));
get_class_stats(&stats, cl);
if ((error = copyout((void *)&stats, ubuf, sizeof(stats))) != 0)
- return (error);
+ return error;
*nbytes = sizeof(stats);
return (0);
}
@@ -507,7 +507,7 @@ cbq_enqueue(struct ifaltq *ifq, struct m
printf("altq: packet for %s does not have pkthdr\n",
ifq->altq_ifp->if_xname);
m_freem(m);
- return (ENOBUFS);
+ return ENOBUFS;
}
cl = NULL;
if ((t = m_tag_find(m, PACKET_TAG_ALTQ_QID)) != NULL)
@@ -520,7 +520,7 @@ cbq_enqueue(struct ifaltq *ifq, struct m
cl = cbqp->ifnp.default_;
if (cl == NULL) {
m_freem(m);
- return (ENOBUFS);
+ return ENOBUFS;
}
}
#ifdef ALTQ3_COMPAT
@@ -537,13 +537,13 @@ cbq_enqueue(struct ifaltq *ifq, struct m
if (rmc_queue_packet(cl, m) != 0) {
/* drop occurred. some mbuf was freed in rmc_queue_packet. */
PKTCNTR_ADD(&cl->stats_.drop_cnt, len);
- return (ENOBUFS);
+ return ENOBUFS;
}
/* successfully queued. */
++cbqp->cbq_qlen;
IFQ_INC_LEN(ifq);
- return (0);
+ return 0;
}
static struct mbuf *
@@ -561,7 +561,7 @@ cbq_dequeue(struct ifaltq *ifq, int op)
/* Update the class. */
rmc_update_class_util(&cbqp->ifnp);
}
- return (m);
+ return m;
}
/*
@@ -615,12 +615,12 @@ cbq_add_class(struct cbq_add_class *acp)
ifacename = acp->cbq_iface.cbq_ifacename;
if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
+ return EBADF;
/* check parameters */
if (acp->cbq_class.priority >= CBQ_MAXPRI ||
acp->cbq_class.maxq > CBQ_MAXQSIZE)
- return (EINVAL);
+ return EINVAL;
/* Get pointers to parent and borrow classes. */
parent = clh_to_clp(cbqp, acp->cbq_class.parent_class_handle);
@@ -632,12 +632,12 @@ cbq_add_class(struct cbq_add_class *acp)
*/
if (parent == NULL && (acp->cbq_class.flags & CBQCLF_ROOTCLASS) == 0) {
printf("cbq_add_class: no parent class!\n");
- return (EINVAL);
+ return EINVAL;
}
if ((borrow != parent) && (borrow != NULL)) {
printf("cbq_add_class: borrow class != parent\n");
- return (EINVAL);
+ return EINVAL;
}
return cbq_class_create(cbqp, acp, parent, borrow);
@@ -652,14 +652,14 @@ cbq_delete_class(struct cbq_delete_class
ifacename = dcp->cbq_iface.cbq_ifacename;
if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
+ return EBADF;
if ((cl = clh_to_clp(cbqp, dcp->cbq_class_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
/* if we are a parent class, then return an error. */
if (is_a_parent_class(cl))
- return (EINVAL);
+ return EINVAL;
/* if a filter has a reference to this class delete the filter */
acc_discard_filters(&cbqp->cbq_classifier, cl, 0);
@@ -676,18 +676,18 @@ cbq_modify_class(struct cbq_modify_class
ifacename = acp->cbq_iface.cbq_ifacename;
if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
+ return EBADF;
/* Get pointer to this class */
if ((cl = clh_to_clp(cbqp, acp->cbq_class_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
if (rmc_modclass(cl, acp->cbq_class.pico_sec_per_byte,
acp->cbq_class.maxq, acp->cbq_class.maxidle,
acp->cbq_class.minidle, acp->cbq_class.offtime,
acp->cbq_class.pktsize) < 0)
- return (EINVAL);
- return (0);
+ return EINVAL;
+ return 0;
}
/*
@@ -716,7 +716,7 @@ cbq_class_create(cbq_state_t *cbqp, stru
if (cbqp->cbq_class_tbl[i] == NULL)
break;
if (i == CBQ_MAX_CLASSES)
- return (EINVAL);
+ return EINVAL;
chandle = i; /* use the slot number as class handle */
/*
@@ -729,7 +729,7 @@ cbq_class_create(cbq_state_t *cbqp, stru
RM_MAXQUEUED, spec->maxidle, spec->minidle, spec->offtime,
spec->flags);
if (error)
- return (error);
+ return error;
cl = cbqp->ifnp.root_;
} else {
cl = rmc_newclass(spec->priority,
@@ -739,7 +739,7 @@ cbq_class_create(cbq_state_t *cbqp, stru
spec->pktsize, spec->flags);
}
if (cl == NULL)
- return (ENOMEM);
+ return ENOMEM;
/* return handle to user space. */
acp->cbq_class_handle = chandle;
@@ -755,7 +755,7 @@ cbq_class_create(cbq_state_t *cbqp, stru
if ((spec->flags & CBQCLF_CTLCLASS) != 0)
cbqp->ifnp.ctl_ = cl;
- return (0);
+ return 0;
}
static int
@@ -767,11 +767,11 @@ cbq_add_filter(struct cbq_add_filter *af
ifacename = afp->cbq_iface.cbq_ifacename;
if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
+ return EBADF;
/* Get the pointer to class. */
if ((cl = clh_to_clp(cbqp, afp->cbq_class_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
return acc_add_filter(&cbqp->cbq_classifier, &afp->cbq_filter,
cl, &afp->cbq_filter_handle);
@@ -785,7 +785,7 @@ cbq_delete_filter(struct cbq_delete_filt
ifacename = dfp->cbq_iface.cbq_ifacename;
if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
+ return EBADF;
return acc_delete_filter(&cbqp->cbq_classifier,
dfp->cbq_filter_handle);
@@ -803,7 +803,7 @@ cbq_clear_hierarchy(struct cbq_interface
ifacename = ifacep->cbq_ifacename;
if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
+ return EBADF;
return cbq_clear_interface(cbqp);
}
@@ -828,7 +828,7 @@ cbq_set_enable(struct cbq_interface *ep,
ifacename = ep->cbq_ifacename;
if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
+ return EBADF;
switch (enable) {
case ENABLE:
@@ -847,7 +847,7 @@ cbq_set_enable(struct cbq_interface *ep,
error = altq_disable(cbqp->ifnp.ifq_);
break;
}
- return (error);
+ return error;
}
static int
@@ -865,9 +865,9 @@ cbq_getstats(struct cbq_getstats *gsp)
usp = gsp->stats;
if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
+ return EBADF;
if (nclasses <= 0)
- return (EINVAL);
+ return EINVAL;
for (n = 0, i = 0; n < nclasses && i < CBQ_MAX_CLASSES; n++, i++) {
while ((cl = cbqp->cbq_class_tbl[i]) == NULL)
@@ -880,12 +880,12 @@ cbq_getstats(struct cbq_getstats *gsp)
if ((error = copyout((void *)&stats, (void *)usp++,
sizeof(stats))) != 0)
- return (error);
+ return error;
}
out:
gsp->nclasses = n;
- return (error);
+ return error;
}
static int
@@ -898,14 +898,14 @@ cbq_ifattach(struct cbq_interface *iface
ifacename = ifacep->cbq_ifacename;
if ((ifp = ifunit(ifacename)) == NULL)
- return (ENXIO);
+ return ENXIO;
if (!ALTQ_IS_READY(&ifp->if_snd))
- return (ENXIO);
+ return ENXIO;
/* allocate and initialize cbq_state_t */
new_cbqp = malloc(sizeof(cbq_state_t), M_DEVBUF, M_WAITOK|M_ZERO);
if (new_cbqp == NULL)
- return (ENOMEM);
+ return ENOMEM;
CALLOUT_INIT(&new_cbqp->cbq_callout);
new_cbqp->cbq_qlen = 0;
@@ -919,14 +919,14 @@ cbq_ifattach(struct cbq_interface *iface
&new_cbqp->cbq_classifier, acc_classify);
if (error) {
free(new_cbqp, M_DEVBUF);
- return (error);
+ return error;
}
/* prepend to the list of cbq_state_t's. */
new_cbqp->cbq_next = cbq_list;
cbq_list = new_cbqp;
- return (0);
+ return 0;
}
static int
@@ -963,7 +963,7 @@ cbq_ifdetach(struct cbq_interface *iface
/* deallocate cbq_state_t */
free(cbqp, M_DEVBUF);
- return (0);
+ return 0;
}
/*
@@ -976,7 +976,7 @@ int
cbqopen(dev_t dev, int flag, int fmt,
struct lwp *l)
{
- return (0);
+ return 0;
}
int
@@ -996,7 +996,7 @@ cbqclose(dev_t dev, int flag, int fmt,
error = err;
}
- return (error);
+ return error;
}
int
@@ -1015,7 +1015,7 @@ cbqioctl(dev_t dev, ioctlcmd_t cmd, void
KAUTH_NETWORK_ALTQ, KAUTH_REQ_NETWORK_ALTQ_CBQ, NULL, NULL,
NULL);
if (error)
- return (error);
+ return error;
break;
}
Index: src/sys/altq/altq_cdnr.c
diff -u src/sys/altq/altq_cdnr.c:1.22 src/sys/altq/altq_cdnr.c:1.23
--- src/sys/altq/altq_cdnr.c:1.22 Tue Sep 21 14:30:15 2021
+++ src/sys/altq/altq_cdnr.c Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_cdnr.c,v 1.22 2021/09/21 14:30:15 christos Exp $ */
+/* $NetBSD: altq_cdnr.c,v 1.23 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_cdnr.c,v 1.15 2005/04/13 03:44:24 suz Exp $ */
/*
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_cdnr.c,v 1.22 2021/09/21 14:30:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_cdnr.c,v 1.23 2025/01/08 13:00:04 joe Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -142,7 +142,7 @@ altq_cdnr_input(struct mbuf *m, int af)
ifp = m_get_rcvif_NOMPSAFE(m);
if (!ALTQ_IS_CNDTNING(&ifp->if_snd))
/* traffic conditioner is not enabled on this interface */
- return (1);
+ return 1;
top = ifp->if_snd.altq_cdnr;
@@ -172,12 +172,12 @@ altq_cdnr_input(struct mbuf *m, int af)
switch (tca->tca_code) {
case TCACODE_PASS:
- return (1);
+ return 1;
case TCACODE_DROP:
m_freem(m);
- return (0);
+ return 0;
case TCACODE_RETURN:
- return (0);
+ return 0;
case TCACODE_MARK:
#ifdef INET6
if (af == AF_INET6) {
@@ -192,14 +192,14 @@ altq_cdnr_input(struct mbuf *m, int af)
#endif
ip->ip_tos = tca->tca_dscp |
(ip->ip_tos & DSCP_CUMASK);
- return (1);
+ return 1;
case TCACODE_NEXT:
cb = tca->tca_next;
tca = (*cb->cb_input)(cb, &pktinfo);
break;
case TCACODE_NONE:
default:
- return (1);
+ return 1;
}
}
}
@@ -213,8 +213,8 @@ tcb_lookup(char *ifname)
if ((ifp = ifunit(ifname)) != NULL)
LIST_FOREACH(top, &tcb_list, tc_next)
if (top->tc_ifq->altq_ifp == ifp)
- return (top);
- return (NULL);
+ return top;
+ return NULL;
}
static struct cdnr_block *
@@ -224,11 +224,11 @@ cdnr_handle2cb(u_long handle)
cb = (struct cdnr_block *)handle;
if (handle != ALIGN(cb))
- return (NULL);
+ return NULL;
if (cb == NULL || cb->cb_handle != handle)
- return (NULL);
- return (cb);
+ return NULL;
+ return cb;
}
static u_long
@@ -261,12 +261,12 @@ cdnr_cballoc(struct top_cdnr *top, int t
size = sizeof(struct tswtcm);
break;
default:
- return (NULL);
+ return NULL;
}
cb = malloc(size, M_DEVBUF, M_WAITOK|M_ZERO);
if (cb == NULL)
- return (NULL);
+ return NULL;
cb->cb_len = size;
cb->cb_type = type;
@@ -337,7 +337,7 @@ generic_element_destroy(struct cdnr_bloc
default:
error = EINVAL;
}
- return (error);
+ return error;
}
static int
@@ -353,7 +353,7 @@ tca_verify_action(struct tc_action *utca
case TCACODE_HANDLE:
/* verify handle value */
if (cdnr_handle2cb(utca->tca_handle) == NULL)
- return (-1);
+ return -1;
break;
case TCACODE_NONE:
@@ -361,9 +361,9 @@ tca_verify_action(struct tc_action *utca
case TCACODE_NEXT:
default:
/* should not be passed from a user */
- return (-1);
+ return -1;
}
- return (0);
+ return 0;
}
static void
@@ -410,7 +410,7 @@ top_create(struct ifaltq *ifq)
struct top_cdnr *top;
if ((top = cdnr_cballoc(NULL, TCETYPE_TOP, NULL)) == NULL)
- return (NULL);
+ return NULL;
top->tc_ifq = ifq;
/* set default action for the top level conditioner */
@@ -420,7 +420,7 @@ top_create(struct ifaltq *ifq)
ifq->altq_cdnr = top;
- return (top);
+ return top;
}
static int
@@ -455,7 +455,7 @@ top_destroy(struct top_cdnr *top)
altq_input = NULL;
}
- return (0);
+ return 0;
}
/*
@@ -467,26 +467,26 @@ element_create(struct top_cdnr *top, str
struct cdnr_block *cb;
if (tca_verify_action(action) < 0)
- return (NULL);
+ return NULL;
if ((cb = cdnr_cballoc(top, TCETYPE_ELEMENT, NULL)) == NULL)
- return (NULL);
+ return NULL;
tca_import_action(&cb->cb_action, action);
- return (cb);
+ return cb;
}
static int
element_destroy(struct cdnr_block *cb)
{
if (cb->cb_ref > 0)
- return (EBUSY);
+ return EBUSY;
tca_invalidate_action(&cb->cb_action);
cdnr_cbdestroy(cb);
- return (0);
+ return 0;
}
/*
@@ -524,31 +524,31 @@ tbm_create(struct top_cdnr *top, struct
if (tca_verify_action(in_action) < 0
|| tca_verify_action(out_action) < 0)
- return (NULL);
+ return NULL;
if ((tbm = cdnr_cballoc(top, TCETYPE_TBMETER,
tbm_input)) == NULL)
- return (NULL);
+ return NULL;
tb_import_profile(&tbm->tb, profile);
tca_import_action(&tbm->in_action, in_action);
tca_import_action(&tbm->out_action, out_action);
- return (tbm);
+ return tbm;
}
static int
tbm_destroy(struct tbmeter *tbm)
{
if (tbm->cdnrblk.cb_ref > 0)
- return (EBUSY);
+ return EBUSY;
tca_invalidate_action(&tbm->in_action);
tca_invalidate_action(&tbm->out_action);
cdnr_cbdestroy(tbm);
- return (0);
+ return 0;
}
static struct tc_action *
@@ -598,11 +598,11 @@ trtcm_create(struct top_cdnr *top, struc
if (tca_verify_action(green_action) < 0
|| tca_verify_action(yellow_action) < 0
|| tca_verify_action(red_action) < 0)
- return (NULL);
+ return NULL;
if ((tcm = cdnr_cballoc(top, TCETYPE_TRTCM,
trtcm_input)) == NULL)
- return (NULL);
+ return NULL;
tb_import_profile(&tcm->cmtd_tb, cmtd_profile);
tb_import_profile(&tcm->peak_tb, peak_profile);
@@ -627,21 +627,21 @@ trtcm_create(struct top_cdnr *top, struc
tcm->coloraware = coloraware;
- return (tcm);
+ return tcm;
}
static int
trtcm_destroy(struct trtcm *tcm)
{
if (tcm->cdnrblk.cb_ref > 0)
- return (EBUSY);
+ return EBUSY;
tca_invalidate_action(&tcm->green_action);
tca_invalidate_action(&tcm->yellow_action);
tca_invalidate_action(&tcm->red_action);
cdnr_cbdestroy(tcm);
- return (0);
+ return 0;
}
static struct tc_action *
@@ -720,11 +720,11 @@ tswtcm_create(struct top_cdnr *top, u_in
if (tca_verify_action(green_action) < 0
|| tca_verify_action(yellow_action) < 0
|| tca_verify_action(red_action) < 0)
- return (NULL);
+ return NULL;
if ((tsw = cdnr_cballoc(top, TCETYPE_TSWTCM,
tswtcm_input)) == NULL)
- return (NULL);
+ return NULL;
tca_import_action(&tsw->green_action, green_action);
tca_import_action(&tsw->yellow_action, yellow_action);
@@ -752,21 +752,21 @@ tswtcm_create(struct top_cdnr *top, u_in
/* timewin is converted from msec to machine clock unit */
tsw->timewin = (u_int64_t)machclk_freq * avg_interval / 1000;
- return (tsw);
+ return tsw;
}
static int
tswtcm_destroy(struct tswtcm *tsw)
{
if (tsw->cdnrblk.cb_ref > 0)
- return (EBUSY);
+ return EBUSY;
tca_invalidate_action(&tsw->green_action);
tca_invalidate_action(&tsw->yellow_action);
tca_invalidate_action(&tsw->red_action);
cdnr_cbdestroy(tsw);
- return (0);
+ return 0;
}
static struct tc_action *
@@ -839,14 +839,14 @@ cdnrcmd_if_attach(char *ifname)
struct top_cdnr *top;
if ((ifp = ifunit(ifname)) == NULL)
- return (EBADF);
+ return EBADF;
if (ifp->if_snd.altq_cdnr != NULL)
- return (EBUSY);
+ return EBUSY;
if ((top = top_create(&ifp->if_snd)) == NULL)
- return (ENOMEM);
- return (0);
+ return ENOMEM;
+ return 0;
}
static int
@@ -855,7 +855,7 @@ cdnrcmd_if_detach(char *ifname)
struct top_cdnr *top;
if ((top = tcb_lookup(ifname)) == NULL)
- return (EBADF);
+ return EBADF;
return top_destroy(top);
}
@@ -867,14 +867,14 @@ cdnrcmd_add_element(struct cdnr_add_elem
struct cdnr_block *cb;
if ((top = tcb_lookup(ap->iface.cdnr_ifname)) == NULL)
- return (EBADF);
+ return EBADF;
cb = element_create(top, &ap->action);
if (cb == NULL)
- return (EINVAL);
+ return EINVAL;
/* return a class handle to the user */
ap->cdnr_handle = cdnr_cb2handle(cb);
- return (0);
+ return 0;
}
static int
@@ -884,10 +884,10 @@ cdnrcmd_delete_element(struct cdnr_delet
struct cdnr_block *cb;
if ((top = tcb_lookup(ap->iface.cdnr_ifname)) == NULL)
- return (EBADF);
+ return EBADF;
if ((cb = cdnr_handle2cb(ap->cdnr_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
if (cb->cb_type != TCETYPE_ELEMENT)
return generic_element_destroy(cb);
@@ -902,10 +902,10 @@ cdnrcmd_add_filter(struct cdnr_add_filte
struct cdnr_block *cb;
if ((top = tcb_lookup(ap->iface.cdnr_ifname)) == NULL)
- return (EBADF);
+ return EBADF;
if ((cb = cdnr_handle2cb(ap->cdnr_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
return acc_add_filter(&top->tc_classifier, &ap->filter,
cb, &ap->filter_handle);
@@ -917,7 +917,7 @@ cdnrcmd_delete_filter(struct cdnr_delete
struct top_cdnr *top;
if ((top = tcb_lookup(ap->iface.cdnr_ifname)) == NULL)
- return (EBADF);
+ return EBADF;
return acc_delete_filter(&top->tc_classifier, ap->filter_handle);
}
@@ -929,14 +929,14 @@ cdnrcmd_add_tbm(struct cdnr_add_tbmeter
struct tbmeter *tbm;
if ((top = tcb_lookup(ap->iface.cdnr_ifname)) == NULL)
- return (EBADF);
+ return EBADF;
tbm = tbm_create(top, &ap->profile, &ap->in_action, &ap->out_action);
if (tbm == NULL)
- return (EINVAL);
+ return EINVAL;
/* return a class handle to the user */
ap->cdnr_handle = cdnr_cb2handle(&tbm->cdnrblk);
- return (0);
+ return 0;
}
static int
@@ -945,11 +945,11 @@ cdnrcmd_modify_tbm(struct cdnr_modify_tb
struct tbmeter *tbm;
if ((tbm = (struct tbmeter *)cdnr_handle2cb(ap->cdnr_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
tb_import_profile(&tbm->tb, &ap->profile);
- return (0);
+ return 0;
}
static int
@@ -958,12 +958,12 @@ cdnrcmd_tbm_stats(struct cdnr_tbmeter_st
struct tbmeter *tbm;
if ((tbm = (struct tbmeter *)cdnr_handle2cb(ap->cdnr_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
ap->in_cnt = tbm->in_cnt;
ap->out_cnt = tbm->out_cnt;
- return (0);
+ return 0;
}
static int
@@ -973,17 +973,17 @@ cdnrcmd_add_trtcm(struct cdnr_add_trtcm
struct trtcm *tcm;
if ((top = tcb_lookup(ap->iface.cdnr_ifname)) == NULL)
- return (EBADF);
+ return EBADF;
tcm = trtcm_create(top, &ap->cmtd_profile, &ap->peak_profile,
&ap->green_action, &ap->yellow_action,
&ap->red_action, ap->coloraware);
if (tcm == NULL)
- return (EINVAL);
+ return EINVAL;
/* return a class handle to the user */
ap->cdnr_handle = cdnr_cb2handle(&tcm->cdnrblk);
- return (0);
+ return 0;
}
static int
@@ -992,12 +992,12 @@ cdnrcmd_modify_trtcm(struct cdnr_modify_
struct trtcm *tcm;
if ((tcm = (struct trtcm *)cdnr_handle2cb(ap->cdnr_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
tb_import_profile(&tcm->cmtd_tb, &ap->cmtd_profile);
tb_import_profile(&tcm->peak_tb, &ap->peak_profile);
- return (0);
+ return 0;
}
static int
@@ -1006,7 +1006,7 @@ cdnrcmd_tcm_stats(struct cdnr_tcm_stats
struct cdnr_block *cb;
if ((cb = cdnr_handle2cb(ap->cdnr_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
if (cb->cb_type == TCETYPE_TRTCM) {
struct trtcm *tcm = (struct trtcm *)cb;
@@ -1021,9 +1021,9 @@ cdnrcmd_tcm_stats(struct cdnr_tcm_stats
ap->yellow_cnt = tsw->yellow_cnt;
ap->red_cnt = tsw->red_cnt;
} else
- return (EINVAL);
+ return EINVAL;
- return (0);
+ return 0;
}
static int
@@ -1033,20 +1033,20 @@ cdnrcmd_add_tswtcm(struct cdnr_add_tswtc
struct tswtcm *tsw;
if ((top = tcb_lookup(ap->iface.cdnr_ifname)) == NULL)
- return (EBADF);
+ return EBADF;
if (ap->cmtd_rate > ap->peak_rate)
- return (EINVAL);
+ return EINVAL;
tsw = tswtcm_create(top, ap->cmtd_rate, ap->peak_rate,
ap->avg_interval, &ap->green_action,
&ap->yellow_action, &ap->red_action);
if (tsw == NULL)
- return (EINVAL);
+ return EINVAL;
/* return a class handle to the user */
ap->cdnr_handle = cdnr_cb2handle(&tsw->cdnrblk);
- return (0);
+ return 0;
}
static int
@@ -1055,10 +1055,10 @@ cdnrcmd_modify_tswtcm(struct cdnr_modify
struct tswtcm *tsw;
if ((tsw = (struct tswtcm *)cdnr_handle2cb(ap->cdnr_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
if (ap->cmtd_rate > ap->peak_rate)
- return (EINVAL);
+ return EINVAL;
/* convert rates from bits/sec to bytes/sec */
tsw->cmtd_rate = ap->cmtd_rate / 8;
@@ -1068,7 +1068,7 @@ cdnrcmd_modify_tswtcm(struct cdnr_modify
/* timewin is converted from msec to machine clock unit */
tsw->timewin = (u_int64_t)machclk_freq * ap->avg_interval / 1000;
- return (0);
+ return 0;
}
static int
@@ -1083,7 +1083,7 @@ cdnrcmd_get_stats(struct cdnr_get_stats
int error, n, nskip, nelements;
if ((top = tcb_lookup(ap->iface.cdnr_ifname)) == NULL)
- return (EBADF);
+ return EBADF;
/* copy action stats */
(void)memcpy(ap->cnts, top->tc_cnts, sizeof(ap->cnts));
@@ -1092,7 +1092,7 @@ cdnrcmd_get_stats(struct cdnr_get_stats
nelements = ap->nelements;
usp = ap->tce_stats;
if (nelements <= 0 || usp == NULL)
- return (0);
+ return 0;
nskip = ap->nskip;
n = 0;
@@ -1129,14 +1129,14 @@ cdnrcmd_get_stats(struct cdnr_get_stats
if ((error = copyout((void *)&tce, (void *)usp++,
sizeof(tce))) != 0)
- return (error);
+ return error;
if (++n == nelements)
break;
}
ap->nelements = n;
- return (0);
+ return 0;
}
/*
@@ -1151,7 +1151,7 @@ cdnropen(dev_t dev, int flag, int fmt,
if (machclk_freq == 0) {
printf("cdnr: no CPU clock available!\n");
- return (ENXIO);
+ return ENXIO;
}
/* everything will be done when the queueing scheme is attached. */
@@ -1173,7 +1173,7 @@ cdnrclose(dev_t dev, int flag, int fmt,
}
altq_input = NULL;
- return (error);
+ return error;
}
int
Index: src/sys/altq/altq_conf.c
diff -u src/sys/altq/altq_conf.c:1.22 src/sys/altq/altq_conf.c:1.23
--- src/sys/altq/altq_conf.c:1.22 Tue Sep 21 14:30:15 2021
+++ src/sys/altq/altq_conf.c Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_conf.c,v 1.22 2021/09/21 14:30:15 christos Exp $ */
+/* $NetBSD: altq_conf.c,v 1.23 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_conf.c,v 1.24 2005/04/13 03:44:24 suz Exp $ */
/*
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_conf.c,v 1.22 2021/09/21 14:30:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_conf.c,v 1.23 2025/01/08 13:00:04 joe Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -188,7 +188,7 @@ altqopen(dev_t dev, int flag, int fmt, s
int unit = minor(dev);
if (unit == 0)
- return (0);
+ return 0;
if (unit < naltqsw)
return (*altqsw[unit].d_open)(dev, flag, fmt, l);
@@ -201,7 +201,7 @@ altqclose(dev_t dev, int flag, int fmt,
int unit = minor(dev);
if (unit == 0)
- return (0);
+ return 0;
if (unit < naltqsw)
return (*altqsw[unit].d_close)(dev, flag, fmt, l);
@@ -228,7 +228,7 @@ altqioctl(dev_t dev, ioctlcmd_t cmd, voi
l->l_cred, KAUTH_NETWORK_ALTQ,
KAUTH_REQ_NETWORK_ALTQ_CONF, NULL, NULL,
NULL)) != 0)
- return (error);
+ return error;
break;
}
@@ -238,19 +238,19 @@ altqioctl(dev_t dev, ioctlcmd_t cmd, voi
if ((ifp = ifunit(typereq->ifname)) == NULL)
return (EINVAL);
typereq->arg = (u_long)ifp->if_snd.altq_type;
- return (0);
+ return 0;
case ALTQTBRSET:
tbrreq = (struct tbrreq *)addr;
if ((ifp = ifunit(tbrreq->ifname)) == NULL)
- return (EINVAL);
+ return EINVAL;
return tbr_set(&ifp->if_snd, &tbrreq->tb_prof);
case ALTQTBRGET:
tbrreq = (struct tbrreq *)addr;
if ((ifp = ifunit(tbrreq->ifname)) == NULL)
- return (EINVAL);
+ return EINVAL;
return tbr_get(&ifp->if_snd, &tbrreq->tb_prof);
default:
- return (EINVAL);
+ return EINVAL;
}
}
if (unit < naltqsw)
@@ -324,13 +324,13 @@ altq_module_register(struct altq_module_
int type = mdata->type;
if (type < 0 || type >= ALTQT_MAX)
- return (EINVAL);
+ return EINVAL;
#if (__FreeBSD_version < 502103)
if (altqsw[type].d_open != noopen)
#else
if (altqsw[type].d_open != NULL)
#endif
- return (EBUSY);
+ return EBUSY;
altqsw[type] = *mdata->altqsw; /* set discipline functions */
altq_modules[type] = mdata; /* save module data pointer */
#if (__FreeBSD_version < 502103)
@@ -340,7 +340,7 @@ altq_module_register(struct altq_module_
altqsw[type].dev = make_dev(&altq_cdevsw, type, UID_ROOT, GID_WHEEL,
0644, "altq/%s", altqsw[type].d_name);
#endif
- return (0);
+ return 0;
}
static int
@@ -349,11 +349,11 @@ altq_module_deregister(struct altq_modul
int type = mdata->type;
if (type < 0 || type >= ALTQT_MAX)
- return (EINVAL);
+ return EINVAL;
if (mdata != altq_modules[type])
- return (EINVAL);
+ return EINVAL;
if (altq_modules[type]->ref > 0)
- return (EBUSY);
+ return EBUSY;
#if (__FreeBSD_version < 502103)
destroy_dev(makedev(CDEV_MAJOR, type));
#else
@@ -361,7 +361,7 @@ altq_module_deregister(struct altq_modul
#endif
altqsw[type] = noqdisc;
altq_modules[type] = NULL;
- return (0);
+ return 0;
}
int
@@ -384,7 +384,7 @@ altq_module_handler(module_t mod, int cm
break;
}
- return (error);
+ return error;
}
#endif /* ALTQ_KLD */
Index: src/sys/altq/altq_classq.h
diff -u src/sys/altq/altq_classq.h:1.8 src/sys/altq/altq_classq.h:1.9
--- src/sys/altq/altq_classq.h:1.8 Thu Apr 19 21:50:06 2018
+++ src/sys/altq/altq_classq.h Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_classq.h,v 1.8 2018/04/19 21:50:06 christos Exp $ */
+/* $NetBSD: altq_classq.h,v 1.9 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_classq.h,v 1.6 2003/01/07 07:33:38 kjc Exp $ */
/*
@@ -109,14 +109,14 @@ _getq(class_queue_t *q)
struct mbuf *m, *m0;
if ((m = qtail(q)) == NULL)
- return (NULL);
+ return NULL;
if ((m0 = m->m_nextpkt) != m)
m->m_nextpkt = m0->m_nextpkt;
else
qtail(q) = NULL;
qlen(q)--;
m0->m_nextpkt = NULL;
- return (m0);
+ return m0;
}
/* drop a packet at the tail of the queue */
@@ -138,7 +138,7 @@ _getq_tail(class_queue_t *q)
qtail(q) = prev;
qlen(q)--;
m->m_nextpkt = NULL;
- return (m);
+ return m;
}
/* randomly select a packet in the queue */
@@ -166,7 +166,7 @@ _getq_random(class_queue_t *q)
}
qlen(q)--;
m->m_nextpkt = NULL;
- return (m);
+ return m;
}
static __inline void
Index: src/sys/altq/altq_fifoq.c
diff -u src/sys/altq/altq_fifoq.c:1.18 src/sys/altq/altq_fifoq.c:1.19
--- src/sys/altq/altq_fifoq.c:1.18 Tue Sep 21 14:30:15 2021
+++ src/sys/altq/altq_fifoq.c Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_fifoq.c,v 1.18 2021/09/21 14:30:15 christos Exp $ */
+/* $NetBSD: altq_fifoq.c,v 1.19 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_fifoq.c,v 1.12 2003/07/10 12:07:48 kjc Exp $ */
/*
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_fifoq.c,v 1.18 2021/09/21 14:30:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_fifoq.c,v 1.19 2025/01/08 13:00:04 joe Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -134,7 +134,7 @@ fifoqioctl(dev_t dev, ioctlcmd_t cmd, vo
if ((error = kauth_authorize_network(l->l_cred,
KAUTH_NETWORK_ALTQ, KAUTH_REQ_NETWORK_ALTQ_FIFOQ, NULL,
NULL, NULL)) != 0)
- return (error);
+ return error;
break;
}
@@ -270,7 +270,7 @@ fifoq_enqueue(struct ifaltq *ifq, struct
PKTCNTR_ADD(&q->q_stats.drop_cnt, m_pktlen(m));
#endif
m_freem(m);
- return (ENOBUFS);
+ return ENOBUFS;
}
/* enqueue the packet at the taile of the queue */
@@ -310,7 +310,7 @@ fifoq_dequeue(struct ifaltq *ifq, int op
return (q->q_head);
if ((m = q->q_head) == NULL)
- return (NULL);
+ return NULL;
if ((q->q_head = m->m_nextpkt) == NULL)
q->q_tail = NULL;
@@ -322,7 +322,7 @@ fifoq_dequeue(struct ifaltq *ifq, int op
if (q->q_len == 0)
q->q_stats.period++;
#endif
- return (m);
+ return m;
}
static int
@@ -335,7 +335,7 @@ fifoq_request(struct ifaltq *ifq, int re
fifoq_purge(q);
break;
}
- return (0);
+ return 0;
}
@@ -351,7 +351,7 @@ fifoq_detach(fifoq_state_t *q)
fifoq_purge(q);
if ((error = altq_detach(q->q_ifq)))
- return (error);
+ return error;
if (fifoq_list == q)
fifoq_list = q->q_next;
@@ -366,7 +366,7 @@ fifoq_detach(fifoq_state_t *q)
}
free(q, M_DEVBUF);
- return (error);
+ return error;
}
/*
Index: src/sys/altq/altq_hfsc.c
diff -u src/sys/altq/altq_hfsc.c:1.30 src/sys/altq/altq_hfsc.c:1.31
--- src/sys/altq/altq_hfsc.c:1.30 Tue Sep 21 14:30:15 2021
+++ src/sys/altq/altq_hfsc.c Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_hfsc.c,v 1.30 2021/09/21 14:30:15 christos Exp $ */
+/* $NetBSD: altq_hfsc.c,v 1.31 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_hfsc.c,v 1.26 2005/04/13 03:44:24 suz Exp $ */
/*
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_hfsc.c,v 1.30 2021/09/21 14:30:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_hfsc.c,v 1.31 2025/01/08 13:00:04 joe Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -181,12 +181,12 @@ hfsc_pfattach(struct pf_altq *a)
int s, error;
if ((ifp = ifunit(a->ifname)) == NULL || a->altq_disc == NULL)
- return (EINVAL);
+ return EINVAL;
s = splnet();
error = altq_attach(&ifp->if_snd, ALTQT_HFSC, a->altq_disc,
hfsc_enqueue, hfsc_dequeue, hfsc_request, NULL, NULL);
splx(s);
- return (error);
+ return error;
}
int
@@ -196,18 +196,18 @@ hfsc_add_altq(struct pf_altq *a)
struct ifnet *ifp;
if ((ifp = ifunit(a->ifname)) == NULL)
- return (EINVAL);
+ return EINVAL;
if (!ALTQ_IS_READY(&ifp->if_snd))
- return (ENODEV);
+ return ENODEV;
hif = malloc(sizeof(struct hfsc_if), M_DEVBUF, M_WAITOK|M_ZERO);
if (hif == NULL)
- return (ENOMEM);
+ return ENOMEM;
hif->hif_eligible = ellist_alloc();
if (hif->hif_eligible == NULL) {
free(hif, M_DEVBUF);
- return (ENOMEM);
+ return ENOMEM;
}
hif->hif_ifq = &ifp->if_snd;
@@ -215,7 +215,7 @@ hfsc_add_altq(struct pf_altq *a)
/* keep the state in pf_altq */
a->altq_disc = hif;
- return (0);
+ return 0;
}
int
@@ -224,7 +224,7 @@ hfsc_remove_altq(struct pf_altq *a)
struct hfsc_if *hif;
if ((hif = a->altq_disc) == NULL)
- return (EINVAL);
+ return EINVAL;
a->altq_disc = NULL;
(void)hfsc_clear_interface(hif);
@@ -234,7 +234,7 @@ hfsc_remove_altq(struct pf_altq *a)
free(hif, M_DEVBUF);
- return (0);
+ return 0;
}
int
@@ -246,7 +246,7 @@ hfsc_add_queue(struct pf_altq *a)
struct service_curve rtsc, lssc, ulsc;
if ((hif = a->altq_disc) == NULL)
- return (EINVAL);
+ return EINVAL;
opts = &a->pq_u.hfsc_opts;
@@ -254,13 +254,13 @@ hfsc_add_queue(struct pf_altq *a)
hif->hif_rootclass == NULL)
parent = NULL;
else if ((parent = clh_to_clp(hif, a->parent_qid)) == NULL)
- return (EINVAL);
+ return EINVAL;
if (a->qid == 0)
- return (EINVAL);
+ return EINVAL;
if (clh_to_clp(hif, a->qid) != NULL)
- return (EBUSY);
+ return EBUSY;
rtsc.m1 = opts->rtsc_m1;
rtsc.d = opts->rtsc_d;
@@ -275,9 +275,9 @@ hfsc_add_queue(struct pf_altq *a)
cl = hfsc_class_create(hif, &rtsc, &lssc, &ulsc,
parent, a->qlimit, opts->flags, a->qid);
if (cl == NULL)
- return (ENOMEM);
+ return ENOMEM;
- return (0);
+ return 0;
}
int
@@ -287,10 +287,10 @@ hfsc_remove_queue(struct pf_altq *a)
struct hfsc_class *cl;
if ((hif = a->altq_disc) == NULL)
- return (EINVAL);
+ return EINVAL;
if ((cl = clh_to_clp(hif, a->qid)) == NULL)
- return (EINVAL);
+ return EINVAL;
return (hfsc_class_destroy(cl));
}
@@ -304,21 +304,21 @@ hfsc_getqstats(struct pf_altq *a, void *
int error = 0;
if ((hif = altq_lookup(a->ifname, ALTQT_HFSC)) == NULL)
- return (EBADF);
+ return EBADF;
if ((cl = clh_to_clp(hif, a->qid)) == NULL)
- return (EINVAL);
+ return EINVAL;
if (*nbytes < sizeof(stats))
- return (EINVAL);
+ return EINVAL;
memset(&stats, 0, sizeof(stats));
get_class_stats(&stats, cl);
if ((error = copyout((void *)&stats, ubuf, sizeof(stats))) != 0)
- return (error);
+ return error;
*nbytes = sizeof(stats);
- return (0);
+ return 0;
}
#endif /* NPF > 0 */
@@ -351,7 +351,7 @@ hfsc_clear_interface(struct hfsc_if *hif
}
}
- return (0);
+ return 0;
}
static int
@@ -364,7 +364,7 @@ hfsc_request(struct ifaltq *ifq, int req
hfsc_purge(hif);
break;
}
- return (0);
+ return 0;
}
/* discard all the queued packets on the interface */
@@ -389,20 +389,20 @@ hfsc_class_create(struct hfsc_if *hif, s
int i, s;
if (hif->hif_classes >= HFSC_MAX_CLASSES)
- return (NULL);
+ return NULL;
#ifndef ALTQ_RED
if (flags & HFCF_RED) {
#ifdef ALTQ_DEBUG
printf("hfsc_class_create: RED not configured for HFSC!\n");
#endif
- return (NULL);
+ return NULL;
}
#endif
cl = malloc(sizeof(struct hfsc_class), M_DEVBUF, M_WAITOK|M_ZERO);
if (cl == NULL)
- return (NULL);
+ return NULL;
cl->cl_q = malloc(sizeof(class_queue_t), M_DEVBUF, M_WAITOK|M_ZERO);
if (cl->cl_q == NULL)
@@ -534,7 +534,7 @@ hfsc_class_create(struct hfsc_if *hif, s
}
splx(s);
- return (cl);
+ return cl;
err_ret:
if (cl->cl_actc != NULL)
@@ -558,7 +558,7 @@ hfsc_class_create(struct hfsc_if *hif, s
if (cl->cl_q != NULL)
free(cl->cl_q, M_DEVBUF);
free(cl, M_DEVBUF);
- return (NULL);
+ return NULL;
}
static int
@@ -567,10 +567,10 @@ hfsc_class_destroy(struct hfsc_class *cl
int i, s;
if (cl == NULL)
- return (0);
+ return 0;
if (is_a_parent_class(cl))
- return (EBUSY);
+ return EBUSY;
s = splnet();
@@ -634,7 +634,7 @@ hfsc_class_destroy(struct hfsc_class *cl
free(cl->cl_q, M_DEVBUF);
free(cl, M_DEVBUF);
- return (0);
+ return 0;
}
/*
@@ -658,7 +658,7 @@ hfsc_nextclass(struct hfsc_class *cl)
}
}
- return (cl);
+ return cl;
}
/*
@@ -680,7 +680,7 @@ hfsc_enqueue(struct ifaltq *ifq, struct
printf("altq: packet for %s does not have pkthdr\n",
ifq->altq_ifp->if_xname);
m_freem(m);
- return (ENOBUFS);
+ return ENOBUFS;
}
cl = NULL;
if ((t = m_tag_find(m, PACKET_TAG_ALTQ_QID)) != NULL)
@@ -710,7 +710,7 @@ hfsc_enqueue(struct ifaltq *ifq, struct
if (hfsc_addq(cl, m) != 0) {
/* drop occurred. mbuf was freed in hfsc_addq. */
PKTCNTR_ADD(&cl->cl_stats.drop_cnt, len);
- return (ENOBUFS);
+ return ENOBUFS;
}
IFQ_INC_LEN(ifq);
cl->cl_hif->hif_packets++;
@@ -719,7 +719,7 @@ hfsc_enqueue(struct ifaltq *ifq, struct
if (qlen(cl->cl_q) == 1)
set_active(cl, m_pktlen(m));
- return (0);
+ return 0;
}
/*
@@ -743,7 +743,7 @@ hfsc_dequeue(struct ifaltq *ifq, int op)
if (hif->hif_packets == 0)
/* no packet in the tree */
- return (NULL);
+ return NULL;
cur_time = read_machclk();
@@ -797,7 +797,7 @@ hfsc_dequeue(struct ifaltq *ifq, int op)
if (op == ALTDQ_POLL) {
hif->hif_pollcache = cl;
m = hfsc_pollq(cl);
- return (m);
+ return m;
}
}
@@ -828,7 +828,7 @@ hfsc_dequeue(struct ifaltq *ifq, int op)
set_passive(cl);
}
- return (m);
+ return m;
}
static int
@@ -846,7 +846,7 @@ hfsc_addq(struct hfsc_class *cl, struct
#endif
if (qlen(cl->cl_q) >= qlimit(cl->cl_q)) {
m_freem(m);
- return (-1);
+ return -1;
}
if (cl->cl_flags & HFCF_CLEARDSCP)
@@ -854,7 +854,7 @@ hfsc_addq(struct hfsc_class *cl, struct
_addq(cl->cl_q, m);
- return (0);
+ return 0;
}
static struct mbuf *
@@ -1177,7 +1177,7 @@ ellist_alloc(void)
head = malloc(sizeof(ellist_t), M_DEVBUF, M_WAITOK);
TAILQ_INIT(head);
- return (head);
+ return head;
}
static void
@@ -1265,7 +1265,7 @@ ellist_get_mindl(ellist_t *head, u_int64
if (cl == NULL || p->cl_d < cl->cl_d)
cl = p;
}
- return (cl);
+ return cl;
}
/*
@@ -1280,7 +1280,7 @@ actlist_alloc(void)
head = malloc(sizeof(actlist_t), M_DEVBUF, M_WAITOK);
TAILQ_INIT(head);
- return (head);
+ return head;
}
static void
@@ -1359,9 +1359,9 @@ actlist_firstfit(struct hfsc_class *cl,
TAILQ_FOREACH(p, cl->cl_actc, cl_actlist) {
if (p->cl_f <= cur_time)
- return (p);
+ return p;
}
- return (NULL);
+ return NULL;
}
/*
@@ -1407,7 +1407,7 @@ seg_x2y(u_int64_t x, u_int64_t sm)
* but divide it for the upper and lower bits to avoid overflow
*/
y = (x >> SM_SHIFT) * sm + (((x & SM_MASK) * sm) >> SM_SHIFT);
- return (y);
+ return y;
}
static inline u_int64_t
@@ -1423,7 +1423,7 @@ seg_y2x(u_int64_t y, u_int64_t ism)
x = (y >> ISM_SHIFT) * ism
+ (((y & ISM_MASK) * ism) >> ISM_SHIFT);
}
- return (x);
+ return x;
}
static inline u_int64_t
@@ -1432,7 +1432,7 @@ m2sm(u_int m)
u_int64_t sm;
sm = ((u_int64_t)m << SM_SHIFT) / 8 / machclk_freq;
- return (sm);
+ return sm;
}
static inline u_int64_t
@@ -1444,7 +1444,7 @@ m2ism(u_int m)
ism = HT_INFINITY;
else
ism = ((u_int64_t)machclk_freq << ISM_SHIFT) * 8 / m;
- return (ism);
+ return ism;
}
static inline u_int64_t
@@ -1453,7 +1453,7 @@ d2dx(u_int d)
u_int64_t dx;
dx = ((u_int64_t)d * machclk_freq) / 1000;
- return (dx);
+ return dx;
}
static u_int
@@ -1525,7 +1525,7 @@ rtsc_y2x(struct runtime_sc *rtsc, u_int6
x = rtsc->x + rtsc->dx
+ seg_y2x(y - rtsc->y - rtsc->dy, rtsc->ism2);
}
- return (x);
+ return x;
}
static u_int64_t
@@ -1542,7 +1542,7 @@ rtsc_x2y(struct runtime_sc *rtsc, u_int6
/* y belongs to the 2nd segment */
y = rtsc->y + rtsc->dy
+ seg_x2y(x - rtsc->x - rtsc->dx, rtsc->sm2);
- return (y);
+ return y;
}
/*
@@ -1692,19 +1692,19 @@ clh_to_clp(struct hfsc_if *hif, u_int32_
struct hfsc_class *cl;
if (chandle == 0)
- return (NULL);
+ return NULL;
/*
* first, try optimistically the slot matching the lower bits of
* the handle. if it fails, do the linear table search.
*/
i = chandle % HFSC_MAX_CLASSES;
if ((cl = hif->hif_class_tbl[i]) != NULL && cl->cl_handle == chandle)
- return (cl);
+ return cl;
for (i = 0; i < HFSC_MAX_CLASSES; i++)
if ((cl = hif->hif_class_tbl[i]) != NULL &&
cl->cl_handle == chandle)
- return (cl);
- return (NULL);
+ return cl;
+ return NULL;
}
#ifdef ALTQ3_COMPAT
@@ -1715,7 +1715,7 @@ hfsc_attach(struct ifaltq *ifq, u_int ba
hif = malloc(sizeof(struct hfsc_if), M_DEVBUF, M_WAITOK|M_ZERO);
if (hif == NULL)
- return (NULL);
+ return NULL;
hif->hif_eligible = ellist_alloc();
if (hif->hif_eligible == NULL) {
@@ -1729,7 +1729,7 @@ hfsc_attach(struct ifaltq *ifq, u_int ba
hif->hif_next = hif_list;
hif_list = hif;
- return (hif);
+ return hif;
}
static void
@@ -1771,21 +1771,21 @@ hfsc_class_modify(struct hfsc_class *cl,
rsc_tmp = malloc(sizeof(struct internal_sc), M_DEVBUF,
M_WAITOK);
if (rsc_tmp == NULL)
- return (ENOMEM);
+ return ENOMEM;
}
if (fsc != NULL && (fsc->m1 != 0 || fsc->m2 != 0) &&
cl->cl_fsc == NULL) {
fsc_tmp = malloc(sizeof(struct internal_sc), M_DEVBUF,
M_WAITOK);
if (fsc_tmp == NULL)
- return (ENOMEM);
+ return ENOMEM;
}
if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0) &&
cl->cl_usc == NULL) {
usc_tmp = malloc(sizeof(struct internal_sc), M_DEVBUF,
M_WAITOK);
if (usc_tmp == NULL)
- return (ENOMEM);
+ return ENOMEM;
}
cur_time = read_machclk();
@@ -1856,7 +1856,7 @@ hfsc_class_modify(struct hfsc_class *cl,
splx(s);
- return (0);
+ return 0;
}
/*
@@ -1871,7 +1871,7 @@ hfscopen(dev_t dev, int flag, int fmt,
if (machclk_freq == 0) {
printf("hfsc: no CPU clock available!\n");
- return (ENXIO);
+ return ENXIO;
}
/* everything will be done when the queueing scheme is attached. */
@@ -1919,7 +1919,7 @@ hfscioctl(dev_t dev, ioctlcmd_t cmd, voi
if ((error = kauth_authorize_network(l->l_cred,
KAUTH_NETWORK_ALTQ, KAUTH_REQ_NETWORK_ALTQ_HFSC, NULL,
NULL, NULL)) != 0)
- return (error);
+ return error;
break;
}
@@ -2005,10 +2005,10 @@ hfsccmd_if_attach(struct hfsc_attach *ap
int error;
if ((ifp = ifunit(ap->iface.hfsc_ifname)) == NULL)
- return (ENXIO);
+ return ENXIO;
if ((hif = hfsc_attach(&ifp->if_snd, ap->bandwidth)) == NULL)
- return (ENOMEM);
+ return ENOMEM;
/*
* set HFSC to this ifnet structure.
@@ -2018,7 +2018,7 @@ hfsccmd_if_attach(struct hfsc_attach *ap
&hif->hif_classifier, acc_classify)) != 0)
hfsc_detach(hif);
- return (error);
+ return error;
}
static int
@@ -2028,13 +2028,13 @@ hfsccmd_if_detach(struct hfsc_interface
int error;
if ((hif = altq_lookup(ap->hfsc_ifname, ALTQT_HFSC)) == NULL)
- return (EBADF);
+ return EBADF;
if (ALTQ_IS_ENABLED(hif->hif_ifq))
altq_disable(hif->hif_ifq);
if ((error = altq_detach(hif->hif_ifq)))
- return (error);
+ return error;
hfsc_detach(hif);
return 0;
@@ -2048,29 +2048,29 @@ hfsccmd_add_class(struct hfsc_add_class
int i;
if ((hif = altq_lookup(ap->iface.hfsc_ifname, ALTQT_HFSC)) == NULL)
- return (EBADF);
+ return EBADF;
if (ap->parent_handle == HFSC_NULLCLASS_HANDLE &&
hif->hif_rootclass == NULL)
parent = NULL;
else if ((parent = clh_to_clp(hif, ap->parent_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
/* assign a class handle (use a free slot number for now) */
for (i = 1; i < HFSC_MAX_CLASSES; i++)
if (hif->hif_class_tbl[i] == NULL)
break;
if (i == HFSC_MAX_CLASSES)
- return (EBUSY);
+ return EBUSY;
if ((cl = hfsc_class_create(hif, &ap->service_curve, NULL, NULL,
parent, ap->qlimit, ap->flags, i)) == NULL)
- return (ENOMEM);
+ return ENOMEM;
/* return a class handle to the user */
ap->class_handle = i;
- return (0);
+ return 0;
}
static int
@@ -2080,10 +2080,10 @@ hfsccmd_delete_class(struct hfsc_delete_
struct hfsc_class *cl;
if ((hif = altq_lookup(ap->iface.hfsc_ifname, ALTQT_HFSC)) == NULL)
- return (EBADF);
+ return EBADF;
if ((cl = clh_to_clp(hif, ap->class_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
return hfsc_class_destroy(cl);
}
@@ -2098,10 +2098,10 @@ hfsccmd_modify_class(struct hfsc_modify_
struct service_curve *usc = NULL;
if ((hif = altq_lookup(ap->iface.hfsc_ifname, ALTQT_HFSC)) == NULL)
- return (EBADF);
+ return EBADF;
if ((cl = clh_to_clp(hif, ap->class_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
if (ap->sctype & HFSC_REALTIMESC)
rsc = &ap->service_curve;
@@ -2120,16 +2120,16 @@ hfsccmd_add_filter(struct hfsc_add_filte
struct hfsc_class *cl;
if ((hif = altq_lookup(ap->iface.hfsc_ifname, ALTQT_HFSC)) == NULL)
- return (EBADF);
+ return EBADF;
if ((cl = clh_to_clp(hif, ap->class_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
if (is_a_parent_class(cl)) {
#ifdef ALTQ_DEBUG
printf("hfsccmd_add_filter: not a leaf class!\n");
#endif
- return (EINVAL);
+ return EINVAL;
}
return acc_add_filter(&hif->hif_classifier, &ap->filter,
@@ -2142,7 +2142,7 @@ hfsccmd_delete_filter(struct hfsc_delete
struct hfsc_if *hif;
if ((hif = altq_lookup(ap->iface.hfsc_ifname, ALTQT_HFSC)) == NULL)
- return (EBADF);
+ return EBADF;
return acc_delete_filter(&hif->hif_classifier,
ap->filter_handle);
@@ -2157,7 +2157,7 @@ hfsccmd_class_stats(struct hfsc_class_st
int n, nclasses, error;
if ((hif = altq_lookup(ap->iface.hfsc_ifname, ALTQT_HFSC)) == NULL)
- return (EBADF);
+ return EBADF;
ap->cur_time = read_machclk();
ap->machclk_freq = machclk_freq;
@@ -2170,7 +2170,7 @@ hfsccmd_class_stats(struct hfsc_class_st
cl = hfsc_nextclass(cl), n++)
;
if (n != nclasses)
- return (EINVAL);
+ return EINVAL;
/* then, read the next N classes in the tree */
nclasses = ap->nclasses;
@@ -2182,12 +2182,12 @@ hfsccmd_class_stats(struct hfsc_class_st
if ((error = copyout((void *)&stats, (void *)usp++,
sizeof(stats))) != 0)
- return (error);
+ return error;
}
ap->nclasses = n;
- return (0);
+ return 0;
}
#ifdef KLD_MODULE
Index: src/sys/altq/altq_jobs.c
diff -u src/sys/altq/altq_jobs.c:1.13 src/sys/altq/altq_jobs.c:1.14
--- src/sys/altq/altq_jobs.c:1.13 Fri Jan 3 18:42:52 2025
+++ src/sys/altq/altq_jobs.c Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_jobs.c,v 1.13 2025/01/03 18:42:52 joe Exp $ */
+/* $NetBSD: altq_jobs.c,v 1.14 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_jobs.c,v 1.11 2005/04/13 03:44:25 suz Exp $ */
/*
* Copyright (c) 2001, the Rector and Board of Visitors of the
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_jobs.c,v 1.13 2025/01/03 18:42:52 joe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_jobs.c,v 1.14 2025/01/08 13:00:04 joe Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -153,7 +153,7 @@ jobs_attach(struct ifaltq *ifq, u_int ba
jif = malloc(sizeof(struct jobs_if), M_DEVBUF, M_WAITOK|M_ZERO);
if (jif == NULL)
- return (NULL);
+ return NULL;
jif->jif_bandwidth = bandwidth;
jif->jif_qlimit = qlimit;
@@ -181,7 +181,7 @@ jobs_attach(struct ifaltq *ifq, u_int ba
jif->jif_next = jif_list;
jif_list = jif;
- return (jif);
+ return jif;
}
static void
@@ -223,7 +223,7 @@ jobs_clear_interface(struct jobs_if *jif
if ((cl = jif->jif_classes[pri]) != NULL)
jobs_class_destroy(cl);
- return (0);
+ return 0;
}
static int
@@ -236,7 +236,7 @@ jobs_request(struct ifaltq *ifq, int req
jobs_purge(jif);
break;
}
- return (0);
+ return 0;
}
/* discard all the queued packets on the interface */
@@ -275,7 +275,7 @@ jobs_class_create(struct jobs_if *jif, i
cl = malloc(sizeof(struct jobs_class), M_DEVBUF,
M_WAITOK|M_ZERO);
if (cl == NULL)
- return (NULL);
+ return NULL;
cl->cl_q = malloc(sizeof(class_queue_t), M_DEVBUF,
M_WAITOK|M_ZERO);
@@ -440,7 +440,7 @@ jobs_class_create(struct jobs_if *jif, i
now = read_machclk();
cl->idletime = now;
- return (cl);
+ return cl;
err_ret:
if (cl->cl_q != NULL)
@@ -449,7 +449,7 @@ jobs_class_create(struct jobs_if *jif, i
free(cl->arv_tm, M_DEVBUF);
free(cl, M_DEVBUF);
- return (NULL);
+ return NULL;
}
static int
@@ -482,7 +482,7 @@ jobs_class_destroy(struct jobs_class *cl
tslist_destroy(cl);
free(cl->cl_q, M_DEVBUF);
free(cl, M_DEVBUF);
- return (0);
+ return 0;
}
/*
@@ -638,7 +638,7 @@ jobs_enqueue(struct ifaltq *ifq, struct
jif->avg_cycles_enqueue += cycles;
jif->avg_cycles2_enqueue += cycles * cycles;
- return (return_flag);
+ return return_flag;
}
/*
@@ -687,7 +687,7 @@ jobs_dequeue(struct ifaltq *ifq, int op)
jif->avg_cycles_dequeue += cycles;
jif->avg_cycles2_dequeue += cycles * cycles;
- return (NULL);
+ return NULL;
}
/*
@@ -765,7 +765,7 @@ jobs_dequeue(struct ifaltq *ifq, int op)
jif->avg_cycles_dequeue += cycles;
jif->avg_cycles2_dequeue += cycles * cycles;
- return (m);
+ return m;
}
static int
@@ -905,7 +905,7 @@ jobs_addq(struct jobs_class *cl, struct
m_freem(m); /* the packet is trashed here */
tslist_drop(victim_class); /* and its timestamp as well */
}
- return (-1);
+ return -1;
}
}
/* else: no drop */
@@ -913,7 +913,7 @@ jobs_addq(struct jobs_class *cl, struct
_addq(cl->cl_q, m);
tslist_enqueue(cl, now);
- return (0);
+ return 0;
}
static struct mbuf *
@@ -960,7 +960,7 @@ tslist_alloc(void)
list_init = malloc(sizeof(TSLIST), M_DEVBUF, M_WAITOK);
TAILQ_INIT(list_init);
- return (list_init);
+ return list_init;
}
static void
@@ -978,11 +978,11 @@ tslist_enqueue(struct jobs_class *cl, u_
TSENTRY *pushed;
pushed = malloc(sizeof(TSENTRY), M_DEVBUF, M_WAITOK);
if (pushed == NULL)
- return (0);
+ return 0;
pushed->timestamp = arv;
TAILQ_INSERT_TAIL(cl->arv_tm, pushed, ts_list);
- return (1);
+ return 1;
}
static void
@@ -1137,7 +1137,7 @@ adjust_rates_rdc(struct jobs_if *jif)
}
if (bk == 0)
- return (result);
+ return result;
for (i = 0; i <= jif->jif_maxpri; i++) {
cl = jif->jif_classes[i];
@@ -1526,7 +1526,7 @@ assign_rate_drops_adc(struct jobs_if *ji
free(k, M_DEVBUF);
free(available, M_DEVBUF);
- return (result);
+ return result;
fail5: __unused
free(available, M_DEVBUF);
@@ -1671,7 +1671,7 @@ proj_delay(struct jobs_if *jif, int i)
if (is_backlogged)
return ((int64_t)delay_diff(now, tslist_first(cl->arv_tm)->timestamp));
- return (0); /* NOTREACHED */
+ return 0; /* NOTREACHED */
}
/*
@@ -1821,7 +1821,7 @@ jobsopen(dev_t dev, int flag, int fmt,
if (machclk_freq == 0) {
printf("jobs: no CPU clock available!\n");
- return (ENXIO);
+ return ENXIO;
}
/* everything will be done when the queueing scheme is attached. */
return 0;
@@ -1953,9 +1953,9 @@ jobscmd_if_attach(struct jobs_attach *ap
int error;
if ((ifp = ifunit(ap->iface.jobs_ifname)) == NULL)
- return (ENXIO);
+ return ENXIO;
if ((jif = jobs_attach(&ifp->if_snd, ap->bandwidth, ap->qlimit, ap->separate)) == NULL)
- return (ENOMEM);
+ return ENOMEM;
/*
* set JOBS to this ifnet structure.
@@ -1965,7 +1965,7 @@ jobscmd_if_attach(struct jobs_attach *ap
&jif->jif_classifier, acc_classify)) != 0)
jobs_detach(jif);
- return (error);
+ return error;
}
static int
@@ -1975,13 +1975,13 @@ jobscmd_if_detach(struct jobs_interface
int error;
if ((jif = altq_lookup(ap->jobs_ifname, ALTQT_JOBS)) == NULL)
- return (EBADF);
+ return EBADF;
if (ALTQ_IS_ENABLED(jif->jif_ifq))
altq_disable(jif->jif_ifq);
if ((error = altq_detach(jif->jif_ifq)))
- return (error);
+ return error;
jobs_detach(jif);
return 0;
@@ -1994,20 +1994,20 @@ jobscmd_add_class(struct jobs_add_class
struct jobs_class *cl;
if ((jif = altq_lookup(ap->iface.jobs_ifname, ALTQT_JOBS)) == NULL)
- return (EBADF);
+ return EBADF;
if (ap->pri < 0 || ap->pri >= JOBS_MAXPRI)
- return (EINVAL);
+ return EINVAL;
if ((cl = jobs_class_create(jif, ap->pri,
ap->cl_adc, ap->cl_rdc,
ap->cl_alc, ap->cl_rlc, ap-> cl_arc,
ap->flags)) == NULL)
- return (ENOMEM);
+ return ENOMEM;
/* return a class handle to the user */
ap->class_handle = clp_to_clh(cl);
- return (0);
+ return 0;
}
static int
@@ -2017,10 +2017,10 @@ jobscmd_delete_class(struct jobs_delete_
struct jobs_class *cl;
if ((jif = altq_lookup(ap->iface.jobs_ifname, ALTQT_JOBS)) == NULL)
- return (EBADF);
+ return EBADF;
if ((cl = clh_to_clp(jif, ap->class_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
return jobs_class_destroy(cl);
}
@@ -2032,20 +2032,20 @@ jobscmd_modify_class(struct jobs_modify_
struct jobs_class *cl;
if ((jif = altq_lookup(ap->iface.jobs_ifname, ALTQT_JOBS)) == NULL)
- return (EBADF);
+ return EBADF;
if (ap->pri < 0 || ap->pri >= JOBS_MAXPRI)
- return (EINVAL);
+ return EINVAL;
if ((cl = clh_to_clp(jif, ap->class_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
/*
* if priority is changed, move the class to the new priority
*/
if (jif->jif_classes[ap->pri] != cl) {
if (jif->jif_classes[ap->pri] != NULL)
- return (EEXIST);
+ return EEXIST;
jif->jif_classes[cl->cl_pri] = NULL;
jif->jif_classes[ap->pri] = cl;
cl->cl_pri = ap->pri;
@@ -2056,7 +2056,7 @@ jobscmd_modify_class(struct jobs_modify_
ap->cl_adc, ap->cl_rdc,
ap->cl_alc, ap->cl_rlc, ap->cl_arc,
ap->flags)) == NULL)
- return (ENOMEM);
+ return ENOMEM;
return 0;
}
@@ -2067,10 +2067,10 @@ jobscmd_add_filter(struct jobs_add_filte
struct jobs_class *cl;
if ((jif = altq_lookup(ap->iface.jobs_ifname, ALTQT_JOBS)) == NULL)
- return (EBADF);
+ return EBADF;
if ((cl = clh_to_clp(jif, ap->class_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
return acc_add_filter(&jif->jif_classifier, &ap->filter,
cl, &ap->filter_handle);
@@ -2082,7 +2082,7 @@ jobscmd_delete_filter(struct jobs_delete
struct jobs_if *jif;
if ((jif = altq_lookup(ap->iface.jobs_ifname, ALTQT_JOBS)) == NULL)
- return (EBADF);
+ return EBADF;
return acc_delete_filter(&jif->jif_classifier, ap->filter_handle);
}
@@ -2096,7 +2096,7 @@ jobscmd_class_stats(struct jobs_class_st
int pri, error;
if ((jif = altq_lookup(ap->iface.jobs_ifname, ALTQT_JOBS)) == NULL)
- return (EBADF);
+ return EBADF;
ap->maxpri = jif->jif_maxpri;
@@ -2109,9 +2109,9 @@ jobscmd_class_stats(struct jobs_class_st
get_class_stats(&stats, cl);
if ((error = copyout((void *)&stats, (void *)usp++,
sizeof(stats))) != 0)
- return (error);
+ return error;
}
- return (0);
+ return 0;
}
static void
@@ -2166,12 +2166,12 @@ clh_to_clp(struct jobs_if *jif, u_long c
#if 1
printf("clh_to_cl: unaligned pointer %p\n", cl);
#endif
- return (NULL);
+ return NULL;
}
if (cl == NULL || cl->cl_handle != chandle || cl->cl_jif != jif)
- return (NULL);
- return (cl);
+ return NULL;
+ return cl;
}
/* convert a class pointer to the corresponding class handle */
Index: src/sys/altq/altq_priq.c
diff -u src/sys/altq/altq_priq.c:1.28 src/sys/altq/altq_priq.c:1.29
--- src/sys/altq/altq_priq.c:1.28 Tue Sep 21 14:30:15 2021
+++ src/sys/altq/altq_priq.c Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_priq.c,v 1.28 2021/09/21 14:30:15 christos Exp $ */
+/* $NetBSD: altq_priq.c,v 1.29 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_priq.c,v 1.13 2005/04/13 03:44:25 suz Exp $ */
/*
* Copyright (C) 2000-2003
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_priq.c,v 1.28 2021/09/21 14:30:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_priq.c,v 1.29 2025/01/08 13:00:04 joe Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -113,12 +113,12 @@ priq_pfattach(struct pf_altq *a)
int s, error;
if ((ifp = ifunit(a->ifname)) == NULL || a->altq_disc == NULL)
- return (EINVAL);
+ return EINVAL;
s = splnet();
error = altq_attach(&ifp->if_snd, ALTQT_PRIQ, a->altq_disc,
priq_enqueue, priq_dequeue, priq_request, NULL, NULL);
splx(s);
- return (error);
+ return error;
}
int
@@ -128,13 +128,13 @@ priq_add_altq(struct pf_altq *a)
struct ifnet *ifp;
if ((ifp = ifunit(a->ifname)) == NULL)
- return (EINVAL);
+ return EINVAL;
if (!ALTQ_IS_READY(&ifp->if_snd))
- return (ENODEV);
+ return ENODEV;
pif = malloc(sizeof(struct priq_if), M_DEVBUF, M_WAITOK|M_ZERO);
if (pif == NULL)
- return (ENOMEM);
+ return ENOMEM;
pif->pif_bandwidth = a->ifbandwidth;
pif->pif_maxpri = -1;
pif->pif_ifq = &ifp->if_snd;
@@ -142,7 +142,7 @@ priq_add_altq(struct pf_altq *a)
/* keep the state in pf_altq */
a->altq_disc = pif;
- return (0);
+ return 0;
}
int
@@ -151,13 +151,13 @@ priq_remove_altq(struct pf_altq *a)
struct priq_if *pif;
if ((pif = a->altq_disc) == NULL)
- return (EINVAL);
+ return EINVAL;
a->altq_disc = NULL;
(void)priq_clear_interface(pif);
free(pif, M_DEVBUF);
- return (0);
+ return 0;
}
int
@@ -167,24 +167,24 @@ priq_add_queue(struct pf_altq *a)
struct priq_class *cl;
if ((pif = a->altq_disc) == NULL)
- return (EINVAL);
+ return EINVAL;
/* check parameters */
if (a->priority >= PRIQ_MAXPRI)
- return (EINVAL);
+ return EINVAL;
if (a->qid == 0)
- return (EINVAL);
+ return EINVAL;
if (pif->pif_classes[a->priority] != NULL)
- return (EBUSY);
+ return EBUSY;
if (clh_to_clp(pif, a->qid) != NULL)
- return (EBUSY);
+ return EBUSY;
cl = priq_class_create(pif, a->priority, a->qlimit,
a->pq_u.priq_opts.flags, a->qid);
if (cl == NULL)
- return (ENOMEM);
+ return ENOMEM;
- return (0);
+ return 0;
}
int
@@ -194,12 +194,12 @@ priq_remove_queue(struct pf_altq *a)
struct priq_class *cl;
if ((pif = a->altq_disc) == NULL)
- return (EINVAL);
+ return EINVAL;
if ((cl = clh_to_clp(pif, a->qid)) == NULL)
- return (EINVAL);
+ return EINVAL;
- return (priq_class_destroy(cl));
+ return priq_class_destroy(cl);
}
int
@@ -211,21 +211,21 @@ priq_getqstats(struct pf_altq *a, void *
int error = 0;
if ((pif = altq_lookup(a->ifname, ALTQT_PRIQ)) == NULL)
- return (EBADF);
+ return EBADF;
if ((cl = clh_to_clp(pif, a->qid)) == NULL)
- return (EINVAL);
+ return EINVAL;
if (*nbytes < sizeof(stats))
- return (EINVAL);
+ return EINVAL;
memset(&stats, 0, sizeof(stats));
get_class_stats(&stats, cl);
if ((error = copyout((void *)&stats, ubuf, sizeof(stats))) != 0)
- return (error);
+ return error;
*nbytes = sizeof(stats);
- return (0);
+ return 0;
}
#endif /* NPF > 0 */
@@ -249,7 +249,7 @@ priq_clear_interface(struct priq_if *pif
if ((cl = pif->pif_classes[pri]) != NULL)
priq_class_destroy(cl);
- return (0);
+ return 0;
}
static int
@@ -262,7 +262,7 @@ priq_request(struct ifaltq *ifq, int req
priq_purge(pif);
break;
}
- return (0);
+ return 0;
}
/* discard all the queued packets on the interface */
@@ -291,7 +291,7 @@ priq_class_create(struct priq_if *pif, i
#ifdef ALTQ_DEBUG
printf("priq_class_create: RED not configured for PRIQ!\n");
#endif
- return (NULL);
+ return NULL;
}
#endif
@@ -313,13 +313,13 @@ priq_class_create(struct priq_if *pif, i
cl = malloc(sizeof(struct priq_class), M_DEVBUF,
M_WAITOK|M_ZERO);
if (cl == NULL)
- return (NULL);
+ return NULL;
cl->cl_q = malloc(sizeof(class_queue_t), M_DEVBUF,
M_WAITOK|M_ZERO);
if (cl->cl_q == NULL) {
free(cl, M_DEVBUF);
- return (NULL);
+ return NULL;
}
}
@@ -373,7 +373,7 @@ priq_class_create(struct priq_if *pif, i
}
#endif /* ALTQ_RED */
- return (cl);
+ return cl;
}
static int
@@ -417,7 +417,7 @@ priq_class_destroy(struct priq_class *cl
}
free(cl->cl_q, M_DEVBUF);
free(cl, M_DEVBUF);
- return (0);
+ return 0;
}
/*
@@ -439,7 +439,7 @@ priq_enqueue(struct ifaltq *ifq, struct
printf("altq: packet for %s does not have pkthdr\n",
ifq->altq_ifp->if_xname);
m_freem(m);
- return (ENOBUFS);
+ return ENOBUFS;
}
cl = NULL;
if ((t = m_tag_find(m, PACKET_TAG_ALTQ_QID)) != NULL)
@@ -452,7 +452,7 @@ priq_enqueue(struct ifaltq *ifq, struct
cl = pif->pif_default;
if (cl == NULL) {
m_freem(m);
- return (ENOBUFS);
+ return ENOBUFS;
}
}
#ifdef ALTQ3_COMPAT
@@ -469,12 +469,12 @@ priq_enqueue(struct ifaltq *ifq, struct
if (priq_addq(cl, m) != 0) {
/* drop occurred. mbuf was freed in priq_addq. */
PKTCNTR_ADD(&cl->cl_dropcnt, len);
- return (ENOBUFS);
+ return ENOBUFS;
}
IFQ_INC_LEN(ifq);
/* successfully queued. */
- return (0);
+ return 0;
}
/*
@@ -496,13 +496,13 @@ priq_dequeue(struct ifaltq *ifq, int op)
if (IFQ_IS_EMPTY(ifq))
/* no packet in the queue */
- return (NULL);
+ return NULL;
for (pri = pif->pif_maxpri; pri >= 0; pri--) {
if ((cl = pif->pif_classes[pri]) != NULL &&
!qempty(cl->cl_q)) {
if (op == ALTDQ_POLL)
- return (priq_pollq(cl));
+ return priq_pollq(cl);
m = priq_getq(cl);
if (m != NULL) {
@@ -511,10 +511,10 @@ priq_dequeue(struct ifaltq *ifq, int op)
cl->cl_period++;
PKTCNTR_ADD(&cl->cl_xmitcnt, m_pktlen(m));
}
- return (m);
+ return m;
}
}
- return (NULL);
+ return NULL;
}
static int
@@ -532,7 +532,7 @@ priq_addq(struct priq_class *cl, struct
#endif
if (qlen(cl->cl_q) >= qlimit(cl->cl_q)) {
m_freem(m);
- return (-1);
+ return -1;
}
if (cl->cl_flags & PRCF_CLEARDSCP)
@@ -540,7 +540,7 @@ priq_addq(struct priq_class *cl, struct
_addq(cl->cl_q, m);
- return (0);
+ return 0;
}
static struct mbuf *
@@ -608,14 +608,14 @@ clh_to_clp(struct priq_if *pif, u_int32_
int idx;
if (chandle == 0)
- return (NULL);
+ return NULL;
for (idx = pif->pif_maxpri; idx >= 0; idx--)
if ((cl = pif->pif_classes[idx]) != NULL &&
cl->cl_handle == chandle)
- return (cl);
+ return cl;
- return (NULL);
+ return NULL;
}
@@ -628,7 +628,7 @@ priq_attach(struct ifaltq *ifq, u_int ba
pif = malloc(sizeof(struct priq_if), M_DEVBUF, M_WAITOK|M_ZERO);
if (pif == NULL)
- return (NULL);
+ return NULL;
pif->pif_bandwidth = bandwidth;
pif->pif_maxpri = -1;
pif->pif_ifq = ifq;
@@ -637,7 +637,7 @@ priq_attach(struct ifaltq *ifq, u_int ba
pif->pif_next = pif_list;
pif_list = pif;
- return (pif);
+ return pif;
}
static void
@@ -799,10 +799,10 @@ priqcmd_if_attach(struct priq_interface
int error;
if ((ifp = ifunit(ap->ifname)) == NULL)
- return (ENXIO);
+ return ENXIO;
if ((pif = priq_attach(&ifp->if_snd, ap->arg)) == NULL)
- return (ENOMEM);
+ return ENOMEM;
/*
* set PRIQ to this ifnet structure.
@@ -812,7 +812,7 @@ priqcmd_if_attach(struct priq_interface
&pif->pif_classifier, acc_classify)) != 0)
priq_detach(pif);
- return (error);
+ return error;
}
static int
@@ -822,13 +822,13 @@ priqcmd_if_detach(struct priq_interface
int error;
if ((pif = altq_lookup(ap->ifname, ALTQT_PRIQ)) == NULL)
- return (EBADF);
+ return EBADF;
if (ALTQ_IS_ENABLED(pif->pif_ifq))
altq_disable(pif->pif_ifq);
if ((error = altq_detach(pif->pif_ifq)))
- return (error);
+ return error;
priq_detach(pif);
return 0;
@@ -842,22 +842,22 @@ priqcmd_add_class(struct priq_add_class
int qid;
if ((pif = altq_lookup(ap->iface.ifname, ALTQT_PRIQ)) == NULL)
- return (EBADF);
+ return EBADF;
if (ap->pri < 0 || ap->pri >= PRIQ_MAXPRI)
- return (EINVAL);
+ return EINVAL;
if (pif->pif_classes[ap->pri] != NULL)
- return (EBUSY);
+ return EBUSY;
qid = ap->pri + 1;
if ((cl = priq_class_create(pif, ap->pri,
ap->qlimit, ap->flags, qid)) == NULL)
- return (ENOMEM);
+ return ENOMEM;
/* return a class handle to the user */
ap->class_handle = cl->cl_handle;
- return (0);
+ return 0;
}
static int
@@ -867,10 +867,10 @@ priqcmd_delete_class(struct priq_delete_
struct priq_class *cl;
if ((pif = altq_lookup(ap->iface.ifname, ALTQT_PRIQ)) == NULL)
- return (EBADF);
+ return EBADF;
if ((cl = clh_to_clp(pif, ap->class_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
return priq_class_destroy(cl);
}
@@ -882,20 +882,20 @@ priqcmd_modify_class(struct priq_modify_
struct priq_class *cl;
if ((pif = altq_lookup(ap->iface.ifname, ALTQT_PRIQ)) == NULL)
- return (EBADF);
+ return EBADF;
if (ap->pri < 0 || ap->pri >= PRIQ_MAXPRI)
- return (EINVAL);
+ return EINVAL;
if ((cl = clh_to_clp(pif, ap->class_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
/*
* if priority is changed, move the class to the new priority
*/
if (pif->pif_classes[ap->pri] != cl) {
if (pif->pif_classes[ap->pri] != NULL)
- return (EEXIST);
+ return EEXIST;
pif->pif_classes[cl->cl_pri] = NULL;
pif->pif_classes[ap->pri] = cl;
cl->cl_pri = ap->pri;
@@ -904,7 +904,7 @@ priqcmd_modify_class(struct priq_modify_
/* call priq_class_create to change class parameters */
if ((cl = priq_class_create(pif, ap->pri,
ap->qlimit, ap->flags, ap->class_handle)) == NULL)
- return (ENOMEM);
+ return ENOMEM;
return 0;
}
@@ -915,10 +915,10 @@ priqcmd_add_filter(struct priq_add_filte
struct priq_class *cl;
if ((pif = altq_lookup(ap->iface.ifname, ALTQT_PRIQ)) == NULL)
- return (EBADF);
+ return EBADF;
if ((cl = clh_to_clp(pif, ap->class_handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
return acc_add_filter(&pif->pif_classifier, &ap->filter,
cl, &ap->filter_handle);
@@ -930,7 +930,7 @@ priqcmd_delete_filter(struct priq_delete
struct priq_if *pif;
if ((pif = altq_lookup(ap->iface.ifname, ALTQT_PRIQ)) == NULL)
- return (EBADF);
+ return EBADF;
return acc_delete_filter(&pif->pif_classifier,
ap->filter_handle);
@@ -945,7 +945,7 @@ priqcmd_class_stats(struct priq_class_st
int pri, error;
if ((pif = altq_lookup(ap->iface.ifname, ALTQT_PRIQ)) == NULL)
- return (EBADF);
+ return EBADF;
ap->maxpri = pif->pif_maxpri;
@@ -958,9 +958,9 @@ priqcmd_class_stats(struct priq_class_st
get_class_stats(&stats, cl);
if ((error = copyout((void *)&stats, (void *)usp++,
sizeof(stats))) != 0)
- return (error);
+ return error;
}
- return (0);
+ return 0;
}
#ifdef KLD_MODULE
Index: src/sys/altq/altq_red.c
diff -u src/sys/altq/altq_red.c:1.35 src/sys/altq/altq_red.c:1.36
--- src/sys/altq/altq_red.c:1.35 Sun Dec 5 04:43:57 2021
+++ src/sys/altq/altq_red.c Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_red.c,v 1.35 2021/12/05 04:43:57 msaitoh Exp $ */
+/* $NetBSD: altq_red.c,v 1.36 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_red.c,v 1.20 2005/04/13 03:44:25 suz Exp $ */
/*
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_red.c,v 1.35 2021/12/05 04:43:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_red.c,v 1.36 2025/01/08 13:00:04 joe Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -237,7 +237,7 @@ red_alloc(int weight, int inv_pmax, int
rp = malloc(sizeof(red_t), M_DEVBUF, M_WAITOK|M_ZERO);
if (rp == NULL)
- return (NULL);
+ return NULL;
rp->red_avg = 0;
rp->red_idle = 1;
@@ -316,7 +316,7 @@ red_alloc(int weight, int inv_pmax, int
/* if fv_alloc fails, flowvalve is just disabled */
#endif
#endif /* ALTQ3_COMPAT */
- return (rp);
+ return rp;
}
void
@@ -356,7 +356,7 @@ red_addq(red_t *rp, class_queue_t *q, st
if (rp->red_flowvalve != NULL && rp->red_flowvalve->fv_flows > 0)
if (fv_checkflow(rp->red_flowvalve, pktattr, &fve)) {
m_freem(m);
- return (-1);
+ return -1;
}
#endif
#endif /* ALTQ3_COMPAT */
@@ -472,13 +472,13 @@ red_addq(red_t *rp, class_queue_t *q, st
#endif
#endif /* ALTQ3_COMPAT */
m_freem(m);
- return (-1);
+ return -1;
}
/* successfully queued */
#ifdef RED_STATS
PKTCNTR_ADD(&rp->red_stats.xmit_cnt, m_pktlen(m));
#endif
- return (0);
+ return 0;
}
/*
@@ -498,7 +498,7 @@ drop_early(int fp_len, int fp_probd, int
d = fp_probd - count * fp_len;
if (d <= 0)
/* count exceeds the hard limit: drop or mark */
- return (1);
+ return 1;
/*
* now the range of d is [1..600] in fixed-point. (when
@@ -508,10 +508,10 @@ drop_early(int fp_len, int fp_probd, int
if ((cprng_fast32() % d) < fp_len) {
/* drop or mark */
- return (1);
+ return 1;
}
/* no drop/mark */
- return (0);
+ return 0;
}
/*
@@ -531,7 +531,7 @@ mark_ecn(struct mbuf *m, struct altq_pkt
if (t != NULL) {
at = (struct altq_tag *)(t + 1);
if (at == NULL)
- return (0);
+ return 0;
af = at->af;
hdr = at->hdr;
#ifdef ALTQ3_COMPAT
@@ -540,10 +540,10 @@ mark_ecn(struct mbuf *m, struct altq_pkt
hdr = pktattr->pattr_hdr;
#endif /* ALTQ3_COMPAT */
} else
- return (0);
+ return 0;
if (af != AF_INET && af != AF_INET6)
- return (0);
+ return 0;
/* verify that pattr_hdr is within the mbuf data */
for (m0 = m; m0 != NULL; m0 = m0->m_next)
@@ -552,7 +552,7 @@ mark_ecn(struct mbuf *m, struct altq_pkt
break;
if (m0 == NULL) {
/* ick, tag info is stale */
- return (0);
+ return 0;
}
switch (af) {
@@ -563,12 +563,12 @@ mark_ecn(struct mbuf *m, struct altq_pkt
int sum;
if (ip->ip_v != 4)
- return (0); /* version mismatch! */
+ return 0; /* version mismatch! */
if ((ip->ip_tos & IPTOS_ECN_MASK) == IPTOS_ECN_NOTECT)
- return (0); /* not-ECT */
+ return 0; /* not-ECT */
if ((ip->ip_tos & IPTOS_ECN_MASK) == IPTOS_ECN_CE)
- return (1); /* already marked */
+ return 1; /* already marked */
/*
* ecn-capable but not marked,
@@ -585,7 +585,7 @@ mark_ecn(struct mbuf *m, struct altq_pkt
sum = (sum >> 16) + (sum & 0xffff);
sum += (sum >> 16); /* add carry */
ip->ip_sum = htons(~sum & 0xffff);
- return (1);
+ return 1;
}
break;
#ifdef INET6
@@ -596,26 +596,26 @@ mark_ecn(struct mbuf *m, struct altq_pkt
flowlabel = ntohl(ip6->ip6_flow);
if ((flowlabel >> 28) != 6)
- return (0); /* version mismatch! */
+ return 0; /* version mismatch! */
if ((flowlabel & (IPTOS_ECN_MASK << 20)) ==
(IPTOS_ECN_NOTECT << 20))
- return (0); /* not-ECT */
+ return 0; /* not-ECT */
if ((flowlabel & (IPTOS_ECN_MASK << 20)) ==
(IPTOS_ECN_CE << 20))
- return (1); /* already marked */
+ return 1; /* already marked */
/*
* ecn-capable but not marked, mark CE
*/
flowlabel |= (IPTOS_ECN_CE << 20);
ip6->ip6_flow = htonl(flowlabel);
- return (1);
+ return 1;
}
break;
#endif /* INET6 */
}
/* not marked */
- return (0);
+ return 0;
}
struct mbuf *
@@ -632,7 +632,7 @@ red_getq(red_t *rp, class_queue_t *q)
}
rp->red_idle = 0;
- return (m);
+ return m;
}
/*
@@ -653,7 +653,7 @@ wtab_alloc(int weight)
for (w = wtab_list; w != NULL; w = w->w_next)
if (w->w_weight == weight) {
w->w_refcount++;
- return (w);
+ return w;
}
w = malloc(sizeof(struct wtab), M_DEVBUF, M_WAITOK|M_ZERO);
@@ -672,7 +672,7 @@ wtab_alloc(int weight)
w->w_param_max = 1 << i;
}
- return (w);
+ return w;
}
int
@@ -681,7 +681,7 @@ wtab_destroy(struct wtab *w)
struct wtab *prev;
if (--w->w_refcount > 0)
- return (0);
+ return 0;
if (wtab_list == w)
wtab_list = w->w_next;
@@ -692,7 +692,7 @@ wtab_destroy(struct wtab *w)
}
free(w, M_DEVBUF);
- return (0);
+ return 0;
}
int32_t
@@ -702,11 +702,11 @@ pow_w(struct wtab *w, int n)
int32_t val;
if (n >= w->w_param_max)
- return (0);
+ return 0;
val = 1 << FP_SHIFT;
if (n <= 0)
- return (val);
+ return val;
bit = 1;
i = 0;
@@ -718,7 +718,7 @@ pow_w(struct wtab *w, int n)
i++;
bit <<= 1;
}
- return (val);
+ return val;
}
#ifdef ALTQ3_COMPAT
@@ -769,7 +769,7 @@ redioctl(dev_t dev, ioctlcmd_t cmd, void
if ((error = kauth_authorize_network(l->l_cred,
KAUTH_NETWORK_ALTQ, KAUTH_REQ_NETWORK_ALTQ_RED, NULL,
NULL, NULL)) != 0)
- return (error);
+ return error;
break;
}
@@ -979,7 +979,7 @@ red_detach(red_queue_t *rqp)
altq_disable(rqp->rq_ifq);
if ((error = altq_detach(rqp->rq_ifq)))
- return (error);
+ return error;
if (red_list == rqp)
red_list = rqp->rq_next;
@@ -996,7 +996,7 @@ red_detach(red_queue_t *rqp)
red_destroy(rqp->rq_red);
free(rqp->rq_q, M_DEVBUF);
free(rqp, M_DEVBUF);
- return (error);
+ return error;
}
/*
@@ -1042,7 +1042,7 @@ red_dequeue(struct ifaltq *ifq, int op)
m = red_getq(rqp->rq_red, rqp->rq_q);
if (m != NULL)
ifq->ifq_len--;
- return (m);
+ return m;
}
static int
@@ -1055,7 +1055,7 @@ red_request(struct ifaltq *ifq, int req,
red_purgeq(rqp);
break;
}
- return (0);
+ return 0;
}
static void
@@ -1134,7 +1134,7 @@ flowlist_lookup(struct flowvalve *fv, st
struct timeval tthresh;
if (pktattr == NULL)
- return (NULL);
+ return NULL;
tthresh.tv_sec = now->tv_sec - FV_TTHRESH;
flows = 0;
@@ -1156,7 +1156,7 @@ flowlist_lookup(struct flowvalve *fv, st
ip->ip_src.s_addr &&
fve->fve_flow.flow_ip.ip_dst.s_addr ==
ip->ip_dst.s_addr)
- return (fve);
+ return fve;
flows++;
}
break;
@@ -1175,7 +1175,7 @@ flowlist_lookup(struct flowvalve *fv, st
&ip6->ip6_src) &&
IN6_ARE_ADDR_EQUAL(&fve->fve_flow.flow_ip6.ip6_dst,
&ip6->ip6_dst))
- return (fve);
+ return fve;
flows++;
}
break;
@@ -1183,10 +1183,10 @@ flowlist_lookup(struct flowvalve *fv, st
default:
/* unknown protocol. no drop. */
- return (NULL);
+ return NULL;
}
fv->fv_flows = flows; /* save the number of active fve's */
- return (NULL);
+ return NULL;
}
static inline struct fve *
@@ -1230,7 +1230,7 @@ flowlist_reclaim(struct flowvalve *fv, s
#ifdef FV_STATS
fv->fv_stats.alloc++;
#endif
- return (fve);
+ return fve;
}
static inline void
@@ -1255,13 +1255,13 @@ fv_alloc(struct red *rp)
num = FV_FLOWLISTSIZE;
fv = malloc(sizeof(struct flowvalve), M_DEVBUF, M_WAITOK|M_ZERO);
if (fv == NULL)
- return (NULL);
+ return NULL;
fv->fv_fves = malloc(sizeof(struct fve) * num, M_DEVBUF,
M_WAITOK|M_ZERO);
if (fv->fv_fves == NULL) {
free(fv, M_DEVBUF);
- return (NULL);
+ return NULL;
}
fv->fv_flows = 0;
@@ -1280,7 +1280,7 @@ fv_alloc(struct red *rp)
if (fv->fv_p2ftab == NULL) {
free(fv->fv_fves, M_DEVBUF);
free(fv, M_DEVBUF);
- return (NULL);
+ return NULL;
}
/*
* create the p2f table.
@@ -1293,7 +1293,7 @@ fv_alloc(struct red *rp)
fv->fv_p2ftab[i] = (f / (rp->red_thmax + FV_ALPHA)) >> 8;
}
- return (fv);
+ return fv;
}
static void
@@ -1315,7 +1315,7 @@ fv_p2f(struct flowvalve *fv, int p)
f = fv->fv_p2ftab[(val >> BRTT_SHIFT)];
else
f = fv->fv_p2ftab[1];
- return (f);
+ return f;
}
/*
@@ -1336,7 +1336,7 @@ fv_checkflow(struct flowvalve *fv, struc
if ((fve = flowlist_lookup(fv, pktattr, &now)) == NULL)
/* no matching entry in the flowlist */
- return (0);
+ return 0;
*fcache = fve;
@@ -1382,7 +1382,7 @@ fv_checkflow(struct flowvalve *fv, struc
#ifdef FV_STATS
fv->fv_stats.predrop++;
#endif
- return (1);
+ return 1;
}
}
@@ -1395,7 +1395,7 @@ fv_checkflow(struct flowvalve *fv, struc
#ifdef FV_STATS
fv->fv_stats.pass++;
#endif
- return (0);
+ return 0;
}
/*
Index: src/sys/altq/altq_rio.c
diff -u src/sys/altq/altq_rio.c:1.25 src/sys/altq/altq_rio.c:1.26
--- src/sys/altq/altq_rio.c:1.25 Tue Sep 21 14:30:15 2021
+++ src/sys/altq/altq_rio.c Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_rio.c,v 1.25 2021/09/21 14:30:15 christos Exp $ */
+/* $NetBSD: altq_rio.c,v 1.26 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_rio.c,v 1.19 2005/04/13 03:44:25 suz Exp $ */
/*
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_rio.c,v 1.25 2021/09/21 14:30:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_rio.c,v 1.26 2025/01/08 13:00:04 joe Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -211,7 +211,7 @@ rio_alloc(int weight, struct redparams *
rp = malloc(sizeof(rio_t), M_DEVBUF, M_WAITOK|M_ZERO);
if (rp == NULL)
- return (NULL);
+ return NULL;
rp->rio_flags = flags;
if (pkttime == 0)
@@ -288,7 +288,7 @@ rio_alloc(int weight, struct redparams *
microtime(&prec->last);
}
- return (rp);
+ return rp;
}
void
@@ -321,7 +321,7 @@ dscp2index(u_int8_t dscp)
int dpindex = dscp & AF_DROPPRECMASK;
if (dpindex == 0)
- return (0);
+ return 0;
return ((dpindex >> 3) - 1);
}
#endif
@@ -416,7 +416,7 @@ rio_addq(rio_t *rp, class_queue_t *q, st
PKTCNTR_ADD(&rp->q_stats[dpindex].drop_cnt, m_pktlen(m));
#endif
m_freem(m);
- return (-1);
+ return -1;
}
for (i = dpindex; i < RIO_NDROPPREC; i++)
@@ -436,7 +436,7 @@ rio_addq(rio_t *rp, class_queue_t *q, st
#ifdef RIO_STATS
PKTCNTR_ADD(&rp->q_stats[dpindex].xmit_cnt, m_pktlen(m));
#endif
- return (0);
+ return 0;
}
struct mbuf *
@@ -457,7 +457,7 @@ rio_getq(rio_t *rp, class_queue_t *q)
}
}
}
- return (m);
+ return m;
}
#ifdef ALTQ3_COMPAT
@@ -503,7 +503,7 @@ rioioctl(dev_t dev, ioctlcmd_t cmd, void
if ((error = kauth_authorize_network(l->l_cred,
KAUTH_NETWORK_ALTQ, KAUTH_REQ_NETWORK_ALTQ_RIO, NULL,
NULL, NULL)) != 0)
- return (error);
+ return error;
break;
}
@@ -700,7 +700,7 @@ rio_detach(rio_queue_t *rqp)
altq_disable(rqp->rq_ifq);
if ((error = altq_detach(rqp->rq_ifq)))
- return (error);
+ return error;
if (rio_list == rqp)
rio_list = rqp->rq_next;
@@ -717,7 +717,7 @@ rio_detach(rio_queue_t *rqp)
rio_destroy(rqp->rq_rio);
free(rqp->rq_q, M_DEVBUF);
free(rqp, M_DEVBUF);
- return (error);
+ return error;
}
/*
@@ -735,7 +735,7 @@ rio_request(struct ifaltq *ifq, int req,
ifq->ifq_len = 0;
break;
}
- return (0);
+ return 0;
}
/*
Index: src/sys/altq/altq_rmclass.c
diff -u src/sys/altq/altq_rmclass.c:1.31 src/sys/altq/altq_rmclass.c:1.32
--- src/sys/altq/altq_rmclass.c:1.31 Mon Jul 1 02:18:44 2024
+++ src/sys/altq/altq_rmclass.c Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_rmclass.c,v 1.31 2024/07/01 02:18:44 ozaki-r Exp $ */
+/* $NetBSD: altq_rmclass.c,v 1.32 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_rmclass.c,v 1.19 2005/04/13 03:44:25 suz Exp $ */
/*
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_rmclass.c,v 1.31 2024/07/01 02:18:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_rmclass.c,v 1.32 2025/01/08 13:00:04 joe Exp $");
/* #ident "@(#)rm_class.c 1.48 97/12/05 SMI" */
@@ -205,13 +205,13 @@ rmc_newclass(int pri, struct rm_ifdat *i
int s;
if (pri >= RM_MAXPRIO)
- return (NULL);
+ return NULL;
#ifndef ALTQ_RED
if (flags & RMCF_RED) {
#ifdef ALTQ_DEBUG
printf("rmc_newclass: RED not configured for CBQ!\n");
#endif
- return (NULL);
+ return NULL;
}
#endif
#ifndef ALTQ_RIO
@@ -219,19 +219,19 @@ rmc_newclass(int pri, struct rm_ifdat *i
#ifdef ALTQ_DEBUG
printf("rmc_newclass: RIO not configured for CBQ!\n");
#endif
- return (NULL);
+ return NULL;
}
#endif
cl = malloc(sizeof(struct rm_class), M_DEVBUF, M_WAITOK|M_ZERO);
if (cl == NULL)
- return (NULL);
+ return NULL;
CALLOUT_INIT(&cl->callout_);
cl->q_ = malloc(sizeof(class_queue_t), M_DEVBUF, M_WAITOK|M_ZERO);
if (cl->q_ == NULL) {
free(cl, M_DEVBUF);
- return (NULL);
+ return NULL;
}
/*
@@ -344,7 +344,7 @@ rmc_newclass(int pri, struct rm_ifdat *i
rmc_wrr_set_weights(ifd);
}
splx(s);
- return (cl);
+ return cl;
}
int
@@ -393,7 +393,7 @@ rmc_modclass(struct rm_class *cl, uint64
rmc_wrr_set_weights(ifd);
}
splx(s);
- return (0);
+ return 0;
}
/*
@@ -449,7 +449,7 @@ rmc_get_weight(struct rm_ifdat *ifd, int
if ((pri >= 0) && (pri < RM_MAXPRIO))
return (ifd->M_[pri]);
else
- return (0);
+ return 0;
}
/*
@@ -677,7 +677,7 @@ rmc_init(struct ifaltq *ifq, struct rm_i
if (mtu < 1) {
printf("altq: %s: invalid MTU (interface not initialized?)\n",
ifq->altq_ifp->if_xname);
- return (EINVAL);
+ return EINVAL;
}
(void)memset((char *)ifd, 0, sizeof (*ifd));
@@ -728,11 +728,11 @@ rmc_init(struct ifaltq *ifq, struct rm_i
maxidle, minidle, offtime,
0, 0)) == NULL) {
printf("rmc_init: root class not allocated\n");
- return (ENOMEM);
+ return ENOMEM;
}
ifd->root_->depth_ = 0;
- return (0);
+ return 0;
}
/*
@@ -793,7 +793,7 @@ rmc_queue_packet(struct rm_class *cl, mb
if (_rmc_addq(cl, m) < 0)
/* failed */
- return (-1);
+ return -1;
if (is_empty) {
CBQTRACE(rmc_queue_packet, 'ytpe', cl->stats_.handle);
@@ -803,9 +803,9 @@ rmc_queue_packet(struct rm_class *cl, mb
if (qlen(cl->q_) > qlimit(cl->q_)) {
/* note: qlimit can be set to 0 or 1 */
rmc_drop_action(cl);
- return (-1);
+ return -1;
}
- return (0);
+ return 0;
}
/*
@@ -846,25 +846,25 @@ rmc_satisfied(struct rm_class *cl, struc
rm_class_t *p;
if (cl == NULL)
- return (1);
+ return 1;
if (TS_LT(now, &cl->undertime_))
- return (1);
+ return 1;
if (cl->depth_ == 0) {
if (!cl->sleeping_ && (qlen(cl->q_) > cl->qthresh_))
- return (0);
+ return 0;
else
- return (1);
+ return 1;
}
if (cl->children_ != NULL) {
p = cl->children_;
while (p != NULL) {
if (!rmc_satisfied(p, now))
- return (0);
+ return 0;
p = p->next_;
}
}
- return (1);
+ return 1;
}
/*
@@ -887,7 +887,7 @@ rmc_under_limit(struct rm_class *cl, str
* underlimit. Otherwise, check to see if the class is underlimit.
*/
if (cl->parent_ == NULL)
- return (1);
+ return 1;
if (!TS_LT(now, &cl->undertime_)) {
/* Fast path: the given class is allowed to send packets */
@@ -896,7 +896,7 @@ rmc_under_limit(struct rm_class *cl, str
cl->sleeping_ = 0;
cl->undertime_.tv_sec = 0;
}
- return (1);
+ return 1;
}
top = NULL;
@@ -905,13 +905,13 @@ rmc_under_limit(struct rm_class *cl, str
(cl->depth_ > ifd->cutoff_)) {
/* No need to call the delay action */
if (sleeping)
- return (0);
+ return 0;
#ifdef ADJUST_CUTOFF
if (cl != NULL)
/* cutoff is taking effect, just
return false without calling
the delay action. */
- return (0);
+ return 0;
#endif
#ifdef BORROW_OFFTIME
/*
@@ -932,14 +932,14 @@ rmc_under_limit(struct rm_class *cl, str
p->overtime_ = *now;
(p->overlimit)(p, NULL);
#endif
- return (0);
+ return 0;
}
top = cl;
} while (cl->undertime_.tv_sec && TS_LT(now, &cl->undertime_));
if (cl != p)
ifd->borrowed_[ifd->qi_] = cl;
- return (1);
+ return 1;
}
/*
@@ -1061,7 +1061,7 @@ _rmc_wrr_dequeue_next(struct rm_ifdat *i
CBQTRACE(_rmc_wrr_dequeue_next, 'otsr', ifd->cutoff_);
if (!ifd->efficient_ || first == NULL)
- return (NULL);
+ return NULL;
cl = first;
cpri = cl->pri_;
@@ -1106,7 +1106,7 @@ _rmc_wrr_dequeue_next(struct rm_ifdat *i
m = _rmc_pollq(cl);
ifd->pollcache_ = cl;
}
- return (m);
+ return m;
}
/*
@@ -1176,7 +1176,7 @@ _rmc_prr_dequeue_next(struct rm_ifdat *i
*/
reset_cutoff(ifd);
if (!ifd->efficient_ || first == NULL)
- return (NULL);
+ return NULL;
cl = first;
cpri = cl->pri_;
@@ -1212,7 +1212,7 @@ _rmc_prr_dequeue_next(struct rm_ifdat *i
m = _rmc_pollq(cl);
ifd->pollcache_ = cl;
}
- return (m);
+ return m;
}
/*
@@ -1233,7 +1233,7 @@ mbuf_t *
rmc_dequeue_next(struct rm_ifdat *ifd, int mode)
{
if (ifd->queued_ >= ifd->maxqueued_)
- return (NULL);
+ return NULL;
else if (ifd->wrr_)
return (_rmc_wrr_dequeue_next(ifd, mode));
else
@@ -1470,7 +1470,7 @@ tvhzto(struct timeval *tv)
getmicrotime(&t2);
t2.tv_sec = tv->tv_sec - t2.tv_sec;
t2.tv_usec = tv->tv_usec - t2.tv_usec;
- return (tvtohz(&t2));
+ return tvtohz(&t2);
}
#endif /* __FreeBSD_version > 300000 */
@@ -1624,7 +1624,7 @@ _rmc_addq(rm_class_t *cl, mbuf_t *m)
write_dsfield(m, cl->pktattr_, 0);
_addq(cl->q_, m);
- return (0);
+ return 0;
}
/* note: _rmc_dropq is not called for red */
@@ -1743,7 +1743,7 @@ _getq(class_queue_t *q)
mbuf_t *m, *m0;
if ((m = qtail(q)) == NULL)
- return (NULL);
+ return NULL;
if ((m0 = m->m_nextpkt) != m)
m->m_nextpkt = m0->m_nextpkt;
else {
@@ -1752,7 +1752,7 @@ _getq(class_queue_t *q)
}
qlen(q)--;
m0->m_nextpkt = NULL;
- return (m0);
+ return m0;
}
/* drop a packet at the tail of the queue */
@@ -1775,7 +1775,7 @@ _getq_tail(class_queue_t *q)
qtail(q) = prev;
qlen(q)--;
m->m_nextpkt = NULL;
- return (m);
+ return m;
}
/* randomly select a packet in the queue */
@@ -1804,7 +1804,7 @@ _getq_random(class_queue_t *q)
}
qlen(q)--;
m->m_nextpkt = NULL;
- return (m);
+ return m;
}
void
Index: src/sys/altq/altq_subr.c
diff -u src/sys/altq/altq_subr.c:1.33 src/sys/altq/altq_subr.c:1.34
--- src/sys/altq/altq_subr.c:1.33 Tue Mar 14 09:03:08 2017
+++ src/sys/altq/altq_subr.c Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_subr.c,v 1.33 2017/03/14 09:03:08 ozaki-r Exp $ */
+/* $NetBSD: altq_subr.c,v 1.34 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_subr.c,v 1.24 2005/04/13 03:44:25 suz Exp $ */
/*
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_subr.c,v 1.33 2017/03/14 09:03:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_subr.c,v 1.34 2025/01/08 13:00:04 joe Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -169,7 +169,7 @@ altq_detach(struct ifaltq *ifq)
if (ALTQ_IS_ENABLED(ifq))
return EBUSY;
if (!ALTQ_IS_ATTACHED(ifq))
- return (0);
+ return 0;
#ifdef ALTQ3_COMPAT
#ifdef ALTQ_KLD
altq_module_declref(ifq->altq_type);
@@ -273,7 +273,7 @@ tbr_dequeue(struct ifaltq *ifq, int op)
}
/* if token is still negative, don't allow dequeue */
if (tbr->tbr_token <= 0)
- return (NULL);
+ return NULL;
}
if (ALTQ_IS_ENABLED(ifq))
@@ -304,21 +304,21 @@ tbr_set(struct ifaltq *ifq, struct tb_pr
init_machclk();
if (machclk_freq == 0) {
printf("tbr_set: no CPU clock available!\n");
- return (ENXIO);
+ return ENXIO;
}
if (profile->rate == 0) {
/* delete this tbr */
if ((tbr = ifq->altq_tbr) == NULL)
- return (ENOENT);
+ return ENOENT;
ifq->altq_tbr = NULL;
free(tbr, M_DEVBUF);
- return (0);
+ return 0;
}
tbr = malloc(sizeof(struct tb_regulator), M_DEVBUF, M_WAITOK|M_ZERO);
if (tbr == NULL)
- return (ENOMEM);
+ return ENOMEM;
tbr->tbr_rate = TBR_SCALE(profile->rate / 8) / machclk_freq;
tbr->tbr_depth = TBR_SCALE(profile->depth);
@@ -341,7 +341,7 @@ tbr_set(struct ifaltq *ifq, struct tb_pr
tbr_timer = 1;
}
}
- return (0);
+ return 0;
}
/*
@@ -397,7 +397,7 @@ tbr_get(struct ifaltq *ifq, struct tb_pr
(u_int)TBR_UNSCALE(tbr->tbr_rate * 8 * machclk_freq);
profile->depth = (u_int)TBR_UNSCALE(tbr->tbr_depth);
}
- return (0);
+ return 0;
}
#if NPF > 0
@@ -432,7 +432,7 @@ altq_pfattach(struct pf_altq *a)
error = ENXIO;
}
- return (error);
+ return error;
}
/*
@@ -447,11 +447,11 @@ altq_pfdetach(struct pf_altq *a)
int s, error = 0;
if ((ifp = ifunit(a->ifname)) == NULL)
- return (EINVAL);
+ return EINVAL;
/* if this discipline is no longer referenced, just return */
if (a->altq_disc == NULL || a->altq_disc != ifp->if_snd.altq_disc)
- return (0);
+ return 0;
s = splnet();
if (ALTQ_IS_ENABLED(&ifp->if_snd))
@@ -460,7 +460,7 @@ altq_pfdetach(struct pf_altq *a)
error = altq_detach(&ifp->if_snd);
splx(s);
- return (error);
+ return error;
}
/*
@@ -499,7 +499,7 @@ altq_add(struct pf_altq *a)
error = ENXIO;
}
- return (error);
+ return error;
}
/*
@@ -533,7 +533,7 @@ altq_remove(struct pf_altq *a)
error = ENXIO;
}
- return (error);
+ return error;
}
/*
@@ -564,7 +564,7 @@ altq_add_queue(struct pf_altq *a)
error = ENXIO;
}
- return (error);
+ return error;
}
/*
@@ -595,7 +595,7 @@ altq_remove_queue(struct pf_altq *a)
error = ENXIO;
}
- return (error);
+ return error;
}
/*
@@ -626,7 +626,7 @@ altq_getqstats(struct pf_altq *a, void *
error = ENXIO;
}
- return (error);
+ return error;
}
#endif /* NPF > 0 */
@@ -675,7 +675,7 @@ read_dsfield(struct mbuf *m, struct altq
ds_field = (flowlabel >> 20) & 0xff;
}
#endif
- return (ds_field);
+ return ds_field;
}
void
@@ -771,7 +771,7 @@ read_machclk(void)
binuptime(&bt);
val = (((u_int64_t)bt.sec << 32) + (bt.frac >> 32)) >> BINTIME_SHIFT;
- return (val);
+ return val;
}
#ifdef ALTQ3_CLFIER_COMPAT
@@ -822,7 +822,7 @@ altq_extractflow(struct mbuf *m, int af,
fin->fi_dport = 0;
fin->fi_gpi = 0;
}
- return (1);
+ return 1;
}
#ifdef INET6
@@ -858,7 +858,7 @@ altq_extractflow(struct mbuf *m, int af,
fin6->fi6_dport = 0;
fin6->fi6_gpi = 0;
}
- return (1);
+ return 1;
}
#endif /* INET6 */
@@ -869,7 +869,7 @@ altq_extractflow(struct mbuf *m, int af,
/* failed */
flow->fi_len = sizeof(struct flowinfo);
flow->fi_family = AF_UNSPEC;
- return (0);
+ return 0;
}
/*
@@ -903,7 +903,7 @@ extract_ports4(struct mbuf *m, struct ip
/* if it is a fragment, try cached fragment info */
if (ip_off & IP_OFFMASK) {
ip4f_lookup(ip, fin);
- return (1);
+ return 1;
}
/* locate the mbuf containing the protocol header */
@@ -915,7 +915,7 @@ extract_ports4(struct mbuf *m, struct ip
#ifdef ALTQ_DEBUG
printf("extract_ports4: can't locate header! ip=%p\n", ip);
#endif
- return (0);
+ return 0;
}
off = ((char *)ip - m0->m_data) + (ip->ip_hl << 2);
proto = ip->ip_p;
@@ -927,10 +927,10 @@ extract_ports4(struct mbuf *m, struct ip
off -= m0->m_len;
m0 = m0->m_next;
if (m0 == NULL)
- return (0); /* bogus ip_hl! */
+ return 0; /* bogus ip_hl! */
}
if (m0->m_len < off + 4)
- return (0);
+ return 0;
switch (proto) {
case IPPROTO_TCP:
@@ -971,14 +971,14 @@ extract_ports4(struct mbuf *m, struct ip
default:
fin->fi_proto = proto;
- return (0);
+ return 0;
}
/* if this is a first fragment, cache it. */
if (ip_off & IP_MF)
ip4f_cache(ip, fin);
- return (1);
+ return 1;
}
#ifdef INET6
@@ -1002,7 +1002,7 @@ extract_ports6(struct mbuf *m, struct ip
#ifdef ALTQ_DEBUG
printf("extract_ports6: can't locate header! ip6=%p\n", ip6);
#endif
- return (0);
+ return 0;
}
off = ((char *)ip6 - m0->m_data) + sizeof(struct ip6_hdr);
@@ -1012,10 +1012,10 @@ extract_ports6(struct mbuf *m, struct ip
off -= m0->m_len;
m0 = m0->m_next;
if (m0 == NULL)
- return (0);
+ return 0;
}
if (m0->m_len < off + 4)
- return (0);
+ return 0;
switch (proto) {
case IPPROTO_TCP:
@@ -1027,7 +1027,7 @@ extract_ports6(struct mbuf *m, struct ip
fin6->fi6_dport = udp->uh_dport;
fin6->fi6_proto = proto;
}
- return (1);
+ return 1;
case IPPROTO_ESP:
if (fin6->fi6_gpi == 0) {
@@ -1037,7 +1037,7 @@ extract_ports6(struct mbuf *m, struct ip
fin6->fi6_gpi = *gpi;
}
fin6->fi6_proto = proto;
- return (1);
+ return 1;
case IPPROTO_AH: {
/* get next header and header length */
@@ -1069,7 +1069,7 @@ extract_ports6(struct mbuf *m, struct ip
/* ipv6 fragmentations are not supported yet */
default:
fin6->fi6_proto = proto;
- return (0);
+ return 0;
}
} while (1);
/*NOTREACHED*/
@@ -1089,15 +1089,15 @@ acc_add_filter(struct acc_classifier *cl
#ifdef INET6
if (filter->ff_flow.fi_family != AF_INET &&
filter->ff_flow.fi_family != AF_INET6)
- return (EINVAL);
+ return EINVAL;
#else
if (filter->ff_flow.fi_family != AF_INET)
- return (EINVAL);
+ return EINVAL;
#endif
afp = malloc(sizeof(struct acc_filter), M_DEVBUF, M_WAITOK|M_ZERO);
if (afp == NULL)
- return (ENOMEM);
+ return ENOMEM;
afp->f_filter = *filter;
afp->f_class = class;
@@ -1194,7 +1194,7 @@ acc_add_filter(struct acc_classifier *cl
splx(s);
*phandle = afp->f_handle;
- return (0);
+ return 0;
}
int
@@ -1204,7 +1204,7 @@ acc_delete_filter(struct acc_classifier
int s;
if ((afp = filth_to_filtp(classifier, handle)) == NULL)
- return (EINVAL);
+ return EINVAL;
s = splnet();
LIST_REMOVE(afp, f_chain);
@@ -1214,7 +1214,7 @@ acc_delete_filter(struct acc_classifier
/* todo: update filt_bmask */
- return (0);
+ return 0;
}
/*
@@ -1244,7 +1244,7 @@ acc_discard_filters(struct acc_classifie
if (all)
classifier->acc_fbmask = 0;
- return (0);
+ return 0;
}
void *
@@ -1341,7 +1341,7 @@ acc_classify(void *clfier, struct mbuf *
#endif /* INET6 */
/* no filter matched */
- return (NULL);
+ return NULL;
}
static int
@@ -1349,28 +1349,28 @@ apply_filter4(u_int32_t fbmask, struct f
struct flowinfo_in *pkt)
{
if (filt->ff_flow.fi_family != AF_INET)
- return (0);
+ return 0;
if ((fbmask & FIMB4_SPORT) && filt->ff_flow.fi_sport != pkt->fi_sport)
- return (0);
+ return 0;
if ((fbmask & FIMB4_DPORT) && filt->ff_flow.fi_dport != pkt->fi_dport)
- return (0);
+ return 0;
if ((fbmask & FIMB4_DADDR) &&
filt->ff_flow.fi_dst.s_addr !=
(pkt->fi_dst.s_addr & filt->ff_mask.mask_dst.s_addr))
- return (0);
+ return 0;
if ((fbmask & FIMB4_SADDR) &&
filt->ff_flow.fi_src.s_addr !=
(pkt->fi_src.s_addr & filt->ff_mask.mask_src.s_addr))
- return (0);
+ return 0;
if ((fbmask & FIMB4_PROTO) && filt->ff_flow.fi_proto != pkt->fi_proto)
- return (0);
+ return 0;
if ((fbmask & FIMB4_TOS) && filt->ff_flow.fi_tos !=
(pkt->fi_tos & filt->ff_mask.mask_tos))
- return (0);
+ return 0;
if ((fbmask & FIMB4_GPI) && filt->ff_flow.fi_gpi != (pkt->fi_gpi))
- return (0);
+ return 0;
/* match */
- return (1);
+ return 1;
}
/*
@@ -1382,15 +1382,15 @@ apply_ppfilter4(u_int32_t fbmask, struct
struct flowinfo_in *pkt)
{
if (filt->ff_flow.fi_family != AF_INET)
- return (0);
+ return 0;
if ((fbmask & FIMB4_SPORT) && filt->ff_flow.fi_sport != pkt->fi_sport)
- return (0);
+ return 0;
if ((fbmask & FIMB4_DPORT) && filt->ff_flow.fi_dport != pkt->fi_dport)
- return (0);
+ return 0;
if ((fbmask & FIMB4_PROTO) && filt->ff_flow.fi_proto != pkt->fi_proto)
- return (0);
+ return 0;
/* match */
- return (1);
+ return 1;
}
/*
@@ -1401,12 +1401,12 @@ apply_tosfilter4(u_int32_t fbmask, struc
struct flowinfo_in *pkt)
{
if (filt->ff_flow.fi_family != AF_INET)
- return (0);
+ return 0;
if ((fbmask & FIMB4_TOS) && filt->ff_flow.fi_tos !=
(pkt->fi_tos & filt->ff_mask.mask_tos))
- return (0);
+ return 0;
/* match */
- return (1);
+ return 1;
}
#ifdef INET6
@@ -1417,42 +1417,42 @@ apply_filter6(u_int32_t fbmask, struct f
int i;
if (filt->ff_flow6.fi6_family != AF_INET6)
- return (0);
+ return 0;
if ((fbmask & FIMB6_FLABEL) &&
filt->ff_flow6.fi6_flowlabel != pkt->fi6_flowlabel)
- return (0);
+ return 0;
if ((fbmask & FIMB6_PROTO) &&
filt->ff_flow6.fi6_proto != pkt->fi6_proto)
- return (0);
+ return 0;
if ((fbmask & FIMB6_SPORT) &&
filt->ff_flow6.fi6_sport != pkt->fi6_sport)
- return (0);
+ return 0;
if ((fbmask & FIMB6_DPORT) &&
filt->ff_flow6.fi6_dport != pkt->fi6_dport)
- return (0);
+ return 0;
if (fbmask & FIMB6_SADDR) {
for (i = 0; i < 4; i++)
if (filt->ff_flow6.fi6_src.s6_addr32[i] !=
(pkt->fi6_src.s6_addr32[i] &
filt->ff_mask6.mask6_src.s6_addr32[i]))
- return (0);
+ return 0;
}
if (fbmask & FIMB6_DADDR) {
for (i = 0; i < 4; i++)
if (filt->ff_flow6.fi6_dst.s6_addr32[i] !=
(pkt->fi6_dst.s6_addr32[i] &
filt->ff_mask6.mask6_dst.s6_addr32[i]))
- return (0);
+ return 0;
}
if ((fbmask & FIMB6_TCLASS) &&
filt->ff_flow6.fi6_tclass !=
(pkt->fi6_tclass & filt->ff_mask6.mask6_tclass))
- return (0);
+ return 0;
if ((fbmask & FIMB6_GPI) &&
filt->ff_flow6.fi6_gpi != pkt->fi6_gpi)
- return (0);
+ return 0;
/* match */
- return (1);
+ return 1;
}
#endif /* INET6 */
@@ -1496,9 +1496,9 @@ filth_to_filtp(struct acc_classifier *cl
LIST_FOREACH(afp, &classifier->acc_filters[i], f_chain)
if (afp->f_handle == handle)
- return (afp);
+ return afp;
- return (NULL);
+ return NULL;
}
/* create flowinfo bitmask */
@@ -1550,7 +1550,7 @@ filt2fibmask(struct flow_filter *filt)
break;
#endif /* INET6 */
}
- return (mask);
+ return mask;
}
@@ -1620,11 +1620,11 @@ ip4f_lookup(struct ip *ip, struct flowin
release the entry. */
ip4f_free(fp);
- return (1);
+ return 1;
}
/* no matching entry found */
- return (0);
+ return 0;
}
static int
@@ -1639,13 +1639,13 @@ ip4f_init(void)
if (fp == NULL) {
printf("ip4f_init: can't alloc %dth entry!\n", i);
if (i == 0)
- return (-1);
- return (0);
+ return -1;
+ return 0;
}
fp->ip4f_valid = 0;
TAILQ_INSERT_TAIL(&ip4f_list, fp, ip4f_chain);
}
- return (0);
+ return 0;
}
static struct ip4_frag *
@@ -1658,7 +1658,7 @@ ip4f_alloc(void)
TAILQ_REMOVE(&ip4f_list, fp, ip4f_chain);
fp->ip4f_valid = 1;
TAILQ_INSERT_HEAD(&ip4f_list, fp, ip4f_chain);
- return (fp);
+ return fp;
}
static void
Index: src/sys/altq/altq_wfq.c
diff -u src/sys/altq/altq_wfq.c:1.23 src/sys/altq/altq_wfq.c:1.24
--- src/sys/altq/altq_wfq.c:1.23 Tue Sep 21 14:30:15 2021
+++ src/sys/altq/altq_wfq.c Wed Jan 8 13:00:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_wfq.c,v 1.23 2021/09/21 14:30:15 christos Exp $ */
+/* $NetBSD: altq_wfq.c,v 1.24 2025/01/08 13:00:04 joe Exp $ */
/* $KAME: altq_wfq.c,v 1.14 2005/04/13 03:44:25 suz Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_wfq.c,v 1.23 2021/09/21 14:30:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_wfq.c,v 1.24 2025/01/08 13:00:04 joe Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -94,7 +94,7 @@ wfq_setenable(struct wfq_interface *ifac
int error = 0;
if ((wfqp = altq_lookup(ifacep->wfq_ifacename, ALTQT_WFQ)) == NULL)
- return (EBADF);
+ return EBADF;
switch(flag){
case ENABLE:
@@ -120,25 +120,25 @@ wfq_ifattach(struct wfq_interface *iface
#ifdef WFQ_DEBUG
printf("wfq_ifattach()...no ifp found\n");
#endif
- return (ENXIO);
+ return ENXIO;
}
if (!ALTQ_IS_READY(&ifp->if_snd)) {
#ifdef WFQ_DEBUG
printf("wfq_ifattach()...altq is not ready\n");
#endif
- return (ENXIO);
+ return ENXIO;
}
/* allocate and initialize wfq_state_t */
new_wfqp = malloc(sizeof(wfq_state_t), M_DEVBUF, M_WAITOK|M_ZERO);
if (new_wfqp == NULL)
- return (ENOMEM);
+ return ENOMEM;
queue = malloc(sizeof(wfq) * DEFAULT_QSIZE, M_DEVBUF, M_WAITOK|M_ZERO);
if (queue == NULL) {
free(new_wfqp, M_DEVBUF);
- return (ENOMEM);
+ return ENOMEM;
}
/* keep the ifq */
@@ -166,13 +166,13 @@ wfq_ifattach(struct wfq_interface *iface
new_wfqp, wfq_classify)) != 0) {
free(queue, M_DEVBUF);
free(new_wfqp, M_DEVBUF);
- return (error);
+ return error;
}
new_wfqp->next = wfq_list;
wfq_list = new_wfqp;
- return (error);
+ return error;
}
@@ -183,7 +183,7 @@ wfq_ifdetach(struct wfq_interface *iface
wfq_state_t *wfqp;
if ((wfqp = altq_lookup(ifacep->wfq_ifacename, ALTQT_WFQ)) == NULL)
- return (EBADF);
+ return EBADF;
/* free queued mbuf */
wfq_flush(wfqp->ifq);
@@ -208,7 +208,7 @@ wfq_ifdetach(struct wfq_interface *iface
/* deallocate wfq_state_t */
free(wfqp->queue, M_DEVBUF);
free(wfqp, M_DEVBUF);
- return (error);
+ return error;
}
static int
@@ -221,7 +221,7 @@ wfq_request(struct ifaltq *ifq, int req,
wfq_flush(wfqp->ifq);
break;
}
- return (0);
+ return 0;
}
@@ -580,7 +580,7 @@ wfq_config(struct wfq_conf *cf)
queue = malloc(sizeof(wfq) * cf->nqueues, M_DEVBUF,
M_WAITOK|M_ZERO);
if (queue == NULL)
- return (ENOMEM);
+ return ENOMEM;
wfqp->nums = cf->nqueues;
wfqp->bytes = 0;
@@ -682,7 +682,7 @@ wfqioctl(dev_t dev, ioctlcmd_t cmd, void
if ((error = kauth_authorize_network(l->l_cred,
KAUTH_NETWORK_ALTQ, KAUTH_REQ_NETWORK_ALTQ_WFQ, NULL,
NULL, NULL)) != 0)
- return (error);
+ return error;
break;
}