Date: Sun, 21 Mar 2010 16:38:45 +0000 (UTC) From: Luigi Rizzo <luigi@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r205419 - user/luigi/ipfw3-r8/sys/netinet/ipfw Message-ID: <201003211638.o2LGcjxw056881@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: luigi Date: Sun Mar 21 16:38:45 2010 New Revision: 205419 URL: http://svn.freebsd.org/changeset/base/205419 Log: misc merges from HEAD Modified: user/luigi/ipfw3-r8/sys/netinet/ipfw/dn_sched.h user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_dummynet.c user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw2.c user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw_private.h user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw_table.c Modified: user/luigi/ipfw3-r8/sys/netinet/ipfw/dn_sched.h ============================================================================== --- user/luigi/ipfw3-r8/sys/netinet/ipfw/dn_sched.h Sun Mar 21 16:34:54 2010 (r205418) +++ user/luigi/ipfw3-r8/sys/netinet/ipfw/dn_sched.h Sun Mar 21 16:38:45 2010 (r205419) @@ -68,6 +68,18 @@ struct dn_alg { * enqueue enqueue packet 'm' on scheduler 's', queue 'q'. * q is NULL for !MULTIQUEUE. * Return 0 on success, 1 on drop (packet consumed anyways). + * Note that q should be interpreted only as a hint + * on the flow that the mbuf belongs to: while a + * scheduler will normally enqueue m into q, it is ok + * to leave q alone and put the mbuf elsewhere. + * This function is called in two cases: + * - when a new packet arrives to the scheduler; + * - when a scheduler is reconfigured. In this case the + * call is issued by the new_queue callback, with a + * non empty queue (q) and m pointing to the first + * mbuf in the queue. For this reason, the function + * should internally check for (m != q->mq.head) + * before calling dn_enqueue(). * * dequeue Called when scheduler instance 's' can * dequeue a packet. Return NULL if none are available. @@ -94,8 +106,15 @@ struct dn_alg { * * new_queue called to set the per-queue parameters, * e.g. S and F, adjust sum of weights in the parent, etc. - * If the queue has packets in it, add them to the scheduler - * as well. + * + * The new_queue callback is normally called from when + * creating a new queue. In some cases (such as a + * scheduler change or reconfiguration) it can be called + * with a non empty queue. In this case, the queue + * In case of non empty queue, the new_queue callback could + * need to call the enqueue function. In this case, + * the callback should eventually call enqueue() passing + * as m the first element in the queue. * * free_queue actions related to a queue removal, e.g. undo * all the above. If the queue has data in it, also remove Modified: user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_dummynet.c Sun Mar 21 16:34:54 2010 (r205418) +++ user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_dummynet.c Sun Mar 21 16:38:45 2010 (r205419) @@ -814,15 +814,15 @@ copy_obj(char **start, char *end, void * } /* Specific function to copy a queue. - * It copies only the common part of a queue, and correctly set - * the length + * Copies only the user-visible part of a queue (which is in + * a struct dn_flow), and sets len accordingly. */ static int copy_obj_q(char **start, char *end, void *_o, const char *msg, int i) { struct dn_id *o = _o; int have = end - *start; - int len = sizeof(struct dn_queue); + int len = sizeof(struct dn_flow); /* see above comment */ if (have < len || o->len == 0 || o->type != DN_QUEUE) { D("ERROR type %d %s %d have %d need %d", @@ -1783,9 +1783,13 @@ compute_space(struct dn_id *cmd, struct if (x & DN_C_LINK) { need += dn_cfg.schk_count * sizeof(struct dn_link) / 2; } - /* XXX queue space might be variable */ + /* + * When exporting a queue to userland, only pass up the + * struct dn_flow, which is the only visible part. + */ + if (x & DN_C_QUEUE) - need += dn_cfg.queue_count * sizeof(struct dn_queue); + need += dn_cfg.queue_count * sizeof(struct dn_flow); if (x & DN_C_FLOW) need += dn_cfg.si_count * (sizeof(struct dn_flow)); return need; Modified: user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw2.c Sun Mar 21 16:34:54 2010 (r205418) +++ user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw2.c Sun Mar 21 16:38:45 2010 (r205419) @@ -2399,7 +2399,7 @@ vnet_ipfw_uninit(const void *unused) IPFW_WLOCK(chain); ipfw_dyn_uninit(0); /* run the callout_drain */ - ipfw_flush_tables(chain); + ipfw_destroy_tables(chain); reap = NULL; for (i = 0; i < chain->n_rules; i++) { rule = chain->map[i]; Modified: user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw_private.h ============================================================================== --- user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw_private.h Sun Mar 21 16:34:54 2010 (r205418) +++ user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw_private.h Sun Mar 21 16:38:45 2010 (r205419) @@ -274,7 +274,6 @@ int ipfw_lookup_table(struct ip_fw_chain int ipfw_init_tables(struct ip_fw_chain *ch); void ipfw_destroy_tables(struct ip_fw_chain *ch); int ipfw_flush_table(struct ip_fw_chain *ch, uint16_t tbl); -void ipfw_flush_tables(struct ip_fw_chain *ch); int ipfw_add_table_entry(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr, uint8_t mlen, uint32_t value); int ipfw_dump_table_entry(struct radix_node *rn, void *arg); Modified: user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw_table.c ============================================================================== --- user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw_table.c Sun Mar 21 16:34:54 2010 (r205418) +++ user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw_table.c Sun Mar 21 16:38:45 2010 (r205419) @@ -176,14 +176,18 @@ ipfw_flush_table(struct ip_fw_chain *ch, } void -ipfw_flush_tables(struct ip_fw_chain *ch) +ipfw_destroy_tables(struct ip_fw_chain *ch) { uint16_t tbl; + struct radix_node_head *rnh; IPFW_WLOCK_ASSERT(ch); - for (tbl = 0; tbl < IPFW_TABLES_MAX; tbl++) + for (tbl = 0; tbl < IPFW_TABLES_MAX; tbl++) { ipfw_flush_table(ch, tbl); + rnh = ch->tables[tbl]; + rn_detachhead((void **)&rnh); + } } int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003211638.o2LGcjxw056881>