Transform tbr_dequeue into a function pointer in order to build drivers with
ALTQ enabled versions of IFQ_* macros by default, as requested by serveral others. This is a follow-up to the quick fix I committed yesterday which turned off the ALTQ checks for non-ALTQ kernels.
This commit is contained in:
parent
1cab0c857e
commit
4cb655c020
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130508
@ -91,6 +91,7 @@
|
||||
*/
|
||||
static void tbr_timeout(void *);
|
||||
int (*altq_input)(struct mbuf *, int) = NULL;
|
||||
static struct mbuf *tbr_dequeue(struct ifaltq *, int);
|
||||
static int tbr_timer = 0; /* token bucket regulator timer */
|
||||
static struct callout tbr_callout = CALLOUT_INITIALIZER;
|
||||
|
||||
@ -312,7 +313,7 @@ altq_assert(file, line, failedexpr)
|
||||
#define TBR_SCALE(x) ((int64_t)(x) << TBR_SHIFT)
|
||||
#define TBR_UNSCALE(x) ((x) >> TBR_SHIFT)
|
||||
|
||||
struct mbuf *
|
||||
static struct mbuf *
|
||||
tbr_dequeue(ifq, op)
|
||||
struct ifaltq *ifq;
|
||||
int op;
|
||||
@ -370,6 +371,9 @@ tbr_set(ifq, profile)
|
||||
struct tb_profile *profile;
|
||||
{
|
||||
struct tb_regulator *tbr, *otbr;
|
||||
|
||||
if (tbr_dequeue_ptr == NULL)
|
||||
tbr_dequeue_ptr = tbr_dequeue;
|
||||
|
||||
if (machclk_freq == 0)
|
||||
init_machclk();
|
||||
|
@ -181,9 +181,9 @@ extern int altq_attach(struct ifaltq *, int, void *,
|
||||
extern int altq_detach(struct ifaltq *);
|
||||
extern int altq_enable(struct ifaltq *);
|
||||
extern int altq_disable(struct ifaltq *);
|
||||
extern struct mbuf *tbr_dequeue(struct ifaltq *, int);
|
||||
extern struct mbuf *(*tbr_dequeue_ptr)(struct ifaltq *, int);
|
||||
extern int (*altq_input)(struct mbuf *, int);
|
||||
#if 1 /* ALTQ3_CLFIER_COMPAT */
|
||||
#if 0 /* ALTQ3_CLFIER_COMPAT */
|
||||
void altq_etherclassify(struct ifaltq *, struct mbuf *, struct altq_pktattr *);
|
||||
#endif
|
||||
#endif /* _KERNEL */
|
||||
|
@ -75,6 +75,8 @@
|
||||
#include <netinet/if_ether.h>
|
||||
#endif
|
||||
|
||||
struct mbuf *(*tbr_dequeue_ptr)(struct ifaltq *, int) = NULL;
|
||||
|
||||
static void if_attachdomain(void *);
|
||||
static void if_attachdomain1(struct ifnet *);
|
||||
static int ifconf(u_long, caddr_t);
|
||||
@ -441,13 +443,11 @@ if_attach(struct ifnet *ifp)
|
||||
ifa->ifa_refcnt = 1;
|
||||
TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link);
|
||||
ifp->if_broadcastaddr = 0; /* reliably crash if used uninitialized */
|
||||
#ifdef ALTQ
|
||||
ifp->if_snd.altq_type = 0;
|
||||
ifp->if_snd.altq_disc = NULL;
|
||||
ifp->if_snd.altq_flags &= ALTQF_CANTCHANGE;
|
||||
ifp->if_snd.altq_tbr = NULL;
|
||||
ifp->if_snd.altq_ifp = ifp;
|
||||
#endif
|
||||
|
||||
if (domains)
|
||||
if_attachdomain1(ifp);
|
||||
|
@ -356,7 +356,7 @@ if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust)
|
||||
(*ifp->if_start)(ifp);
|
||||
return (1);
|
||||
}
|
||||
#ifdef ALTQ
|
||||
#if 1 /* ALTQ */
|
||||
#define IFQ_ENQUEUE(ifq, m, err) \
|
||||
do { \
|
||||
IF_LOCK(ifq); \
|
||||
@ -379,7 +379,7 @@ do { \
|
||||
#define IFQ_DEQUEUE_NOLOCK(ifq, m) \
|
||||
do { \
|
||||
if (TBR_IS_ENABLED(ifq)) \
|
||||
(m) = tbr_dequeue(ifq, ALTDQ_REMOVE); \
|
||||
(m) = tbr_dequeue_ptr(ifq, ALTDQ_REMOVE); \
|
||||
else if (ALTQ_IS_ENABLED(ifq)) \
|
||||
ALTQ_DEQUEUE(ifq, m); \
|
||||
else \
|
||||
@ -396,7 +396,7 @@ do { \
|
||||
#define IFQ_POLL_NOLOCK(ifq, m) \
|
||||
do { \
|
||||
if (TBR_IS_ENABLED(ifq)) \
|
||||
(m) = tbr_dequeue(ifq, ALTDQ_POLL); \
|
||||
(m) = tbr_dequeue_ptr(ifq, ALTDQ_POLL); \
|
||||
else if (ALTQ_IS_ENABLED(ifq)) \
|
||||
ALTQ_POLL(ifq, m); \
|
||||
else \
|
||||
|
Loading…
Reference in New Issue
Block a user