Skip to content

Commit 9772953

Browse files
committed
functions to initialize queueing, and add queues in the kernel
1 parent bebe621 commit 9772953

File tree

12 files changed

+266
-50
lines changed

12 files changed

+266
-50
lines changed

sys/altq/altq_cbq.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.42 2025/01/08 13:00:04 joe Exp $");
6060
#include <netinet/in.h>
6161

6262
#if NNPF > 0
63-
#include <net/npf_altq.h>
63+
#include <net/npf/npf_altq.h>
6464
#endif
6565
#include <altq/altq.h>
6666
#include <altq/altq_cbq.h>
@@ -244,7 +244,7 @@ get_class_stats(class_stats_t *statsp, struct rm_class *cl)
244244

245245
#if NNPF > 0
246246
int
247-
cbq_pfattach(struct npf_altq *a)
247+
cbq_npfattach(struct npf_altq *a)
248248
{
249249
struct ifnet *ifp;
250250
int s, error;
@@ -313,7 +313,7 @@ cbq_add_queue(struct npf_altq *a)
313313
struct rm_class *borrow, *parent;
314314
cbq_state_t *cbqp;
315315
struct rm_class *cl;
316-
struct cbq_opts *opts;
316+
struct npf_cbq_opts *opts;
317317
int i, error;
318318

319319
if ((cbqp = a->altq_disc) == NULL)

sys/altq/altq_hfsc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: altq_hfsc.c,v 1.31 2025/01/08 13:00:04 joe Exp $");
7171
#include <netinet/in.h>
7272

7373
#if NNPF > 0
74-
#include <net/npf_altq.h>
74+
#include <net/npf/npf_altq.h>
7575
#endif
7676
#include <altq/altq.h>
7777
#include <altq/altq_hfsc.h>
@@ -175,7 +175,7 @@ static struct hfsc_if *hif_list = NULL;
175175

176176
#if NNPF > 0
177177
int
178-
hfsc_pfattach(struct npf_altq *a)
178+
hfsc_npfattach(struct npf_altq *a)
179179
{
180180
struct ifnet *ifp;
181181
int s, error;
@@ -242,7 +242,7 @@ hfsc_add_queue(struct npf_altq *a)
242242
{
243243
struct hfsc_if *hif;
244244
struct hfsc_class *cl, *parent;
245-
struct hfsc_opts *opts;
245+
struct npf_hfsc_opts *opts;
246246
struct service_curve rtsc, lssc, ulsc;
247247

248248
if ((hif = a->altq_disc) == NULL)

sys/altq/altq_priq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: altq_priq.c,v 1.29 2025/01/08 13:00:04 joe Exp $");
5757
#include <netinet/in.h>
5858

5959
#if NNPF > 0
60-
#include <net/npf_altq.h>
60+
#include <net/npf/npf_altq.h>
6161
#endif
6262
#include <altq/altq.h>
6363
#include <altq/altq_conf.h>
@@ -107,7 +107,7 @@ static struct priq_if *pif_list = NULL;
107107

108108
#if NNPF > 0
109109
int
110-
priq_pfattach(struct npf_altq *a)
110+
priq_npfattach(struct npf_altq *a)
111111
{
112112
struct ifnet *ifp;
113113
int s, error;

sys/altq/altq_subr.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: altq_subr.c,v 1.34 2025/01/08 13:00:04 joe Exp $");
6363
#include <netinet/udp.h>
6464

6565
#if NNPF > 0
66-
#include <net/npf_altq.h>
66+
#include <net/npf/npf_altq.h>
6767
#endif
6868
#include <altq/altq.h>
6969
#ifdef ALTQ3_COMPAT
@@ -400,13 +400,12 @@ tbr_get(struct ifaltq *ifq, struct tb_profile *profile)
400400
return 0;
401401
}
402402

403-
#if NNPF > 0
404403
/*
405404
* attach a discipline to the interface. if one already exists, it is
406405
* overridden.
407406
*/
408407
int
409-
altq_pfattach(struct npf_altq *a)
408+
altq_npfattach(struct npf_altq *a)
410409
{
411410
int error = 0;
412411

@@ -415,17 +414,17 @@ altq_pfattach(struct npf_altq *a)
415414
break;
416415
#ifdef ALTQ_CBQ
417416
case ALTQT_CBQ:
418-
error = cbq_pfattach(a);
417+
error = cbq_npfattach(a);
419418
break;
420419
#endif
421420
#ifdef ALTQ_PRIQ
422421
case ALTQT_PRIQ:
423-
error = priq_pfattach(a);
422+
error = priq_npfattach(a);
424423
break;
425424
#endif
426425
#ifdef ALTQ_HFSC
427426
case ALTQT_HFSC:
428-
error = hfsc_pfattach(a);
427+
error = hfsc_npfattach(a);
429428
break;
430429
#endif
431430
default:
@@ -441,7 +440,7 @@ altq_pfattach(struct npf_altq *a)
441440
* discipline.
442441
*/
443442
int
444-
altq_pfdetach(struct npf_altq *a)
443+
altq_npfdetach(struct npf_altq *a)
445444
{
446445
struct ifnet *ifp;
447446
int s, error = 0;
@@ -628,7 +627,6 @@ altq_getqstats(struct npf_altq *a, void *ubuf, int *nbytes)
628627

629628
return error;
630629
}
631-
#endif /* NNPF > 0 */
632630

633631
/*
634632
* read and write diffserv field in IPv4 or IPv6 header

sys/altq/altq_var.h

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,13 @@ typedef void (timeout_t)(void *);
207207
#define m_pktlen(m) ((m)->m_pkthdr.len)
208208

209209
struct ifnet; struct mbuf;
210-
struct pf_altq;
210+
struct npf_altq;
211211
#ifdef ALTQ3_CLFIER_COMPAT
212212
struct flowinfo;
213213
#endif
214214

215+
#include <altq/if_altq.h>
216+
215217
void *altq_lookup(char *, int);
216218
#ifdef ALTQ3_CLFIER_COMPAT
217219
int altq_extractflow(struct mbuf *, int, struct flowinfo *, u_int32_t);
@@ -227,34 +229,34 @@ void altq_assert(const char *, int, const char *);
227229
int tbr_set(struct ifaltq *, struct tb_profile *);
228230
int tbr_get(struct ifaltq *, struct tb_profile *);
229231

230-
int altq_pfattach(struct pf_altq *);
231-
int altq_pfdetach(struct pf_altq *);
232-
int altq_add(struct pf_altq *);
233-
int altq_remove(struct pf_altq *);
234-
int altq_add_queue(struct pf_altq *);
235-
int altq_remove_queue(struct pf_altq *);
236-
int altq_getqstats(struct pf_altq *, void *, int *);
232+
int altq_npfattach(struct npf_altq *);
233+
int altq_npfdetach(struct npf_altq *);
234+
int altq_add(struct npf_altq *);
235+
int altq_remove(struct npf_altq *);
236+
int altq_add_queue(struct npf_altq *);
237+
int altq_remove_queue(struct npf_altq *);
238+
int altq_getqstats(struct npf_altq *, void *, int *);
237239

238-
int cbq_pfattach(struct pf_altq *);
239-
int cbq_add_altq(struct pf_altq *);
240-
int cbq_remove_altq(struct pf_altq *);
241-
int cbq_add_queue(struct pf_altq *);
242-
int cbq_remove_queue(struct pf_altq *);
243-
int cbq_getqstats(struct pf_altq *, void *, int *);
240+
int cbq_npfattach(struct npf_altq *);
241+
int cbq_add_altq(struct npf_altq *);
242+
int cbq_remove_altq(struct npf_altq *);
243+
int cbq_add_queue(struct npf_altq *);
244+
int cbq_remove_queue(struct npf_altq *);
245+
int cbq_getqstats(struct npf_altq *, void *, int *);
244246

245-
int priq_pfattach(struct pf_altq *);
246-
int priq_add_altq(struct pf_altq *);
247-
int priq_remove_altq(struct pf_altq *);
248-
int priq_add_queue(struct pf_altq *);
249-
int priq_remove_queue(struct pf_altq *);
250-
int priq_getqstats(struct pf_altq *, void *, int *);
247+
int priq_npfattach(struct npf_altq *);
248+
int priq_add_altq(struct npf_altq *);
249+
int priq_remove_altq(struct npf_altq *);
250+
int priq_add_queue(struct npf_altq *);
251+
int priq_remove_queue(struct npf_altq *);
252+
int priq_getqstats(struct npf_altq *, void *, int *);
251253

252-
int hfsc_pfattach(struct pf_altq *);
253-
int hfsc_add_altq(struct pf_altq *);
254-
int hfsc_remove_altq(struct pf_altq *);
255-
int hfsc_add_queue(struct pf_altq *);
256-
int hfsc_remove_queue(struct pf_altq *);
257-
int hfsc_getqstats(struct pf_altq *, void *, int *);
254+
int hfsc_npfattach(struct npf_altq *);
255+
int hfsc_add_altq(struct npf_altq *);
256+
int hfsc_remove_altq(struct npf_altq *);
257+
int hfsc_add_queue(struct npf_altq *);
258+
int hfsc_remove_queue(struct npf_altq *);
259+
int hfsc_getqstats(struct npf_altq *, void *, int *);
258260

259261
#endif /* _KERNEL */
260262
#endif /* _ALTQ_ALTQ_VAR_H_ */

sys/net/npf/files.npf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ file net/npf/npf_alg_icmp.c npf
5050

5151
# Interfaces
5252
file net/npf/if_npflog.c npf
53+
54+
# queues
55+
file net/npf/npf_altq.c npf

sys/net/npf/npf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ 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)
333+
#define IOC_NPF_BEGIN_ALTQ _IO('N', 112)
334334
#define IOC_NPF_ADD_ALTQ _IOWR('N', 110, struct npfioc_altq)
335335
#define IOC_NPF_GET_ALTQS _IOWR('N', 111, struct npfioc_altq)
336336

0 commit comments

Comments
 (0)