svn commit: r201805 - user/luigi/ipfw3-head/sys/netinet/ipfw
Luigi Rizzo
luigi at FreeBSD.org
Fri Jan 8 16:58:38 UTC 2010
Author: luigi
Date: Fri Jan 8 16:58:37 2010
New Revision: 201805
URL: http://svn.freebsd.org/changeset/base/201805
Log:
add missing file
Added:
user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h (contents, props changed)
Added: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Fri Jan 8 16:58:37 2010 (r201805)
@@ -0,0 +1,127 @@
+/*-
+ * Copyright (c) 2010 Luigi Rizzo, Riccardo Panicucci, Universita` di Pisa
+ * All rights reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _IP_DN_PRIVATE_H
+#define _IP_DN_PRIVATE_H
+
+/*
+ * internal dummynet APIs.
+ */
+#define div64(a, b) ((int64_t)(a) / (int64_t)(b))
+
+MALLOC_DECLARE(M_DUMMYNET);
+
+extern struct mtx dummynet_mtx;
+#define DUMMYNET_LOCK_INIT() \
+ mtx_init(&dummynet_mtx, "dummynet", NULL, MTX_DEF)
+#define DUMMYNET_LOCK_DESTROY() mtx_destroy(&dummynet_mtx)
+#define DUMMYNET_LOCK() mtx_lock(&dummynet_mtx)
+#define DUMMYNET_UNLOCK() mtx_unlock(&dummynet_mtx)
+#define DUMMYNET_LOCK_ASSERT() mtx_assert(&dummynet_mtx, MA_OWNED)
+
+#define DN_S_LOCK(x)
+#define DN_S_UNLOCK(x)
+#define DN_S_LOCK_DESTROY(x)
+
+#define DN_HEAP_LOCK(x)
+#define DN_HEAP_UNLOCK(x)
+
+#define DN_HASHSIZE 16
+#define HASH(num) ((((num) >> 8) ^ ((num) >> 4) ^ (num)) & 0x0f)
+
+SLIST_HEAD(new_pipe_head, new_pipe);
+SLIST_HEAD(new_sch_head, new_sch);
+SLIST_HEAD(new_fs_head, new_fs);
+extern struct new_pipe_head pipehash[DN_HASHSIZE]; /* all pipes */
+extern struct new_fs_head flowsethash[DN_HASHSIZE]; /* all flowsets */
+extern struct new_sch_head schedulerhash[DN_HASHSIZE]; /* all schedulers */
+extern struct new_fs_head flowsetunlinked; /* all unlinked flowsets */
+
+
+/*
+ * global configuration parameters.
+ *
+ * When a configuration is modified from userland, 'id' is incremented
+ * so we can use the value to check for stale pointers.
+ */
+struct dn_parms {
+ uint32_t id; /* configuration version */
+ int red_lookup_depth;
+ int red_avg_pkt_size;
+ int red_max_pkt_size;
+ int hash_size;
+ long pipe_byte_limit;
+ long pipe_slot_limit;
+
+ int io_fast;
+ struct timeval prev_t;
+};
+
+static inline void
+set_oid(struct dn_id *o, int type, int subtype, int len)
+{
+ o->type = type;
+ o->subtype = subtype;
+ o->len = len;
+};
+
+/*
+ * Delay line, contains all packets that will be send out at certain time.
+ * Every scheduler instance has a delay line
+ */
+struct delay_line {
+ struct dn_id oid;
+
+ /* Pointer to scheduler instance, NULL if the instance
+ * has been deleted */
+ struct new_sch_inst *si;
+ struct mbuf *head, *tail; /* Packets queue */
+};
+
+/* These values are in the flag field of a flowset
+ * Some of them are used only by kernel (k)
+ */
+enum flowset_flag {
+ DN_FS_DELETE = 0x0001, /* (k) */
+ DN_FS_REENQUEUE = 0x0002, /* (k) */
+ DN_FS_HAVE_MASK = 0x0004,
+ DN_FS_QSIZE_BYTES = 0x0008,
+ DN_FS_NOERROR = 0x0010, /* (k) do not report ENOBUFS on drops */
+};
+
+extern struct dn_parms dn_cfg;
+
+struct new_pipe *ipdn_locate_pipe(int);
+struct new_fs *ipdn_locate_flowset(int);
+int dummynet_io(struct mbuf **, int , struct ip_fw_args *);
+void dummynet_task(void *context, int pending);
+void dn_reschedule(void);
+int dn_fs_config(struct new_fs *);
+int delete_delay_line(struct delay_line *dline);
+int really_deletescheduler(struct new_sch *sch_t);
+
+
+#endif /* _IP_DN_PRIVATE_H */
More information about the svn-src-user
mailing list