Skip to content

Commit 1dad8e5

Browse files
committed
definition of altq_expand which sends npfioc_altq to kernel
it is implemented to compute all params of queues for any kind of scheduler
1 parent add8f94 commit 1dad8e5

File tree

7 files changed

+1332
-4
lines changed

7 files changed

+1332
-4
lines changed

sys/net/npf/npf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ struct npfioc_altq {
330330
#define IOC_NPF_RULE _IOWR('N', 107, nvlist_ref_t)
331331
#define IOC_NPF_CONN_LOOKUP _IOWR('N', 108, nvlist_ref_t)
332332
#define IOC_NPF_TABLE_REPLACE _IOWR('N', 109, nvlist_ref_t)
333+
#define IOC_NPF_BEGIN_ALTQ _IO('N', 112)
334+
#define IOC_NPF_ADD_ALTQ _IOWR('N', 110, struct npfioc_altq)
335+
#define IOC_NPF_GET_ALTQS _IOWR('N', 111, struct npfioc_altq)
333336

334337
/*
335338
* NPF error report.

sys/net/npf/npf_altq.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,12 @@ struct npf_altq {
104104
} pq_u;
105105
u_int32_t qid; /* return value */
106106
};
107+
108+
TAILQ_HEAD(npf_altqqueue, npf_altq);
109+
110+
extern int npf_get_altqs(void *);
111+
extern void npf_altq_init(void);
112+
extern int npf_begin_altq(void);
113+
extern int npf_add_altq(void *);
114+
107115
#endif /* NPF_ALTQ_H_ */

sys/net/npf/npf_os.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ npf_dev_ioctl(dev_t dev, u_long cmd, void *data, int flag, lwp_t *l)
274274
return npfctl_table(npf, data);
275275
case IOC_NPF_STATS:
276276
return npf_stats_export(npf, data);
277+
277278
case IOC_NPF_LOAD:
278279
case IOC_NPF_SAVE:
279280
case IOC_NPF_RULE:

usr.sbin/npf/npfctl/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ MAN= npfctl.8 npf.conf.5
77
BINDIR= /sbin
88

99
SRCS= npfctl.c npf_cmd.c npf_var.c npf_data.c npf_build.c
10-
SRCS+= npf_bpf_comp.c npf_show.c npf_extmod.c
10+
SRCS+= npf_bpf_comp.c npf_show.c npf_extmod.c npfctl_altq.c
1111

1212
CPPFLAGS+= -I${.CURDIR}
1313
SRCS+= npf_scan.l npf_parse.y
1414
YHEADER= 1
1515

16-
LDADD+= -lnpf -lpcap -lutil -ly
17-
DPADD+= ${LIBNPF} ${LIBUTIL} ${LIBPCAP} ${LIBUTIL} ${LIBY}
16+
LDADD+= -lnpf -lpcap -lutil -ly -lm
17+
DPADD+= ${LIBNPF} ${LIBUTIL} ${LIBPCAP} ${LIBUTIL} ${LIBY} ${LIBM}
1818

1919
WARNS= 5
2020

usr.sbin/npf/npfctl/npfctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ npfctl_load(int fd)
339339
return errno;
340340
}
341341

342-
static int
342+
int
343343
npfctl_open_dev(const char *path)
344344
{
345345
struct stat st;

usr.sbin/npf/npfctl/npfctl.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,31 @@ void npfctl_build_table(const char *, u_int, const char *);
303303

304304
void npfctl_setparam(const char *, int);
305305

306+
/* ALTQ related */
307+
int npfctl_test_altqsupport(int);
308+
extern int npfctl_open_dev(const char *);
309+
int npfctl_eval_bw(struct node_queue_bw *, char *);
310+
int expand_altq(struct npf_altq *, const char *, struct node_queue *,
311+
struct node_queue_bw bwspec, struct node_queue_opt *);
312+
int expand_queue(struct npf_altq *, const char *, struct node_queue *,
313+
struct node_queue_bw, struct node_queue_opt *);
314+
u_long get_ifmtu(char *);
315+
uint32_t get_ifspeed(char *);
316+
uint32_t npf_eval_bwspec(struct node_queue_bw *, uint32_t);
317+
void npfaltq_store(struct npf_altq *);
318+
int npfctl_add_altq(struct npf_altq *);
319+
int npf_eval_queue_opts(struct npf_altq *, struct node_queue_opt *,
320+
uint32_t);
321+
int eval_npfaltq(struct npf_altq *, struct node_queue_bw *,
322+
struct node_queue_opt *);
323+
int eval_npfqueue(struct npf_altq *, struct node_queue_bw *,
324+
struct node_queue_opt *);
325+
struct npf_altq *qname_to_npfaltq(const char *, const char *);
326+
uint32_t qname_to_qid(const char *);
327+
struct npf_altq *npfaltq_lookup(const char *ifname);
328+
char *rate2str(double);
329+
int check_commit_altq(void);
330+
306331
/*
307332
* For the systems which do not define TH_ECE and TW_CRW.
308333
*/

0 commit comments

Comments
 (0)