Deleted Added
full compact
ip_dummynet.h (125952) ip_dummynet.h (126239)
1/*
2 * Copyright (c) 1998-2002 Luigi Rizzo, Universita` di Pisa
3 * Portions Copyright (c) 2000 Akamba Corp.
4 * All rights reserved
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*
2 * Copyright (c) 1998-2002 Luigi Rizzo, Universita` di Pisa
3 * Portions Copyright (c) 2000 Akamba Corp.
4 * All rights reserved
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/netinet/ip_dummynet.h 125952 2004-02-18 00:04:52Z mlaier $
27 * $FreeBSD: head/sys/netinet/ip_dummynet.h 126239 2004-02-25 19:55:29Z mlaier $
28 */
29
30#ifndef _IP_DUMMYNET_H
31#define _IP_DUMMYNET_H
32
33/*
34 * Definition of dummynet data structures. In the structures, I decided
35 * not to use the macros in <sys/queue.h> in the hope of making the code

--- 70 unchanged lines hidden (view full) ---

106 int size ;
107 int elements ;
108 int offset ; /* XXX if > 0 this is the offset of direct ptr to obj */
109 struct dn_heap_entry *p ; /* really an array of "size" entries */
110} ;
111
112#ifdef _KERNEL
113/*
28 */
29
30#ifndef _IP_DUMMYNET_H
31#define _IP_DUMMYNET_H
32
33/*
34 * Definition of dummynet data structures. In the structures, I decided
35 * not to use the macros in <sys/queue.h> in the hope of making the code

--- 70 unchanged lines hidden (view full) ---

106 int size ;
107 int elements ;
108 int offset ; /* XXX if > 0 this is the offset of direct ptr to obj */
109 struct dn_heap_entry *p ; /* really an array of "size" entries */
110} ;
111
112#ifdef _KERNEL
113/*
114 * struct dn_pkt identifies a packet in the dummynet queue, but
115 * is also used to tag packets passed back to the various destinations
116 * (ip_input(), ip_output(), bdg_forward() and so on).
117 * As such the first part of the structure must be a struct m_hdr,
118 * followed by dummynet-specific parameters. The m_hdr must be
119 * initialized with
120 * mh_type = MT_TAG;
121 * mh_flags = PACKET_TYPE_DUMMYNET;
122 * mh_next = <pointer to the actual mbuf>
123 *
124 * mh_nextpkt, mh_data are free for dummynet use (mh_nextpkt is used to
125 * build a linked list of packets in a dummynet queue).
114 * Packets processed by dummynet have an mbuf tag associated with
115 * them that carries their dummynet state. This is used within
116 * the dummynet code as well as outside when checking for special
117 * processing requirements.
126 */
118 */
127struct dn_pkt {
128 struct m_hdr hdr ;
129#define DN_NEXT(x) (struct dn_pkt *)(x)->hdr.mh_nextpkt
130#define dn_m hdr.mh_next /* packet to be forwarded */
131
119struct dn_pkt_tag {
132 struct ip_fw *rule; /* matching rule */
133 int dn_dir; /* action when packet comes out. */
134#define DN_TO_IP_OUT 1
135#define DN_TO_IP_IN 2
136#define DN_TO_BDG_FWD 3
137#define DN_TO_ETH_DEMUX 4
138#define DN_TO_ETH_OUT 5
139

--- 72 unchanged lines hidden (view full) ---

212 *
213 * A dn_flow_queue is created and initialized whenever a packet for
214 * a new flow arrives.
215 */
216struct dn_flow_queue {
217 struct dn_flow_queue *next ;
218 struct ipfw_flow_id id ;
219
120 struct ip_fw *rule; /* matching rule */
121 int dn_dir; /* action when packet comes out. */
122#define DN_TO_IP_OUT 1
123#define DN_TO_IP_IN 2
124#define DN_TO_BDG_FWD 3
125#define DN_TO_ETH_DEMUX 4
126#define DN_TO_ETH_OUT 5
127

--- 72 unchanged lines hidden (view full) ---

200 *
201 * A dn_flow_queue is created and initialized whenever a packet for
202 * a new flow arrives.
203 */
204struct dn_flow_queue {
205 struct dn_flow_queue *next ;
206 struct ipfw_flow_id id ;
207
220 struct dn_pkt *head, *tail ; /* queue of packets */
208 struct mbuf *head, *tail ; /* queue of packets */
221 u_int len ;
222 u_int len_bytes ;
223 u_long numbytes ; /* credit for transmission (dynamic queues) */
224
225 u_int64_t tot_pkts ; /* statistics counters */
226 u_int64_t tot_bytes ;
227 u_int32_t drops ;
228

--- 96 unchanged lines hidden (view full) ---

325 */
326struct dn_pipe { /* a pipe */
327 struct dn_pipe *next ;
328
329 int pipe_nr ; /* number */
330 int bandwidth; /* really, bytes/tick. */
331 int delay ; /* really, ticks */
332
209 u_int len ;
210 u_int len_bytes ;
211 u_long numbytes ; /* credit for transmission (dynamic queues) */
212
213 u_int64_t tot_pkts ; /* statistics counters */
214 u_int64_t tot_bytes ;
215 u_int32_t drops ;
216

--- 96 unchanged lines hidden (view full) ---

313 */
314struct dn_pipe { /* a pipe */
315 struct dn_pipe *next ;
316
317 int pipe_nr ; /* number */
318 int bandwidth; /* really, bytes/tick. */
319 int delay ; /* really, ticks */
320
333 struct dn_pkt *head, *tail ; /* packets in delay line */
321 struct mbuf *head, *tail ; /* packets in delay line */
334
335 /* WF2Q+ */
336 struct dn_heap scheduler_heap ; /* top extract - key Finish time*/
337 struct dn_heap not_eligible_heap; /* top extract- key Start time */
338 struct dn_heap idle_heap ; /* random extract - key Start=Finish time */
339
340 dn_key V ; /* virtual time */
341 int sum; /* sum of weights of all active sessions */

--- 17 unchanged lines hidden (view full) ---

359typedef void ip_dn_ruledel_t(void *); /* ip_fw.c */
360typedef int ip_dn_io_t(struct mbuf *m, int pipe_nr, int dir,
361 struct ip_fw_args *fwa);
362extern ip_dn_ctl_t *ip_dn_ctl_ptr;
363extern ip_dn_ruledel_t *ip_dn_ruledel_ptr;
364extern ip_dn_io_t *ip_dn_io_ptr;
365#define DUMMYNET_LOADED (ip_dn_io_ptr != NULL)
366
322
323 /* WF2Q+ */
324 struct dn_heap scheduler_heap ; /* top extract - key Finish time*/
325 struct dn_heap not_eligible_heap; /* top extract- key Start time */
326 struct dn_heap idle_heap ; /* random extract - key Start=Finish time */
327
328 dn_key V ; /* virtual time */
329 int sum; /* sum of weights of all active sessions */

--- 17 unchanged lines hidden (view full) ---

347typedef void ip_dn_ruledel_t(void *); /* ip_fw.c */
348typedef int ip_dn_io_t(struct mbuf *m, int pipe_nr, int dir,
349 struct ip_fw_args *fwa);
350extern ip_dn_ctl_t *ip_dn_ctl_ptr;
351extern ip_dn_ruledel_t *ip_dn_ruledel_ptr;
352extern ip_dn_io_t *ip_dn_io_ptr;
353#define DUMMYNET_LOADED (ip_dn_io_ptr != NULL)
354
355/*
356 * Return the IPFW rule associated with the dummynet tag; if any.
357 * Make sure that the dummynet tag is not reused by lower layers.
358 */
359static __inline struct ip_fw *
360ip_dn_claim_rule(struct mbuf *m)
361{
362 struct m_tag *mtag = m_tag_find(m, PACKET_TAG_DUMMYNET, NULL);
363 if (mtag != NULL) {
364 mtag->m_tag_id = PACKET_TAG_NONE;
365 return (((struct dn_pkt_tag *)(mtag+1))->rule);
366 } else
367 return (NULL);
368}
367#endif
368#endif /* _IP_DUMMYNET_H */
369#endif
370#endif /* _IP_DUMMYNET_H */