summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2002-06-20 21:29:55 +0000
committerluigi <luigi@FreeBSD.org>2002-06-20 21:29:55 +0000
commit44cc39dc68fd4f5d03568c9ff13c5e4eb2ce789f (patch)
treed6fbb5da8ec0156fd317bb5663cf3d66bee8dbb5 /sys
parentd0fe7ef0c80799f14a11f30e2a23335c2c83bfa2 (diff)
downloadFreeBSD-src-44cc39dc68fd4f5d03568c9ff13c5e4eb2ce789f.zip
FreeBSD-src-44cc39dc68fd4f5d03568c9ff13c5e4eb2ce789f.tar.gz
Add some #define's for mbuf annotations.
As the comment in the code says, eventually there will be a proper data structure (e.g NetBSD's struct m_tag) to store chains of annotations, and mbuf-handling procedures will handle these chains in the correct way. Right now, these chains do not exist, and we just use the constants defined here to implement simple ad-hoc solutions to remove some global variables used so far to pass around informations about packets being processed. Global variables are not only ugly and make the code unreadable, they also prevent from using parallelism in network stack processing. (the 3-days MFC only refers to this commit, i.e. the PACKET_TAG_* constants; the full mechanism will be committed and MFC'ed on a longer timescale). MFC after: 3 days
Diffstat (limited to 'sys')
-rw-r--r--sys/sys/mbuf.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 5cfb1ae..dec48ec 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -410,6 +410,54 @@ struct mauxtag {
void *p;
};
+/*
+ * Some packet tags to identify different mbuf annotations.
+ *
+ * Eventually, these annotations will end up in an appropriate chain
+ * (struct m_tag or similar, e.g. as in NetBSD) properly managed by
+ * the mbuf handling routines.
+ *
+ * As a temporary and low impact solution to replace the even uglier
+ * approach used so far in some parts of the network stack (which relies
+ * on global variables), these annotations are stored in MT_CONTROL
+ * mbufs (or lookalikes) prepended to the actual mbuf chain.
+ *
+ * m_type = MT_CONTROL
+ * m_flags = m_tag_id
+ * m_next = next buffer in chain.
+ *
+ * BE VERY CAREFUL not to pass these blocks to the mbuf handling routines.
+ *
+ */
+
+#define m_tag_id m_hdr.mh_flags
+
+/* Packet tag types -- first ones are from NetBSD */
+
+#define PACKET_TAG_NONE 0 /* Nadda */
+#define PACKET_TAG_IPSEC_IN_DONE 1 /* IPsec applied, in */
+#define PACKET_TAG_IPSEC_OUT_DONE 2 /* IPsec applied, out */
+#define PACKET_TAG_IPSEC_IN_CRYPTO_DONE 3 /* NIC IPsec crypto done */
+#define PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED 4 /* NIC IPsec crypto req'ed */
+#define PACKET_TAG_IPSEC_IN_COULD_DO_CRYPTO 5 /* NIC notifies IPsec */
+#define PACKET_TAG_IPSEC_PENDING_TDB 6 /* Reminder to do IPsec */
+#define PACKET_TAG_BRIDGE 7 /* Bridge processing done */
+#define PACKET_TAG_GIF 8 /* GIF processing done */
+#define PACKET_TAG_GRE 9 /* GRE processing done */
+#define PACKET_TAG_IN_PACKET_CHECKSUM 10 /* NIC checksumming done */
+#define PACKET_TAG_ENCAP 11 /* Encap. processing */
+#define PACKET_TAG_IPSEC_SOCKET 12 /* IPSEC socket ref */
+#define PACKET_TAG_IPSEC_HISTORY 13 /* IPSEC history */
+#define PACKET_TAG_IPV6_INPUT 14 /* IPV6 input processing */
+
+/* Packet tags used in the FreeBSD network stack */
+#define PACKET_TAG_DUMMYNET 15 /* dummynet info */
+#define PACKET_TAG_IPFW 16 /* ipfw classification */
+#define PACKET_TAG_DIVERT 17 /* divert info */
+#define PACKET_TAG_IPFORWARD 18 /* ipforward info */
+
+#define PACKET_TAG_MAX 19
+
extern int max_datalen; /* MHLEN - max_hdr */
extern int max_hdr; /* largest link + protocol header */
extern int max_linkhdr; /* largest link-level header */
OpenPOWER on IntegriCloud