summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_dummynet.h
diff options
context:
space:
mode:
authormlaier <mlaier@FreeBSD.org>2004-02-25 19:55:29 +0000
committermlaier <mlaier@FreeBSD.org>2004-02-25 19:55:29 +0000
commit1504165dce30978b55fb5992d94ebc8914ced705 (patch)
treeef732081c31aa5924d309022a0341c52a90908c0 /sys/netinet/ip_dummynet.h
parent333bc770a3745a8206d3afcea031c505caddf9d4 (diff)
downloadFreeBSD-src-1504165dce30978b55fb5992d94ebc8914ced705.zip
FreeBSD-src-1504165dce30978b55fb5992d94ebc8914ced705.tar.gz
Re-remove MT_TAGs. The problems with dummynet have been fixed now.
Tested by: -current, bms(mentor), me Approved by: bms(mentor), sam
Diffstat (limited to 'sys/netinet/ip_dummynet.h')
-rw-r--r--sys/netinet/ip_dummynet.h40
1 files changed, 21 insertions, 19 deletions
diff --git a/sys/netinet/ip_dummynet.h b/sys/netinet/ip_dummynet.h
index bc506af..28e85a9 100644
--- a/sys/netinet/ip_dummynet.h
+++ b/sys/netinet/ip_dummynet.h
@@ -111,24 +111,12 @@ struct dn_heap {
#ifdef _KERNEL
/*
- * struct dn_pkt identifies a packet in the dummynet queue, but
- * is also used to tag packets passed back to the various destinations
- * (ip_input(), ip_output(), bdg_forward() and so on).
- * As such the first part of the structure must be a struct m_hdr,
- * followed by dummynet-specific parameters. The m_hdr must be
- * initialized with
- * mh_type = MT_TAG;
- * mh_flags = PACKET_TYPE_DUMMYNET;
- * mh_next = <pointer to the actual mbuf>
- *
- * mh_nextpkt, mh_data are free for dummynet use (mh_nextpkt is used to
- * build a linked list of packets in a dummynet queue).
+ * Packets processed by dummynet have an mbuf tag associated with
+ * them that carries their dummynet state. This is used within
+ * the dummynet code as well as outside when checking for special
+ * processing requirements.
*/
-struct dn_pkt {
- struct m_hdr hdr ;
-#define DN_NEXT(x) (struct dn_pkt *)(x)->hdr.mh_nextpkt
-#define dn_m hdr.mh_next /* packet to be forwarded */
-
+struct dn_pkt_tag {
struct ip_fw *rule; /* matching rule */
int dn_dir; /* action when packet comes out. */
#define DN_TO_IP_OUT 1
@@ -217,7 +205,7 @@ struct dn_flow_queue {
struct dn_flow_queue *next ;
struct ipfw_flow_id id ;
- struct dn_pkt *head, *tail ; /* queue of packets */
+ struct mbuf *head, *tail ; /* queue of packets */
u_int len ;
u_int len_bytes ;
u_long numbytes ; /* credit for transmission (dynamic queues) */
@@ -330,7 +318,7 @@ struct dn_pipe { /* a pipe */
int bandwidth; /* really, bytes/tick. */
int delay ; /* really, ticks */
- struct dn_pkt *head, *tail ; /* packets in delay line */
+ struct mbuf *head, *tail ; /* packets in delay line */
/* WF2Q+ */
struct dn_heap scheduler_heap ; /* top extract - key Finish time*/
@@ -364,5 +352,19 @@ extern ip_dn_ruledel_t *ip_dn_ruledel_ptr;
extern ip_dn_io_t *ip_dn_io_ptr;
#define DUMMYNET_LOADED (ip_dn_io_ptr != NULL)
+/*
+ * Return the IPFW rule associated with the dummynet tag; if any.
+ * Make sure that the dummynet tag is not reused by lower layers.
+ */
+static __inline struct ip_fw *
+ip_dn_claim_rule(struct mbuf *m)
+{
+ struct m_tag *mtag = m_tag_find(m, PACKET_TAG_DUMMYNET, NULL);
+ if (mtag != NULL) {
+ mtag->m_tag_id = PACKET_TAG_NONE;
+ return (((struct dn_pkt_tag *)(mtag+1))->rule);
+ } else
+ return (NULL);
+}
#endif
#endif /* _IP_DUMMYNET_H */
OpenPOWER on IntegriCloud