From owner-svn-src-user@FreeBSD.ORG Sun Jan 31 11:34:45 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51F541065672; Sun, 31 Jan 2010 11:34:45 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4199B8FC16; Sun, 31 Jan 2010 11:34:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0VBYjtY011427; Sun, 31 Jan 2010 11:34:45 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0VBYjvn011425; Sun, 31 Jan 2010 11:34:45 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201001311134.o0VBYjvn011425@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 31 Jan 2010 11:34:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203275 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2010 11:34:45 -0000 Author: luigi Date: Sun Jan 31 11:34:44 2010 New Revision: 203275 URL: http://svn.freebsd.org/changeset/base/203275 Log: round heap size to powers of 2, so we save an expensive modulo op. Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Sun Jan 31 11:30:28 2010 (r203274) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Sun Jan 31 11:34:44 2010 (r203275) @@ -78,7 +78,15 @@ heap_resize(struct dn_heap *h, int new_s if (h->size >= new_size ) /* have enough room */ return 0; +#if 1 /* round to the next power of 2 */ + new_size |= new_size >> 1; + new_size |= new_size >> 2; + new_size |= new_size >> 4; + new_size |= new_size >> 8; + new_size |= new_size >> 16; +#else new_size = (new_size + HEAP_INCREMENT ) & ~HEAP_INCREMENT; +#endif p = malloc(new_size * sizeof(*p), M_DN_HEAP, M_NOWAIT); if (p == NULL) { printf("--- %s, resize %d failed\n", __func__, new_size ); From owner-svn-src-user@FreeBSD.ORG Sun Jan 31 11:36:04 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DB031065692; Sun, 31 Jan 2010 11:36:04 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C4A88FC17; Sun, 31 Jan 2010 11:36:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0VBa4Kg011764; Sun, 31 Jan 2010 11:36:04 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0VBa4CQ011761; Sun, 31 Jan 2010 11:36:04 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201001311136.o0VBa4CQ011761@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 31 Jan 2010 11:36:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203276 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2010 11:36:04 -0000 Author: luigi Date: Sun Jan 31 11:36:04 2010 New Revision: 203276 URL: http://svn.freebsd.org/changeset/base/203276 Log: rr: less verbose debugging, use par[1] as quantum size wf2q+: multiply by inverse of weight instead of dividing by weight; this saves about 50ns per packet. Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c Sun Jan 31 11:34:44 2010 (r203275) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c Sun Jan 31 11:36:04 2010 (r203276) @@ -198,11 +198,12 @@ static int rr_config(struct new_schk *_schk) { struct rr_schk *schk = (struct rr_schk *)(_schk + 1); - D("called"); + ND("called"); - schk->min_q = 1; - schk->max_q = 1000; - schk->q_bytes = 50; + /* use reasonable quantums (64..2k bytes, default 1500) */ + schk->min_q = 64; + schk->max_q = 2048; + schk->q_bytes = 1500; /* quantum */ return 0; } @@ -212,7 +213,7 @@ rr_new_sched(struct new_sch_inst *_si) { struct rr_si *si = (struct rr_si *)(_si + 1); - D("called"); + ND("called"); si->head = si->tail = NULL; return 0; @@ -221,7 +222,7 @@ rr_new_sched(struct new_sch_inst *_si) static int rr_free_sched(struct new_sch_inst *_si) { - D("called"); + ND("called"); /* Nothing to do? */ return 0; } @@ -230,7 +231,10 @@ static int rr_new_fsk(struct new_fsk *fs) { struct rr_schk *schk = (struct rr_schk *)(fs->sched + 1); - ipdn_bound_var(&fs->fs.par[0], schk->min_q, + /* par[0] is the weight, par[1] is the quantum step */ + ipdn_bound_var(&fs->fs.par[0], 1, + 1, 65536, "RR weight"); + ipdn_bound_var(&fs->fs.par[1], schk->q_bytes, schk->min_q, schk->max_q, "RR quantum"); return 0; } @@ -239,12 +243,11 @@ static int rr_new_queue(struct new_queue *_q) { struct rr_queue *q = (struct rr_queue *)_q; - struct rr_schk *schk = (struct rr_schk *)(_q->_si->sched + 1); - D("called, schk->quantum=%d", schk->q_bytes); _q->ni.oid.subtype = DN_SCHED_RR; - q->quantum = _q->fs->fs.par[0] * schk->q_bytes; + q->quantum = _q->fs->fs.par[0] * _q->fs->fs.par[1]; + ND("called, q->quantum %d", q->quantum); q->credit = q->quantum; q->status = 0; @@ -260,7 +263,7 @@ rr_free_queue(struct new_queue *_q) { struct rr_queue *q = (struct rr_queue *)_q; - D("called"); + ND("called"); if (q->status == 1) { struct rr_si *si = (struct rr_si *)(_q->_si + 1); remove_queue_q(q, si); Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c Sun Jan 31 11:34:44 2010 (r203275) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c Sun Jan 31 11:36:04 2010 (r203276) @@ -48,8 +48,20 @@ #define MAX64(x,y) (( (int64_t) ( (y)-(x) )) > 0 ) ? (y) : (x) #endif -#ifndef MY_M -#define MY_M 16 /* shift for fixed point arithmetic */ +/* + * timestamps are computed on 64 bit using fixed point arithmetic. + * LMAX_BITS, WMAX_BITS are the max number of bits for the packet len + * and sum of weights, respectively. FRAC_BITS is the number of + * fractional bits. We want FRAC_BITS >> WMAX_BITS to avoid too large + * errors when computing the inverse, FRAC_BITS < 32 so we can do 1/w + * using an unsigned 32-bit division, and to avoid wraparounds we need + * LMAX_BITS + WMAX_BITS + FRAC_BITS << 64 + * As an example + * FRAC_BITS = 26, LMAX_BITS=14, WMAX_BITS = 19 + */ +#ifndef FRAC_BITS +#define FRAC_BITS 28 /* shift for fixed point arithmetic */ +#define ONE_FP (1UL << FRAC_BITS) #endif /* @@ -67,11 +79,14 @@ struct wf2qp_si { struct dn_heap ne_heap; /* top extract - key Start time */ struct dn_heap idle_heap; /* random extract - key Start=Finish time */ uint64_t V; /* virtual time */ - uint32_t sum; /* sum of weights */ + uint32_t inv_wsum; /* inverse of sum of weights */ + uint32_t wsum; /* sum of weights */ }; struct wf2qp_queue { + struct new_queue _q; uint64_t S, F; /* start time, finish time */ + uint32_t inv_w; /* ONE_FP / weight */ int32_t heap_pos; /* position (index) of struct in heap */ }; @@ -93,14 +108,16 @@ idle_check(struct wf2qp_si *si, int n, i while (n-- > 0 && h->elements > 0 && (force || DN_KEY_LT(HEAP_TOP(h)->key, si->V))) { struct new_queue *q = HEAP_TOP(h)->object; - struct wf2qp_queue *alg_fq = (struct wf2qp_queue *)(q+1); + struct wf2qp_queue *alg_fq = (struct wf2qp_queue *)q; heap_extract(h, NULL); /* XXX to let the flowset delete the queue we should * mark it as 'unused' by the scheduler. */ alg_fq->S = alg_fq->F + 1; /* Mark timestamp as invalid. */ - si->sum -= q->fs->fs.par[0]; /* adjust sum of weights */ + si->wsum -= q->fs->fs.par[0]; /* adjust sum of weights */ + if (si->wsum > 0) + si->inv_wsum = ONE_FP/si->wsum; } } @@ -120,17 +137,18 @@ wf2qp_enqueue(struct new_sch_inst *_si, } /* If reach this point, queue q was idle */ - alg_fq = (struct wf2qp_queue *)(q+1); + alg_fq = (struct wf2qp_queue *)q; if (DN_KEY_LT(alg_fq->F, alg_fq->S)) { /* Fbrand new queue. */ alg_fq->S = si->V; /* init start time */ - si->sum += fs->fs.par[0]; /* add weight of new queue. */ + si->wsum += fs->fs.par[0]; /* add weight of new queue. */ + si->inv_wsum = ONE_FP/si->wsum; } else { /* if it was idle then it was in the idle heap */ heap_extract(&si->idle_heap, q); alg_fq->S = MAX64(alg_fq->F, si->V); /* compute new S */ } - alg_fq->F = alg_fq->S + div64((len << MY_M), fs->fs.par[0]); + alg_fq->F = alg_fq->S + len * alg_fq->inv_w; /* if nothing is backlogged, make sure this flow is eligible */ if (si->ne_heap.elements == 0 && si->sch_heap.elements == 0) @@ -164,7 +182,7 @@ wf2qp_dequeue(struct new_sch_inst *_si) { /* Access scheduler instance private data */ struct wf2qp_si *si = (struct wf2qp_si *)(_si + 1); - struct mbuf *pkt; + struct mbuf *m; struct new_queue *q; struct dn_heap *sch = &si->sch_heap; struct dn_heap *neh = &si->ne_heap; @@ -176,7 +194,7 @@ wf2qp_dequeue(struct new_sch_inst *_si) */ idle_check(si, 0x7fffffff, 1); si->V = 0; - si->sum = 0; /* should be set already */ + si->wsum = 0; /* should be set already */ return NULL; /* quick return if nothing to do */ } idle_check(si, 1, 0); /* drain something from the idle heap */ @@ -187,7 +205,7 @@ wf2qp_dequeue(struct new_sch_inst *_si) * after extracting the candidate, or enqueue() will * find the data structure in a wrong state. */ - pkt = NULL; + m = NULL; for(;;) { /* * Compute V = max(V, min(S_i)). Remember that all elements @@ -203,25 +221,25 @@ wf2qp_dequeue(struct new_sch_inst *_si) while (neh->elements > 0 && DN_KEY_LEQ(HEAP_TOP(neh)->key, si->V)) { q = HEAP_TOP(neh)->object; - alg_fq = (struct wf2qp_queue *)(q + 1); + alg_fq = (struct wf2qp_queue *)q; heap_extract(neh, NULL); heap_insert(sch, alg_fq->F, q); } - if (pkt) /* pkt found in previous iteration */ + if (m) /* pkt found in previous iteration */ break; /* ok we have at least one eligible pkt */ q = HEAP_TOP(sch)->object; - alg_fq = (struct wf2qp_queue *)(q + 1); - pkt = dn_dequeue(q); + alg_fq = (struct wf2qp_queue *)q; + m = dn_dequeue(q); heap_extract(sch, NULL); /* Remove queue from heap. */ - si->V += div64(pkt->m_pkthdr.len << MY_M, si->sum); + si->V += (uint64_t)(m->m_pkthdr.len) * si->inv_wsum; alg_fq->S = alg_fq->F; /* Update start time. */ if (q->mq.head == 0) { /* not backlogged any more. */ heap_insert(&si->idle_heap, alg_fq->F, q); } else { /* Still backlogged. */ /* Update F, store in neh or sch */ uint64_t len = q->mq.head->m_pkthdr.len; - alg_fq->F += div64(len << MY_M, q->fs->fs.par[0]); + alg_fq->F += len * alg_fq->inv_w; if (DN_KEY_LEQ(alg_fq->S, si->V)) { heap_insert(sch, alg_fq->F, q); } else { @@ -229,14 +247,14 @@ wf2qp_dequeue(struct new_sch_inst *_si) } } } - return pkt; + return m; } static int wf2qp_new_sched(struct new_sch_inst *_si) { struct wf2qp_si *si = (struct wf2qp_si *)(_si + 1); - int ofs = sizeof(*_si) + offsetof(struct wf2qp_queue, heap_pos); + int ofs = offsetof(struct wf2qp_queue, heap_pos); /* all heaps support extract from middle */ if (heap_init(&si->idle_heap, 16, ofs) || @@ -274,11 +292,12 @@ wf2qp_new_fsk(struct new_fsk *fs) static int wf2qp_new_queue(struct new_queue *_q) { - struct wf2qp_queue *q = (struct wf2qp_queue *)(_q + 1); + struct wf2qp_queue *q = (struct wf2qp_queue *)_q; _q->ni.oid.subtype = DN_SCHED_WF2QP; q->F = 0; /* not strictly necessary */ q->S = q->F + 1; /* mark timestamp as invalid. */ + q->inv_w = ONE_FP / _q->fs->fs.par[0]; if (_q->mq.head != NULL) { wf2qp_enqueue(_q->_si, _q, _q->mq.head); } @@ -294,13 +313,15 @@ wf2qp_new_queue(struct new_queue *_q) static int wf2qp_free_queue(struct new_queue *q) { - struct wf2qp_queue *alg_fq = (struct wf2qp_queue *)(q + 1); + struct wf2qp_queue *alg_fq = (struct wf2qp_queue *)q; struct wf2qp_si *si = (struct wf2qp_si *)(q->_si + 1); printf("%s called\n", __FUNCTION__); if (alg_fq->S >= alg_fq->F + 1) return 0; /* nothing to do, not in any heap */ - si->sum -= q->fs->fs.par[0]; + si->wsum -= q->fs->fs.par[0]; + if (si->wsum > 0) + si->inv_wsum = ONE_FP/si->wsum; /* extract from the heap. XXX TODO we may need to adjust V * to make sure the invariants hold. @@ -327,7 +348,7 @@ static struct dn_alg wf2qp_desc = { /* we need extra space in the si and the queue */ .si_datalen = sizeof(struct wf2qp_si), - .q_datalen = sizeof(struct wf2qp_queue), + .q_datalen = sizeof(struct wf2qp_queue) - sizeof(struct new_queue), .enqueue = wf2qp_enqueue, .dequeue = wf2qp_dequeue, From owner-svn-src-user@FreeBSD.ORG Sun Jan 31 12:20:29 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EEBF1065676; Sun, 31 Jan 2010 12:20:29 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E7858FC14; Sun, 31 Jan 2010 12:20:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0VCKThQ021695; Sun, 31 Jan 2010 12:20:29 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0VCKTP3021693; Sun, 31 Jan 2010 12:20:29 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201001311220.o0VCKTP3021693@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 31 Jan 2010 12:20:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203279 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2010 12:20:29 -0000 Author: luigi Date: Sun Jan 31 12:20:29 2010 New Revision: 203279 URL: http://svn.freebsd.org/changeset/base/203279 Log: don't panic if passed a NULL pointer to dn_ht_entries() Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Sun Jan 31 12:07:13 2010 (r203278) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Sun Jan 31 12:20:29 2010 (r203279) @@ -392,7 +392,7 @@ dn_ht_free(struct dn_ht *ht, int flags) int dn_ht_entries(struct dn_ht *ht) { - return ht->entries; + return ht ? ht->entries : 0; } /* lookup and optionally create or delete element */ From owner-svn-src-user@FreeBSD.ORG Sun Jan 31 12:21:21 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56157106568F; Sun, 31 Jan 2010 12:21:21 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A8148FC0C; Sun, 31 Jan 2010 12:21:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0VCLLQA021928; Sun, 31 Jan 2010 12:21:21 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0VCLLMV021925; Sun, 31 Jan 2010 12:21:21 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201001311221.o0VCLLMV021925@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 31 Jan 2010 12:21:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203280 - user/luigi/ipfw3-head/sbin/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2010 12:21:21 -0000 Author: luigi Date: Sun Jan 31 12:21:20 2010 New Revision: 203280 URL: http://svn.freebsd.org/changeset/base/203280 Log: handle lmax and priority in a 'queue config'. use the correct size for children of a scheduler. Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c user/luigi/ipfw3-head/sbin/ipfw/ipfw2.h Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Sun Jan 31 12:20:29 2010 (r203279) +++ user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Sun Jan 31 12:21:20 2010 (r203280) @@ -50,6 +50,8 @@ static struct _s_x dummynet_params[] = { { "src-port", TOK_SRCPORT }, { "proto", TOK_PROTO }, { "weight", TOK_WEIGHT }, + { "lmax", TOK_LMAX }, + { "maxlen", TOK_LMAX }, { "all", TOK_ALL }, { "mask", TOK_MASK }, /* alias for both */ { "sched_mask", TOK_SCHED_MASK }, @@ -66,6 +68,7 @@ static struct _s_x dummynet_params[] = { { "flowset", TOK_FLOWSET }, { "sched", TOK_SCHED }, { "pri", TOK_PRI }, + { "priority", TOK_PRI }, { "type", TOK_TYPE }, { "flow-id", TOK_FLOWID}, { "dst-ipv6", TOK_DSTIP6}, @@ -242,9 +245,10 @@ print_flowset_parms(struct new_fs *fs, c prefix, qs, plr, fs->oid.id, fs->buckets, red); prefix[0] = '\0'; } else { - printf("q%05d %s%s %d flows (%d buckets) %s sched %d weight %d\n", + printf("q%05d %s%s %d flows (%d buckets) %s sched %d " + "weight %d lmax %d pri %d\n", fs->fs_nr, qs, plr, fs->oid.id, fs->buckets, red, - fs->sched_nr, fs->par[0]); + fs->sched_nr, fs->par[0], fs->par[1], fs->par[2]); if (fs->flags & DN_HAVE_MASK) print_mask(&fs->flow_mask); } @@ -301,9 +305,9 @@ list_pipes(struct dn_id *oid, struct dn_ int i, l; struct { struct dn_id id; - uint16_t p[0]; + uintptr_t p[0]; } *d = (void *)oid; - l = (oid->len - sizeof(*oid))/sizeof(uint16_t); + l = (oid->len - sizeof(*oid))/sizeof(d->p[0]); if (l == 0) break; printf(" Children flowsets: "); @@ -1087,11 +1091,25 @@ end_mask: case TOK_WEIGHT: NEED(fs, "weight is only for flowsets"); - NEED1("weight needs argument 0..100\n"); + NEED1("weight needs argument\n"); fs->par[0] = strtol(av[0], &end, 0); ac--; av++; break; + case TOK_LMAX: + NEED(fs, "lmax is only for flowsets"); + NEED1("lmax needs argument\n"); + fs->par[1] = strtol(av[0], &end, 0); + ac--; av++; + break; + + case TOK_PRI: + NEED(fs, "priority is only for flowsets"); + NEED1("priority needs argument\n"); + fs->par[2] = strtol(av[0], &end, 0); + ac--; av++; + break; + case TOK_SCHED: case TOK_PIPE: NEED(fs, "pipe/sched"); Modified: user/luigi/ipfw3-head/sbin/ipfw/ipfw2.h ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/ipfw2.h Sun Jan 31 12:20:29 2010 (r203279) +++ user/luigi/ipfw3-head/sbin/ipfw/ipfw2.h Sun Jan 31 12:21:20 2010 (r203280) @@ -166,6 +166,7 @@ enum tokens { TOK_PROTO, /* dummynet tokens */ TOK_WEIGHT, + TOK_LMAX, TOK_PRI, TOK_TYPE, TOK_SLOTSIZE, From owner-svn-src-user@FreeBSD.ORG Sun Jan 31 12:30:55 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA7F01065672; Sun, 31 Jan 2010 12:30:55 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9E588FC0A; Sun, 31 Jan 2010 12:30:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0VCUtFs024113; Sun, 31 Jan 2010 12:30:55 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0VCUtjm024111; Sun, 31 Jan 2010 12:30:55 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201001311230.o0VCUtjm024111@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 31 Jan 2010 12:30:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203281 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2010 12:30:55 -0000 Author: luigi Date: Sun Jan 31 12:30:55 2010 New Revision: 203281 URL: http://svn.freebsd.org/changeset/base/203281 Log: add a debug variable Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Sun Jan 31 12:21:20 2010 (r203280) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Sun Jan 31 12:30:55 2010 (r203281) @@ -111,6 +111,7 @@ struct dn_parms { long slot_limit; int io_fast; + int debug; /* timekeeping */ struct timeval prev_t; /* last time dummynet_tick ran */ From owner-svn-src-user@FreeBSD.ORG Sun Jan 31 12:31:49 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8E4F106566C; Sun, 31 Jan 2010 12:31:49 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 985668FC2F; Sun, 31 Jan 2010 12:31:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0VCVnSM024347; Sun, 31 Jan 2010 12:31:49 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0VCVnR9024345; Sun, 31 Jan 2010 12:31:49 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201001311231.o0VCVnR9024345@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 31 Jan 2010 12:31:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203282 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2010 12:31:49 -0000 Author: luigi Date: Sun Jan 31 12:31:49 2010 New Revision: 203282 URL: http://svn.freebsd.org/changeset/base/203282 Log: initialize the event heap Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Sun Jan 31 12:30:55 2010 (r203281) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Sun Jan 31 12:31:49 2010 (r203282) @@ -1594,6 +1594,7 @@ ip_dn_init(void) offsetof(struct new_fsk, fsk_next), fsk_hash, fsk_match, fsk_new); + heap_init(&dn_cfg.evheap, 16, offsetof(struct dn_id, id)); SLIST_INIT(&dn_cfg.fsu); SLIST_INIT(&dn_cfg.schedlist); From owner-svn-src-user@FreeBSD.ORG Sun Jan 31 12:32:58 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40E10106566B; Sun, 31 Jan 2010 12:32:58 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E4F58FC22; Sun, 31 Jan 2010 12:32:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0VCWwP2024614; Sun, 31 Jan 2010 12:32:58 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0VCWwx0024611; Sun, 31 Jan 2010 12:32:58 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201001311232.o0VCWwx0024611@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 31 Jan 2010 12:32:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203283 - in user/luigi/ipfw3-head/sys: conf netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2010 12:32:58 -0000 Author: luigi Date: Sun Jan 31 12:32:57 2010 New Revision: 203283 URL: http://svn.freebsd.org/changeset/base/203283 Log: add a new and very fast fair queueing scheduler with O(1) WFI Added: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c (contents, props changed) Modified: user/luigi/ipfw3-head/sys/conf/files Modified: user/luigi/ipfw3-head/sys/conf/files ============================================================================== --- user/luigi/ipfw3-head/sys/conf/files Sun Jan 31 12:31:49 2010 (r203282) +++ user/luigi/ipfw3-head/sys/conf/files Sun Jan 31 12:32:57 2010 (r203283) @@ -2453,6 +2453,7 @@ netinet/ipfw/dn_heap.c optional inet du netinet/ipfw/dn_sched_fifo.c optional inet dummynet netinet/ipfw/dn_sched_rr.c optional inet dummynet netinet/ipfw/dn_sched_wf2q.c optional inet dummynet +netinet/ipfw/dn_sched_qfq.c optional inet dummynet netinet/ipfw/ip_dummynet.c optional inet dummynet netinet/ipfw/ip_dn_io.c optional inet dummynet netinet/ip_ecn.c optional inet | inet6 Added: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Sun Jan 31 12:32:57 2010 (r203283) @@ -0,0 +1,849 @@ +/* + * Copyright (c) 2010 Fabio Checconi, Luigi Rizzo, Paolo Valente + * 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. + */ + +#ifdef _KERNEL +#include +#include +#include +#include +#include +#include +#include /* IFNAMSIZ */ +#include +#include /* ipfw_rule_ref */ +#include /* flow_id */ +#include +#include +#include +#include +#else +#include +#endif + +#ifdef QFQ_DEBUG +struct qfq_sched; +static void dump_sched(struct qfq_sched *q, const char *msg); +#define NO(x) x +#else +#define NO(x) +#endif +#define DN_SCHED_QFQ 4 // XXX Where? +typedef uint64_t u64; +typedef unsigned int bitmap; + +#ifndef __FreeBSD__ +static inline unsigned long __fls(unsigned long word) +{ + asm("bsr %1,%0" + : "=r" (word) + : "rm" (word)); + return word; +} +#else +static inline unsigned long __fls(unsigned long word) +{ + return fls(word) - 1; +} +#endif + +#ifdef QFQ_DEBUG +int test_bit(int ix, bitmap *p) +{ + if (ix < 0 || ix > 31) + D("bad index %d", ix); + return *p & (1< 31) + D("bad index %d", ix); + *p |= (1< 31) + D("bad index %d", ix); + *p &= ~(1<index = 0 + *.__grp->slot_shift + + where MIN_SLOT_SHIFT is derived by difference from the others. + +The max group index corresponds to Lmax/w_min, where +Lmax=1<group mapping. Class weights are + * in the range [1, QFQ_MAX_WEIGHT], we to map each class i to the + * group with the smallest index that can support the L_i / r_i + * configured for the class. + * + * grp->index is the index of the group; and grp->slot_shift + * is the shift for the corresponding (scaled) sigma_i. + * + * When computing the group index, we do (len<i_wsum) +#define IWSUM ((1< 0; +} + +/* Round a precise timestamp to its slotted value. */ +static inline u64 qfq_round_down(u64 ts, unsigned int shift) +{ + return ts & ~((1ULL << shift) - 1); +} + +/* return the pointer to the group with lowest index in the bitmap */ +static inline struct qfq_group *qfq_ffs(struct qfq_sched *q, + unsigned long bitmap) +{ + int index = ffs(bitmap) - 1; // zero-based + return &q->groups[index]; +} + +/* + * Calculate a flow index, given its weight and maximum packet length. + * index = log_2(maxlen/weight) but we need to apply the scaling. + * This is used only once at flow creation. + */ +static int qfq_calc_index(uint32_t inv_w, unsigned int maxlen) +{ + u64 slot_size = (u64)maxlen *inv_w; + unsigned long size_map; + int index = 0; + + size_map = (unsigned long)(slot_size >> QFQ_MIN_SLOT_SHIFT); + if (!size_map) + goto out; + + index = __fls(size_map) + 1; // basically a log_2() + index -= !(slot_size - (1ULL << (index + QFQ_MIN_SLOT_SHIFT - 1))); + + if (index < 0) + index = 0; + +out: + ND("W = %d, L = %d, I = %d\n", ONE_FP/inv_w, maxlen, index); + return index; +} +/*---- end support functions ----*/ + +/*-------- API calls --------------------------------*/ +/* + * Validate and copy parameters from flowset. + */ +static int +qfq_new_queue(struct new_queue *_q) +{ + struct qfq_sched *q = (struct qfq_sched *)(_q->_si + 1); + struct qfq_class *cl = (struct qfq_class *)_q; + int i; + uint32_t w; /* approximated weight */ + + /* import parameters from the flowset. They should be correct + * already. + */ + w = _q->fs->fs.par[0]; + cl->lmax = _q->fs->fs.par[1]; + if (!w || w > QFQ_MAX_WEIGHT) { + w = 1; + D("rounding weight to 1"); + } + cl->inv_w = ONE_FP/w; + w = ONE_FP/cl->inv_w; + if (q->wsum + w > QFQ_MAX_WSUM) + return EINVAL; + + i = qfq_calc_index(cl->inv_w, cl->lmax); + cl->grp = &q->groups[i]; + q->wsum += w; + // XXX cl->S = q->V; ? + // XXX compute q->i_wsum + return 0; +} + +/* remove an empty queue */ +static int +qfq_free_queue(struct new_queue *_q) +{ + struct qfq_sched *q = (struct qfq_sched *)(_q->_si + 1); + struct qfq_class *cl = (struct qfq_class *)_q; + if (cl->inv_w) { + q->wsum -= ONE_FP/cl->inv_w; + cl->inv_w = 0; /* reset weight to avoid run twice */ + } + return 0; +} + +/* Calculate a mask to mimic what would be ffs_from(). */ +static inline unsigned long +mask_from(unsigned long bitmap, int from) +{ + return bitmap & ~((1UL << from) - 1); +} + +/* + * The state computation relies on ER=0, IR=1, EB=2, IB=3 + * First compute eligibility comparing grp->S, q->V, + * then check if someone is blocking us and possibly add EB + */ +static inline unsigned int +qfq_calc_state(struct qfq_sched *q, struct qfq_group *grp) +{ + /* if S > V we are not eligible */ + unsigned int state = qfq_gt(grp->S, q->V); + unsigned long mask = mask_from(q->bitmaps[ER], grp->index); + struct qfq_group *next; + + if (mask) { + next = qfq_ffs(q, mask); + if (qfq_gt(grp->F, next->F)) + state |= EB; + } + + return state; +} + +/* + * In principle + * q->bitmaps[dst] |= q->bitmaps[src] & mask; + * q->bitmaps[src] &= ~mask; + * but we should make sure that src != dst + */ +static inline void +qfq_move_groups(struct qfq_sched *q, unsigned long mask, int src, int dst) +{ + q->bitmaps[dst] |= q->bitmaps[src] & mask; + q->bitmaps[src] &= ~mask; +} + +static inline void +qfq_unblock_groups(struct qfq_sched *q, int index, u64 old_finish) +{ + unsigned long mask = mask_from(q->bitmaps[ER], index + 1); + struct qfq_group *next; + + if (mask) { + next = qfq_ffs(q, mask); + if (!qfq_gt(next->F, old_finish)) + return; + } + + mask = (1UL << index) - 1; + qfq_move_groups(q, mask, EB, ER); + qfq_move_groups(q, mask, IB, IR); +} + +/* + * perhaps + * + old_V ^= q->V; + old_V >>= QFQ_MIN_SLOT_SHIFT; + if (old_V) { + ... + } + * + */ +static inline void +qfq_make_eligible(struct qfq_sched *q, u64 old_V) +{ + unsigned long mask, vslot, old_vslot; + + vslot = q->V >> QFQ_MIN_SLOT_SHIFT; + old_vslot = old_V >> QFQ_MIN_SLOT_SHIFT; + + if (vslot != old_vslot) { + mask = (2UL << (__fls(vslot ^ old_vslot))) - 1; + qfq_move_groups(q, mask, IR, ER); + qfq_move_groups(q, mask, IB, EB); + } +} + +/* + * XXX we should make sure that slot becomes less than 32. + * This is guaranteed by the input values. + * roundedS is always cl->S rounded on grp->slot_shift bits. + */ +static inline void +qfq_slot_insert(struct qfq_group *grp, struct qfq_class *cl, u64 roundedS) +{ + u64 slot = (roundedS - grp->S) >> grp->slot_shift; + unsigned int i = (grp->front + slot) % QFQ_MAX_SLOTS; + + cl->next = grp->slots[i]; + grp->slots[i] = cl; + __set_bit(slot, &grp->full_slots); +} + +/* + * remove the entry from the slot + */ +static inline void +qfq_front_slot_remove(struct qfq_group *grp) +{ + struct qfq_class **h = &grp->slots[grp->front]; + + *h = (*h)->next; + if (!*h) + __clear_bit(0, &grp->full_slots); +} + +/* + * Returns the first full queue in a group. As a side effect, + * adjust the bucket list so the first non-empty bucket is at + * position 0 in full_slots. + */ +static inline struct qfq_class * +qfq_slot_scan(struct qfq_group *grp) +{ + int i; + + ND("grp %d full %x", grp->index, grp->full_slots); + if (!grp->full_slots) + return NULL; + + i = ffs(grp->full_slots) - 1; // zero-based + if (i > 0) { + grp->front = (grp->front + i) % QFQ_MAX_SLOTS; + grp->full_slots >>= i; + } + + return grp->slots[grp->front]; +} + +/* + * adjust the bucket list. When the start time of a group decreases, + * we move the index down (modulo QFQ_MAX_SLOTS) so we don't need to + * move the objects. The mask of occupied slots must be shifted + * because we use ffs() to find the first non-empty slot. + * This covers decreases in the group's start time, but what about + * increases of the start time ? + * Here too we should make sure that i is less than 32 + */ +static inline void +qfq_slot_rotate(struct qfq_sched *q, struct qfq_group *grp, u64 roundedS) +{ + unsigned int i = (grp->S - roundedS) >> grp->slot_shift; + + grp->full_slots <<= i; + grp->front = (grp->front - i) % QFQ_MAX_SLOTS; +} + + +static inline void +qfq_update_eligible(struct qfq_sched *q, u64 old_V) +{ + bitmap ineligible; + + ineligible = q->bitmaps[IR] | q->bitmaps[IB]; + if (ineligible) { + if (!q->bitmaps[ER]) { + struct qfq_group *grp; + grp = qfq_ffs(q, ineligible); + if (qfq_gt(grp->S, q->V)) + q->V = grp->S; + } + qfq_make_eligible(q, old_V); + } +} + +/* + * Updates the class, returns true if also the group needs to be updated. + */ +static inline int +qfq_update_class(struct qfq_sched *q, struct qfq_group *grp, + struct qfq_class *cl) +{ + + cl->S = cl->F; + if (cl->_q.mq.head == NULL) { + qfq_front_slot_remove(grp); + } else { + unsigned int len; + u64 roundedS; + + len = cl->_q.mq.head->m_pkthdr.len; + cl->F = cl->S + (u64)len * cl->inv_w; + roundedS = qfq_round_down(cl->S, grp->slot_shift); + if (roundedS == grp->S) + return 0; + + qfq_front_slot_remove(grp); + qfq_slot_insert(grp, cl, roundedS); + } + return 1; +} + +static struct mbuf * +qfq_dequeue(struct new_sch_inst *si) +{ + struct qfq_sched *q = (struct qfq_sched *)(si + 1); + struct qfq_group *grp; + struct qfq_class *cl; + struct mbuf *m; + u64 old_V; + + NO(q->loops++;) + if (!q->bitmaps[ER]) { + NO(if (q->queued) + dump_sched(q, "start dequeue");) + return NULL; + } + + grp = qfq_ffs(q, q->bitmaps[ER]); + + cl = grp->slots[grp->front]; + /* extract from the first bucket in the bucket list */ + m = dn_dequeue(&cl->_q); + + if (!m) { + D("BUG/* non-workconserving leaf */"); + return NULL; + } + NO(q->queued--;) + old_V = q->V; + q->V += (u64)m->m_pkthdr.len * IWSUM; + ND("m is %p F 0x%llx V now 0x%llx", m, cl->F, q->V); + + if (qfq_update_class(q, grp, cl)) { + u64 old_F = grp->F; + cl = qfq_slot_scan(grp); + if (!cl) { /* group gone, remove from ER */ + __clear_bit(grp->index, &q->bitmaps[ER]); + // grp->S = grp->F + 1; // XXX debugging only + } else { + u64 roundedS = qfq_round_down(cl->S, grp->slot_shift); + unsigned int s; + + if (grp->S == roundedS) + goto skip_unblock; + grp->S = roundedS; + grp->F = roundedS + (2ULL << grp->slot_shift); + /* remove from ER and put in the new set */ + __clear_bit(grp->index, &q->bitmaps[ER]); + s = qfq_calc_state(q, grp); + __set_bit(grp->index, &q->bitmaps[s]); + } + /* we need to unblock even if the group has gone away */ + qfq_unblock_groups(q, grp->index, old_F); + } + +skip_unblock: + qfq_update_eligible(q, old_V); + NO(if (!q->bitmaps[ER] && q->queued) + dump_sched(q, "end dequeue");) + + return m; +} + +/* + * Assign a reasonable start time for a new flow k in group i. + * Admissible values for \hat(F) are multiples of \sigma_i + * no greater than V+\sigma_i . Larger values mean that + * we had a wraparound so we consider the timestamp to be stale. + * + * If F is not stale and F >= V then we set S = F. + * Otherwise we should assign S = V, but this may violate + * the ordering in ER. So, if we have groups in ER, set S to + * the F_j of the first group j which would be blocking us. + * We are guaranteed not to move S backward because + * otherwise our group i would still be blocked. + */ +static inline void +qfq_update_start(struct qfq_sched *q, struct qfq_class *cl) +{ + unsigned long mask; + uint32_t limit, roundedF; + int slot_shift = cl->grp->slot_shift; + + roundedF = qfq_round_down(cl->F, slot_shift); + limit = qfq_round_down(q->V, slot_shift) + (1UL << slot_shift); + + if (!qfq_gt(cl->F, q->V) || qfq_gt(roundedF, limit)) { + /* timestamp was stale */ + mask = mask_from(q->bitmaps[ER], cl->grp->index); + if (mask) { + struct qfq_group *next = qfq_ffs(q, mask); + if (qfq_gt(roundedF, next->F)) { + cl->S = next->F; + return; + } + } + cl->S = q->V; + } else { /* timestamp is not stale */ + cl->S = cl->F; + } +} + +static int +qfq_enqueue(struct new_sch_inst *si, struct new_queue *_q, struct mbuf *m) +{ + struct qfq_sched *q = (struct qfq_sched *)(si + 1); + struct qfq_group *grp; + struct qfq_class *cl = (struct qfq_class *)_q; + u64 roundedS; + int s; + + NO(q->loops++;) + DX(4, "len %d flow %p inv_w 0x%x grp %d", m->m_pkthdr.len, + _q, cl->inv_w, cl->grp->index); + /* XXX verify that the packet obeys the parameters */ + if (m != _q->mq.head) { + if (dn_enqueue(_q, m, 0)) /* packet was dropped */ + return 1; + NO(q->queued++;) + if (m != _q->mq.head) + return 0; + } + /* If reach this point, queue q was idle */ + grp = cl->grp; + qfq_update_start(q, cl); /* adjust start time */ + /* compute new finish time and rounded start. */ + cl->F = cl->S + (u64)(m->m_pkthdr.len) * cl->inv_w; + roundedS = qfq_round_down(cl->S, grp->slot_shift); + + /* + * insert cl in the correct bucket. + * If cl->S >= grp->S we don't need to adjust the + * bucket list and simply go to the insertion phase. + * Otherwise grp->S is decreasing, we must make room + * in the bucket list, and also recompute the group state. + * Finally, if there were no flows in this group and nobody + * was in ER make sure to adjust V. + */ + if (grp->full_slots) { + if (!qfq_gt(grp->S, cl->S)) + goto skip_update; + /* create a slot for this cl->S */ + qfq_slot_rotate(q, grp, roundedS); + /* group was surely ineligible, remove */ + __clear_bit(grp->index, &q->bitmaps[IR]); + __clear_bit(grp->index, &q->bitmaps[IB]); + } else if (!q->bitmaps[ER] && qfq_gt(roundedS, q->V)) + q->V = roundedS; + + grp->S = roundedS; + grp->F = roundedS + (2ULL << grp->slot_shift); // i.e. 2\sigma_i + s = qfq_calc_state(q, grp); + __set_bit(grp->index, &q->bitmaps[s]); + ND("new state %d 0x%x", s, q->bitmaps[s]); + ND("S %llx F %llx V %llx", cl->S, cl->F, q->V); +skip_update: + qfq_slot_insert(grp, cl, roundedS); + + return 0; +} + + +#if 0 +static inline void +qfq_slot_remove(struct qfq_sched *q, struct qfq_group *grp, + struct qfq_class *cl, struct qfq_class **pprev) +{ + unsigned int i, offset; + u64 roundedS; + + roundedS = qfq_round_down(cl->S, grp->slot_shift); + offset = (roundedS - grp->S) >> grp->slot_shift; + i = (grp->front + offset) % QFQ_MAX_SLOTS; + +#ifdef notyet + if (!pprev) { + pprev = &grp->slots[i]; + while (*pprev && *pprev != cl) + pprev = &(*pprev)->next; + } +#endif + + *pprev = cl->next; + if (!grp->slots[i]) + __clear_bit(offset, &grp->full_slots); +} + +/* + * called to forcibly destroy a queue. + * If the queue is not in the front bucket, or if it has + * other queues in the front bucket, we can simply remove + * the queue with no other side effects. + * Otherwise we must propagate the event up. + * XXX description to be completed. + */ +static void +qfq_deactivate_class(struct qfq_sched *q, struct qfq_class *cl, + struct qfq_class **pprev) +{ + struct qfq_group *grp = &q->groups[cl->index]; + unsigned long mask; + u64 roundedS; + int s; + + cl->F = cl->S; // not needed if the class goes away. + qfq_slot_remove(q, grp, cl, pprev); + + if (!grp->full_slots) { + /* nothing left in the group, remove from all sets. + * Do ER last because if we were blocking other groups + * we must unblock them. + */ + __clear_bit(grp->index, &q->bitmaps[IR]); + __clear_bit(grp->index, &q->bitmaps[EB]); + __clear_bit(grp->index, &q->bitmaps[IB]); + + if (test_bit(grp->index, &q->bitmaps[ER]) && + !(q->bitmaps[ER] & ~((1UL << grp->index) - 1))) { + mask = q->bitmaps[ER] & ((1UL << grp->index) - 1); + if (mask) + mask = ~((1UL << __fls(mask)) - 1); + else + mask = ~0UL; + qfq_move_groups(q, mask, EB, ER); + qfq_move_groups(q, mask, IB, IR); + } + __clear_bit(grp->index, &q->bitmaps[ER]); + } else if (!grp->slots[grp->front]) { + cl = qfq_slot_scan(grp); + roundedS = qfq_round_down(cl->S, grp->slot_shift); + if (grp->S != roundedS) { + __clear_bit(grp->index, &q->bitmaps[ER]); + __clear_bit(grp->index, &q->bitmaps[IR]); + __clear_bit(grp->index, &q->bitmaps[EB]); + __clear_bit(grp->index, &q->bitmaps[IB]); + grp->S = roundedS; + grp->F = roundedS + (2ULL << grp->slot_shift); + s = qfq_calc_state(q, grp); + __set_bit(grp->index, &q->bitmaps[s]); + } + } + qfq_update_eligible(q, q->V); +} +#endif + +static int +qfq_new_fsk(struct new_fsk *f) +{ + ipdn_bound_var(&f->fs.par[0], 1, 1, QFQ_MAX_WEIGHT, "qfq weight"); + ipdn_bound_var(&f->fs.par[1], 1500, 1, 2000, "qfq maxlen"); + ND("weight %d len %d\n", f->fs.par[0], f->fs.par[1]); + return 0; +} + +/* + * initialize a new scheduler instance + */ +static int +qfq_new_sched(struct new_sch_inst *si) +{ + struct qfq_sched *q = (struct qfq_sched *)(si + 1); + struct qfq_group *grp; + int i; + + for (i = 0; i <= QFQ_MAX_INDEX; i++) { + grp = &q->groups[i]; + grp->index = i; + grp->slot_shift = QFQ_MTU_SHIFT + FRAC_BITS - + (QFQ_MAX_INDEX - i); + } + return 0; +} + +/* + * QFQ scheduler descriptor + */ +static struct dn_alg qfq_desc = { + .type = DN_SCHED_QFQ, + .name = "QFQ", + .flags = DN_MULTIQUEUE, + + .si_datalen = sizeof(struct qfq_sched), + .q_datalen = sizeof(struct qfq_class) - sizeof(struct new_queue), + + .enqueue = qfq_enqueue, + .dequeue = qfq_dequeue, + + .new_sched = qfq_new_sched, + .new_fsk = qfq_new_fsk, + + .new_queue = qfq_new_queue, + .free_queue = qfq_free_queue, +}; + +DECLARE_DNSCHED_MODULE(dn_qfq, &qfq_desc); + +#ifdef QFQ_DEBUG +static void +dump_groups(struct qfq_sched *q, uint32_t mask) +{ + int i, j; + + for (i = 0; i < QFQ_MAX_INDEX + 1; i++) { + struct qfq_group *g = &q->groups[i]; + + if (0 == (mask & (1<slots[j]) + D(" bucket %d %p", j, g->slots[j]); + } + D("full_slots 0x%x", g->full_slots); + D(" %2d S 0x%20llx F 0x%llx %c", i, + g->S, g->F, + mask & (1<loops, q->queued, q->V); + D(" ER 0x%08x", q->bitmaps[ER]); + D(" EB 0x%08x", q->bitmaps[EB]); + D(" IR 0x%08x", q->bitmaps[IR]); + D(" IB 0x%08x", q->bitmaps[IB]); + dump_groups(q, 0xffffffff); +}; +#endif /* QFQ_DEBUG */ From owner-svn-src-user@FreeBSD.ORG Sun Jan 31 15:38:26 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8965D1065676; Sun, 31 Jan 2010 15:38:26 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77C2F8FC13; Sun, 31 Jan 2010 15:38:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0VFcQuu065559; Sun, 31 Jan 2010 15:38:26 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0VFcQNu065556; Sun, 31 Jan 2010 15:38:26 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201001311538.o0VFcQNu065556@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 31 Jan 2010 15:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203293 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2010 15:38:26 -0000 Author: luigi Date: Sun Jan 31 15:38:26 2010 New Revision: 203293 URL: http://svn.freebsd.org/changeset/base/203293 Log: fix a problem in the order of initialization. The callback new_sched can only be called after creating the internal flowset, so we need to postpone calls to si_new until after that. This means that siht remains NULL until then in the case !HAVE_MASK, which in turn means we create the scheduler instance as the first packet comes in. Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt Sun Jan 31 15:19:16 2010 (r203292) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt Sun Jan 31 15:38:26 2010 (r203293) @@ -2,6 +2,7 @@ Notes on the internal structure of dummy by Riccardo Panicucci and Luigi Rizzo Work supported by the EC project ONELAB2 + ********* * INDEX * ********* @@ -28,6 +29,12 @@ How to implement a new scheduler +OPEN ISSUES +------------------------------ +20100131 deleting RR causes infinite loop + presumably in the rr_free_queue() call -- seems to hang + forever when deleting a live flow +------------------------------ Dummynet is a traffic shaper and network emulator. Packets are selected by an external filter such as ipfw, and passed to the emulator Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Sun Jan 31 15:19:16 2010 (r203292) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Sun Jan 31 15:38:26 2010 (r203293) @@ -471,7 +471,7 @@ si_destroy(void *_si, void *arg) /* * Find the scheduler instance for this packet. If we need to apply * a mask, do on a local copy of the flow_id to preserve the original. - * Assume siht is always initialized. + * Assume siht is always initialized if we have a mask. */ struct new_sch_inst * ipdn_si_find(struct new_schk *s, struct ipfw_flow_id *id) @@ -482,9 +482,10 @@ ipdn_si_find(struct new_schk *s, struct flow_id_mask(&s->sch.sched_mask, &id_t); return dn_ht_find(s->siht, (uintptr_t)&id_t, DNHT_INSERT, s); - } else { - return (struct new_sch_inst *)s->siht; } + if (!s->siht) + s->siht = si_new(0, 0, s); + return (struct new_sch_inst *)s->siht; } /* callback to flush credit for the scheduler instance */ @@ -503,7 +504,7 @@ schk_reset_credit(struct new_schk *s) { if (s->sch.flags & DN_HAVE_MASK) dn_ht_scan(s->siht, si_reset_credit, NULL); - else + else if (s->siht) si_reset_credit(s->siht, NULL); } /*---- end of sch_inst hashtable ---------------------*/ @@ -672,14 +673,14 @@ schk_new(uintptr_t key, int flags, void SLIST_INIT(&s->fsk_list); /* initialize the hash table or create the single instance */ s->fp = a->fp; /* si_new needs this */ - s->siht = (s->sch.flags & DN_HAVE_MASK) ? - dn_ht_init(NULL, s->sch.buckets, + if (s->sch.flags & DN_HAVE_MASK) { + s->siht = dn_ht_init(NULL, s->sch.buckets, offsetof(struct new_sch_inst, si_next), - si_hash, si_match, si_new) : - si_new(0, 0, s); - if (s->siht == NULL) { - free(s, M_DUMMYNET); - return NULL; + si_hash, si_match, si_new); + if (s->siht == NULL) { + free(s, M_DUMMYNET); + return NULL; + } } s->fp = NULL; /* mark as a new scheduler */ dn_cfg.schk_count++; @@ -709,7 +710,7 @@ schk_delete_cb(void *obj, void *arg) /* no more flowset pointing to us now */ if (s->sch.flags & DN_HAVE_MASK) dn_ht_scan(s->siht, si_destroy, NULL); - else + else if (s->siht) si_destroy(s->siht, NULL); s->siht = NULL; if (s->fp->destroy) @@ -828,7 +829,7 @@ copy_si(struct copy_args *a, struct new_ { if (s->sch.flags & DN_HAVE_MASK) dn_ht_scan(s->siht, copy_si_cb, a); - else + else if (s->siht) copy_si_cb(s->siht, a); return 0; } From owner-svn-src-user@FreeBSD.ORG Sun Jan 31 16:04:23 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8168A106566B; Sun, 31 Jan 2010 16:04:23 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F09C8FC15; Sun, 31 Jan 2010 16:04:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0VG4NZU071240; Sun, 31 Jan 2010 16:04:23 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0VG4NPv071235; Sun, 31 Jan 2010 16:04:23 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201001311604.o0VG4NPv071235@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 31 Jan 2010 16:04:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203294 - in user/luigi/ipfw3-head: sbin/ipfw sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2010 16:04:23 -0000 Author: luigi Date: Sun Jan 31 16:04:23 2010 New Revision: 203294 URL: http://svn.freebsd.org/changeset/base/203294 Log: make some diagnostic messages conditional on net.inet.ip.dummynet.debug Fix (hopefully) the printing of children of a flowset. Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Sun Jan 31 15:38:26 2010 (r203293) +++ user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Sun Jan 31 16:04:23 2010 (r203294) @@ -305,14 +305,14 @@ list_pipes(struct dn_id *oid, struct dn_ int i, l; struct { struct dn_id id; - uintptr_t p[0]; + uint32_t p[0]; } *d = (void *)oid; l = (oid->len - sizeof(*oid))/sizeof(d->p[0]); if (l == 0) break; printf(" Children flowsets: "); for (i = 0; i < l; i++) - printf("%d ", d->p[i]); + printf("%u ", d->p[i]); printf("\n"); break; } Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c Sun Jan 31 15:38:26 2010 (r203293) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c Sun Jan 31 16:04:23 2010 (r203294) @@ -168,7 +168,7 @@ wf2qp_enqueue(struct new_sch_inst *_si, if (DN_KEY_LT(si->V, alg_fq->S)) { /* S>V means flow Not eligible. */ if (si->sch_heap.elements == 0) - printf("dummynet: ++ ouch! not eligible but empty scheduler!\n"); + D("++ ouch! not eligible but empty scheduler!"); heap_insert(&si->ne_heap, alg_fq->S, q); } else { heap_insert(&si->sch_heap, alg_fq->F, q); @@ -283,7 +283,6 @@ wf2qp_free_sched(struct new_sch_inst *_s static int wf2qp_new_fsk(struct new_fsk *fs) { - // printf("%s called\n", __FUNCTION__); ipdn_bound_var(&fs->fs.par[0], 1, 1, 100, "WF2Q+ weight"); return 0; @@ -316,7 +315,6 @@ wf2qp_free_queue(struct new_queue *q) struct wf2qp_queue *alg_fq = (struct wf2qp_queue *)q; struct wf2qp_si *si = (struct wf2qp_si *)(q->_si + 1); - printf("%s called\n", __FUNCTION__); if (alg_fq->S >= alg_fq->F + 1) return 0; /* nothing to do, not in any heap */ si->wsum -= q->fs->fs.par[0]; Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Sun Jan 31 15:38:26 2010 (r203293) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Sun Jan 31 16:04:23 2010 (r203294) @@ -117,6 +117,8 @@ SYSCTL_LONG(_net_inet_ip_dummynet, OID_A "Upper limit in bytes for pipe queue."); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, io_fast, CTLFLAG_RW, &dn_cfg.io_fast, 0, "Enable fast dummynet io."); +SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, debug, + CTLFLAG_RW, &dn_cfg.debug, 0, "Dummynet debug level"); /* RED parameters */ SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, red_lookup_depth, Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Sun Jan 31 15:38:26 2010 (r203293) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Sun Jan 31 16:04:23 2010 (r203294) @@ -106,15 +106,18 @@ find_sched_type(int type, char *name) int ipdn_bound_var(int *v, int dflt, int lo, int hi, const char *msg) { - if (*v < lo) { + int oldv = *v; + const char *op = NULL; + if (oldv < lo) { *v = dflt; - if (msg) - printf("default %s to %d\n", msg, *v); - } else if (*v > hi) { + op = "Bump"; + } else if (oldv > hi) { *v = hi; - if (msg) - printf("clamp %s to %d\n", msg, *v); - } + op = "Clamp"; + } else + return *v; + if (op && msg) + printf("%s %s to %d (was %d)\n", op, msg, *v, oldv); return *v; } @@ -834,27 +837,30 @@ copy_si(struct copy_args *a, struct new_ return 0; } +/* + * compute a list of children of a scheduler and copy up + */ static int copy_fsk_list(struct copy_args *a, struct new_schk *s, int flags) { struct new_fsk *fs; struct dn_id *o; - uint16_t *p; + uint32_t *p; int n = 0, space = sizeof(*o); SLIST_FOREACH(fs, &s->fsk_list, sch_chain) { if (fs->fs.fs_nr < DN_MAX_ID) n++; } - space += n * sizeof(uintptr_t); - D("sched %d has %d flowsets", s->sch.sched_nr, n); + space += n * sizeof(uint32_t); + DX(3, "sched %d has %d flowsets", s->sch.sched_nr, n); if (a->end - *(a->start) < space) return DNHT_SCAN_END; o = (struct dn_id *)(*(a->start)); o->len = space; *a->start += o->len; o->type = DN_TEXT; - p = (uint16_t *)(o+1); + p = (uint32_t *)(o+1); SLIST_FOREACH(fs, &s->fsk_list, sch_chain) if (fs->fs.fs_nr < DN_MAX_ID) *p++ = fs->fs.fs_nr; @@ -1083,7 +1089,7 @@ config_fs(struct new_fs *nfs, struct dn_ * queues if we need to reattach. Then update the * configuration, and possibly attach to the new sched. */ - D("fs %d changed sched %d@%p to %d@%p", + DX(2, "fs %d changed sched %d@%p to %d@%p", fs->fs.fs_nr, fs->fs.sched_nr, fs->sched, nfs->sched_nr, s); if (fs->sched) { @@ -1170,13 +1176,13 @@ again: /* run twice, for wfq and fifo */ s->link = p; p.link_nr = 0; if (s->fp == NULL) { - D("sched %d new type %s", i, a.fp->name); + DX(2, "sched %d new type %s", i, a.fp->name); } else if (s->fp != a.fp || bcmp(a.sch, &s->sch, sizeof(*a.sch)) ) { /* already existing. */ - D("sched %d type changed from %s to %s", + DX(2, "sched %d type changed from %s to %s", i, s->fp->name, a.fp->name); - ND(" type/sub %d/%d -> %d/%d", + DX(4, " type/sub %d/%d -> %d/%d", s->sch.oid.type, s->sch.oid.subtype, a.sch->oid.type, a.sch->oid.subtype); if (s->link.link_nr == 0) @@ -1190,7 +1196,7 @@ again: /* run twice, for wfq and fifo */ schk_delete_cb(s, (void *)DN_DELETE); goto again; } else { - ND("sched %d unchanged type %s", i, a.fp->name); + DX(4, "sched %d unchanged type %s", i, a.fp->name); } /* complete initialization */ s->sch = *a.sch; @@ -1303,7 +1309,7 @@ dummynet_flush(void) dn_ht_scan(dn_cfg.schedhash, schk_delete_cb, (void *)(uintptr_t)DN_DELETE_FS); /* delete all remaining (unlinked) flowsets */ - D("still %d unlinked fs", dn_cfg.fsk_count); + DX(4, "still %d unlinked fs", dn_cfg.fsk_count); dn_ht_free(dn_cfg.fshash, DNHT_REMOVE); fsk_detach_list(&dn_cfg.fsu, DN_DELETE_FS); /* Reinitialize system heap... */ From owner-svn-src-user@FreeBSD.ORG Sun Jan 31 21:39:25 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64BAA106566B; Sun, 31 Jan 2010 21:39:25 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 530CA8FC15; Sun, 31 Jan 2010 21:39:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0VLdP5C046492; Sun, 31 Jan 2010 21:39:25 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0VLdPfY046479; Sun, 31 Jan 2010 21:39:25 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201001312139.o0VLdPfY046479@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 31 Jan 2010 21:39:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203321 - in user/luigi/ipfw3-head: sbin/ipfw sys/netinet sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2010 21:39:25 -0000 Author: luigi Date: Sun Jan 31 21:39:25 2010 New Revision: 203321 URL: http://svn.freebsd.org/changeset/base/203321 Log: mega rename of new_* to dn_* for all data structures. Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_test.h user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c user/luigi/ipfw3-head/sys/netinet/ipfw/test_dn_sched.c Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Sun Jan 31 21:39:25 2010 (r203321) @@ -208,7 +208,7 @@ list_flow(struct dn_flow *ni) } static void -print_flowset_parms(struct new_fs *fs, char *prefix) +print_flowset_parms(struct dn_fs *fs, char *prefix) { int l; char qs[30]; @@ -255,7 +255,7 @@ print_flowset_parms(struct new_fs *fs, c } static void -print_extra_delay_parms(struct new_profile *p) +print_extra_delay_parms(struct dn_profile *p) { double loss; if (p->samples_no <= 0) @@ -321,7 +321,7 @@ list_pipes(struct dn_id *oid, struct dn_ printf("answer for cmd %d, len %d\n", oid->type, oid->id); break; case DN_SCH: { - struct new_sch *s = (struct new_sch *)oid; + struct dn_sch *s = (struct dn_sch *)oid; flush_buf(buf); printf(" sched %d type %s flags 0x%x %d buckets\n", s->sched_nr, @@ -362,11 +362,11 @@ list_pipes(struct dn_id *oid, struct dn_ break; case DN_FS: - print_flowset_parms((struct new_fs *)oid, buf); + print_flowset_parms((struct dn_fs *)oid, buf); break; case DN_PROFILE: flush_buf(buf); - print_extra_delay_parms((struct new_profile *)oid); + print_extra_delay_parms((struct dn_profile *)oid); } } flush_buf(buf); @@ -604,7 +604,7 @@ compare_points(const void *vp1, const vo #define ED_EFMT(s) EX_DATAERR,"error in %s at line %d: "#s,filename,lineno static void -load_extra_delays(const char *filename, struct new_profile *p) +load_extra_delays(const char *filename, struct dn_profile *p) { char line[ED_MAX_LINE_LEN]; FILE *f; @@ -774,10 +774,10 @@ ipfw_config_pipe(int ac, char **av) char *end; void *par = NULL; struct dn_id *buf, *base; - struct new_sch *sch = NULL; + struct dn_sch *sch = NULL; struct dn_link *p = NULL; - struct new_fs *fs = NULL; - struct new_profile *pf = NULL; + struct dn_fs *fs = NULL; + struct dn_profile *pf = NULL; struct ipfw_flow_id *mask = NULL; int lmax; int _foo = 0, *flags = &_foo; @@ -787,8 +787,8 @@ ipfw_config_pipe(int ac, char **av) * 1 scheduler, 1 link, 1 flowset, 1 profile */ lmax = sizeof(struct dn_id); /* command header */ - lmax += sizeof(struct new_sch) + sizeof(struct dn_link) + - sizeof(struct new_fs) + sizeof(struct new_profile); + lmax += sizeof(struct dn_sch) + sizeof(struct dn_link) + + sizeof(struct dn_fs) + sizeof(struct dn_profile); av++; ac--; /* Pipe number */ @@ -1251,7 +1251,7 @@ end_mask: p.fs.lookup_weight = (int)(weight * (1 << SCALE_RED)); } if (p.samples_no <= 0) { - struct new_profile *prof; + struct dn_profile *prof; prof = o_next(&o, sizeof(*prof), DN_PROFILE); i = do_cmd(IP_DUMMYNET_CONFIGURE, prof, sizeof *prof); } else Modified: user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h Sun Jan 31 21:39:25 2010 (r203321) @@ -53,7 +53,7 @@ struct dn_id { uint16_t len; /* total obj len including this header */ uint8_t type; uint8_t subtype; - uintptr_t id; /* generic id or pointer */ + uint32_t id; /* generic id */ }; /* @@ -119,7 +119,7 @@ struct dn_link { * flow masks, buckets for the flow hash, and possibly scheduler- * specific parameters (weight, quantum and so on). */ -struct new_fs { +struct dn_fs { struct dn_id oid; uint32_t fs_nr; /* the flowset number */ int flags; /* userland flags */ @@ -129,7 +129,9 @@ struct new_fs { struct ipfw_flow_id flow_mask; uint32_t sched_nr; /* the scheduler we attach to */ - /* generic scheduler parameters. Leave them at -1 if unset */ + /* generic scheduler parameters. Leave them at -1 if unset. + * Now we use 0: weight, 1: lmax, 2: priority + */ int par[4]; }; @@ -140,13 +142,13 @@ struct new_fs { * of the parent object. */ struct dn_flow { - struct dn_id oid; - struct ipfw_flow_id fid; + struct dn_id oid; + struct ipfw_flow_id fid; + uint64_t tot_pkts; /* statistics counters */ + uint64_t tot_bytes; uint32_t length; /* Queue lenght, in packets */ uint32_t len_bytes; /* Queue lenght, in bytes */ uint32_t drops; - uint64_t tot_pkts; /* statistics counters */ - uint64_t tot_bytes; }; @@ -154,11 +156,11 @@ struct dn_flow { * Scheduler template, mostly indicating the name, number, * sched_mask and buckets. */ -struct new_sch { - struct dn_id oid; - int sched_nr; /* N, scheduler number */ - int buckets; /* number of buckets for the instances */ - int flags; /* have_mask, ... */ +struct dn_sch { + struct dn_id oid; + uint32_t sched_nr; /* N, scheduler number */ + uint32_t buckets; /* number of buckets for the instances */ + uint32_t flags; /* have_mask, ... */ char name[16]; /* null terminated */ /* mask to select the appropriate scheduler instance */ @@ -168,15 +170,15 @@ struct new_sch { /* A delay profile is attached to a link */ #define ED_MAX_SAMPLES_NO 1024 -struct new_profile { - struct dn_id oid; +struct dn_profile { + struct dn_id oid; /* fields to simulate a delay profile */ #define ED_MAX_NAME_LEN 32 - char name[ED_MAX_NAME_LEN]; - int link_nr; - int loss_level; - int bandwidth; - int samples_no; /* actual length of samples[] */ + char name[ED_MAX_NAME_LEN]; + int link_nr; + int loss_level; + int bandwidth; + int samples_no; /* actual length of samples[] */ int samples[ED_MAX_SAMPLES_NO]; /* may be shorter */ }; @@ -225,8 +227,8 @@ the objects used by dummynet: + dn_profile describes a delay profile; + dn_flow describes the flow status (flow id, statistics) - + new_sch describes a scheduler - + new_fs describes a flowset (msk, weight, queue parameters) + + dn_sch describes a scheduler + + dn_fs describes a flowset (msk, weight, queue parameters) * */ Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h Sun Jan 31 21:39:25 2010 (r203321) @@ -102,18 +102,18 @@ struct dn_alg { * all the above. If the queue has data in it, also remove * from the scheduler. This can e.g. happen during a reconfigure. */ - int (*enqueue)(struct new_sch_inst *, struct new_queue *, + int (*enqueue)(struct dn_sch_inst *, struct dn_queue *, struct mbuf *); - struct mbuf * (*dequeue)(struct new_sch_inst *); + struct mbuf * (*dequeue)(struct dn_sch_inst *); - int (*config)(struct new_schk *); - int (*destroy)(struct new_schk*); - int (*new_sched)(struct new_sch_inst *); - int (*free_sched)(struct new_sch_inst *); - int (*new_fsk)(struct new_fsk *f); - int (*free_fsk)(struct new_fsk *f); - int (*new_queue)(struct new_queue *q); - int (*free_queue)(struct new_queue *q); + int (*config)(struct dn_schk *); + int (*destroy)(struct dn_schk*); + int (*new_sched)(struct dn_sch_inst *); + int (*free_sched)(struct dn_sch_inst *); + int (*new_fsk)(struct dn_fsk *f); + int (*free_fsk)(struct dn_fsk *f); + int (*new_queue)(struct dn_queue *q); + int (*free_queue)(struct dn_queue *q); }; /* @@ -121,7 +121,7 @@ struct dn_alg { * to be used by schedulers: */ void dn_free_pkts(struct mbuf *mnext); -int dn_enqueue(struct new_queue *q, struct mbuf* m, int drop); +int dn_enqueue(struct dn_queue *q, struct mbuf* m, int drop); /* bound a variable between min and max */ int ipdn_bound_var(int *v, int dflt, int lo, int hi, const char *msg); @@ -130,7 +130,7 @@ int ipdn_bound_var(int *v, int dflt, int * thing done on a dequeue as the queue itself may go away. */ static __inline struct mbuf* -dn_dequeue(struct new_queue *q) +dn_dequeue(struct dn_queue *q) { struct mbuf *m = q->mq.head; if (m == NULL) Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c Sun Jan 31 21:39:25 2010 (r203321) @@ -51,26 +51,26 @@ * Enqueue and dequeue use the default library functions. */ static int -fifo_enqueue(struct new_sch_inst *si, struct new_queue *q, struct mbuf *m) +fifo_enqueue(struct dn_sch_inst *si, struct dn_queue *q, struct mbuf *m) { /* XXX if called with q != NULL and m=NULL, this is a * re-enqueue from an existing scheduler, which we should * handle. */ - return dn_enqueue((struct new_queue *)(si+1), m, 0); + return dn_enqueue((struct dn_queue *)(si+1), m, 0); } static struct mbuf * -fifo_dequeue(struct new_sch_inst *si) +fifo_dequeue(struct dn_sch_inst *si) { - return dn_dequeue((struct new_queue *)(si + 1)); + return dn_dequeue((struct dn_queue *)(si + 1)); } static int -fifo_new_sched(struct new_sch_inst *si) +fifo_new_sched(struct dn_sch_inst *si) { /* This scheduler instance contains the queue */ - struct new_queue *q = (struct new_queue *)(si + 1); + struct dn_queue *q = (struct dn_queue *)(si + 1); set_oid(&q->ni.oid, DN_QUEUE, sizeof(*q)); q->_si = si; @@ -79,9 +79,9 @@ fifo_new_sched(struct new_sch_inst *si) } static int -fifo_free_sched(struct new_sch_inst *si) +fifo_free_sched(struct dn_sch_inst *si) { - struct new_queue *q = (struct new_queue *)(si + 1); + struct dn_queue *q = (struct dn_queue *)(si + 1); dn_free_pkts(q->mq.head); bzero(q, sizeof(*q)); return 0; @@ -96,7 +96,7 @@ static struct dn_alg fifo_desc = { .type = DN_SCHED_FIFO, .name = "FIFO", - .si_datalen = sizeof(struct new_queue), + .si_datalen = sizeof(struct dn_queue), .enqueue = fifo_enqueue, .dequeue = fifo_dequeue, Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Sun Jan 31 21:39:25 2010 (r203321) @@ -175,10 +175,10 @@ struct qfq_group; /* * additional queue info. Some of this info should come from * the flowset, we copy them here for faster processing. - * This is an overlay of the struct new_queue + * This is an overlay of the struct dn_queue */ struct qfq_class { - struct new_queue _q; + struct dn_queue _q; uint64_t S, F; /* flow timestamps (exact) */ struct qfq_class *next; /* Link for the slot list. */ @@ -277,7 +277,7 @@ out: * Validate and copy parameters from flowset. */ static int -qfq_new_queue(struct new_queue *_q) +qfq_new_queue(struct dn_queue *_q) { struct qfq_sched *q = (struct qfq_sched *)(_q->_si + 1); struct qfq_class *cl = (struct qfq_class *)_q; @@ -308,7 +308,7 @@ qfq_new_queue(struct new_queue *_q) /* remove an empty queue */ static int -qfq_free_queue(struct new_queue *_q) +qfq_free_queue(struct dn_queue *_q) { struct qfq_sched *q = (struct qfq_sched *)(_q->_si + 1); struct qfq_class *cl = (struct qfq_class *)_q; @@ -519,7 +519,7 @@ qfq_update_class(struct qfq_sched *q, st } static struct mbuf * -qfq_dequeue(struct new_sch_inst *si) +qfq_dequeue(struct dn_sch_inst *si) { struct qfq_sched *q = (struct qfq_sched *)(si + 1); struct qfq_group *grp; @@ -620,7 +620,7 @@ qfq_update_start(struct qfq_sched *q, st } static int -qfq_enqueue(struct new_sch_inst *si, struct new_queue *_q, struct mbuf *m) +qfq_enqueue(struct dn_sch_inst *si, struct dn_queue *_q, struct mbuf *m) { struct qfq_sched *q = (struct qfq_sched *)(si + 1); struct qfq_group *grp; @@ -763,7 +763,7 @@ qfq_deactivate_class(struct qfq_sched *q #endif static int -qfq_new_fsk(struct new_fsk *f) +qfq_new_fsk(struct dn_fsk *f) { ipdn_bound_var(&f->fs.par[0], 1, 1, QFQ_MAX_WEIGHT, "qfq weight"); ipdn_bound_var(&f->fs.par[1], 1500, 1, 2000, "qfq maxlen"); @@ -775,7 +775,7 @@ qfq_new_fsk(struct new_fsk *f) * initialize a new scheduler instance */ static int -qfq_new_sched(struct new_sch_inst *si) +qfq_new_sched(struct dn_sch_inst *si) { struct qfq_sched *q = (struct qfq_sched *)(si + 1); struct qfq_group *grp; @@ -799,7 +799,7 @@ static struct dn_alg qfq_desc = { .flags = DN_MULTIQUEUE, .si_datalen = sizeof(struct qfq_sched), - .q_datalen = sizeof(struct qfq_class) - sizeof(struct new_queue), + .q_datalen = sizeof(struct qfq_class) - sizeof(struct dn_queue), .enqueue = qfq_enqueue, .dequeue = qfq_dequeue, Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c Sun Jan 31 21:39:25 2010 (r203321) @@ -46,7 +46,7 @@ #define DN_SCHED_RR 3 // XXX Where? struct rr_queue { - struct new_queue q; /* Standard queue */ + struct dn_queue q; /* Standard queue */ int status; /* 1: queue is in the list */ int credit; /* Number of bytes to transmit */ int quantum; /* quantum * C */ @@ -54,7 +54,7 @@ struct rr_queue { }; /* struct rr_schk contains global config parameters - * and is right after new_schk + * and is right after dn_schk */ struct rr_schk { int min_q; /* Min quantum */ @@ -62,7 +62,7 @@ struct rr_schk { int q_bytes; /* Bytes per quantum */ }; -/* per-instance round robin list, right after new_sch_inst */ +/* per-instance round robin list, right after dn_sch_inst */ struct rr_si { struct rr_queue *head, *tail; /* Pointer to current queue */ }; @@ -137,7 +137,7 @@ next_pointer(struct rr_si *si) } static int -rr_enqueue(struct new_sch_inst *_si, struct new_queue *q, struct mbuf *m) +rr_enqueue(struct dn_sch_inst *_si, struct dn_queue *q, struct mbuf *m) { struct rr_si *si; struct rr_queue *rrq; @@ -163,7 +163,7 @@ rr_enqueue(struct new_sch_inst *_si, str } static struct mbuf * -rr_dequeue(struct new_sch_inst *_si) +rr_dequeue(struct dn_sch_inst *_si) { /* Access scheduler instance private data */ struct rr_si *si = (struct rr_si *)(_si + 1); @@ -195,7 +195,7 @@ rr_dequeue(struct new_sch_inst *_si) } static int -rr_config(struct new_schk *_schk) +rr_config(struct dn_schk *_schk) { struct rr_schk *schk = (struct rr_schk *)(_schk + 1); ND("called"); @@ -209,7 +209,7 @@ rr_config(struct new_schk *_schk) } static int -rr_new_sched(struct new_sch_inst *_si) +rr_new_sched(struct dn_sch_inst *_si) { struct rr_si *si = (struct rr_si *)(_si + 1); @@ -220,7 +220,7 @@ rr_new_sched(struct new_sch_inst *_si) } static int -rr_free_sched(struct new_sch_inst *_si) +rr_free_sched(struct dn_sch_inst *_si) { ND("called"); /* Nothing to do? */ @@ -228,7 +228,7 @@ rr_free_sched(struct new_sch_inst *_si) } static int -rr_new_fsk(struct new_fsk *fs) +rr_new_fsk(struct dn_fsk *fs) { struct rr_schk *schk = (struct rr_schk *)(fs->sched + 1); /* par[0] is the weight, par[1] is the quantum step */ @@ -240,7 +240,7 @@ rr_new_fsk(struct new_fsk *fs) } static int -rr_new_queue(struct new_queue *_q) +rr_new_queue(struct dn_queue *_q) { struct rr_queue *q = (struct rr_queue *)_q; @@ -259,7 +259,7 @@ rr_new_queue(struct new_queue *_q) } static int -rr_free_queue(struct new_queue *_q) +rr_free_queue(struct dn_queue *_q) { struct rr_queue *q = (struct rr_queue *)_q; @@ -282,7 +282,7 @@ static struct dn_alg rr_desc = { .flags = DN_MULTIQUEUE, .si_datalen = sizeof(struct rr_si), - .q_datalen = sizeof(struct rr_queue) - sizeof(struct new_queue), + .q_datalen = sizeof(struct rr_queue) - sizeof(struct dn_queue), .enqueue = rr_enqueue, .dequeue = rr_dequeue, Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c Sun Jan 31 21:39:25 2010 (r203321) @@ -84,7 +84,7 @@ struct wf2qp_si { }; struct wf2qp_queue { - struct new_queue _q; + struct dn_queue _q; uint64_t S, F; /* start time, finish time */ uint32_t inv_w; /* ONE_FP / weight */ int32_t heap_pos; /* position (index) of struct in heap */ @@ -107,7 +107,7 @@ idle_check(struct wf2qp_si *si, int n, i struct dn_heap *h = &si->idle_heap; while (n-- > 0 && h->elements > 0 && (force || DN_KEY_LT(HEAP_TOP(h)->key, si->V))) { - struct new_queue *q = HEAP_TOP(h)->object; + struct dn_queue *q = HEAP_TOP(h)->object; struct wf2qp_queue *alg_fq = (struct wf2qp_queue *)q; heap_extract(h, NULL); @@ -122,9 +122,9 @@ idle_check(struct wf2qp_si *si, int n, i } static int -wf2qp_enqueue(struct new_sch_inst *_si, struct new_queue *q, struct mbuf *m) +wf2qp_enqueue(struct dn_sch_inst *_si, struct dn_queue *q, struct mbuf *m) { - struct new_fsk *fs = q->fs; + struct dn_fsk *fs = q->fs; struct wf2qp_si *si = (struct wf2qp_si *)(_si + 1); struct wf2qp_queue *alg_fq; uint64_t len = m->m_pkthdr.len; @@ -178,12 +178,12 @@ wf2qp_enqueue(struct new_sch_inst *_si, /* XXX invariant: sch > 0 || V >= min(S in neh) */ static struct mbuf * -wf2qp_dequeue(struct new_sch_inst *_si) +wf2qp_dequeue(struct dn_sch_inst *_si) { /* Access scheduler instance private data */ struct wf2qp_si *si = (struct wf2qp_si *)(_si + 1); struct mbuf *m; - struct new_queue *q; + struct dn_queue *q; struct dn_heap *sch = &si->sch_heap; struct dn_heap *neh = &si->ne_heap; struct wf2qp_queue *alg_fq; @@ -251,7 +251,7 @@ wf2qp_dequeue(struct new_sch_inst *_si) } static int -wf2qp_new_sched(struct new_sch_inst *_si) +wf2qp_new_sched(struct dn_sch_inst *_si) { struct wf2qp_si *si = (struct wf2qp_si *)(_si + 1); int ofs = offsetof(struct wf2qp_queue, heap_pos); @@ -269,7 +269,7 @@ wf2qp_new_sched(struct new_sch_inst *_si } static int -wf2qp_free_sched(struct new_sch_inst *_si) +wf2qp_free_sched(struct dn_sch_inst *_si) { struct wf2qp_si *si = (struct wf2qp_si *)(_si + 1); @@ -281,7 +281,7 @@ wf2qp_free_sched(struct new_sch_inst *_s } static int -wf2qp_new_fsk(struct new_fsk *fs) +wf2qp_new_fsk(struct dn_fsk *fs) { ipdn_bound_var(&fs->fs.par[0], 1, 1, 100, "WF2Q+ weight"); @@ -289,7 +289,7 @@ wf2qp_new_fsk(struct new_fsk *fs) } static int -wf2qp_new_queue(struct new_queue *_q) +wf2qp_new_queue(struct dn_queue *_q) { struct wf2qp_queue *q = (struct wf2qp_queue *)_q; @@ -310,7 +310,7 @@ wf2qp_new_queue(struct new_queue *_q) * of weights. */ static int -wf2qp_free_queue(struct new_queue *q) +wf2qp_free_queue(struct dn_queue *q) { struct wf2qp_queue *alg_fq = (struct wf2qp_queue *)q; struct wf2qp_si *si = (struct wf2qp_si *)(q->_si + 1); @@ -346,7 +346,7 @@ static struct dn_alg wf2qp_desc = { /* we need extra space in the si and the queue */ .si_datalen = sizeof(struct wf2qp_si), - .q_datalen = sizeof(struct wf2qp_queue) - sizeof(struct new_queue), + .q_datalen = sizeof(struct wf2qp_queue) - sizeof(struct dn_queue), .enqueue = wf2qp_enqueue, .dequeue = wf2qp_dequeue, Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_test.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_test.h Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_test.h Sun Jan 31 21:39:25 2010 (r203321) @@ -40,10 +40,10 @@ enum { struct dn_id { int type, subtype, len, id; }; -struct new_fs { +struct dn_fs { int par[1]; }; -struct new_sch { +struct dn_sch { }; struct dn_flow { struct dn_id oid; @@ -86,28 +86,28 @@ typedef struct _md_t moduledata_t; #include #include #else -struct new_queue { - struct new_fsk *fs; /* parent flowset. */ - struct new_sch_inst *_si; /* parent sched instance. */ -}; -struct new_schk { -}; -struct new_fsk { - struct new_fs fs; - struct new_schk *sched; +struct dn_queue { + struct dn_fsk *fs; /* parent flowset. */ + struct dn_sch_inst *_si; /* parent sched instance. */ +}; +struct dn_schk { +}; +struct dn_fsk { + struct dn_fs fs; + struct dn_schk *sched; }; -struct new_sch_inst { - struct new_schk *sched; +struct dn_sch_inst { + struct dn_schk *sched; }; struct dn_alg { int type; const char *name; void *enqueue, *dequeue; int q_datalen, si_datalen, schk_datalen; - int (*config)(struct new_schk *); - int (*new_sched)(struct new_sch_inst *); - int (*new_fsk)(struct new_fsk *); - int (*new_queue)(struct new_queue *q); + int (*config)(struct dn_schk *); + int (*new_sched)(struct dn_sch_inst *); + int (*new_fsk)(struct dn_fsk *); + int (*new_queue)(struct dn_queue *q); }; #endif Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt Sun Jan 31 21:39:25 2010 (r203321) @@ -84,15 +84,15 @@ USERLAND-KERNEL API (ip_dummynet.h) contains data about the physical link such as bandwith, delay, burst size; - struct new_profile: + struct dn_profile: fields to simulate a delay profile - struct new_sch: + struct dn_sch: defines a scheduler (and a link attached to it). Parameters include scheduler type, sched_mask, number of buckets, and possibly other scheduler-specific parameters, - struct new_fs: + struct dn_fs: describes a flowset, i.e. a template for queues. Main parameters are the scheduler we attach to, a flow_mask, buckets, queue size, plr, weight, and other scheduler-specific @@ -100,45 +100,45 @@ USERLAND-KERNEL API (ip_dummynet.h) KERNEL REPRESENTATION (ip_dn_private.h) - struct new_queue + struct dn_queue individual queue of packets, created by a flowset using flow_mask and attached to a scheduler instance selected through sched_mask. - A new_queue has a pointer to the new_fsk (which in turn counts + A dn_queue has a pointer to the dn_fsk (which in turn counts how many queues point to it), a pointer to the - new_sch_inst it attaches to, and is in a hash table in the + dn_sch_inst it attaches to, and is in a hash table in the flowset. scheduler instances also should store queues in their own containers used for scheduling (lists, trees, etc.) CREATE: done on packet arrivals when a flow matches a flowset. - DELETE: done only when deleting the parent new_sch_inst + DELETE: done only when deleting the parent dn_sch_inst or draining memory. - struct new_fsk - includes a new_fs; a pointer to the new_schk; a link field - for the list of new_fsk attached to the same scheduler, + struct dn_fsk + includes a dn_fs; a pointer to the dn_schk; a link field + for the list of dn_fsk attached to the same scheduler, or for the unlinked list; a refcount for the number of queues pointing to it; - The new_fsk is in a hash table, fshash. + The dn_fsk is in a hash table, fshash. CREATE: done on configuration commands. DELETE: on configuration commands. - struct new_sch_inst - a scheduler instance, created from a new_schk applying sched_mask. + struct dn_sch_inst + a scheduler instance, created from a dn_schk applying sched_mask. Contains a delay line, a reference to the parent, and scheduler- - specific info. Both new_sch_inst and its delay line can be in the + specific info. Both dn_sch_inst and its delay line can be in the evheap if they have events to be processed. - CREATE: created from a new_schk applying sched_mask + CREATE: created from a dn_schk applying sched_mask DELETE: configuration command delete a scheduler which in turn sweeps the hash table of instances deleting them - struct new_schk - includes new_sch, dn_link, a pointer to new_profile, - a hash table of new_sch_inst, a list of new_fsk + struct dn_schk + includes dn_sch, dn_link, a pointer to dn_profile, + a hash table of dn_sch_inst, a list of dn_fsk attached to it. CREATE: configuration command. If there are flowsets that refer to this number, they are attached and moved to the hash table - DELETE: manual, see new_sch_inst + DELETE: manual, see dn_sch_inst fshash schedhash @@ -148,11 +148,11 @@ KERNEL REPRESENTATION (ip_dn_private.h) |NEW_FSK |<----. | [dn_link] | +---------------+ | +--------------+ |qht (hash) | | | siht(hash) | - | [new_queue] | | | [new_si] | - | [new_queue] | | | [new_si] | + | [dn_queue] | | | [dn_si] | + | [dn_queue] | | | [dn_si] | | ... | | | ... | - | +---------+ | | | +---------+ | - | |new_queue| | | | |new_si | | + | +--------+ | | | +---------+ | + | |dn_queue| | | | |dn_si | | | | fs *----------' | | | | | | si *---------------------->| | | | +---------+ | | +---------+ | @@ -304,11 +304,11 @@ To create a pipe, queue or scheduler, th The userland side of dummynet will prepare a buffer contains data to pass to kernel side. The buffer contains all struct needed to configure an object. In more detail, -to configure a pipe all three structs (dn_link, new_sch, new_fs) are needed, +to configure a pipe all three structs (dn_link, dn_sch, dn_fs) are needed, plus the delay profile struct if the pipe has a delay profile. -If configuring a scheduler only the struct new_sch is wrote in the buffer, -while if configuring a flowset only the new_fs struct is wrote. +If configuring a scheduler only the struct dn_sch is wrote in the buffer, +while if configuring a flowset only the dn_fs struct is wrote. The first struct in the buffer contains the type of command request, that is if it is configuring a pipe, a queue, or a scheduler. Then there are structs @@ -627,15 +627,15 @@ How to implement a new scheduler ================================ In dummynet, a scheduler algorithm is represented by two main structs, some functions and other minor structs. -- A struct new_sch_xyz (where xyz is the 'type' of scheduler algorithm +- A struct dn_sch_xyz (where xyz is the 'type' of scheduler algorithm implemented) contains data relative to scheduler, as global parameter that are common to all instances of the scheduler -- A struct new_sch_inst_xyz contains data relative to a single scheduler +- A struct dn_sch_inst_xyz contains data relative to a single scheduler instance, as local status variable depending for example by flows that are linked with the scheduler, and so on. To add a scheduler to dummynet, the user should type a command like: 'ipfw pipe x config sched [mask ... ...]' -This command creates a new struct new_sch_xyz of type , and +This command creates a new struct dn_sch_xyz of type , and store the optional parameter in that struct. The parameter mask determines how many scheduler instance of this @@ -646,7 +646,7 @@ If the mask is not set, all traffic goes When a packet arrives to a scheduler, the system search the corrected scheduler instance, and if it does not exist it is created now (the -struct new_sch_inst_xyz is allocated by the system, and the scheduler +struct dn_sch_inst_xyz is allocated by the system, and the scheduler fills the field correctly). It is a task of the scheduler to create the struct that contains all queues for a scheduler instance. Dummynet provides some function to create an hash table to store @@ -655,7 +655,7 @@ queues, but the schedule algorithm can c To link a flow to a scheduler, the user should type a command like: 'ipfw queue z config pipe x [mask... ...]' -This command creates a new 'new_fs' struct that will be inserted +This command creates a new 'dn_fs' struct that will be inserted in the system. If the scheduler x exists, this flowset will be linked to that scheduler and the flowset type become the same as the scheduler type. At this point, the function create_alg_fs_xyz() @@ -668,11 +668,11 @@ and assign it to a separate queue. This so it can ignore the mask if it wants. See now the two main structs: -struct new_sch_xyz { +struct dn_sch_xyz { struct gen g; /* important the name g */ /* global params */ }; -struct new_sch_inst_xyz { +struct dn_sch_inst_xyz { struct gen g; /* important the name g */ /* params of the instance */ }; @@ -703,20 +703,20 @@ The create_alg_fs_xyz() function is mand gen, but the delete_alg_fs_xyz() is mandatory only if the previous function has allocated some memory. -A struct new_queue contains packets belonging to a queue and some statistical +A struct dn_queue contains packets belonging to a queue and some statistical data. The scheduler could have to store data in this struct, so it must define -a new_queue_xyz struct: -struct new_queue_xyz { - struct new_queue q; +a dn_queue_xyz struct: +struct dn_queue_xyz { + struct dn_queue q; /* parameter for a queue */ } All structures are allocated by the system. To do so, the scheduler must set the size of its structs in the scheduler descriptor: -scheduler_size: sizeof(new_sch_xyz) -scheduler_i_size: sizeof(new_sch_inst_xyz) +scheduler_size: sizeof(dn_sch_xyz) +scheduler_i_size: sizeof(dn_sch_inst_xyz) flowset_size: sizeof(alg_fs_xyz) -queue_size: sizeof(new_queue_xyz); +queue_size: sizeof(dn_queue_xyz); The scheduler_size could be 0, but other struct must have at least a struct gen. @@ -731,7 +731,7 @@ scheduler functions. should be implemented to remove this memory. - int (*delete_scheduler_template)(void* sch); Delete a scheduler template. This function is mandatory if the scheduler - uses extra data respect the struct new_sch. + uses extra data respect the struct dn_sch. - int (*create_scheduler_instance)(void *s); Create a new scheduler instance. The system allocate the necessary memory and the schedulet can access it using the 's' pointer. @@ -776,10 +776,10 @@ scheduler functions. It is called when a flowset is deleting. Must remove the memory allocate by the create_alg_fs() function. -- int (*create_queue_alg)(struct new_queue *q, struct gen *f); +- int (*create_queue_alg)(struct dn_queue *q, struct gen *f); Called when a queue is created. The function should link the queue to the struct used by the scheduler instance to store all queues. -- int (*delete_queue_alg)(struct new_queue *q); +- int (*delete_queue_alg)(struct dn_queue *q); Called when a queue is deleting. The function should remove extra data and update the struct contains all queues in the scheduler instance. Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Sun Jan 31 21:39:25 2010 (r203321) @@ -230,9 +230,9 @@ void dn_free_pkts(struct mbuf *mnext) * Return 0 on success, 1 on drop. The packet is consumed anyways. */ int -dn_enqueue(struct new_queue *q, struct mbuf* m, int drop) +dn_enqueue(struct dn_queue *q, struct mbuf* m, int drop) { - struct new_fs *f; + struct dn_fs *f; struct dn_flow *ni; /* stats for scheduler instance */ uint64_t len; @@ -306,11 +306,11 @@ transmit_event(struct mq *q, struct dela * in milliseconds so we need to divide by 1000. */ static uint64_t -extra_bits(struct mbuf *m, struct new_schk *s) +extra_bits(struct mbuf *m, struct dn_schk *s) { int index; uint64_t bits; - struct new_profile *pf = s->profile; + struct dn_profile *pf = s->profile; if (!pf || pf->samples_no == 0) return 0; @@ -329,10 +329,10 @@ extra_bits(struct mbuf *m, struct new_sc * Return a pointer to the head of the queue. */ static struct mbuf * -serve_sched(struct mq *q, struct new_sch_inst *si, uint64_t now) +serve_sched(struct mq *q, struct dn_sch_inst *si, uint64_t now) { struct mq def_q; - struct new_schk *s = si->sched; + struct dn_schk *s = si->sched; struct mbuf *m = NULL; int delay_line_idle = (si->dline.mq.head == NULL); int done, bw; @@ -442,7 +442,7 @@ dummynet_task(void *context, int pending heap_extract(&dn_cfg.evheap, NULL); if (p->type == DN_SCH_I) { - serve_sched(&q, (struct new_sch_inst *)p, curr_time); + serve_sched(&q, (struct dn_sch_inst *)p, curr_time); } else { /* extracted a delay line */ transmit_event(&q, (struct delay_line *)p, curr_time); } @@ -583,9 +583,9 @@ int dummynet_io(struct mbuf **m0, int dir, struct ip_fw_args *fwa) { struct mbuf *m = *m0; - struct new_fsk *fs = NULL; - struct new_sch_inst *si; - struct new_queue *q = NULL; /* default */ + struct dn_fsk *fs = NULL; + struct dn_sch_inst *si; + struct dn_queue *q = NULL; /* default */ int fs_id = (fwa->rule.info & IPFW_INFO_MASK) + ((fwa->rule.info & IPFW_IS_PIPE) ? 2*DN_MAX_ID : 0); Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Sun Jan 31 21:39:25 2010 (r203321) @@ -74,10 +74,10 @@ MALLOC_DECLARE(M_DUMMYNET); #define DN_BH_WUNLOCK() mtx_unlock(&dn_cfg.uh_mtx) #define DN_BH_LOCK_ASSERT() mtx_assert(&dn_cfg.uh_mtx, MA_OWNED) -SLIST_HEAD(new_schk_head, new_schk); -SLIST_HEAD(new_sch_inst_head, new_sch_inst); -SLIST_HEAD(new_fsk_head, new_fsk); -SLIST_HEAD(new_queue_head, new_queue); +SLIST_HEAD(dn_schk_head, dn_schk); +SLIST_HEAD(dn_sch_inst_head, dn_sch_inst); +SLIST_HEAD(dn_fsk_head, dn_fsk); +SLIST_HEAD(dn_queue_head, dn_queue); SLIST_HEAD(dn_alg_head, dn_alg); struct mq { /* a basic queue of packets*/ @@ -130,7 +130,7 @@ struct dn_parms { struct dn_ht *fshash; struct dn_ht *schedhash; /* list of flowsets without a scheduler -- use sch_chain */ - struct new_fsk_head fsu; /* list of unlinked flowsets */ + struct dn_fsk_head fsu; /* list of unlinked flowsets */ struct dn_alg_head schedlist; /* list of algorithms */ /* if the upper half is busy doing something long, @@ -141,14 +141,16 @@ struct dn_parms { struct mq pending; #ifdef _KERNEL - /* uh_mtx arbitrates between system calls and also + /* + * This file is normally used in the kernel, unless we do + * some userland tests, in which case we do not need a mtx. + * uh_mtx arbitrates between system calls and also * protects fshash, schedhash and fsunlinked. * These structures are readonly for the lower half. - */ - struct mtx uh_mtx; - /* bh_mtx protects all other structures which may be + * bh_mtx protects all other structures which may be * modified upon packet arrivals */ + struct mtx uh_mtx; struct mtx bh_mtx; #endif /* _KERNEL */ }; @@ -159,7 +161,7 @@ struct dn_parms { */ struct delay_line { struct dn_id oid; - struct new_sch_inst *si; + struct dn_sch_inst *si; struct mq mq; }; @@ -174,16 +176,16 @@ struct delay_line { * put them in external storage because the scheduler may not be * available when the fsk is created. */ -struct new_fsk { /* kernel side of a flowset */ - struct new_fs fs; - SLIST_ENTRY(new_fsk) fsk_next; /* hash chain for fshash */ +struct dn_fsk { /* kernel side of a flowset */ + struct dn_fs fs; + SLIST_ENTRY(dn_fsk) fsk_next; /* hash chain for fshash */ struct ipfw_flow_id fsk_mask; - /* hash table of queues, or just single queue */ - struct dn_ht *_qht; - struct new_schk *sched; /* Sched we are linked to */ - SLIST_ENTRY(new_fsk) sch_chain; /* list of fsk attached to sched */ + /* qht is a hash table of queues, or just a single queue */ + struct dn_ht *qht; + struct dn_schk *sched; /* Sched we are linked to */ + SLIST_ENTRY(dn_fsk) sch_chain; /* list of fsk attached to sched */ }; /* @@ -194,12 +196,12 @@ struct new_fsk { /* kernel side of a flo * detached from the scheduler -- in this case si == NULL and we * should not enqueue. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sun Jan 31 21:51:28 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AAAC1065672; Sun, 31 Jan 2010 21:51:28 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09C3B8FC16; Sun, 31 Jan 2010 21:51:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0VLpRm1049283; Sun, 31 Jan 2010 21:51:27 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0VLpRCl049278; Sun, 31 Jan 2010 21:51:27 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201001312151.o0VLpRCl049278@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 31 Jan 2010 21:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203324 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2010 21:51:28 -0000 Author: edwin Date: Sun Jan 31 21:51:27 2010 New Revision: 203324 URL: http://svn.freebsd.org/changeset/base/203324 Log: Be able to determine Chinese New Year. Modified: user/edwin/calendar/calendar.h user/edwin/calendar/io.c user/edwin/calendar/parsedata.c user/edwin/calendar/sunpos.c Modified: user/edwin/calendar/calendar.h ============================================================================== --- user/edwin/calendar/calendar.h Sun Jan 31 21:47:39 2010 (r203323) +++ user/edwin/calendar/calendar.h Sun Jan 31 21:51:27 2010 (r203324) @@ -163,3 +163,4 @@ void pom(int year, int *fms, int *nms); /* sunpos.c */ void equinoxsolstice(int year, double UTCoffset, int *equinoxdays, int *solsticedays); +int calculatesunlongitude30(int year, int degreeGMToffset, int *ichinesemonths); Modified: user/edwin/calendar/io.c ============================================================================== --- user/edwin/calendar/io.c Sun Jan 31 21:47:39 2010 (r203323) +++ user/edwin/calendar/io.c Sun Jan 31 21:51:27 2010 (r203324) @@ -174,7 +174,6 @@ cal(void) *pp = '\0'; if ((count = parsedaymonth(buf, year, month, day, &flags)) == 0) continue; - printf("%s - count: %d\n", buf, count); *pp = p; /* Find the last tab */ Modified: user/edwin/calendar/parsedata.c ============================================================================== --- user/edwin/calendar/parsedata.c Sun Jan 31 21:47:39 2010 (r203323) +++ user/edwin/calendar/parsedata.c Sun Jan 31 21:51:27 2010 (r203324) @@ -347,10 +347,10 @@ parsedaymonth(char *date, int *yearp, in int idayofweek, imonth, idayofmonth, year, index; int ieaster, ipaskha; - int ifullmoon[MAXMOONS], inewmoon[MAXMOONS]; + int ifullmoon[MAXMOONS], inewmoon[MAXMOONS], ichinesemonths[MAXMOONS]; int equinoxdays[2], solsticedays[2]; - int *mondays, d, m, dow, rm, rd, offset; + int *mondays, d, m, dow, rm, rd, offset, firstcnyday; /* * CONVENTION @@ -389,6 +389,16 @@ parsedaymonth(char *date, int *yearp, in pom(year, ifullmoon, inewmoon); equinoxsolstice(year, 0.0, equinoxdays, solsticedays); + /* CNY: Match day with sun longitude at 330` with new moon */ + firstcnyday = calculatesunlongitude30(year, 120, + ichinesemonths); + for (m = 0; inewmoon[m] != 0; m++) { + if (inewmoon[m] > firstcnyday) { + firstcnyday = inewmoon[m - 1]; + break; + } + } + /* Same day every year */ if (*flags == (F_MONTH | F_DAYOFMONTH)) { if (!remember_ymd(year, imonth, idayofmonth)) @@ -516,6 +526,18 @@ parsedaymonth(char *date, int *yearp, in continue; } + /* Chinese New Year */ + if ((*flags & ~F_MODIFIEROFFSET) == + (F_SPECIALDAY | F_VARIABLE | F_CNY)) { + offset = 0; + if ((*flags & F_MODIFIEROFFSET) != 0) + offset = parseoffset(modifieroffset); + if (remember_yd(year, firstcnyday + offset, &rm, &rd)) + remember(index++, yearp, monthp, dayp, + year, rm, rd); + continue; + } + /* FullMoon */ if ((*flags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_FULLMOON)) { Modified: user/edwin/calendar/sunpos.c ============================================================================== --- user/edwin/calendar/sunpos.c Sun Jan 31 21:47:39 2010 (r203323) +++ user/edwin/calendar/sunpos.c Sun Jan 31 21:51:27 2010 (r203324) @@ -93,14 +93,10 @@ static double ZJtable[] = { static void sunpos(int inYY, int inMM, int inDD, double UTCOFFSET, int inHOUR, int inMIN, - double eastlongitude, double latitude, double *DEC, double *ALT, double *AZ) + double eastlongitude, double latitude, double *L, double *DEC) { int Y; - double ZJ, D, T, L, M, epsilon, lambda, alpha, HA, UTHM; - - /* Not calculated in this code */ - *ALT = 0; - *AZ = 0; + double ZJ, D, T, M, epsilon, lambda, alpha, HA, UTHM; ZJ = ZJtable[inMM]; if (inMM <= 2 && isleap(inYY)) @@ -110,14 +106,14 @@ sunpos(int inYY, int inMM, int inDD, dou Y = inYY - 1900; /* 1 */ D = floor(365.25 * Y) + ZJ + inDD + UTHM / 24; /* 3 */ T = D / 36525.0; /* 4 */ - L = 279.697 + 36000.769 * T; /* 5 */ - fixup(&L); + *L = 279.697 + 36000.769 * T; /* 5 */ + fixup(L); M = 358.476 + 35999.050 * T; /* 6 */ fixup(&M); epsilon = 23.452 - 0.013 * T; /* 7 */ fixup(&epsilon); - lambda = L + (1.919 - 0.005 * T) * SIN(M) + 0.020 * SIN(2 * M); /* 8 */ + lambda = *L + (1.919 - 0.005 * T) * SIN(M) + 0.020 * SIN(2 * M); /* 8 */ fixup(&lambda); alpha = ATAN(TAN(lambda) * COS(epsilon)); /* 9 */ @@ -134,7 +130,7 @@ sunpos(int inYY, int inMM, int inDD, dou *DEC = ASIN(SIN(lambda) * SIN(epsilon)); /* 10 */ fixup(DEC); fixup(&eastlongitude); - HA = L - alpha + 180 + 15 * UTHM + eastlongitude; /* 12 */ + HA = *L - alpha + 180 + 15 * UTHM + eastlongitude; /* 12 */ fixup(&HA); fixup(&latitude); #ifdef NOTDEF @@ -195,7 +191,7 @@ sunpos(int inYY, int inMM, int inDD, dou void equinoxsolstice(int year, double UTCoffset, int *equinoxdays, int *solsticedays) { - double dec, prevdec, alt, az; + double dec, prevdec, L; int h, d, prevangle, angle; int found = 0; @@ -212,7 +208,7 @@ equinoxsolstice(int year, double UTCoffs for (d = 18; d < 31; d++) { for (h = 0; h < 4 * 24; h++) { sunpos(year, 3, d, UTCoffset, HOUR(h), MIN(h), - 0.0, 0.0, &dec, &alt, &az); + 0.0, 0.0, &L, &dec); if (SIGN(prevdec) != SIGN(dec)) { #ifdef NOTDEF DEBUG1(year, 3, d, HOUR(h), MIN(h), @@ -237,7 +233,7 @@ equinoxsolstice(int year, double UTCoffs for (d = 18; d < 31; d++) { for (h = 0; h < 4 * 24; h++) { sunpos(year, 9, d, UTCoffset, HOUR(h), MIN(h), - 0.0, 0.0, &dec, &alt, &az); + 0.0, 0.0, &L, &dec); if (SIGN(prevdec) != SIGN(dec)) { #ifdef NOTDEF DEBUG1(year, 9, d, HOUR(h), MIN(h), @@ -264,7 +260,7 @@ equinoxsolstice(int year, double UTCoffs for (d = 18; d < 31; d++) { for (h = 0; h < 4 * 24; h++) { sunpos(year, 6, d, UTCoffset, HOUR(h), MIN(h), - 0.0, 0.0, &dec, &alt, &az); + 0.0, 0.0, &L, &dec); angle = ANGLE(prevdec, dec); if (prevangle != angle) { #ifdef NOTDEF @@ -293,7 +289,7 @@ equinoxsolstice(int year, double UTCoffs for (d = 18; d < 31; d++) { for (h = 0; h < 4 * 24; h++) { sunpos(year, 12, d, UTCoffset, HOUR(h), MIN(h), - 0.0, 0.0, &dec, &alt, &az); + 0.0, 0.0, &L, &dec); angle = ANGLE(prevdec, dec); if (prevangle != angle) { #ifdef NOTDEF @@ -314,6 +310,58 @@ equinoxsolstice(int year, double UTCoffs return; } +int +calculatesunlongitude30(int year, int degreeGMToffset, int *ichinesemonths) +{ + int m, d, h; + double dec; + double curL, prevL; + int *pichinesemonths, *monthdays, *cumdays, i; + int firstmonth330; + + cumdays = cumdaytab[isleap(year)]; + monthdays = mondaytab[isleap(year)]; + pichinesemonths = ichinesemonths; + + sunpos(year - 1, 12, 31, + -24 * (degreeGMToffset / 360.0), + HOUR(h), MIN(h), 0.0, 0.0, &prevL, &dec); + + for (m = 1; m <= 12; m++) { + for (d = 1; d <= monthdays[m]; d++) { + for (h = 0; h < 4 * 24; h++) { + sunpos(year, m, d, + -24 * (degreeGMToffset / 360.0), + HOUR(h), MIN(h), 0.0, 0.0, &curL, &dec); + if (curL < 180 && prevL > 180) { + *pichinesemonths = cumdays[m] + d; +#ifdef DEBUG +printf("%04d-%02d-%02d %02d:%02d - %d %g\n", + year, m, d, HOUR(h), MIN(h), *pichinesemonths, curL); +#endif + pichinesemonths++; + } else { + for (i = 0; i <= 360; i += 30) + if (curL > i && prevL < i) { + *pichinesemonths = + cumdays[m] + d; +#ifdef DEBUG +printf("%04d-%02d-%02d %02d:%02d - %d %g\n", + year, m, d, HOUR(h), MIN(h), *pichinesemonths, curL); +#endif + if (i == 330) + firstmonth330 = *pichinesemonths; + pichinesemonths++; + } + } + prevL = curL; + } + } + } + *pichinesemonths = 0; + return (firstmonth330); +} + #ifdef NOTDEF int main(int argc, char **argv) From owner-svn-src-user@FreeBSD.ORG Sun Jan 31 22:08:53 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 498CC106566B; Sun, 31 Jan 2010 22:08:53 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 379828FC1E; Sun, 31 Jan 2010 22:08:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0VM8rGS053139; Sun, 31 Jan 2010 22:08:53 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0VM8rVv053132; Sun, 31 Jan 2010 22:08:53 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201001312208.o0VM8rVv053132@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 31 Jan 2010 22:08:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203325 - in user/luigi/ipfw3-head/sys/netinet/ipfw: . test X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2010 22:08:53 -0000 Author: luigi Date: Sun Jan 31 22:08:52 2010 New Revision: 203325 URL: http://svn.freebsd.org/changeset/base/203325 Log: move test code to its own directory. Add functionality to build schedulers in userland, drive them with mixed traffic patterns, and print results. Added: user/luigi/ipfw3-head/sys/netinet/ipfw/test/ user/luigi/ipfw3-head/sys/netinet/ipfw/test/Makefile (contents, props changed) - copied, changed from r202963, user/luigi/ipfw3-head/sys/netinet/ipfw/Makefile user/luigi/ipfw3-head/sys/netinet/ipfw/test/dn_test.h (contents, props changed) - copied, changed from r203321, user/luigi/ipfw3-head/sys/netinet/ipfw/dn_test.h user/luigi/ipfw3-head/sys/netinet/ipfw/test/main.c (contents, props changed) user/luigi/ipfw3-head/sys/netinet/ipfw/test/mylist.h (contents, props changed) - copied unchanged from r202963, user/luigi/ipfw3-head/sys/netinet/ipfw/test_dn_heap.c user/luigi/ipfw3-head/sys/netinet/ipfw/test/test_dn_sched.c (contents, props changed) - copied, changed from r203321, user/luigi/ipfw3-head/sys/netinet/ipfw/test_dn_sched.c Directory Properties: user/luigi/ipfw3-head/sys/netinet/ipfw/test/test_dn_heap.c (props changed) Deleted: user/luigi/ipfw3-head/sys/netinet/ipfw/Makefile user/luigi/ipfw3-head/sys/netinet/ipfw/dn_test.h user/luigi/ipfw3-head/sys/netinet/ipfw/test_dn_heap.c user/luigi/ipfw3-head/sys/netinet/ipfw/test_dn_sched.c Copied and modified: user/luigi/ipfw3-head/sys/netinet/ipfw/test/Makefile (from r202963, user/luigi/ipfw3-head/sys/netinet/ipfw/Makefile) ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/Makefile Mon Jan 25 07:37:37 2010 (r202963, copy source) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/test/Makefile Sun Jan 31 22:08:52 2010 (r203325) @@ -3,15 +3,19 @@ SCHED_SRCS = test_dn_sched.c SCHED_SRCS += dn_sched_fifo.c SCHED_SRCS += dn_sched_wf2q.c +SCHED_SRCS += dn_sched_qfq.c SCHED_SRCS += dn_sched_rr.c SCHED_SRCS += dn_heap.c +SCHED_SRCS += main.c SCHED_OBJS=$(SCHED_SRCS:.c=.o) HEAP_SRCS = dn_heap.c test_dn_heap.c HEAP_OBJS=$(HEAP_SRCS:.c=.o) -CFLAGS = -I. -Wall -Werror -O2 -DIPFW +VPATH= .:.. + +CFLAGS = -I.. -I. -Wall -Werror -O3 -DIPFW TARGETS= test_heap test_sched all: $(TARGETS) @@ -22,5 +26,8 @@ test_heap : $(HEAP_OBJS) test_sched : $(SCHED_OBJS) $(CC) -o $@ $> +$(SCHED_OBJS): dn_test.h +main.o: mylist.h + clean: - rm *.o $(TARGETS) *.core Copied and modified: user/luigi/ipfw3-head/sys/netinet/ipfw/test/dn_test.h (from r203321, user/luigi/ipfw3-head/sys/netinet/ipfw/dn_test.h) ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_test.h Sun Jan 31 21:39:25 2010 (r203321, copy source) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/test/dn_test.h Sun Jan 31 22:08:52 2010 (r203325) @@ -1,5 +1,7 @@ /* - * userspace compatibility code for dummynet schedulers` + * $Id$ + * + * userspace compatibility code for dummynet schedulers */ #ifndef _DN_TEST_H @@ -7,24 +9,29 @@ #include #include #include -#include /* bzero */ +#include /* bzero, ffs, ... */ #include /* strcmp */ #include #include #include #include + +extern int debug; #define ND(fmt, args...) do {} while (0) #define D1(fmt, args...) do {} while (0) -#define D(fmt, args...) fprintf(stderr, "%-10s " fmt "\n", \ - __FUNCTION__, ## args) +#define D(fmt, args...) fprintf(stderr, "%-8s " fmt "\n", \ + __FUNCTION__, ## args) #define DX(lev, fmt, args...) do { \ - if (debug > lev) D(fmt, ## args); } while (0) + if (debug > lev) D(fmt, ## args); } while (0) + #define offsetof(t,m) (int)((&((t *)0L)->m)) +#include + /* prevent include of other system headers */ -#define _NETINET_IP_VAR_H_ /* ip_fw_args */ +#define _NETINET_IP_VAR_H_ /* ip_fw_args */ #define _IPFW2_H #define _SYS_MBUF_H_ @@ -41,13 +48,35 @@ struct dn_id { int type, subtype, len, id; }; struct dn_fs { - int par[1]; + int par[4]; /* flowset parameters */ + + /* simulation entries. + * 'index' is not strictly necessary + * y is used for the inverse mapping , + */ + int index; + int y; /* inverse mapping */ + int base_y; /* inverse mapping */ + int next_y; /* inverse mapping */ + int n_flows; + int first_flow; + int next_flow; /* first_flow + n_flows */ + /* + * when generating, let 'cur' go from 0 to n_flows-1, + * then point to flow first_flow + cur + */ + int cur; }; struct dn_sch { }; struct dn_flow { struct dn_id oid; - int length, len_bytes, drops; + int length; + int len_bytes; + int drops; + uint64_t tot_bytes; + uint32_t flow_id; + struct list_head h; /* used by the generator */ }; struct dn_link { }; @@ -56,13 +85,13 @@ struct ip_fw_args { }; struct mbuf { - struct { - int len; - } m_pkthdr; - struct mbuf *m_nextpkt; - int flow_id; /* for testing, index of a flow */ - int flowset_id; /* for testing, index of a flowset */ - void *cfg; /* config args */ + struct { + int len; + } m_pkthdr; + struct mbuf *m_nextpkt; + int flow_id; /* for testing, index of a flow */ + //int flowset_id; /* for testing, index of a flowset */ + void *cfg; /* config args */ }; #define MALLOC_DECLARE(x) @@ -87,8 +116,8 @@ typedef struct _md_t moduledata_t; #include #else struct dn_queue { - struct dn_fsk *fs; /* parent flowset. */ - struct dn_sch_inst *_si; /* parent sched instance. */ + struct dn_fsk *fs; /* parent flowset. */ + struct dn_sch_inst *_si; /* parent sched instance. */ }; struct dn_schk { }; @@ -107,9 +136,20 @@ struct dn_alg { int (*config)(struct dn_schk *); int (*new_sched)(struct dn_sch_inst *); int (*new_fsk)(struct dn_fsk *); - int (*new_queue)(struct dn_queue *q); + int (*new_queue)(struct dn_queue *q); }; #endif +static inline void +mq_append(struct mq *q, struct mbuf *m) +{ + if (q->head == NULL) + q->head = m; + else + q->tail->m_nextpkt = m; + q->tail = m; + m->m_nextpkt = NULL; +} + #endif /* _DN_TEST_H */ Added: user/luigi/ipfw3-head/sys/netinet/ipfw/test/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/test/main.c Sun Jan 31 22:08:52 2010 (r203325) @@ -0,0 +1,634 @@ +/* + * $Id$ + * + * Testing program for schedulers + * + * The framework include a simple controller which, at each + * iteration, decides whether we can enqueue and/or dequeue. + * Then the mainloop runs the required number of tests, + * keeping track of statistics. + */ + +#include "dn_test.h" + +struct q_list { + struct list_head h; +}; + +struct cfg_s { + int ac; + char * const *av; + + const char *name; + int loops; + struct timeval time; + + /* running counters */ + uint32_t _enqueue; + uint32_t drop; + uint32_t pending; + uint32_t dequeue; + + /* generator parameters */ + int th_min, th_max; + int maxburst; + int lmin, lmax; /* packet len */ + int flows; /* number of flows */ + int flowsets; /* number of flowsets */ + int wsum; /* sum of weights of all flows */ + int max_y; /* max random number in the generation */ + int cur_y, cur_fs; /* used in generation, between 0 and max_y - 1 */ + const char *fs_config; /* flowset config */ + int can_dequeue; + int burst; /* count of packets sent in a burst */ + struct mbuf *tosend; /* packet to send -- also flag to enqueue */ + + struct mbuf *freelist; + + struct mbuf *head, *tail; /* a simple tailq */ + + /* scheduler hooks */ + int (*enq)(struct dn_sch_inst *, struct dn_queue *, + struct mbuf *); + struct mbuf * (*deq)(struct dn_sch_inst *); + /* size of the three fields including sched-specific areas */ + int schk_len; + int q_len; /* size of a queue including sched-fields */ + int si_len; /* size of a sch_inst including sched-fields */ + char *q; /* array of flow queues */ + /* use a char* because size is variable */ + struct dn_fsk *fs; /* array of flowsets */ + struct dn_sch_inst *si; + struct dn_schk *sched; + + /* generator state */ + int state; /* 0 = going up, 1: going down */ + + /* + * We keep lists for each backlog level, and always serve + * the one with shortest backlog. llmask contains a bitmap + * of lists, and ll are the heads of the lists. The last + * entry (BACKLOG) contains all entries considered 'full' + * XXX to optimize things, entry i could contain queues with + * 2^{i-1}+1 .. 2^i entries. + */ +#define BACKLOG 30 + uint32_t llmask; + struct list_head ll[BACKLOG + 10]; +}; + +/* FI2Q and Q2FI converts from flow_id to dn_queue and back. + * We cannot easily use pointer arithmetic because it is variable size. + */ +#define FI2Q(c, i) ((struct dn_queue *)((c)->q + (c)->q_len * (i))) +#define Q2FI(c, q) (((char *)(q) - (c)->q)/(c)->q_len) + +int debug = 0; + +static void controller(struct cfg_s *c); + +/* release a packet: put the mbuf in the freelist, and the queue in + * the bucket. + */ +int +drop(struct cfg_s *c, struct mbuf *m) +{ + struct dn_queue *q; + int i; + + c->drop++; + q = FI2Q(c, m->flow_id); + i = q->ni.length; // XXX or ffs... + + ND("q %p id %d current length %d", q, m->flow_id, i); + if (i < BACKLOG) { + struct list_head *h = &q->ni.h; + c->llmask &= ~(1<<(i+1)); + c->llmask |= (1<<(i)); + list_del(h); + list_add_tail(h, &c->ll[i]); + } + m->m_nextpkt = c->freelist; + c->freelist = m; + return 0; +} + +/* dequeue returns NON-NULL when a packet is dropped */ +static int +enqueue(struct cfg_s *c, void *_m) +{ + struct mbuf *m = _m; + if (c->enq) + return c->enq(c->si, FI2Q(c, m->flow_id), m); + if (c->head == NULL) + c->head = m; + else + c->tail->m_nextpkt = m; + c->tail = m; + return 0; /* default - success */ +} + +/* dequeue returns NON-NULL when a packet is available */ +static void * +dequeue(struct cfg_s *c) +{ + struct mbuf *m; + if (c->deq) + return c->deq(c->si); + if ((m = c->head)) { + m = c->head; + c->head = m->m_nextpkt; + m->m_nextpkt = NULL; + } + return m; +} + +static int +mainloop(struct cfg_s *c) +{ + int i; + struct mbuf *m; + + for (i=0; i < c->loops; i++) { + /* implement histeresis */ + controller(c); + DX(3, "loop %d enq %d send %p rx %d", + i, c->_enqueue, c->tosend, c->can_dequeue); + if ( (m = c->tosend) ) { + c->_enqueue++; + if (enqueue(c, m)) { + drop(c, m); + ND("loop %d enqueue fail", i ); + } else { + ND("enqueue ok"); + c->pending++; + } + } + if (c->can_dequeue) { + c->dequeue++; + if ((m = dequeue(c))) { + c->pending--; + drop(c, m); + c->drop--; /* compensate */ + } + } + } + DX(1, "mainloop ends %d", i); + return 0; +} + +int +dump(struct cfg_s *c) +{ + int i; + struct dn_queue *q; + + for (i=0; i < c->flows; i++) { + q = FI2Q(c, i); + DX(1, "queue %4d tot %10lld", i, q->ni.tot_bytes); + } + DX(1, "done %d loops\n", c->loops); + return 0; +} + +/* interpret a number in human form */ +static long +getnum(const char *s, char **next, const char *key) +{ + char *end = NULL; + long l; + + if (next) /* default */ + *next = NULL; + if (s && *s) { + DX(3, "token is <%s> %s", s, key ? key : "-"); + l = strtol(s, &end, 0); + } else { + DX(3, "empty string"); + l = -1; + } + if (l < 0) { + DX(2, "invalid %s for %s", s ? s : "NULL", (key ? key : "") ); + return 0; // invalid + } + if (!end || !*end) + return l; + if (*end == 'n') + l = -l; /* multiply by n */ + else if (*end == 'K') + l = l*1000; + else if (*end == 'M') + l = l*1000000; + else if (*end == 'k') + l = l*1024; + else if (*end == 'm') + l = l*1024*1024; + else if (*end == 'w') + ; + else {/* not recognized */ + D("suffix %s for %s, next %p", end, key, next); + end--; + } + end++; + DX(3, "suffix now %s for %s, next %p", end, key, next); + if (next && *end) { + DX(3, "setting next to %s for %s", end, key); + *next = end; + } + return l; +} + +/* + * flowsets are a comma-separated list of + * weight:maxlen:flows + * indicating how many flows are hooked to that fs. + * Both weight and range can be min-max-steps. + * In a first pass we just count the number of flowsets and flows, + * in a second pass we complete the setup. + */ +static void +parse_flowsets(struct cfg_s *c, const char *fs, int pass) +{ + char *s, *cur, *next; + int n_flows = 0, n_fs = 0, wsum = 0; + int i, j; + struct dn_fs *prev = NULL; + + DX(3, "--- pass %d flows %d flowsets %d", pass, c->flows, c->flowsets); + if (pass == 0) + c->fs_config = fs; + s = c->fs_config ? strdup(c->fs_config) : NULL; + if (s == NULL) { + if (pass == 0) + D("no fsconfig"); + return; + } + for (next = s; (cur = strsep(&next, ","));) { + char *p = NULL; + int w, w_h, w_steps, wi; + int len, len_h, l_steps, li; + int flows; + + w = getnum(strsep(&cur, ":"), &p, "weight"); + if (w <= 0) + w = 1; + w_h = p ? getnum(p+1, &p, "weight_max") : w; + w_steps = p ? getnum(p+1, &p, "w_steps") : (w_h == w ?1:2); + len = getnum(strsep(&cur, ":"), &p, "len"); + if (len <= 0) + len = 1000; + len_h = p ? getnum(p+1, &p, "len_max") : len; + l_steps = p ? getnum(p+1, &p, "l_steps") : (len_h == len ? 1 : 2); + flows = getnum(strsep(&cur, ":"), NULL, "flows"); + if (flows == 0) + flows = 1; + DX(4, "weight %d..%d (%d) len %d..%d (%d) flows %d", + w, w_h, w_steps, len, len_h, l_steps, flows); + if (w == 0 || w_h < w || len == 0 || len_h < len || + flows == 0) { + DX(4,"wrong parameters %s", fs); + return; + } + n_flows += flows * w_steps * l_steps; + for (i = 0; i < w_steps; i++) { + wi = w + ((w_h - w)* i)/(w_steps == 1 ? 1 : (w_steps-1)); + for (j = 0; j < l_steps; j++, n_fs++) { + struct dn_fs *fs = &c->fs[n_fs].fs; // tentative + int x; + + li = len + ((len_h - len)* j)/(l_steps == 1 ? 1 : (l_steps-1)); + x = (wi*2048)/li; + DX(3, "----- fs %4d weight %4d lmax %4d X %4d flows %d", + n_fs, wi, li, x, flows); + if (pass == 0) + continue; + if (c->fs == NULL || c->flowsets <= n_fs) { + D("error in number of flowsets"); + return; + } + wsum += wi * flows; + fs->par[0] = wi; + fs->par[1] = li; + fs->index = n_fs; + fs->n_flows = flows; + fs->cur = fs->first_flow = prev==NULL ? 0 : prev->next_flow; + fs->next_flow = fs->first_flow + fs->n_flows; + fs->y = x * flows; + fs->base_y = (prev == NULL) ? 0 : prev->next_y; + fs->next_y = fs->base_y + fs->y; + prev = fs; + } + } + } + c->max_y = prev ? prev->base_y + prev->y : 0; + c->flows = n_flows; + c->flowsets = n_fs; + c->wsum = wsum; + if (pass == 0) + return; + + /* now link all flows to their parent flowsets */ + DX(1,"%d flows on %d flowsets max_y %d", c->flows, c->flowsets, c->max_y); + for (i=0; i < c->flowsets; i++) { + struct dn_fs *fs = &c->fs[i].fs; + DX(1, "fs %3d w %5d l %4d flow %5d .. %5d y %6d .. %6d", + i, fs->par[0], fs->par[1], + fs->first_flow, fs->next_flow, + fs->base_y, fs->next_y); + for (j = fs->first_flow; j < fs->next_flow; j++) { + struct dn_queue *q = FI2Q(c, j); + q->fs = &c->fs[i]; + } + } +} + +static int +init(struct cfg_s *c) +{ + int i; + int ac = c->ac; + char * const *av = c->av; + + c->si_len = sizeof(struct dn_sch_inst); + c->q_len = sizeof(struct dn_queue); + moduledata_t *mod = NULL; + struct dn_alg *p = NULL; + + c->th_min = 0; + c->th_max = -20;/* 20 packets per flow */ + c->lmin = c->lmax = 1280; /* packet len */ + c->flows = 1; + c->flowsets = 1; + c->name = "null"; + ac--; av++; + while (ac > 1) { + if (!strcmp(*av, "-n")) { + c->loops = getnum(av[1], NULL, av[0]); + } else if (!strcmp(*av, "-d")) { + debug = atoi(av[1]); + } else if (!strcmp(*av, "-alg")) { + extern moduledata_t *_g_dn_fifo; + extern moduledata_t *_g_dn_wf2qp; + extern moduledata_t *_g_dn_rr; + extern moduledata_t *_g_dn_qfq; +#ifdef WITH_KPS + extern moduledata_t *_g_dn_kps; +#endif + if (!strcmp(av[1], "rr")) + mod = _g_dn_rr; + else if (!strcmp(av[1], "wf2qp")) + mod = _g_dn_wf2qp; + else if (!strcmp(av[1], "fifo")) + mod = _g_dn_fifo; + else if (!strcmp(av[1], "qfq")) + mod = _g_dn_qfq; +#ifdef WITH_KPS + else if (!strcmp(av[1], "kps")) + mod = _g_dn_kps; +#endif + else + mod = NULL; + c->name = mod ? mod->name : "NULL"; + DX(3, "using scheduler %s", c->name); + } else if (!strcmp(*av, "-len")) { + c->lmin = getnum(av[1], NULL, av[0]); + c->lmax = c->lmin; + DX(3, "setting max to %d", c->th_max); + } else if (!strcmp(*av, "-burst")) { + c->maxburst = getnum(av[1], NULL, av[0]); + DX(3, "setting max to %d", c->th_max); + } else if (!strcmp(*av, "-qmax")) { + c->th_max = getnum(av[1], NULL, av[0]); + DX(3, "setting max to %d", c->th_max); + } else if (!strcmp(*av, "-qmin")) { + c->th_min = getnum(av[1], NULL, av[0]); + DX(3, "setting min to %d", c->th_min); + } else if (!strcmp(*av, "-flows")) { + c->flows = getnum(av[1], NULL, av[0]); + DX(3, "setting flows to %d", c->flows); + } else if (!strcmp(*av, "-flowsets")) { + parse_flowsets(c, av[1], 0); + DX(3, "setting flowsets to %d", c->flowsets); + } else { + D("option %s not recognised, ignore", *av); + } + ac -= 2; av += 2; + } + if (c->maxburst <= 0) + c->maxburst = 1; + if (c->loops <= 0) + c->loops = 1; + if (c->flows <= 0) + c->flows = 1; + if (c->flowsets <= 0) + c->flowsets = 1; + if (c->lmin <= 0) + c->lmin = 1; + if (c->lmax <= 0) + c->lmax = 1; + /* multiply by N */ + if (c->th_min < 0) + c->th_min = c->flows * -c->th_min; + if (c->th_max < 0) + c->th_max = c->flows * -c->th_max; + if (c->th_max <= c->th_min) + c->th_max = c->th_min + 1; + if (mod) { + p = mod->p; + DX(3, "using module %s f %p p %p", mod->name, mod->f, mod->p); + DX(3, "modname %s ty %d", p->name, p->type); + c->enq = p->enqueue; + c->deq = p->dequeue; + c->si_len += p->si_datalen; + c->q_len += p->q_datalen; + c->schk_len += p->schk_datalen; + } + /* allocate queues, flowsets and one scheduler */ + c->q = calloc(c->flows, c->q_len); + c->fs = calloc(c->flowsets, sizeof(struct dn_fsk)); + c->si = calloc(1, c->si_len); + c->sched = calloc(c->flows, c->schk_len); + if (c->q == NULL || c->fs == NULL) { + D("error allocating memory for flows"); + exit(1); + } + c->si->sched = c->sched; + if (p) { + if (p->config) + p->config(c->sched); + if (p->new_sched) + p->new_sched(c->si); + } + /* parse_flowsets links queues to their flowsets */ + parse_flowsets(c, av[1], 1); + /* complete the work calling new_fsk */ + for (i = 0; i < c->flowsets; i++) { + if (c->fs[i].fs.par[1] == 0) + c->fs[i].fs.par[1] = 1000; /* default pkt len */ + c->fs[i].sched = c->sched; + if (p && p->new_fsk) + p->new_fsk(&c->fs[i]); + } + + /* initialize the lists for the generator, and put + * all flows in the list for backlog = 0 + */ + for (i=0; i <= BACKLOG+5; i++) + INIT_LIST_HEAD(&c->ll[i]); + + for (i = 0; i < c->flows; i++) { + struct dn_queue *q = FI2Q(c, i); + if (q->fs == NULL) + q->fs = &c->fs[0]; /* XXX */ + q->_si = c->si; + if (p && p->new_queue) + p->new_queue(q); + INIT_LIST_HEAD(&q->ni.h); + list_add_tail(&q->ni.h, &c->ll[0]); + } + c->llmask = 1; + return 0; +} + + +int +main(int ac, char *av[]) +{ + struct cfg_s c; + struct timeval end; + double ll; + int i; + char msg[40]; + + bzero(&c, sizeof(c)); + c.ac = ac; + c.av = av; + init(&c); + gettimeofday(&c.time, NULL); + mainloop(&c); + gettimeofday(&end, NULL); + end.tv_sec -= c.time.tv_sec; + end.tv_usec -= c.time.tv_usec; + if (end.tv_usec < 0) { + end.tv_usec += 1000000; + end.tv_sec--; + } + c.time = end; + ll = end.tv_sec*1000000 + end.tv_usec; + ll *= 1000; /* convert to nanoseconds */ + ll /= c._enqueue; + sprintf(msg, "1::%d", c.flows); + D("%-8s n %d %d time %d.%06d %8.3f qlen %d %d flows %s drops %d", + c.name, c._enqueue, c.loops, + (int)c.time.tv_sec, (int)c.time.tv_usec, ll, + c.th_min, c.th_max, + c.fs_config ? c.fs_config : msg, c.drop); + dump(&c); + DX(1, "done ac %d av %p", ac, av); + for (i=0; i < ac; i++) + DX(1, "arg %d %s", i, av[i]); + return 0; +} + +/* + * The controller decides whether in this iteration we should send + * (the packet is in c->tosend) and/or receive (flag c->can_dequeue) + */ +static void +controller(struct cfg_s *c) +{ + struct mbuf *m; + struct dn_fs *fs; + int flow_id; + + /* histeresis between max and min */ + if (c->state == 0 && c->pending >= c->th_max) + c->state = 1; + else if (c->state == 1 && c->pending <= c->th_min) + c->state = 0; + ND(1, "state %d pending %2d", c->state, c->pending); + c->can_dequeue = c->state; + c->tosend = NULL; + if (c->state) + return; + + if (1) { + int i; + struct dn_queue *q; + struct list_head *h; + + i = ffs(c->llmask) - 1; + if (i < 0) { + DX(2, "no candidate"); + c->can_dequeue = 1; + return; + } + h = &c->ll[i]; + ND(1, "backlog %d p %p prev %p next %p", i, h, h->prev, h->next); + q = list_first_entry(h, struct dn_queue, ni.h); + list_del(&q->ni.h); + flow_id = Q2FI(c, q); + DX(2, "extracted flow %p %d backlog %d", q, flow_id, i); + if (list_empty(h)) { + ND(2, "backlog %d empty", i); + c->llmask &= ~(1<ni.h, h+1); + ND(1, " after %d p %p prev %p next %p", i+1, h+1, h[1].prev, h[1].next); + if (i < BACKLOG) { + ND(2, "backlog %d full", i+1); + c->llmask |= 1<<(1+i); + } + fs = &q->fs->fs; + c->cur_fs = q->fs - c->fs; + fs->cur = flow_id; + } else { + /* XXX this does not work ? */ + /* now decide whom to send the packet, and the length */ + /* lookup in the flow table */ + if (c->cur_y >= c->max_y) { /* handle wraparound */ + c->cur_y = 0; + c->cur_fs = 0; + } + fs = &c->fs[c->cur_fs].fs; + flow_id = fs->cur++; + if (fs->cur >= fs->next_flow) + fs->cur = fs->first_flow; + c->cur_y++; + if (c->cur_y >= fs->next_y) + c->cur_fs++; + } + + /* construct a packet */ + if (c->freelist) { + m = c->tosend = c->freelist; + c->freelist = c->freelist->m_nextpkt; + } else { + m = c->tosend = calloc(1, sizeof(struct mbuf)); + } + if (m == NULL) + return; + + m->cfg = c; + m->m_nextpkt = NULL; + m->m_pkthdr.len = fs->par[1]; // XXX maxlen + m->flow_id = flow_id; + + ND(2,"y %6d flow %5d fs %3d weight %4d len %4d", + c->cur_y, m->flow_id, c->cur_fs, + fs->par[0], m->m_pkthdr.len); + +} + +/* +Packet allocation: +to achieve a distribution that matches weights, for each X=w/lmax class +we should generate a number of packets proportional to Y = X times the number +of flows in the class. +So we construct an array with the cumulative distribution of Y's, +and use it to identify the flow via inverse mapping (if the Y's are +not too many we can use an array for the lookup). In practice, +each flow will have X entries [virtually] pointing to it. + +*/ Added: user/luigi/ipfw3-head/sys/netinet/ipfw/test/mylist.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/test/mylist.h Sun Jan 31 22:08:52 2010 (r203325) @@ -0,0 +1,47 @@ +/* + * linux-like bidirectional lists + */ + +#ifndef _MYLIST_H +#define _MYLIST_H +struct list_head { + struct list_head *prev, *next; +}; + +#define INIT_LIST_HEAD(l) do { (l)->prev = (l)->next = (l); } while (0) +#define list_empty(l) ( (l)->next == l ) +static inline void +__list_add(struct list_head *new, struct list_head *prev, + struct list_head *next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +static inline void +list_add_tail(struct list_head *new, struct list_head *head) +{ + __list_add(new, head->prev, head); +} + +#define list_first_entry(pL, ty, member) \ + (ty *)((char *)((pL)->next) - offsetof(ty, member)) + +static inline void +__list_del(struct list_head *prev, struct list_head *next) +{ + next->prev = prev; + prev->next = next; +} + +static inline void +list_del(struct list_head *entry) +{ + ND("called on %p", entry); + __list_del(entry->prev, entry->next); + entry->next = entry->prev = NULL; +} + +#endif /* _MYLIST_H */ Copied: user/luigi/ipfw3-head/sys/netinet/ipfw/test/test_dn_heap.c (from r202963, user/luigi/ipfw3-head/sys/netinet/ipfw/test_dn_heap.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/test/test_dn_heap.c Sun Jan 31 22:08:52 2010 (r203325, copy of r202963, user/luigi/ipfw3-head/sys/netinet/ipfw/test_dn_heap.c) @@ -0,0 +1,160 @@ +/*- + * Copyright (c) 1998-2002,2010 Luigi Rizzo, 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. + */ + +/* + * Userland code for testing heap and hash tables + */ + +#include +#include + +#include +#include +#include + +#include "dn_heap.h" +#define log(x, arg...) fprintf(stderr, ## arg) +#define panic(x...) fprintf(stderr, ## x), exit(1) + +#include + +struct x { + struct x *ht_link; + char buf[0]; +}; + +uint32_t hf(uintptr_t key, int flags, void *arg) +{ + return (flags & DNHT_KEY_IS_OBJ) ? + ((struct x *)key)->buf[0] : *(char *)key; +} + +int matchf(void *obj, uintptr_t key, int flags, void *arg) +{ + char *s = (flags & DNHT_KEY_IS_OBJ) ? + ((struct x *)key)->buf : (char *)key; + return (strcmp(((struct x *)obj)->buf, s) == 0); +} + +void *newfn(uintptr_t key, int flags, void *arg) +{ + char *s = (char *)key; + struct x *p = malloc(sizeof(*p) + 1 + strlen(s)); + if (p) + strcpy(p->buf, s); + return p; +} + +char *strings[] = { + "undici", "unico", "doppio", "devoto", + "uno", "due", "tre", "quattro", "cinque", "sei", + "uno", "due", "tre", "quattro", "cinque", "sei", + NULL, +}; + +int doprint(void *_x, void *arg) +{ + struct x *x = _x; + printf("found element <%s>\n", x->buf); + return (int)arg; +} + +static void +test_hash() +{ + char **p; + struct dn_ht *h; + uintptr_t x = 0; + uintptr_t x1 = 0; + + /* first, find and allocate */ + h = dn_ht_init(NULL, 10, 0, hf, matchf, newfn); + + for (p = strings; *p; p++) { + dn_ht_find(h, (uintptr_t)*p, DNHT_INSERT, NULL); + } + dn_ht_scan(h, doprint, 0); + printf("/* second -- find without allocate */\n"); + h = dn_ht_init(NULL, 10, 0, hf, matchf, NULL); + for (p = strings; *p; p++) { + void **y = newfn((uintptr_t)*p, 0, NULL); + if (x == 0) + x = (uintptr_t)y; + else { + if (x1 == 0) + x1 = (uintptr_t)*p; + } + dn_ht_find(h, (uintptr_t)y, DNHT_INSERT | DNHT_KEY_IS_OBJ, NULL); + } + dn_ht_scan(h, doprint, 0); + printf("remove %p gives %p\n", (void *)x, + dn_ht_find(h, x, DNHT_KEY_IS_OBJ | DNHT_REMOVE, NULL)); + printf("remove %p gives %p\n", (void *)x, + dn_ht_find(h, x, DNHT_KEY_IS_OBJ | DNHT_REMOVE, NULL)); + printf("remove %p gives %p\n", (void *)x, + dn_ht_find(h, x1, DNHT_REMOVE, NULL)); + printf("remove %p gives %p\n", (void *)x, + dn_ht_find(h, x1, DNHT_REMOVE, NULL)); + dn_ht_scan(h, doprint, 0); +} + +int +main(int argc, char *argv[]) +{ + struct dn_heap h; + int i, n, n2, n3; + + test_hash(); + return 0; + + /* n = elements, n2 = cycles */ + n = (argc > 1) ? atoi(argv[1]) : 0; + if (n <= 0 || n > 1000000) + n = 100; + n2 = (argc > 2) ? atoi(argv[2]) : 0; + if (n2 <= 0) + n = 1000000; + n3 = (argc > 3) ? atoi(argv[3]) : 0; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Feb 1 10:56:12 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2C091065672; Mon, 1 Feb 2010 10:56:12 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 912978FC17; Mon, 1 Feb 2010 10:56:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o11AuC4X024331; Mon, 1 Feb 2010 10:56:12 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o11AuCPI024329; Mon, 1 Feb 2010 10:56:12 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002011056.o11AuCPI024329@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 1 Feb 2010 10:56:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203337 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2010 10:56:12 -0000 Author: luigi Date: Mon Feb 1 10:56:12 2010 New Revision: 203337 URL: http://svn.freebsd.org/changeset/base/203337 Log: small updates to the documentation Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt Mon Feb 1 10:45:23 2010 (r203336) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt Mon Feb 1 10:56:12 2010 (r203337) @@ -84,22 +84,30 @@ USERLAND-KERNEL API (ip_dummynet.h) contains data about the physical link such as bandwith, delay, burst size; - struct dn_profile: - fields to simulate a delay profile + struct dn_fs: + describes a flowset, i.e. a template for queues. + Main parameters are the scheduler we attach to, a flow_mask, + buckets, queue size, plr, weight, and other scheduler-specific + parameters. + + struct dn_flow + contains information on a flow, including masks and + statistics struct dn_sch: defines a scheduler (and a link attached to it). Parameters include scheduler type, sched_mask, number of buckets, and possibly other scheduler-specific parameters, - struct dn_fs: - describes a flowset, i.e. a template for queues. - Main parameters are the scheduler we attach to, a flow_mask, - buckets, queue size, plr, weight, and other scheduler-specific - parameters. + struct dn_profile: + fields to simulate a delay profile + KERNEL REPRESENTATION (ip_dn_private.h) + struct mq + a queue of mbufs with head and tail. + struct dn_queue individual queue of packets, created by a flowset using flow_mask and attached to a scheduler instance selected @@ -189,21 +197,27 @@ Almost all objects in this implementatio Files ----- -New dummynet is split in several files. -Two headers, a file to implement the userland part and some files for the -kernel side are provided. -- dn_sched.h is the minimal header that is used to implement - a scheduler -- ip_dummynet.h is the main header defining the kenrel-userland API -- ip_dn_io.c is the main files for the kernel side of dummynet. It contains - main functions for processing packets, some functions exported to help - writing new scheduler; -- ip_dummynet.c cointains module glue and sockopt handlers. +The dummynet code is split in several files. +All kernel code is in sys/netinet/ipfw except ip_dummynet.h +All userland code is in sbin/ipfw. +Files are +- sys/netinet/ip_dummynet.h defines the kernel-userland API +- ip_dn_private.h contains the kernel-specific APIs + and data structures +- dn_sched.h defines the scheduler API +- ip_dummynet.c cointains module glue and sockopt handlers, with all + functions to configure and list objects. +- ip_dn_io.c contains the functions directly related to packet processing, + and run in the critical path. It also contains some functions + exported to the schedulers. +- dn_heap.[ch] implement a binary heap and a generic hash table +- dn_sched_* implement the various scheduler modules + - dummynet.c is the file used to implement the user side of dummynet. It contains the function to parsing command line, and functions to show the output of dummynet objects. Moreover, there are two new file (ip_dummynet_glue.c and ip_fw_glue.c) that -are used to allow compatibility with the "ipfw" binary from FreeBSd 7.2 and +are used to allow compatibility with the "ipfw" binary from FreeBSD 7.2 and FreeBSD 8. LOCKING @@ -233,20 +247,56 @@ In perspective we aim at the following: - the main containers (fshash, schedhash, ...) are protected by UH_WLOCK. - TO BE COMPLETED - Packet processing -============== +================= A packet enters dummynet through dummynet_io(). We first lookup -the flowset number in fshash(), then possibly use masks to determine -queue and scheduler instance, and call the enqueue routine for the -scheduler. -If enqueue is successful, we may call dequeue for further processing, -and possibly return the packet upstream. If the packet does not -return, it will be sent later according to the scheduler. +the flowset number in fshash using dn_ht_find(), then find the scheduler +instance using ipdn_si_find(), then possibly identify the correct +queue with ipdn_q_find(). +If successful, we call the scheduler's enqueue function(), and +if needed start I/O on the link calling serve_sched(). +If the packet can be returned immediately, this is done by +leaving *m0 set. Otherwise, the packet is absorbed by dummynet +and we simply return, possibly with some appropriate error code. + +Reconfiguration +--------------- +Reconfiguration is the complex part of the system because we need to +keep track of the various objects and containers. +At the moment we do not use reference counts for objects so all +processing must be done under a lock. + +The main entry points for configuration is the ip_dn_ctl() handler +for the IP_DUMMYNET3 sockopt (others are provided only for backward +compatibility). Modifications to the configuration call do_config(). +The argument is a sequence of blocks each starting with a struct dn_id +which specifies its content. +The first dn_id must contain as obj.id the DN_API_VERSION +The obj.type is DN_CMD_CONFIG (followed by actual objects), +DN_CMD_DELETE (with the correct subtype and list of objects), or +DN_CMD_FLUSH. + +DN_CMD_CONFIG is followed by objects to add/reconfigure. In general, +if an object already exists it is reconfigured, otherwise it is +created in a way that keeps the structure consistent. In detail, +and starting with the simplest objects + +DN_PROFILE <--> config_profile() + attach a delay profile to a DN_LINK with the same number. + To delete, simply provide a profile with 0 points. + XXX is it preserved on link reconfigurations ? + +DN_LINK <--> config_link() + +==== XXX to be completed ==== + +DN_FS + +DN_SCH + + + -The reconfiguration routine ---------------------------- The reconfigure routine is called by the system when the flowset ptr_sched_val number differs from the generation number. This means that a new object is inserted in the system or a object was deleted and no new packet belonging to From owner-svn-src-user@FreeBSD.ORG Mon Feb 1 11:33:45 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D32D61065692; Mon, 1 Feb 2010 11:33:45 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1FAD8FC13; Mon, 1 Feb 2010 11:33:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o11BXj6v032679; Mon, 1 Feb 2010 11:33:45 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o11BXjHT032677; Mon, 1 Feb 2010 11:33:45 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002011133.o11BXjHT032677@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 1 Feb 2010 11:33:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203339 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2010 11:33:46 -0000 Author: luigi Date: Mon Feb 1 11:33:45 2010 New Revision: 203339 URL: http://svn.freebsd.org/changeset/base/203339 Log: more documentation Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt Mon Feb 1 11:05:19 2010 (r203338) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt Mon Feb 1 11:33:45 2010 (r203339) @@ -278,46 +278,46 @@ DN_CMD_FLUSH. DN_CMD_CONFIG is followed by objects to add/reconfigure. In general, if an object already exists it is reconfigured, otherwise it is -created in a way that keeps the structure consistent. In detail, -and starting with the simplest objects +created in a way that keeps the structure consistent. +We have the following objects in the system, normally numbered with +an identifier N between 1 and 65535. For certain objects we have +"shadow" copies numbered I+NMAX and I+ 2*NMAX which are used to +implement certain backward compatibility features. + +In general we have the following linking + + TRADITIONAL DUMMYNET QUEUES "queue N config ... pipe M ..." + corresponds to a dn_fs object numbered N + + TRADITIONAL DUMMYNET PIPES "pipe N config ..." + dn_fs N+2*NMAX --> dn_sch N+NMAX type FIFO --> dn_link N+NMAX + + GENERIC SCHEDULER "sched N config ... " + [dn_fs N+NMAX] --> dn_sch N --> dn_link N + The flowset N+NMAX is created only if the scheduler is not + of type MULTIQUEUE. + + DELAY PROFILE "pipe N config profile ..." + it is always attached to an existing dn_link N + +Because traditional dummynet pipes actually configure both a +'standalone' instance and one that can be used by queues, +we do the following: + + "pipe N config ..." configures: + dn_sched N type WF2Q+ + dn_sched N+NMAX type FIFO + dn_fs N+2NMAX attached to dn_sched N+NMAX + dn_pipe N + dn_pipe N+NMAX + + "queue N config" configures + dn_fs N + + "sched N config" configures + dn_sched N type as desired + dn_fs N+NMAX attached to dn_sched N -DN_PROFILE <--> config_profile() - attach a delay profile to a DN_LINK with the same number. - To delete, simply provide a profile with 0 points. - XXX is it preserved on link reconfigurations ? - -DN_LINK <--> config_link() - -==== XXX to be completed ==== - -DN_FS - -DN_SCH - - - - -The reconfigure routine is called by the system when the flowset ptr_sched_val -number differs from the generation number. This means that a new object is -inserted in the system or a object was deleted and no new packet belonging to -this flowset are yet arrived. - -The reconfigure routine first check if the scheduler pointed by the flowset is -the same that the scheduler located by the number. If so, and if the type are -the same, it means that the scheduler wasn't changed. Now is check if the pipe -exist, and eventually the pointer in the scheduler is updated. If scheduler -and pipe exists, the packet can be enqueued. - -If the scheduler type differs from flowset type, it means that the scheduler -has changed type so the flowset must be deleted and recreated. The pointer -are update and the packet can be enqueued. - -If the scheduler no longer exists, the flowset is remove from flowset list -and inserted in the unlinked flowset list, so that new packet are discarded -early. - -If scheduler or pipe don't exist,packet shoubl be dropped and the function -return 1 so that dummynet_io() can drop the packet. dummynet_task() =============== From owner-svn-src-user@FreeBSD.ORG Mon Feb 1 12:06:37 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1F9B1065697; Mon, 1 Feb 2010 12:06:37 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE20A8FC1F; Mon, 1 Feb 2010 12:06:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o11C6b0u040686; Mon, 1 Feb 2010 12:06:37 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o11C6bIW040684; Mon, 1 Feb 2010 12:06:37 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002011206.o11C6bIW040684@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 1 Feb 2010 12:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203340 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2010 12:06:38 -0000 Author: luigi Date: Mon Feb 1 12:06:37 2010 New Revision: 203340 URL: http://svn.freebsd.org/changeset/base/203340 Log: 64-bit fix Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Mon Feb 1 11:33:45 2010 (r203339) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Mon Feb 1 12:06:37 2010 (r203340) @@ -330,7 +330,7 @@ qht_delete(struct dn_fsk *fs, int flags) if (!fs->qht) return; if (fs->fs.flags & DN_HAVE_MASK) { - dn_ht_scan(fs->qht, q_delete_cb, (void *)flags); + dn_ht_scan(fs->qht, q_delete_cb, (void *)(uintptr_t)flags); if (flags & DN_DELETE) { dn_ht_free(fs->qht, 0); fs->qht = NULL; From owner-svn-src-user@FreeBSD.ORG Mon Feb 1 14:17:40 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C62B21065782; Mon, 1 Feb 2010 14:17:40 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B46058FC1C; Mon, 1 Feb 2010 14:17:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o11EHeJH075728; Mon, 1 Feb 2010 14:17:40 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o11EHeta075725; Mon, 1 Feb 2010 14:17:40 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002011417.o11EHeta075725@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 1 Feb 2010 14:17:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203344 - user/luigi/ipfw3-head/sys/netinet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2010 14:17:40 -0000 Author: luigi Date: Mon Feb 1 14:17:40 2010 New Revision: 203344 URL: http://svn.freebsd.org/changeset/base/203344 Log: use u_char instead of u_int for short bitfields, so tcc and MSC do not get the wrong alignment Modified: user/luigi/ipfw3-head/sys/netinet/ip.h user/luigi/ipfw3-head/sys/netinet/tcp.h Modified: user/luigi/ipfw3-head/sys/netinet/ip.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ip.h Mon Feb 1 14:13:44 2010 (r203343) +++ user/luigi/ipfw3-head/sys/netinet/ip.h Mon Feb 1 14:17:40 2010 (r203344) @@ -48,11 +48,11 @@ */ struct ip { #if BYTE_ORDER == LITTLE_ENDIAN - u_int ip_hl:4, /* header length */ + u_char ip_hl:4, /* header length */ ip_v:4; /* version */ #endif #if BYTE_ORDER == BIG_ENDIAN - u_int ip_v:4, /* version */ + u_char ip_v:4, /* version */ ip_hl:4; /* header length */ #endif u_char ip_tos; /* type of service */ @@ -142,11 +142,11 @@ struct ip_timestamp { u_char ipt_len; /* size of structure (variable) */ u_char ipt_ptr; /* index of current entry */ #if BYTE_ORDER == LITTLE_ENDIAN - u_int ipt_flg:4, /* flags, see below */ + u_char ipt_flg:4, /* flags, see below */ ipt_oflw:4; /* overflow counter */ #endif #if BYTE_ORDER == BIG_ENDIAN - u_int ipt_oflw:4, /* overflow counter */ + u_char ipt_oflw:4, /* overflow counter */ ipt_flg:4; /* flags, see below */ #endif union ipt_timestamp { Modified: user/luigi/ipfw3-head/sys/netinet/tcp.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/tcp.h Mon Feb 1 14:13:44 2010 (r203343) +++ user/luigi/ipfw3-head/sys/netinet/tcp.h Mon Feb 1 14:17:40 2010 (r203344) @@ -52,11 +52,11 @@ struct tcphdr { tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ #if BYTE_ORDER == LITTLE_ENDIAN - u_int th_x2:4, /* (unused) */ + u_char th_x2:4, /* (unused) */ th_off:4; /* data offset */ #endif #if BYTE_ORDER == BIG_ENDIAN - u_int th_off:4, /* data offset */ + u_char th_off:4, /* data offset */ th_x2:4; /* (unused) */ #endif u_char th_flags; From owner-svn-src-user@FreeBSD.ORG Mon Feb 1 14:29:07 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97778106566B; Mon, 1 Feb 2010 14:29:07 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85CCE8FC12; Mon, 1 Feb 2010 14:29:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o11ET7Fk078832; Mon, 1 Feb 2010 14:29:07 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o11ET7tc078830; Mon, 1 Feb 2010 14:29:07 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002011429.o11ET7tc078830@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 1 Feb 2010 14:29:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203345 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2010 14:29:07 -0000 Author: luigi Date: Mon Feb 1 14:29:07 2010 New Revision: 203345 URL: http://svn.freebsd.org/changeset/base/203345 Log: fix removal of a queue from the round robin list Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c Mon Feb 1 14:17:40 2010 (r203344) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c Mon Feb 1 14:29:07 2010 (r203345) @@ -113,15 +113,14 @@ remove_queue_q(struct rr_queue *q, struc if (q == si->head) return rr_remove_head(si); - prev = si->head; - while (prev) { - if (prev->qnext == q) { - prev->qnext = q->qnext; - if (q == si->tail) - si->tail = prev; - q->status = 0; - } - prev = prev->qnext; + for (prev = si->head; prev; prev = prev->qnext) { + if (prev->qnext != q) + continue; + prev->qnext = q->qnext; + if (q == si->tail) + si->tail = prev; + q->status = 0; + break; } } From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 07:39:56 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62BBD106566C; Tue, 2 Feb 2010 07:39:56 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52A218FC12; Tue, 2 Feb 2010 07:39:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o127duVB012267; Tue, 2 Feb 2010 07:39:56 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o127duhd012265; Tue, 2 Feb 2010 07:39:56 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002020739.o127duhd012265@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 2 Feb 2010 07:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203369 - user/luigi/ipfw3-head/sbin/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 07:39:56 -0000 Author: luigi Date: Tue Feb 2 07:39:56 2010 New Revision: 203369 URL: http://svn.freebsd.org/changeset/base/203369 Log: the man page says inet_pton returns 1 on success and 0 on errors, but it does not specify if other return values are possible. So be strict and only use 1 as success, instead of anything != 0 as it was done before (this caused bugs under windows) Modified: user/luigi/ipfw3-head/sbin/ipfw/ipfw2.c Modified: user/luigi/ipfw3-head/sbin/ipfw/ipfw2.c ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/ipfw2.c Tue Feb 2 05:57:42 2010 (r203368) +++ user/luigi/ipfw3-head/sbin/ipfw/ipfw2.c Tue Feb 2 07:39:56 2010 (r203369) @@ -2535,11 +2535,11 @@ add_src(ipfw_insn *cmd, char *av, u_char *ch = '\0'; if (proto == IPPROTO_IPV6 || strcmp(av, "me6") == 0 || - inet_pton(AF_INET6, host, &a)) + inet_pton(AF_INET6, host, &a) == 1) ret = add_srcip6(cmd, av); /* XXX: should check for IPv4, not !IPv6 */ if (ret == NULL && (proto == IPPROTO_IP || strcmp(av, "me") == 0 || - !inet_pton(AF_INET6, host, &a))) + inet_pton(AF_INET6, host, &a) != 1)) ret = add_srcip(cmd, av); if (ret == NULL && strcmp(av, "any") != 0) ret = cmd; @@ -2561,11 +2561,11 @@ add_dst(ipfw_insn *cmd, char *av, u_char *ch = '\0'; if (proto == IPPROTO_IPV6 || strcmp(av, "me6") == 0 || - inet_pton(AF_INET6, host, &a)) + inet_pton(AF_INET6, host, &a) == 1) ret = add_dstip6(cmd, av); /* XXX: should check for IPv4, not !IPv6 */ if (ret == NULL && (proto == IPPROTO_IP || strcmp(av, "me") == 0 || - !inet_pton(AF_INET6, host, &a))) + inet_pton(AF_INET6, host, &a) != 1)) ret = add_dstip(cmd, av); if (ret == NULL && strcmp(av, "any") != 0) ret = cmd; From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 10:03:40 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EAEB1065744; Tue, 2 Feb 2010 10:03:40 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E7048FC16; Tue, 2 Feb 2010 10:03:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o12A3dH4046527; Tue, 2 Feb 2010 10:03:39 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o12A3dn3046525; Tue, 2 Feb 2010 10:03:39 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002021003.o12A3dn3046525@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 2 Feb 2010 10:03:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203371 - user/luigi/ipfw3-head/sbin/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 10:03:40 -0000 Author: luigi Date: Tue Feb 2 10:03:39 2010 New Revision: 203371 URL: http://svn.freebsd.org/changeset/base/203371 Log: small compatibility fixes Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Tue Feb 2 10:00:23 2010 (r203370) +++ user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Tue Feb 2 10:03:39 2010 (r203371) @@ -780,7 +780,7 @@ ipfw_config_pipe(int ac, char **av) struct dn_profile *pf = NULL; struct ipfw_flow_id *mask = NULL; int lmax; - int _foo = 0, *flags = &_foo; + uint32_t _foo = 0, *flags = &_foo; /* * allocate space for 1 header, @@ -1275,7 +1275,7 @@ dummynet_flush(void) * XXX todo- accept filtering arguments. */ void -dummynet_list(int __unused ac, __unused char *av[], int __unused show_counters) +dummynet_list(int ac, char *av[], int show_counters) { struct dn_id oid, *x; int ret, l = sizeof(oid); From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 10:32:08 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0117106566C; Tue, 2 Feb 2010 10:32:08 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFCBE8FC27; Tue, 2 Feb 2010 10:32:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o12AW8OU052793; Tue, 2 Feb 2010 10:32:08 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o12AW8wo052791; Tue, 2 Feb 2010 10:32:08 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002021032.o12AW8wo052791@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 2 Feb 2010 10:32:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203372 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 10:32:08 -0000 Author: luigi Date: Tue Feb 2 10:32:08 2010 New Revision: 203372 URL: http://svn.freebsd.org/changeset/base/203372 Log: remove leftover mutex Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Tue Feb 2 10:03:39 2010 (r203371) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Tue Feb 2 10:32:08 2010 (r203372) @@ -162,8 +162,6 @@ SYSCTL_ULONG(_net_inet_ip_dummynet, OID_ "Number of packets dropped by dummynet."); #endif -struct mtx dummynet_mtx; - static void dummynet_send(struct mbuf *); /* From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 10:42:15 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F94B1065679; Tue, 2 Feb 2010 10:42:15 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E8B98FC2A; Tue, 2 Feb 2010 10:42:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o12AgFcp055085; Tue, 2 Feb 2010 10:42:15 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o12AgFSM055082; Tue, 2 Feb 2010 10:42:15 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002021042.o12AgFSM055082@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 2 Feb 2010 10:42:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203373 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 10:42:15 -0000 Author: luigi Date: Tue Feb 2 10:42:15 2010 New Revision: 203373 URL: http://svn.freebsd.org/changeset/base/203373 Log: compat fixes Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Tue Feb 2 10:32:08 2010 (r203372) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Tue Feb 2 10:42:15 2010 (r203373) @@ -36,7 +36,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifndef log #define log(x, arg...) +#endif #else /* !_KERNEL */ Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Tue Feb 2 10:32:08 2010 (r203372) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Tue Feb 2 10:42:15 2010 (r203373) @@ -51,10 +51,9 @@ static void dump_sched(struct qfq_sched #define NO(x) #endif #define DN_SCHED_QFQ 4 // XXX Where? -typedef uint64_t u64; -typedef unsigned int bitmap; +typedef unsigned long bitmap; -#ifndef __FreeBSD__ +#ifndef __FreeBSD__ /* actually, only linux X86 */ static inline unsigned long __fls(unsigned long word) { asm("bsr %1,%0" @@ -69,6 +68,7 @@ static inline unsigned long __fls(unsign } #endif +#if !defined(__linux__) #ifdef QFQ_DEBUG int test_bit(int ix, bitmap *p) { @@ -94,6 +94,8 @@ void __clear_bit(int ix, bitmap *p) #define __set_bit(ix, pData) (*pData) |= (1<<(ix)) #define __clear_bit(ix, pData) (*pData) &= ~(1<<(ix)) #endif /* !QFQ_DEBUG */ +#endif /* !__linux__ */ + /*-------------------------------------------*/ /* @@ -201,12 +203,7 @@ struct qfq_group { unsigned int slot_shift; /* Slot shift. */ unsigned int index; /* Group index. */ unsigned int front; /* Index of the front slot. */ - - /* - * Bitmap with non-empty slots. Using unsigned long as most - * bitops in Linux use it (i'd rather use u32 or u64 XXX) - */ - bitmap full_slots; + bitmap full_slots; /* non-empty slots */ /* Array of lists of active classes. */ struct qfq_class *slots[QFQ_MAX_SLOTS]; @@ -226,13 +223,13 @@ struct qfq_sched { /*---- support functions ----------------------------*/ /* Generic comparison function, handling wraparound. */ -static inline int qfq_gt(u64 a, u64 b) +static inline int qfq_gt(uint64_t a, uint64_t b) { return (int64_t)(a - b) > 0; } /* Round a precise timestamp to its slotted value. */ -static inline u64 qfq_round_down(u64 ts, unsigned int shift) +static inline uint64_t qfq_round_down(uint64_t ts, unsigned int shift) { return ts & ~((1ULL << shift) - 1); } @@ -252,7 +249,7 @@ static inline struct qfq_group *qfq_ffs( */ static int qfq_calc_index(uint32_t inv_w, unsigned int maxlen) { - u64 slot_size = (u64)maxlen *inv_w; + uint64_t slot_size = (uint64_t)maxlen *inv_w; unsigned long size_map; int index = 0; @@ -362,7 +359,7 @@ qfq_move_groups(struct qfq_sched *q, uns } static inline void -qfq_unblock_groups(struct qfq_sched *q, int index, u64 old_finish) +qfq_unblock_groups(struct qfq_sched *q, int index, uint64_t old_finish) { unsigned long mask = mask_from(q->bitmaps[ER], index + 1); struct qfq_group *next; @@ -389,7 +386,7 @@ qfq_unblock_groups(struct qfq_sched *q, * */ static inline void -qfq_make_eligible(struct qfq_sched *q, u64 old_V) +qfq_make_eligible(struct qfq_sched *q, uint64_t old_V) { unsigned long mask, vslot, old_vslot; @@ -409,9 +406,9 @@ qfq_make_eligible(struct qfq_sched *q, u * roundedS is always cl->S rounded on grp->slot_shift bits. */ static inline void -qfq_slot_insert(struct qfq_group *grp, struct qfq_class *cl, u64 roundedS) +qfq_slot_insert(struct qfq_group *grp, struct qfq_class *cl, uint64_t roundedS) { - u64 slot = (roundedS - grp->S) >> grp->slot_shift; + uint64_t slot = (roundedS - grp->S) >> grp->slot_shift; unsigned int i = (grp->front + slot) % QFQ_MAX_SLOTS; cl->next = grp->slots[i]; @@ -465,7 +462,7 @@ qfq_slot_scan(struct qfq_group *grp) * Here too we should make sure that i is less than 32 */ static inline void -qfq_slot_rotate(struct qfq_sched *q, struct qfq_group *grp, u64 roundedS) +qfq_slot_rotate(struct qfq_sched *q, struct qfq_group *grp, uint64_t roundedS) { unsigned int i = (grp->S - roundedS) >> grp->slot_shift; @@ -475,7 +472,7 @@ qfq_slot_rotate(struct qfq_sched *q, str static inline void -qfq_update_eligible(struct qfq_sched *q, u64 old_V) +qfq_update_eligible(struct qfq_sched *q, uint64_t old_V) { bitmap ineligible; @@ -504,10 +501,10 @@ qfq_update_class(struct qfq_sched *q, st qfq_front_slot_remove(grp); } else { unsigned int len; - u64 roundedS; + uint64_t roundedS; len = cl->_q.mq.head->m_pkthdr.len; - cl->F = cl->S + (u64)len * cl->inv_w; + cl->F = cl->S + (uint64_t)len * cl->inv_w; roundedS = qfq_round_down(cl->S, grp->slot_shift); if (roundedS == grp->S) return 0; @@ -525,7 +522,7 @@ qfq_dequeue(struct dn_sch_inst *si) struct qfq_group *grp; struct qfq_class *cl; struct mbuf *m; - u64 old_V; + uint64_t old_V; NO(q->loops++;) if (!q->bitmaps[ER]) { @@ -546,17 +543,17 @@ qfq_dequeue(struct dn_sch_inst *si) } NO(q->queued--;) old_V = q->V; - q->V += (u64)m->m_pkthdr.len * IWSUM; + q->V += (uint64_t)m->m_pkthdr.len * IWSUM; ND("m is %p F 0x%llx V now 0x%llx", m, cl->F, q->V); if (qfq_update_class(q, grp, cl)) { - u64 old_F = grp->F; + uint64_t old_F = grp->F; cl = qfq_slot_scan(grp); if (!cl) { /* group gone, remove from ER */ __clear_bit(grp->index, &q->bitmaps[ER]); // grp->S = grp->F + 1; // XXX debugging only } else { - u64 roundedS = qfq_round_down(cl->S, grp->slot_shift); + uint64_t roundedS = qfq_round_down(cl->S, grp->slot_shift); unsigned int s; if (grp->S == roundedS) @@ -625,7 +622,7 @@ qfq_enqueue(struct dn_sch_inst *si, stru struct qfq_sched *q = (struct qfq_sched *)(si + 1); struct qfq_group *grp; struct qfq_class *cl = (struct qfq_class *)_q; - u64 roundedS; + uint64_t roundedS; int s; NO(q->loops++;) @@ -643,7 +640,7 @@ qfq_enqueue(struct dn_sch_inst *si, stru grp = cl->grp; qfq_update_start(q, cl); /* adjust start time */ /* compute new finish time and rounded start. */ - cl->F = cl->S + (u64)(m->m_pkthdr.len) * cl->inv_w; + cl->F = cl->S + (uint64_t)(m->m_pkthdr.len) * cl->inv_w; roundedS = qfq_round_down(cl->S, grp->slot_shift); /* @@ -685,7 +682,7 @@ qfq_slot_remove(struct qfq_sched *q, str struct qfq_class *cl, struct qfq_class **pprev) { unsigned int i, offset; - u64 roundedS; + uint64_t roundedS; roundedS = qfq_round_down(cl->S, grp->slot_shift); offset = (roundedS - grp->S) >> grp->slot_shift; @@ -718,7 +715,7 @@ qfq_deactivate_class(struct qfq_sched *q { struct qfq_group *grp = &q->groups[cl->index]; unsigned long mask; - u64 roundedS; + uint64_t roundedS; int s; cl->F = cl->S; // not needed if the class goes away. From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 10:57:13 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F9171065692; Tue, 2 Feb 2010 10:57:13 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F1EB8FC17; Tue, 2 Feb 2010 10:57:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o12AvDhT058420; Tue, 2 Feb 2010 10:57:13 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o12AvDEL058418; Tue, 2 Feb 2010 10:57:13 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002021057.o12AvDEL058418@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 2 Feb 2010 10:57:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203374 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 10:57:13 -0000 Author: luigi Date: Tue Feb 2 10:57:13 2010 New Revision: 203374 URL: http://svn.freebsd.org/changeset/base/203374 Log: remove unnecessary casts and bcopy Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Tue Feb 2 10:42:15 2010 (r203373) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Tue Feb 2 10:57:13 2010 (r203374) @@ -1065,8 +1065,8 @@ do { \ } ip = mtod(m, struct ip *); ip6 = (struct ip6_hdr *)ip; - bcopy(&ip6->ip6_src, &args->f_id.src_ip6, sizeof(ip6->ip6_src)); - bcopy(&ip6->ip6_dst, &args->f_id.dst_ip6, sizeof(ip6->ip6_dst)); + args->f_id.src_ip6 = ip6->ip6_src; + args->f_id.dst_ip6 = ip6->ip6_dst; args->f_id.src_ip = 0; args->f_id.dst_ip = 0; args->f_id.flow_id6 = ntohl(ip6->ip6_flow); @@ -1692,11 +1692,11 @@ do { \ break; case O_IP6_SRC_ME: - match= is_ipv6 && search_ip6_addr_net((struct in6_addr *)&args->f_id.src_ip6); + match= is_ipv6 && search_ip6_addr_net(&args->f_id.src_ip6); break; case O_IP6_DST_ME: - match= is_ipv6 && search_ip6_addr_net((struct in6_addr *)&args->f_id.dst_ip6); + match= is_ipv6 && search_ip6_addr_net(&args->f_id.dst_ip6); break; case O_FLOW6ID: From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 10:58:42 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09A6B1065670; Tue, 2 Feb 2010 10:58:42 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED6BA8FC14; Tue, 2 Feb 2010 10:58:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o12AwfbC058784; Tue, 2 Feb 2010 10:58:41 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o12Awfrg058782; Tue, 2 Feb 2010 10:58:41 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002021058.o12Awfrg058782@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 2 Feb 2010 10:58:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203375 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 10:58:42 -0000 Author: luigi Date: Tue Feb 2 10:58:41 2010 New Revision: 203375 URL: http://svn.freebsd.org/changeset/base/203375 Log: another unnecessary cast Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Tue Feb 2 10:57:13 2010 (r203374) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Tue Feb 2 10:58:41 2010 (r203375) @@ -1994,7 +1994,7 @@ do { \ (proto != IPPROTO_ICMPV6 || (is_icmp6_query(args->f_id.flags) == 1)) && !(m->m_flags & (M_BCAST|M_MCAST)) && - !IN6_IS_ADDR_MULTICAST((struct in6_addr *)&args->f_id.dst_ip6)) { + !IN6_IS_ADDR_MULTICAST(&args->f_id.dst_ip6)) { send_reject6( args, cmd->arg1, hlen, (struct ip6_hdr *)ip); From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 16:18:51 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4462106566C; Tue, 2 Feb 2010 16:18:51 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93DBD8FC17; Tue, 2 Feb 2010 16:18:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o12GIppB008855; Tue, 2 Feb 2010 16:18:51 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o12GIp7U008850; Tue, 2 Feb 2010 16:18:51 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002021618.o12GIp7U008850@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 2 Feb 2010 16:18:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203382 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 16:18:51 -0000 Author: luigi Date: Tue Feb 2 16:18:51 2010 New Revision: 203382 URL: http://svn.freebsd.org/changeset/base/203382 Log: some portability fixes. Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Tue Feb 2 16:17:44 2010 (r203381) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Tue Feb 2 16:18:51 2010 (r203382) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #else /* !_KERNEL */ #include +#include #include #include @@ -74,7 +75,7 @@ MALLOC_DEFINE(M_DN_HEAP, "dummynet", "du #define HEAP_INCREMENT 15 static int -heap_resize(struct dn_heap *h, int new_size) +heap_resize(struct dn_heap *h, unsigned int new_size) { struct dn_heap_entry *p; Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Tue Feb 2 16:17:44 2010 (r203381) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Tue Feb 2 16:18:51 2010 (r203382) @@ -53,22 +53,18 @@ static void dump_sched(struct qfq_sched #define DN_SCHED_QFQ 4 // XXX Where? typedef unsigned long bitmap; -#ifndef __FreeBSD__ /* actually, only linux X86 */ -static inline unsigned long __fls(unsigned long word) -{ - asm("bsr %1,%0" - : "=r" (word) - : "rm" (word)); - return word; -} -#else +/* + * bitmaps ops are critical. Some linux versions have __fls + * and the bitmap ops. Some machines have ffs + */ +#if !defined(_KERNEL) || defined( __FreeBSD__ ) static inline unsigned long __fls(unsigned long word) { return fls(word) - 1; } #endif -#if !defined(__linux__) +#if !defined(_KERNEL) || !defined(__linux__) #ifdef QFQ_DEBUG int test_bit(int ix, bitmap *p) { Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Tue Feb 2 16:17:44 2010 (r203381) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Tue Feb 2 16:18:51 2010 (r203382) @@ -248,10 +248,11 @@ struct dn_sch_inst { uint64_t idle_time; /* start of scheduler instance idle time */ }; -/* kernel-side flags */ +/* kernel-side flags. Linux has DN_DELETE in fcntl.h + */ enum { /* 1 and 2 are reserved for the SCAN flags */ - DN_DELETE = 0x0004, /* destroy */ + DN_DESTROY = 0x0004, /* destroy */ DN_DELETE_FS = 0x0008, /* destroy flowset */ DN_DETACH = 0x0010, DN_ACTIVE = 0x0020, /* object is in evheap */ Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Tue Feb 2 16:17:44 2010 (r203381) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Tue Feb 2 16:18:51 2010 (r203382) @@ -287,7 +287,7 @@ q_new(uintptr_t key, int flags, void *ar /* * Notify schedulers that a queue is going away. - * If (flags & DN_DELETE), also free the packets. + * If (flags & DN_DESTROY), also free the packets. * The version for callbacks is called q_delete_cb(). */ static void @@ -300,7 +300,7 @@ dn_delete_queue(struct dn_queue *q, int if (fs && fs->sched->fp->free_queue) fs->sched->fp->free_queue(q); q->_si = NULL; - if (flags & DN_DELETE) { + if (flags & DN_DESTROY) { if (q->mq.head) dn_free_pkts(q->mq.head); bzero(q, sizeof(*q)); // safety @@ -314,13 +314,13 @@ q_delete_cb(void *q, void *arg) { int flags = (int)(uintptr_t)arg; dn_delete_queue(q, flags); - return (flags & DN_DELETE) ? DNHT_SCAN_DEL : 0; + return (flags & DN_DESTROY) ? DNHT_SCAN_DEL : 0; } /* * calls dn_delete_queue/q_delete_cb on all queues, * which notifies the parent scheduler and possibly drains packets. - * flags & DN_DELETE: drains queues and destroy qht; + * flags & DN_DESTROY: drains queues and destroy qht; */ static void qht_delete(struct dn_fsk *fs, int flags) @@ -331,13 +331,13 @@ qht_delete(struct dn_fsk *fs, int flags) return; if (fs->fs.flags & DN_HAVE_MASK) { dn_ht_scan(fs->qht, q_delete_cb, (void *)(uintptr_t)flags); - if (flags & DN_DELETE) { + if (flags & DN_DESTROY) { dn_ht_free(fs->qht, 0); fs->qht = NULL; } } else { dn_delete_queue((struct dn_queue *)(fs->qht), flags); - if (flags & DN_DELETE) + if (flags & DN_DESTROY) fs->qht = NULL; } } @@ -553,18 +553,18 @@ fsk_new(uintptr_t key, int flags, void * /* * detach flowset from its current scheduler. Flags as follows: * DN_DETACH removes from the fsk_list - * DN_DELETE deletes individual queues + * DN_DESTROY deletes individual queues * DN_DELETE_FS destroys the flowset (otherwise goes in unlinked). */ static void fsk_detach(struct dn_fsk *fs, int flags) { if (flags & DN_DELETE_FS) - flags |= DN_DELETE; + flags |= DN_DESTROY; ND("fs %d from sched %d flags %s %s %s", fs->fs.fs_nr, fs->fs.sched_nr, (flags & DN_DELETE_FS) ? "DEL_FS":"", - (flags & DN_DELETE) ? "DEL":"", + (flags & DN_DESTROY) ? "DEL":"", (flags & DN_DETACH) ? "DET":""); if (flags & DN_DETACH) { /* detach from the list */ struct dn_fsk_head *h; @@ -587,9 +587,9 @@ fsk_detach(struct dn_fsk *fs, int flags) /* * Detach or destroy all flowsets in a list. * flags specifies what to do: - * DN_DELETE: flush all queues - * DN_DELETE_FS: DN_DELETE + destroy flowset - * DN_DELETE_FS implies DN_DELETE + * DN_DESTROY: flush all queues + * DN_DELETE_FS: DN_DESTROY + destroy flowset + * DN_DELETE_FS implies DN_DESTROY */ static void fsk_detach_list(struct dn_fsk_head *h, int flags) @@ -695,7 +695,7 @@ schk_new(uintptr_t key, int flags, void * detach from the scheduler, destroy the internal flowset, and * all instances. The scheduler goes away too. * arg is 0 (only detach flowsets and destroy instances) - * DN_DELETE (detach & delete queues, delete schk) + * DN_DESTROY (detach & delete queues, delete schk) * or DN_DELETE_FS (delete queues and flowsets, delete schk) */ static int @@ -706,10 +706,10 @@ schk_delete_cb(void *obj, void *arg) int a = (int)arg; ND("sched %d arg %s%s", s->sch.sched_nr, - a&DN_DELETE ? "DEL ":"", + a&DN_DESTROY ? "DEL ":"", a&DN_DELETE_FS ? "DEL_FS":""); #endif - fsk_detach_list(&s->fsk_list, arg ? DN_DELETE : 0); + fsk_detach_list(&s->fsk_list, arg ? DN_DESTROY : 0); /* no more flowset pointing to us now */ if (s->sch.flags & DN_HAVE_MASK) dn_ht_scan(s->siht, si_destroy, NULL); @@ -740,7 +740,7 @@ delete_schk(int i) return EINVAL; delete_fs(i + DN_MAX_ID, 1); /* first delete internal fs */ /* then detach flowsets, delete traffic */ - schk_delete_cb(s, (void*)(uintptr_t)DN_DELETE); + schk_delete_cb(s, (void*)(uintptr_t)DN_DESTROY); return 0; } /*--- end of schk hashtable support ---*/ @@ -1093,8 +1093,8 @@ config_fs(struct dn_fs *nfs, struct dn_i fs->fs.fs_nr, fs->fs.sched_nr, fs->sched, nfs->sched_nr, s); if (fs->sched) { - int flags = s ? DN_DETACH : (DN_DETACH | DN_DELETE); - flags |= DN_DELETE; /* XXX temporary */ + int flags = s ? DN_DETACH : (DN_DETACH | DN_DESTROY); + flags |= DN_DESTROY; /* XXX temporary */ fsk_detach(fs, flags); } fs->fs = *nfs; /* copy configuration */ @@ -1193,7 +1193,7 @@ again: /* run twice, for wfq and fifo */ /* Detach flowsets, preserve queues. */ // schk_delete_cb(s, NULL); // XXX temporarily, kill queues - schk_delete_cb(s, (void *)DN_DELETE); + schk_delete_cb(s, (void *)DN_DESTROY); goto again; } else { DX(4, "sched %d unchanged type %s", i, a.fp->name); @@ -1217,7 +1217,7 @@ again: /* run twice, for wfq and fifo */ s->fs = config_fs(&fs, NULL, 1 /* locked */); } if (!s->fs) { - schk_delete_cb(s, (void *)DN_DELETE); + schk_delete_cb(s, (void *)DN_DESTROY); D("error creating internal fs for %d", i); DN_BH_WUNLOCK(); return ENOMEM; From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 20:05:28 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05E771065670; Tue, 2 Feb 2010 20:05:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1B198FC1B; Tue, 2 Feb 2010 20:05:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o12K5R99063480; Tue, 2 Feb 2010 20:05:27 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o12K5RQm063479; Tue, 2 Feb 2010 20:05:27 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201002022005.o12K5RQm063479@svn.freebsd.org> From: Warner Losh Date: Tue, 2 Feb 2010 20:05:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203399 - user/imp/tbemd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 20:05:28 -0000 Author: imp Date: Tue Feb 2 20:05:27 2010 New Revision: 203399 URL: http://svn.freebsd.org/changeset/base/203399 Log: Create a branch to kill off TARGET_BIG_ENDIAN Added: - copied from r203398, head/ Directory Properties: user/imp/tbemd/ (props changed) From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 21:23:36 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3D761065698; Tue, 2 Feb 2010 21:23:36 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA8EB8FC13; Tue, 2 Feb 2010 21:23:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o12LNatZ080936; Tue, 2 Feb 2010 21:23:36 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o12LNah9080934; Tue, 2 Feb 2010 21:23:36 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002022123.o12LNah9080934@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 2 Feb 2010 21:23:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203405 - user/edwin/calendar/calendars X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 21:23:37 -0000 Author: edwin Date: Tue Feb 2 21:23:36 2010 New Revision: 203405 URL: http://svn.freebsd.org/changeset/base/203405 Log: Replace month numbers by month names for easier recognition by humans. Modified: user/edwin/calendar/calendars/calendar.dutch Modified: user/edwin/calendar/calendars/calendar.dutch ============================================================================== --- user/edwin/calendar/calendars/calendar.dutch Tue Feb 2 20:55:12 2010 (r203404) +++ user/edwin/calendar/calendars/calendar.dutch Tue Feb 2 21:23:36 2010 (r203405) @@ -10,25 +10,25 @@ Easter=Pasen /* * Feestdagen */ -01/01 Nieuwjaar -01/06 Driekoningen -04/01 Een April -04/30 Koninginendag -05/01 Dag van de Arbeid -05/04 Dodenherdenking -05/05 Bevrijdingsdag -10/04 Dierendag -11/01 Allerheilingen -11/02 Allerzielen -11/11 Sint Maarten -11/11 Elfde-van-de-elfde -12/05 Sinterklaas avond -12/15 Koninkrijksdag -12/24 Kerstavond -12/25 Eerste kerstdag -12/26 Tweede kerstdag -12/28 Feest der Onnozele Kinderen -12/31 Oudjaar +Jan/01 Nieuwjaar +Jan/06 Driekoningen +Apr/01 Een April +Apr/30 Koninginendag +Mei/01 Dag van de Arbeid +Mei/04 Dodenherdenking +Mei/05 Bevrijdingsdag +Okt/04 Dierendag +Nov/01 Allerheilingen +Nov/02 Allerzielen +Nov/11 Sint Maarten +Nov/11 Elfde-van-de-elfde +Dec/05 Sinterklaas avond +Dec/15 Koninkrijksdag +Dec/24 Kerstavond +Dec/25 Eerste kerstdag +Dec/26 Tweede kerstdag +Dec/28 Feest der Onnozele Kinderen +Dec/31 Oudjaar /* * Pasen gerelateerd @@ -52,28 +52,28 @@ Pasen+56 Trinitatis /* * Misc */ -05/SunSecond Moederdag -06/SunThird Vaderdag -09/TueThird Prinsjesdag +Mei/SunSecond Moederdag +Jun/SunThird Vaderdag +Sep/TueThird Prinsjesdag /* * Het koningshuis */ -01/19 Prinses Margriet (1943) -01/31 Koningin Beatrix (1938) -02/17 Prins Willem III (1817 - 1890) -02/18 Prinses Christina (1947) -04/10 Prinses Ariane (2007) -04/19 Prins Hendrik (1876 - 1934) -04/27 Kroonprins Willem Alexander (1967) -04/30 Koningin Juliana (1909 - 2004) -04/30 Mr. Pieter van Vollenhoven (1939) -05/17 Prinses Maxima (1971) -06/26 Prinses Alexia (2005) -06/29 Prins Bernhard (1911 - 2004) -08/05 Prinses Irene (1939) -08/31 Prinses Wilhelmina (1880 - 1962) -09/06 Prins Claus (1925 - 2002) -09/25 Prins Johan Friso (1968) -10/11 Prins Constantijn (1969) -12/07 Prinses Catharina-Amalia (2003) +Jan/19 Prinses Margriet (1943) +Jan/31 Koningin Beatrix (1938) +Feb/17 Prins Willem III (1817 - 1890) +Feb/18 Prinses Christina (1947) +Apr/10 Prinses Ariane (2007) +Apr/19 Prins Hendrik (1876 - 1934) +Apr/27 Kroonprins Willem Alexander (1967) +Apr/30 Koningin Juliana (1909 - 2004) +Apr/30 Mr. Pieter van Vollenhoven (1939) +Mei/17 Prinses Maxima (1971) +Jun/26 Prinses Alexia (2005) +Jun/29 Prins Bernhard (1911 - 2004) +Aug/05 Prinses Irene (1939) +Aug/31 Prinses Wilhelmina (1880 - 1962) +Sep/06 Prins Claus (1925 - 2002) +Sep/25 Prins Johan Friso (1968) +Okt/11 Prins Constantijn (1969) +Dec/07 Prinses Catharina-Amalia (2003) From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 21:24:19 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B8BE1065672; Tue, 2 Feb 2010 21:24:19 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5AEB28FC18; Tue, 2 Feb 2010 21:24:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o12LOJ6t081136; Tue, 2 Feb 2010 21:24:19 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o12LOJAO081133; Tue, 2 Feb 2010 21:24:19 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002022124.o12LOJAO081133@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 2 Feb 2010 21:24:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203406 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 21:24:19 -0000 Author: edwin Date: Tue Feb 2 21:24:19 2010 New Revision: 203406 URL: http://svn.freebsd.org/changeset/base/203406 Log: Improve speed on overlapping years by remembering the important dates in those years. Modified: user/edwin/calendar/Makefile user/edwin/calendar/parsedata.c Modified: user/edwin/calendar/Makefile ============================================================================== --- user/edwin/calendar/Makefile Tue Feb 2 21:23:36 2010 (r203405) +++ user/edwin/calendar/Makefile Tue Feb 2 21:24:19 2010 (r203406) @@ -1,7 +1,7 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ -CFLAGS= -pipe -g -std=gnu99 -fstack-protector -Wall +CFLAGS= -pipe -g -pg -std=gnu99 -fstack-protector -Wall PROG= calendar SRCS= calendar.c locale.c events.c dates.c parsedata.c io.c day.c \ Modified: user/edwin/calendar/parsedata.c ============================================================================== --- user/edwin/calendar/parsedata.c Tue Feb 2 21:23:36 2010 (r203405) +++ user/edwin/calendar/parsedata.c Tue Feb 2 21:24:19 2010 (r203406) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD: user/edwin/calendar/ #include #include #include +#include #include "calendar.h" @@ -328,7 +329,14 @@ debug_determinestyle(int dateonly, char printf("specialday: |%s|\n", specialday); } - +struct yearinfo { + int year; + int ieaster, ipaskha, firstcnyday; + int ifullmoon[MAXMOONS], inewmoon[MAXMOONS], + ichinesemonths[MAXMOONS], equinoxdays[2], solsticedays[2]; + int *mondays; + struct yearinfo *next; +}; /* * Possible date formats include any combination of: * 3-charmonth (January, Jan, Jan) @@ -345,12 +353,9 @@ parsedaymonth(char *date, int *yearp, in char month[100], dayofmonth[100], dayofweek[100], modifieroffset[100]; char modifierindex[100], specialday[100]; int idayofweek, imonth, idayofmonth, year, index; + int d, m, dow, rm, rd, offset; - int ieaster, ipaskha; - int ifullmoon[MAXMOONS], inewmoon[MAXMOONS], ichinesemonths[MAXMOONS]; - int equinoxdays[2], solsticedays[2]; - - int *mondays, d, m, dow, rm, rd, offset, firstcnyday; + static struct yearinfo *years, *yearinfo; /* * CONVENTION @@ -384,18 +389,40 @@ parsedaymonth(char *date, int *yearp, in index = 0; for (year = year1; year <= year2; year++) { /* Get important dates for this year */ - mondays = mondaytab[isleap(year)]; - ieaster = easter(year); - pom(year, ifullmoon, inewmoon); - equinoxsolstice(year, 0.0, equinoxdays, solsticedays); - - /* CNY: Match day with sun longitude at 330` with new moon */ - firstcnyday = calculatesunlongitude30(year, 120, - ichinesemonths); - for (m = 0; inewmoon[m] != 0; m++) { - if (inewmoon[m] > firstcnyday) { - firstcnyday = inewmoon[m - 1]; + yearinfo = years; + while (yearinfo != NULL) { + if (yearinfo->year == year) break; + yearinfo = yearinfo -> next; + } + if (yearinfo == NULL) { + yearinfo = (struct yearinfo *)calloc(1, + sizeof(struct yearinfo)); + if (yearinfo == NULL) + errx(1, "Unable to allocate more years"); + yearinfo->year = year; + yearinfo->next = years; + years = yearinfo; + + yearinfo->mondays = mondaytab[isleap(year)]; + yearinfo->ieaster = easter(year); + pom(year, yearinfo->ifullmoon, yearinfo->inewmoon); + equinoxsolstice(year, 0.0, + yearinfo->equinoxdays, yearinfo->solsticedays); + + /* + * CNY: Match day with sun longitude at 330` with new + * moon + */ + yearinfo->firstcnyday = calculatesunlongitude30(year, + 120, yearinfo->ichinesemonths); + for (m = 0; yearinfo->inewmoon[m] != 0; m++) { + if (yearinfo->inewmoon[m] > + yearinfo->firstcnyday) { + yearinfo->firstcnyday = + yearinfo->inewmoon[m - 1]; + break; + } } } @@ -421,7 +448,7 @@ parsedaymonth(char *date, int *yearp, in /* Every day of a month */ if (*flags == (F_ALLDAY | F_MONTH)) { - for (d = 1; d <= mondays[imonth]; d++) { + for (d = 1; d <= yearinfo->mondays[imonth]; d++) { if (!remember_ymd(year, imonth, d)) continue; remember(index++, yearp, monthp, dayp, @@ -462,7 +489,7 @@ parsedaymonth(char *date, int *yearp, in d = (idayofweek - dow + 8) % 7; if (offset > 0) { - while (d <= mondays[imonth]) { + while (d <= yearinfo->mondays[imonth]) { if (--offset == 0 && remember_ymd(year, imonth, d)) { remember(index++, yearp, @@ -475,7 +502,7 @@ parsedaymonth(char *date, int *yearp, in continue; } if (offset < 0) { - while (d <= mondays[imonth]) + while (d <= yearinfo->mondays[imonth]) d += 7; while (offset != 0) { offset++; @@ -493,7 +520,7 @@ parsedaymonth(char *date, int *yearp, in if (*flags == (F_DAYOFWEEK | F_MONTH | F_VARIABLE)) { dow = first_dayofweek_of_month(year, imonth); d = (idayofweek - dow + 8) % 7; - while (d <= mondays[imonth]) { + while (d <= yearinfo->mondays[imonth]) { if (remember_ymd(year, imonth, d)) remember(index++, yearp, monthp, dayp, year, imonth, d); @@ -508,7 +535,8 @@ parsedaymonth(char *date, int *yearp, in offset = 0; if ((*flags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); - if (remember_yd(year, ieaster + offset, &rm, &rd)) + if (remember_yd(year, yearinfo->ieaster + offset, + &rm, &rd)) remember(index++, yearp, monthp, dayp, year, rm, rd); continue; @@ -520,7 +548,8 @@ parsedaymonth(char *date, int *yearp, in offset = 0; if ((*flags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); - if (remember_yd(year, ipaskha + offset, &rm, &rd)) + if (remember_yd(year, yearinfo->ipaskha + offset, + &rm, &rd)) remember(index++, yearp, monthp, dayp, year, rm, rd); continue; @@ -532,7 +561,8 @@ parsedaymonth(char *date, int *yearp, in offset = 0; if ((*flags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); - if (remember_yd(year, firstcnyday + offset, &rm, &rd)) + if (remember_yd(year, yearinfo->firstcnyday + offset, + &rm, &rd)) remember(index++, yearp, monthp, dayp, year, rm, rd); continue; @@ -546,9 +576,9 @@ parsedaymonth(char *date, int *yearp, in offset = 0; if ((*flags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); - for (i = 0; ifullmoon[i] != 0; i++) { - if (remember_yd(year, ifullmoon[i] + offset, - &rm, &rd)) + for (i = 0; yearinfo->ifullmoon[i] != 0; i++) { + if (remember_yd(year, + yearinfo->ifullmoon[i] + offset, &rm, &rd)) remember(index++, yearp, monthp, dayp, year, rm, rd); } @@ -563,9 +593,9 @@ parsedaymonth(char *date, int *yearp, in offset = 0; if ((*flags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); - for (i = 0; ifullmoon[i] != 0; i++) { - if (remember_yd(year, inewmoon[i] + offset, - &rm, &rd)) + for (i = 0; yearinfo->ifullmoon[i] != 0; i++) { + if (remember_yd(year, + yearinfo->inewmoon[i] + offset, &rm, &rd)) remember(index++, yearp, monthp, dayp, year, rm, rd); } @@ -578,7 +608,7 @@ parsedaymonth(char *date, int *yearp, in offset = 0; if ((*flags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); - if (remember_yd(year, equinoxdays[0] + offset, + if (remember_yd(year, yearinfo->equinoxdays[0] + offset, &rm, &rd)) remember(index++, yearp, monthp, dayp, year, rm, rd); @@ -589,7 +619,7 @@ parsedaymonth(char *date, int *yearp, in offset = 0; if ((*flags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); - if (remember_yd(year, equinoxdays[1] + offset, + if (remember_yd(year, yearinfo->equinoxdays[1] + offset, &rm, &rd)) remember(index++, yearp, monthp, dayp, year, rm, rd); @@ -602,8 +632,8 @@ parsedaymonth(char *date, int *yearp, in offset = 0; if ((*flags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); - if (remember_yd(year, solsticedays[0] + offset, - &rm, &rd)) + if (remember_yd(year, + yearinfo->solsticedays[0] + offset, &rm, &rd)) remember(index++, yearp, monthp, dayp, year, rm, rd); continue; @@ -613,8 +643,8 @@ parsedaymonth(char *date, int *yearp, in offset = 0; if ((*flags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); - if (remember_yd(year, solsticedays[1] + offset, - &rm, &rd)) + if (remember_yd(year, + yearinfo->solsticedays[1] + offset, &rm, &rd)) remember(index++, yearp, monthp, dayp, year, rm, rd); continue; From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 21:38:07 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99B35106566C; Tue, 2 Feb 2010 21:38:07 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 62F458FC14; Tue, 2 Feb 2010 21:38:07 +0000 (UTC) Received: by palm.hoeg.nl (Postfix, from userid 1000) id CAFA71CDDB; Tue, 2 Feb 2010 22:38:06 +0100 (CET) Date: Tue, 2 Feb 2010 22:38:06 +0100 From: Ed Schouten To: Edwin Groothuis Message-ID: <20100202213806.GV77705@hoeg.nl> References: <201002022123.o12LNah9080934@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WiuFC6bSmcjanUfV" Content-Disposition: inline In-Reply-To: <201002022123.o12LNah9080934@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r203405 - user/edwin/calendar/calendars X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 21:38:07 -0000 --WiuFC6bSmcjanUfV Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable He Edwin, * Edwin Groothuis wrote: > +Apr/01 Een April Volgens mij kan je hier beter "1 april" gebruiken. Volgens mij is het gebruikelijk het cijfer te gebruiken en de naam van de maand hoeft ook niet met hoofdletter. > +Apr/30 Koninginendag Volgens mij schrijf je dit als Koninginnedag, dus een dubbele n, maar geen n op het einde. Dit omdat er maar 1 koningin van Nederland is. :) > +Dec/31 Oudjaar Ik dacht dat de offici=EBle naam voor deze dag Oudejaarsdag is. Weet ik niet zeker. Groetjes, --=20 Ed Schouten WWW: http://80386.nl/ --WiuFC6bSmcjanUfV Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAktomz4ACgkQ52SDGA2eCwXIiwCeMZyf36j2abUh+aN1W9WmShTM Y5YAn03F99khcOrojDVal54n9bt4BZHQ =TOE5 -----END PGP SIGNATURE----- --WiuFC6bSmcjanUfV-- From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 21:38:34 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81C2510656C0; Tue, 2 Feb 2010 21:38:34 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 4B7DC8FC1A; Tue, 2 Feb 2010 21:38:34 +0000 (UTC) Received: by palm.hoeg.nl (Postfix, from userid 1000) id BA6B41CDDB; Tue, 2 Feb 2010 22:38:33 +0100 (CET) Date: Tue, 2 Feb 2010 22:38:33 +0100 From: Ed Schouten To: Edwin Groothuis Message-ID: <20100202213833.GW77705@hoeg.nl> References: <201002022124.o12LOJAO081133@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HATTsZJGJQJ3rT4Z" Content-Disposition: inline In-Reply-To: <201002022124.o12LOJAO081133@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r203406 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 21:38:34 -0000 --HATTsZJGJQJ3rT4Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Edwin Groothuis wrote: > -CFLAGS=3D -pipe -g -std=3Dgnu99 -fstack-protector -Wall > +CFLAGS=3D -pipe -g -pg -std=3Dgnu99 -fstack-protector -Wall Was this change intentional? Greetings, --=20 Ed Schouten WWW: http://80386.nl/ --HATTsZJGJQJ3rT4Z Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAktom1kACgkQ52SDGA2eCwVT/gCfQa99Q6lINIYnXZMOV9lxdS/1 eKAAn13S+0KK2lGyKclbmY88Tq7M4BSV =rq9m -----END PGP SIGNATURE----- --HATTsZJGJQJ3rT4Z-- From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 21:41:00 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E1A31065693; Tue, 2 Feb 2010 21:41:00 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 676C18FC16; Tue, 2 Feb 2010 21:41:00 +0000 (UTC) Received: by palm.hoeg.nl (Postfix, from userid 1000) id D3A881CDDB; Tue, 2 Feb 2010 22:40:59 +0100 (CET) Date: Tue, 2 Feb 2010 22:40:59 +0100 From: Ed Schouten To: Edwin Groothuis Message-ID: <20100202214059.GX77705@hoeg.nl> References: <201002022124.o12LOJAO081133@svn.freebsd.org> <20100202213833.GW77705@hoeg.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="iuL7KOmW1iVG2alW" Content-Disposition: inline In-Reply-To: <20100202213833.GW77705@hoeg.nl> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r203406 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 21:41:00 -0000 --iuL7KOmW1iVG2alW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Ed Schouten wrote: > * Edwin Groothuis wrote: > > -CFLAGS=3D -pipe -g -std=3Dgnu99 -fstack-protector -Wall > > +CFLAGS=3D -pipe -g -pg -std=3Dgnu99 -fstack-protector -Wall >=20 > Was this change intentional? Oh wait, it was on a branch. Never mind! --=20 Ed Schouten WWW: http://80386.nl/ --iuL7KOmW1iVG2alW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAktom+sACgkQ52SDGA2eCwXj+ACfVmS0lPCiB976kjOMhJeKg/Zp 4sQAnR2fivUaNLiyTEQO5BICgeAF6Ey2 =Uqtn -----END PGP SIGNATURE----- --iuL7KOmW1iVG2alW-- From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 21:51:52 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3B8A1065672; Tue, 2 Feb 2010 21:51:52 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA70F8FC16; Tue, 2 Feb 2010 21:51:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o12Lpq7a087152; Tue, 2 Feb 2010 21:51:52 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o12Lpqm1087150; Tue, 2 Feb 2010 21:51:52 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002022151.o12Lpqm1087150@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 2 Feb 2010 21:51:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203407 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 21:51:52 -0000 Author: edwin Date: Tue Feb 2 21:51:52 2010 New Revision: 203407 URL: http://svn.freebsd.org/changeset/base/203407 Log: Update manpage with new recognized special days, new bugs and notes. Modified: user/edwin/calendar/calendar.1 Modified: user/edwin/calendar/calendar.1 ============================================================================== --- user/edwin/calendar/calendar.1 Tue Feb 2 21:24:19 2010 (r203406) +++ user/edwin/calendar/calendar.1 Tue Feb 2 21:51:52 2010 (r203407) @@ -103,12 +103,31 @@ Ignore weekends when calculating the num To handle calendars in your national code table you can specify .Dq LANG= in the calendar file as early as possible. -To handle national Easter -names in the calendars -.Dq Easter= -(for Catholic Easter) or -.Dq Paskha= -(for Orthodox Easter) can be used. +.Pp +The names of the following special days are recognized: +.Bl -tag -width 123456789012345 -compact +.It Easter +Catholic Easter. +.It Paskha +Orthodox Easter. +.It NewMoon +The lunar New Moon. +.It FullMoon +The lunar Full Moon. +.It MarSolstice +The solar solstice in March. +.It JunEquinox +The solar equinox in June. +.It MarSolstice +The solar solstice in March. +.It DecEquinox +The solar equinox in December. +.It ChineseNewYear +The first day of the Chinese year. +.El +They may be reassigned to their local names via an assignment like +.Dq Easter=Pasen +in the calendar file. .Pp Other lines should begin with a month and day. They may be entered in almost any format, either numeric or as character @@ -122,11 +141,11 @@ Two numbers default to the month followe Lines with leading tabs default to the last entered date, allowing multiple line specifications for a single date. .Pp -``Easter'', is Easter for this year, and may be followed by a positive -or negative integer. -.Pp -``Paskha'', is Orthodox Easter for this year, and may be followed by a -positive or negative integer. +The names of the special recognized days may be followed by a +positive or negative integer, like: +.Dq Easter+3 +or +.Dq Pashka-4 . .Pp Weekdays may be followed by ``-4'' ...\& ``+5'' (aliases for last, first, second, third, fourth) for moving events like @@ -259,7 +278,17 @@ A .Nm command appeared in .At v7 . +.Sh NOTES +Chinese New Year is calculated at 120 degrees east of Greenwich, +which roughly corresponds with the east coast of China. +.Pp +The phases of the moon and the longitude of the sun are calculated +against the local position which corresponds with 30 degrees times +the time-difference towards Greenwich. .Sh BUGS The .Nm -utility does not handle Jewish holidays and moon phases. +utility does not handle Jewish holidays. +.Pp +There is no possibility to properly specify the local position +needed for solar and lunar calculations. From owner-svn-src-user@FreeBSD.ORG Wed Feb 3 03:26:01 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4ED4A1065692; Wed, 3 Feb 2010 03:26:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F1908FC15; Wed, 3 Feb 2010 03:26:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o133Q1EE062693; Wed, 3 Feb 2010 03:26:01 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o133Q1bt062691; Wed, 3 Feb 2010 03:26:01 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201002030326.o133Q1bt062691@svn.freebsd.org> From: Warner Losh Date: Wed, 3 Feb 2010 03:26:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203413 - user/imp/tbemd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2010 03:26:01 -0000 Author: imp Date: Wed Feb 3 03:26:00 2010 New Revision: 203413 URL: http://svn.freebsd.org/changeset/base/203413 Log: Describe what I'm going to do to kill TARGET_BIG_ENDIAN Added: user/imp/tbemd/README-BRANCH Added: user/imp/tbemd/README-BRANCH ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/imp/tbemd/README-BRANCH Wed Feb 3 03:26:00 2010 (r203413) @@ -0,0 +1,24 @@ +TARGET_BIG_ENDIAN must die + +Changes in MACHINE_ARCH: + +mips (big endian) mipseb +mips (little endian) mipsel +arm (little endian) arm For historical reasons +arm (big endian) armeb + +What we call today MACHINE_ARCH is really MACHINE_CPUARCH. This is +called MACHINE_CPU on NetBSD, but FreeBSD already uses MACHINE_CPU for +other purposes. In general $MACHINE_ARCH -> $MACHINE_CPUARCH in most +places in the tree. MACHINE_CPUARCH is defined in bsd.own.mk, since +it is dependent on the bsd tree, actually. All the translation from +MACHINE_ARCH to MACHINE_CPUARCH assumes that all members of that +family are supported by one set of files on FreeBSD. So mips files +have support for both big and little endian. But MACHINE_ARCH +determines the default binaries that are generated. + +We'll likely need to have a MACHINE_ABI at some point. Both MIPS and +ARM have multiple ABIs, and we'll need something to be the default, +and different CPUs within a family might have different defaults. +Etc. Plus there's t he need for multilib. However, issues like this +are beyond the scope of this branch. From owner-svn-src-user@FreeBSD.ORG Wed Feb 3 06:53:58 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C105F1065676; Wed, 3 Feb 2010 06:53:58 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B18088FC12; Wed, 3 Feb 2010 06:53:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o136rwHA009825; Wed, 3 Feb 2010 06:53:58 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o136rwLL009823; Wed, 3 Feb 2010 06:53:58 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002030653.o136rwLL009823@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 3 Feb 2010 06:53:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203417 - user/edwin/calendar/calendars X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2010 06:53:58 -0000 Author: edwin Date: Wed Feb 3 06:53:58 2010 New Revision: 203417 URL: http://svn.freebsd.org/changeset/base/203417 Log: Fix spelling. Also, months in the dutch language are lower case. Modified: user/edwin/calendar/calendars/calendar.dutch Modified: user/edwin/calendar/calendars/calendar.dutch ============================================================================== --- user/edwin/calendar/calendars/calendar.dutch Wed Feb 3 04:58:08 2010 (r203416) +++ user/edwin/calendar/calendars/calendar.dutch Wed Feb 3 06:53:58 2010 (r203417) @@ -10,25 +10,25 @@ Easter=Pasen /* * Feestdagen */ -Jan/01 Nieuwjaar -Jan/06 Driekoningen -Apr/01 Een April -Apr/30 Koninginendag -Mei/01 Dag van de Arbeid -Mei/04 Dodenherdenking -Mei/05 Bevrijdingsdag -Okt/04 Dierendag -Nov/01 Allerheilingen -Nov/02 Allerzielen -Nov/11 Sint Maarten -Nov/11 Elfde-van-de-elfde -Dec/05 Sinterklaas avond -Dec/15 Koninkrijksdag -Dec/24 Kerstavond -Dec/25 Eerste kerstdag -Dec/26 Tweede kerstdag -Dec/28 Feest der Onnozele Kinderen -Dec/31 Oudjaar +jan/01 Nieuwjaar +jan/06 Driekoningen +apr/01 1 april +apr/30 Koninginnedag +mei/01 Dag van de Arbeid +mei/04 Dodenherdenking +mei/05 Bevrijdingsdag +okt/04 Dierendag +nov/01 Allerheilingen +nov/02 Allerzielen +nov/11 Sint Maarten +nov/11 Elfde-van-de-elfde +dec/05 Sinterklaas avond +dec/15 Koninkrijksdag +dec/24 Kerstavond +dec/25 Eerste kerstdag +dec/26 Tweede kerstdag +dec/28 Feest der Onnozele Kinderen +dec/31 Oudjaar /* * Pasen gerelateerd @@ -38,12 +38,12 @@ Pasen-49 Carnaval Pasen-48 Carnaval Pasen-47 Carnaval (Vastenavond) Pasen-46 Aswoensdag -Pasen-7 Palmzondag -Pasen-3 Witte Donderdag -Pasen-2 Goede vrijdag -Pasen-1 Stille zaterdag +Pasen-7 Palmzondag +Pasen-3 Witte Donderdag +Pasen-2 Goede vrijdag +Pasen-1 Stille zaterdag Pasen Eerste paasdag -Pasen+1 Tweede paasdag +Pasen+1 Tweede paasdag Pasen+39 Hemelvaartsdag Pasen+49 Eerste Pinksterdag Pasen+50 Tweede Pinksterdag @@ -52,28 +52,28 @@ Pasen+56 Trinitatis /* * Misc */ -Mei/SunSecond Moederdag -Jun/SunThird Vaderdag -Sep/TueThird Prinsjesdag +mei/SunSecond Moederdag +jun/SunThird Vaderdag +sep/TueThird Prinsjesdag /* * Het koningshuis */ -Jan/19 Prinses Margriet (1943) -Jan/31 Koningin Beatrix (1938) -Feb/17 Prins Willem III (1817 - 1890) -Feb/18 Prinses Christina (1947) -Apr/10 Prinses Ariane (2007) -Apr/19 Prins Hendrik (1876 - 1934) -Apr/27 Kroonprins Willem Alexander (1967) -Apr/30 Koningin Juliana (1909 - 2004) -Apr/30 Mr. Pieter van Vollenhoven (1939) -Mei/17 Prinses Maxima (1971) -Jun/26 Prinses Alexia (2005) -Jun/29 Prins Bernhard (1911 - 2004) -Aug/05 Prinses Irene (1939) -Aug/31 Prinses Wilhelmina (1880 - 1962) -Sep/06 Prins Claus (1925 - 2002) -Sep/25 Prins Johan Friso (1968) -Okt/11 Prins Constantijn (1969) -Dec/07 Prinses Catharina-Amalia (2003) +jan/19 Prinses Margriet (1943) +jan/31 Koningin Beatrix (1938) +feb/17 Prins Willem III (1817 - 1890) +feb/18 Prinses Christina (1947) +apr/10 Prinses Ariane (2007) +apr/19 Prins Hendrik (1876 - 1934) +apr/27 Kroonprins Willem Alexander (1967) +apr/30 Koningin Juliana (1909 - 2004) +apr/30 Mr. Pieter van Vollenhoven (1939) +mei/17 Prinses Maxima (1971) +jun/26 Prinses Alexia (2005) +jun/29 Prins Bernhard (1911 - 2004) +aug/05 Prinses Irene (1939) +aug/31 Prinses Wilhelmina (1880 - 1962) +sep/06 Prins Claus (1925 - 2002) +sep/25 Prins Johan Friso (1968) +okt/11 Prins Constantijn (1969) +dec/07 Prinses Catharina-Amalia (2003) From owner-svn-src-user@FreeBSD.ORG Wed Feb 3 06:55:13 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EA1A106566C; Wed, 3 Feb 2010 06:55:13 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F8DE8FC16; Wed, 3 Feb 2010 06:55:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o136tDg2010208; Wed, 3 Feb 2010 06:55:13 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o136tDXP010206; Wed, 3 Feb 2010 06:55:13 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002030655.o136tDXP010206@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 3 Feb 2010 06:55:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203418 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2010 06:55:13 -0000 Author: edwin Date: Wed Feb 3 06:55:13 2010 New Revision: 203418 URL: http://svn.freebsd.org/changeset/base/203418 Log: Fix lines to make them actually understandable by non-dutch people living in Australia. Modified: user/edwin/calendar/calendar.1 Modified: user/edwin/calendar/calendar.1 ============================================================================== --- user/edwin/calendar/calendar.1 Wed Feb 3 06:53:58 2010 (r203417) +++ user/edwin/calendar/calendar.1 Wed Feb 3 06:55:13 2010 (r203418) @@ -125,7 +125,8 @@ The solar equinox in December. .It ChineseNewYear The first day of the Chinese year. .El -They may be reassigned to their local names via an assignment like +These names may be reassigned to their local names via an assignment +like .Dq Easter=Pasen in the calendar file. .Pp @@ -141,7 +142,7 @@ Two numbers default to the month followe Lines with leading tabs default to the last entered date, allowing multiple line specifications for a single date. .Pp -The names of the special recognized days may be followed by a +The names of the recognized special days may be followed by a positive or negative integer, like: .Dq Easter+3 or @@ -210,7 +211,8 @@ calendar file to use if no calendar file do not send mail if this file exists. .El .Pp -The following default calendar files are provided: +The following default calendar files are provided in +.Pa /usr/share/calendars: .Pp .Bl -tag -width calendar.southafrica -compact .It Pa calendar.all @@ -227,6 +229,8 @@ so that roving holidays are set correctl Days of special significance to computer people. .It Pa calendar.croatian Calendar of events in Croatia. +.It Pa calendar.dutch +Calendar of events in the Netherlands. .It Pa calendar.freebsd Birthdays of .Fx From owner-svn-src-user@FreeBSD.ORG Wed Feb 3 07:16:57 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06E341065693; Wed, 3 Feb 2010 07:16:57 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: from k7.mavetju.org (ppp113-58.static.internode.on.net [150.101.113.58]) by mx1.freebsd.org (Postfix) with ESMTP id AFE6E8FC0A; Wed, 3 Feb 2010 07:16:56 +0000 (UTC) Received: by k7.mavetju.org (Postfix, from userid 1001) id BBDBD4517C; Wed, 3 Feb 2010 17:51:50 +1100 (EST) Date: Wed, 3 Feb 2010 17:51:50 +1100 From: Edwin Groothuis To: Ed Schouten Message-ID: <20100203065150.GB71594@mavetju.org> References: <201002022123.o12LNah9080934@svn.freebsd.org> <20100202213806.GV77705@hoeg.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100202213806.GV77705@hoeg.nl> User-Agent: Mutt/1.4.2.3i Cc: src-committers@freebsd.org, svn-src-user@freebsd.org, Edwin Groothuis Subject: Re: svn commit: r203405 - user/edwin/calendar/calendars X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2010 07:16:57 -0000 Hello Ed, On Tue, Feb 02, 2010 at 10:38:06PM +0100, Ed Schouten wrote: > * Edwin Groothuis wrote: > > +Apr/01 Een April > > +Apr/30 Koninginendag Fixed. > > +Dec/31 Oudjaar > > Ik dacht dat de offici?le naam voor deze dag Oudejaarsdag is. Weet ik > niet zeker. Bij ons in het dorp was het altijd Oudjaar :-P Net zoals 1 Januarie Nieuwjaar is :-) Edwin -- Edwin Groothuis Website: http://www.mavetju.org/ edwin@mavetju.org Weblog: http://www.mavetju.org/weblog/ From owner-svn-src-user@FreeBSD.ORG Wed Feb 3 08:07:41 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A82DD1065670 for ; Wed, 3 Feb 2010 08:07:41 +0000 (UTC) (envelope-from remko@elvandar.org) Received: from mailgate.jr-hosting.nl (mailgate.jr-hosting.nl [78.46.126.30]) by mx1.freebsd.org (Postfix) with ESMTP id 647C78FC16 for ; Wed, 3 Feb 2010 08:07:41 +0000 (UTC) Received: from websrv01.jr-hosting.nl (websrv01 [78.47.69.233]) by mailgate.jr-hosting.nl (Postfix) with ESMTP id 72E731CC46; Wed, 3 Feb 2010 08:49:33 +0100 (CET) Received: from www by websrv01.jr-hosting.nl with local (Exim 4.71 (FreeBSD)) (envelope-from ) id 1NcZzR-000PTT-BR; Wed, 03 Feb 2010 08:49:33 +0100 Received: from 192.58.226.100 (SquirrelMail authenticated user remko) by www.jr-hosting.nl with HTTP; Wed, 3 Feb 2010 08:49:33 +0100 Message-ID: <3ce0582c8ad3e3a0f3e5714b7eacc079.squirrel@www.jr-hosting.nl> In-Reply-To: <20100203065150.GB71594@mavetju.org> References: <201002022123.o12LNah9080934@svn.freebsd.org> <20100202213806.GV77705@hoeg.nl> <20100203065150.GB71594@mavetju.org> Date: Wed, 3 Feb 2010 08:49:33 +0100 From: "Remko Lodder" To: "Edwin Groothuis" User-Agent: SquirrelMail/1.4.19 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Cc: Ed Schouten , src-committers@freebsd.org, svn-src-user@freebsd.org, Edwin Groothuis Subject: Re: svn commit: r203405 - user/edwin/calendar/calendars X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: remko@elvandar.org List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2010 08:07:41 -0000 On Wed, February 3, 2010 7:51 am, Edwin Groothuis wrote: > Hello Ed, > > On Tue, Feb 02, 2010 at 10:38:06PM +0100, Ed Schouten wrote: >> * Edwin Groothuis wrote: >> > +Apr/01 Een April >> > +Apr/30 Koninginendag > > Fixed. > >> > +Dec/31 Oudjaar >> >> Ik dacht dat de offici?le naam voor deze dag Oudejaarsdag is. Weet ik >> niet zeker. > > Bij ons in het dorp was het altijd Oudjaar :-P > Net zoals 1 Januarie Nieuwjaar is :-) > > Edwin > Bij ons is het gewoon 1 januari >:) Volgens mij is het inderdaad "oudjaar" op die dag, en wordt de dag ook wel "oudejaarsdag" genoemd, lekker complex... -- /"\ Best regards, | remko@FreeBSD.org \ / Remko Lodder | remko@EFnet X http://www.evilcoder.org/ | / \ ASCII Ribbon Campaign | Against HTML Mail and News From owner-svn-src-user@FreeBSD.ORG Wed Feb 3 21:29:07 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA685106566B; Wed, 3 Feb 2010 21:29:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A759C8FC08; Wed, 3 Feb 2010 21:29:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o13LT7Ui013083; Wed, 3 Feb 2010 21:29:07 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o13LT7kZ013039; Wed, 3 Feb 2010 21:29:07 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201002032129.o13LT7kZ013039@svn.freebsd.org> From: Warner Losh Date: Wed, 3 Feb 2010 21:29:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203446 - in user/imp/tbemd: . bin/pax cddl/lib/libdtrace cddl/lib/libzpool contrib/smbfs etc games/morse gnu/lib/csu gnu/lib/libgcc gnu/lib/libgomp gnu/lib/libstdc++ gnu/usr.bin gnu/us... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2010 21:29:07 -0000 Author: imp Date: Wed Feb 3 21:29:06 2010 New Revision: 203446 URL: http://svn.freebsd.org/changeset/base/203446 Log: Introduce MACHINE_CPUARCH. MACHINE is the specific kernel architecture for this machine. MACHINE_ARCH is the specific CPU type (abi, word size, etc). MACHINE_CPUARCH is the family of CPUs that's supported. Most of the tree conflates MACHINE_ARCH and MACHINE_CPUARCH since historically they have been identical. However, there's now a reason to to split the two concepts. NetBSD calls this MACHINE_CPU, but that's already used for something else in FreeBSD, so MACHINE_CPUARCH was selected instead. However, the sources in the tree have had a KLUDGE in the tree called TARGET_BIG_ENDIAN to select which endian to compile the code for. However, this is a cumbersome and awkward solution. MACHINE_ARCH really does need to be different for different endian because users use it for things like their path. Yet, the source tree also used MACHINE_ARCH to figure out the MD code to use. This source often supports multiple MACHINE_ARCHs. 'mips' supports 32 (and soon 64) bit word sizes as well as big and little endian. 'arm' support both endians. powerpc will soon support both 32-bit and 64-bit. These patches start to unwind this confusion. It implements MACHINE_ARCH of mipsel, mipseb for the two endians of MIPS, as well as arm and armeb for ARM. The names for ARM are historical accidents (ARM was primarily little endian until relatively recently). These names follow the NetBSD convetions. With these changes, "make buildworld TARGET=mips TARGET_ARCH=mipsel" finishes. armeb and mipseb should work, but haven't been tested yet. Committed as one big chunk so that people can comment on the patches as a whole and suggest improvements. Modified: user/imp/tbemd/Makefile.inc1 user/imp/tbemd/bin/pax/Makefile user/imp/tbemd/cddl/lib/libdtrace/Makefile user/imp/tbemd/cddl/lib/libzpool/Makefile user/imp/tbemd/contrib/smbfs/Makefile user/imp/tbemd/etc/Makefile user/imp/tbemd/games/morse/Makefile user/imp/tbemd/gnu/lib/csu/Makefile user/imp/tbemd/gnu/lib/libgcc/Makefile user/imp/tbemd/gnu/lib/libgomp/Makefile user/imp/tbemd/gnu/lib/libstdc++/Makefile user/imp/tbemd/gnu/usr.bin/Makefile user/imp/tbemd/gnu/usr.bin/binutils/Makefile.inc0 user/imp/tbemd/gnu/usr.bin/binutils/as/Makefile user/imp/tbemd/gnu/usr.bin/binutils/gdb/Makefile user/imp/tbemd/gnu/usr.bin/binutils/ld/Makefile.arm user/imp/tbemd/gnu/usr.bin/binutils/ld/Makefile.mips user/imp/tbemd/gnu/usr.bin/binutils/libbfd/Makefile.arm user/imp/tbemd/gnu/usr.bin/binutils/libbfd/Makefile.mips user/imp/tbemd/gnu/usr.bin/cc/Makefile.inc user/imp/tbemd/gnu/usr.bin/cc/Makefile.tgt user/imp/tbemd/gnu/usr.bin/cc/cc_int/Makefile user/imp/tbemd/gnu/usr.bin/cc/cc_tools/Makefile user/imp/tbemd/gnu/usr.bin/gdb/Makefile user/imp/tbemd/gnu/usr.bin/gdb/Makefile.inc user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/Makefile user/imp/tbemd/gnu/usr.bin/gdb/libgdb/Makefile user/imp/tbemd/include/Makefile user/imp/tbemd/lib/Makefile user/imp/tbemd/lib/bind/config.mk user/imp/tbemd/lib/libc/Makefile user/imp/tbemd/lib/libc/compat-43/Makefile.inc user/imp/tbemd/lib/libc/gen/Makefile.inc user/imp/tbemd/lib/libc/locale/Makefile.inc user/imp/tbemd/lib/libc/quad/Makefile.inc user/imp/tbemd/lib/libc/softfloat/Makefile.inc user/imp/tbemd/lib/libc/stdlib/Makefile.inc user/imp/tbemd/lib/libc/string/Makefile.inc user/imp/tbemd/lib/libc/sys/Makefile.inc user/imp/tbemd/lib/libc_r/sys/Makefile.inc user/imp/tbemd/lib/libcompat/Makefile user/imp/tbemd/lib/libdisk/Makefile user/imp/tbemd/lib/libkse/Makefile user/imp/tbemd/lib/libkse/arch/amd64/Makefile.inc user/imp/tbemd/lib/libkse/arch/arm/Makefile.inc user/imp/tbemd/lib/libkse/arch/i386/Makefile.inc user/imp/tbemd/lib/libkse/arch/ia64/Makefile.inc user/imp/tbemd/lib/libkse/arch/powerpc/Makefile.inc user/imp/tbemd/lib/libkse/arch/sparc64/Makefile.inc user/imp/tbemd/lib/libkse/support/Makefile.inc user/imp/tbemd/lib/libkvm/Makefile user/imp/tbemd/lib/libpmc/Makefile user/imp/tbemd/lib/libstand/Makefile user/imp/tbemd/lib/libthr/Makefile user/imp/tbemd/lib/libthr/arch/amd64/Makefile.inc user/imp/tbemd/lib/libthr/arch/arm/Makefile.inc user/imp/tbemd/lib/libthr/arch/i386/Makefile.inc user/imp/tbemd/lib/libthr/arch/ia64/Makefile.inc user/imp/tbemd/lib/libthr/arch/mips/Makefile.inc user/imp/tbemd/lib/libthr/arch/powerpc/Makefile.inc user/imp/tbemd/lib/libthr/arch/sparc64/Makefile.inc user/imp/tbemd/lib/libthr/support/Makefile.inc user/imp/tbemd/lib/libthread_db/Makefile user/imp/tbemd/lib/msun/Makefile user/imp/tbemd/libexec/rtld-elf/Makefile user/imp/tbemd/libexec/rtld-elf/amd64/Makefile.inc user/imp/tbemd/libexec/rtld-elf/i386/Makefile.inc user/imp/tbemd/rescue/rescue/Makefile user/imp/tbemd/sbin/Makefile user/imp/tbemd/sbin/atm/atmconfig/Makefile user/imp/tbemd/sbin/bsdlabel/Makefile user/imp/tbemd/sbin/camcontrol/Makefile user/imp/tbemd/sbin/gbde/Makefile user/imp/tbemd/sbin/newfs_msdos/Makefile user/imp/tbemd/sbin/routed/Makefile user/imp/tbemd/sbin/sunlabel/Makefile user/imp/tbemd/secure/lib/libcrypto/Makefile user/imp/tbemd/share/man/man4/Makefile user/imp/tbemd/share/man/man5/Makefile user/imp/tbemd/share/mk/bsd.cpu.mk user/imp/tbemd/share/mk/bsd.endian.mk user/imp/tbemd/share/mk/bsd.lib.mk user/imp/tbemd/share/mk/bsd.sys.mk user/imp/tbemd/share/mk/sys.mk user/imp/tbemd/sys/boot/Makefile user/imp/tbemd/sys/boot/arm/ixp425/boot2/Makefile user/imp/tbemd/sys/boot/common/Makefile.inc user/imp/tbemd/sys/boot/efi/libefi/Makefile user/imp/tbemd/sys/boot/ficl/Makefile user/imp/tbemd/sys/boot/i386/Makefile.inc user/imp/tbemd/sys/boot/i386/boot2/Makefile user/imp/tbemd/sys/boot/i386/gptboot/Makefile user/imp/tbemd/sys/boot/i386/gptzfsboot/Makefile user/imp/tbemd/sys/boot/i386/libfirewire/Makefile user/imp/tbemd/sys/boot/i386/libi386/Makefile user/imp/tbemd/sys/boot/i386/loader/Makefile user/imp/tbemd/sys/boot/i386/zfsboot/Makefile user/imp/tbemd/sys/boot/ia64/common/Makefile user/imp/tbemd/sys/boot/ia64/efi/Makefile user/imp/tbemd/sys/boot/ia64/ski/Makefile user/imp/tbemd/sys/boot/ofw/libofw/Makefile user/imp/tbemd/sys/boot/uboot/lib/Makefile user/imp/tbemd/sys/boot/zfs/Makefile user/imp/tbemd/sys/conf/Makefile.mips user/imp/tbemd/sys/conf/kern.mk user/imp/tbemd/sys/conf/kern.post.mk user/imp/tbemd/sys/conf/kern.pre.mk user/imp/tbemd/sys/conf/kmod.mk user/imp/tbemd/sys/kern/Makefile user/imp/tbemd/sys/modules/Makefile user/imp/tbemd/sys/modules/aac/Makefile user/imp/tbemd/sys/modules/acpi/acpi/Makefile user/imp/tbemd/sys/modules/agp/Makefile user/imp/tbemd/sys/modules/amr/Makefile user/imp/tbemd/sys/modules/asr/Makefile user/imp/tbemd/sys/modules/bge/Makefile user/imp/tbemd/sys/modules/cpufreq/Makefile user/imp/tbemd/sys/modules/cxgb/Makefile user/imp/tbemd/sys/modules/cyclic/Makefile user/imp/tbemd/sys/modules/dtrace/Makefile user/imp/tbemd/sys/modules/dtrace/Makefile.inc user/imp/tbemd/sys/modules/dtrace/dtrace/Makefile user/imp/tbemd/sys/modules/dtrace/fasttrap/Makefile user/imp/tbemd/sys/modules/hptmv/Makefile user/imp/tbemd/sys/modules/hptrr/Makefile user/imp/tbemd/sys/modules/hwpmc/Makefile user/imp/tbemd/sys/modules/i2c/controllers/pcf/Makefile user/imp/tbemd/sys/modules/io/Makefile user/imp/tbemd/sys/modules/le/Makefile user/imp/tbemd/sys/modules/linprocfs/Makefile user/imp/tbemd/sys/modules/linsysfs/Makefile user/imp/tbemd/sys/modules/linux/Makefile user/imp/tbemd/sys/modules/mem/Makefile user/imp/tbemd/sys/modules/mfi/Makefile user/imp/tbemd/sys/modules/ndis/Makefile user/imp/tbemd/sys/modules/opensolaris/Makefile user/imp/tbemd/sys/modules/ppc/Makefile user/imp/tbemd/sys/modules/procfs/Makefile user/imp/tbemd/sys/modules/scc/Makefile user/imp/tbemd/sys/modules/smbfs/Makefile user/imp/tbemd/sys/modules/sound/driver/Makefile user/imp/tbemd/sys/modules/sound/sound/Makefile user/imp/tbemd/sys/modules/svr4/Makefile user/imp/tbemd/sys/modules/syscons/Makefile user/imp/tbemd/sys/modules/uart/Makefile user/imp/tbemd/sys/modules/usb/Makefile user/imp/tbemd/sys/modules/vx/Makefile user/imp/tbemd/sys/modules/zfs/Makefile user/imp/tbemd/usr.bin/Makefile user/imp/tbemd/usr.bin/ldd/Makefile user/imp/tbemd/usr.bin/truss/Makefile user/imp/tbemd/usr.bin/xlint/Makefile.inc user/imp/tbemd/usr.sbin/Makefile user/imp/tbemd/usr.sbin/ac/Makefile user/imp/tbemd/usr.sbin/amd/Makefile.inc user/imp/tbemd/usr.sbin/apm/Makefile user/imp/tbemd/usr.sbin/crunch/crunchide/Makefile user/imp/tbemd/usr.sbin/kldxref/Makefile user/imp/tbemd/usr.sbin/powerd/Makefile user/imp/tbemd/usr.sbin/sade/Makefile user/imp/tbemd/usr.sbin/sysinstall/Makefile user/imp/tbemd/usr.sbin/tcpdump/tcpdump/Makefile Modified: user/imp/tbemd/Makefile.inc1 ============================================================================== --- user/imp/tbemd/Makefile.inc1 Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/Makefile.inc1 Wed Feb 3 21:29:06 2010 (r203446) @@ -29,7 +29,7 @@ .include -.if ${MACHINE_ARCH} == "mips" +.if ${MACHINE_CPUARCH} == "mips" MK_RESCUE=no # not yet .endif @@ -129,7 +129,7 @@ TARGET= ${TARGET_ARCH} TARGET?= ${MACHINE} TARGET_ARCH?= ${MACHINE_ARCH} -KNOWN_ARCHES?= amd64 arm i386 i386/pc98 ia64 mips powerpc sparc64 sparc64/sun4v +KNOWN_ARCHES?= amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips mipseb/mips powerpc sparc64 sparc64/sun4v .if ${TARGET} == ${TARGET_ARCH} _t= ${TARGET} .else @@ -1095,10 +1095,10 @@ _prereq_libs= gnu/lib/libssp/libssp_nons # all shared libraries for ELF. # _startup_libs= gnu/lib/csu -.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) -_startup_libs+= lib/csu/${MACHINE_ARCH}-elf +.if exists(${.CURDIR}/lib/csu/${MACHINE_CPUARCH}-elf) +_startup_libs+= lib/csu/${MACHINE_CPUARCH}-elf .else -_startup_libs+= lib/csu/${MACHINE_ARCH} +_startup_libs+= lib/csu/${MACHINE_CPUARCH} .endif _startup_libs+= gnu/lib/libgcc _startup_libs+= lib/libc Modified: user/imp/tbemd/bin/pax/Makefile ============================================================================== --- user/imp/tbemd/bin/pax/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/bin/pax/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -33,7 +33,8 @@ SRCS= ar_io.c ar_subs.c buf_subs.c cache #MAN= pax.1 tar.1 cpio.1 #LINKS= ${BINDIR}/pax ${BINDIR}/tar ${BINDIR}/pax ${BINDIR}/cpio -.if ${MACHINE_ARCH} == "arm" +# This is verboten +.if ${MACHINE_CPUARCH} == "arm" WARNS?= 3 .endif Modified: user/imp/tbemd/cddl/lib/libdtrace/Makefile ============================================================================== --- user/imp/tbemd/cddl/lib/libdtrace/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/cddl/lib/libdtrace/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -64,9 +64,9 @@ CFLAGS+= -I${.OBJDIR} \ #CFLAGS+= -DYYDEBUG -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/intel -.elif ${MACHINE_ARCH} == "sparc64" +.elif ${MACHINE_CPUARCH} == "sparc64" CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/sparc .else # temporary hack Modified: user/imp/tbemd/cddl/lib/libzpool/Makefile ============================================================================== --- user/imp/tbemd/cddl/lib/libzpool/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/cddl/lib/libzpool/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -11,8 +11,8 @@ # LIST_SRCS .PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/os # ATOMIC_SRCS -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64" -.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH} +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "ia64" +.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_CPUARCH} ATOMIC_SRCS= opensolaris_atomic.S .else .PATH: ${.CURDIR}/../../../sys/cddl/compat/opensolaris/kern @@ -50,7 +50,7 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/cont CFLAGS+= -DWANTS_MUTEX_OWNED CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/thread CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/sys -CFLAGS+= -I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_ARCH}/include +CFLAGS+= -I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_CPUARCH}/include DPADD= ${LIBPTHREAD} ${LIBZ} LDADD= -lpthread -lz Modified: user/imp/tbemd/contrib/smbfs/Makefile ============================================================================== --- user/imp/tbemd/contrib/smbfs/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/contrib/smbfs/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -9,7 +9,7 @@ # deinstall-src undo corresponding install-* target # clean cleanup source tree -.if ${MACHINE_ARCH} != "i386" +.if ${MACHINE_CPUARCH} != "i386" . error "only IA32 machines supported" .endif Modified: user/imp/tbemd/etc/Makefile ============================================================================== --- user/imp/tbemd/etc/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/etc/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -23,7 +23,7 @@ BIN1= auth.conf \ .if exists(${.CURDIR}/etc.${MACHINE}/ttys) BIN1+= etc.${MACHINE}/ttys .else -BIN1+= etc.${MACHINE_ARCH}/ttys +BIN1+= etc.${MACHINE_CPUARCH}/ttys .endif OPENBSMDIR= ${.CURDIR}/../contrib/openbsm Modified: user/imp/tbemd/games/morse/Makefile ============================================================================== --- user/imp/tbemd/games/morse/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/games/morse/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -4,7 +4,7 @@ PROG= morse MAN= morse.6 -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" CFLAGS += -DSPEAKER=\"/dev/speaker\" .endif Modified: user/imp/tbemd/gnu/lib/csu/Makefile ============================================================================== --- user/imp/tbemd/gnu/lib/csu/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/lib/csu/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -23,18 +23,18 @@ CFLAGS+= -I${GCCLIB}/include -I${GCCDIR} CRTS_CFLAGS= -DCRTSTUFFS_O -DSHARED ${PICFLAG} MKDEP= -DCRT_BEGIN -.if ${MACHINE_ARCH} == "ia64" +.if ${MACHINE_CPUARCH} == "ia64" BEGINSRC= crtbegin.asm ENDSRC= crtend.asm CFLAGS+= -x assembler-with-cpp # Ugly hack CFLAGS+= -include osreldate.h .undef SRCS # hack for 'make depend' .endif -.if ${MACHINE_ARCH} == "powerpc" +.if ${MACHINE_CPUARCH} == "powerpc" TGTOBJS= crtsavres.o SRCS+= crtsavres.asm .endif -.if ${MACHINE_ARCH} == "sparc64" +.if ${MACHINE_CPUARCH} == "sparc64" TGTOBJS= crtfastmath.o SRCS+= crtfastmath.c .endif Modified: user/imp/tbemd/gnu/lib/libgcc/Makefile ============================================================================== --- user/imp/tbemd/gnu/lib/libgcc/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/lib/libgcc/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -26,7 +26,7 @@ CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_F LDFLAGS+= -nodefaultlibs LDADD+= -lc -OBJS= # added to below in various ways depending on TARGET_ARCH +OBJS= # added to below in various ways depending on TARGET_CPUARCH #--------------------------------------------------------------------------- # @@ -99,7 +99,7 @@ LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udi # Platform specific bits. # When upgrading GCC, get the following definitions from config//t-* # -.if ${TARGET_ARCH} == "arm" +.if ${TARGET_CPUARCH} == "arm" # from config/arm/t-strongarm-elf CFLAGS+= -Dinhibit_libc -fno-inline LIB1ASMSRC = lib1funcs.asm @@ -115,11 +115,11 @@ LIB2FUNCS_EXTRA = floatunsidf.c floatuns # _fixsfsi _fixunssfsi _floatdidf _floatdisf .endif -.if ${TARGET_ARCH} == "mips" +.if ${TARGET_CPUARCH} == "mips" LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c .endif -.if ${TARGET_ARCH} == "ia64" +.if ${TARGET_CPUARCH} == "ia64" # from config/ia64/t-ia64 LIB1ASMSRC = lib1funcs.asm LIB1ASMFUNCS = __divxf3 __divdf3 __divsf3 \ @@ -130,13 +130,13 @@ LIB1ASMFUNCS = __divxf3 __divdf3 __divsf LIB2ADDEH = unwind-ia64.c unwind-sjlj.c unwind-c.c .endif -.if ${TARGET_ARCH} == "powerpc" +.if ${TARGET_CPUARCH} == "powerpc" # from config/rs6000/t-ppccomm LIB2FUNCS_EXTRA = tramp.asm LIB2FUNCS_STATIC_EXTRA = eabi.asm .endif -.if ${TARGET_ARCH} == "sparc64" +.if ${TARGET_CPUARCH} == "sparc64" # from config/sparc/t-elf LIB1ASMSRC = lb1spc.asm LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 @@ -183,8 +183,8 @@ OBJ_GRPS = STD DIV # # Floating point emulation functions # -.if ${TARGET_ARCH} == "armNOT_YET" || \ - ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "sparc64" +.if ${TARGET_CPUARCH} == "armNOT_YET" || \ + ${TARGET_CPUARCH} == "powerpc" || ${TARGET_CPUARCH} == "sparc64" FPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES -DFLOAT DPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES Modified: user/imp/tbemd/gnu/lib/libgomp/Makefile ============================================================================== --- user/imp/tbemd/gnu/lib/libgomp/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/lib/libgomp/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -23,8 +23,9 @@ CFLAGS+= -I${.CURDIR} -I. -I${SRCDIR} -I VERSION_MAP= ${SRCDIR}/libgomp.map # Target-specific OpenMP configuration -.if ${MACHINE_ARCH} == arm || ${MACHINE_ARCH} == i386 || \ - ${MACHINE_ARCH} == mips || ${MACHINE_ARCH} == powerpc +.if ${MACHINE_CPUARCH} == arm || ${MACHINE_CPUARCH} == i386 || \ + ${MACHINE_ARCH} == mipsel || ${MACHINE_ARCH} == mipseb || \ + ${MACHINE_ARCH} == powerpc || OMP_LOCK_ALIGN = 4 OMP_LOCK_KIND= 4 OMP_LOCK_SIZE= 4 Modified: user/imp/tbemd/gnu/lib/libstdc++/Makefile ============================================================================== --- user/imp/tbemd/gnu/lib/libstdc++/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/lib/libstdc++/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -13,7 +13,7 @@ LIB= stdc++ SHLIB_MAJOR= 6 CFLAGS+= -DIN_GLIBCPP_V3 -DHAVE_CONFIG_H -.if ${MACHINE_ARCH} == "arm" +.if ${MACHINE_CPUARCH} == "arm" CFLAGS+= -D_GLIBCXX_SJLJ_EXCEPTIONS=1 .endif CFLAGS+= -I${.CURDIR} -I${SUPDIR} -I${GCCDIR} -I${SRCDIR}/include @@ -66,14 +66,14 @@ SRCS+= del_op.cc del_opnt.cc del_opv.cc SRCS+= cp-demangle.c # MD headers location -.if ${MACHINE_ARCH} == "sparc64" +.if ${MACHINE_CPUARCH} == "sparc64" MARCHDIR= sparc -.elif ${MACHINE_ARCH} == "i386" && ${MACHINE_CPU} != 'i386' +.elif ${MACHINE_CPUARCH} == "i386" && ${MACHINE_CPU} != 'i386' MARCHDIR= i486 -.elif ${MACHINE_ARCH} == "amd64" +.elif ${MACHINE_CPUARCH} == "amd64" MARCHDIR= i486 .else -MARCHDIR= ${MACHINE_ARCH} +MARCHDIR= ${MACHINE_CPUARCH} .endif .if exists(${SRCDIR}/config/cpu/${MARCHDIR}/atomicity.h) @@ -82,7 +82,7 @@ ATOMICITY_H= ${SRCDIR}/config/cpu/${MARC ATOMICITY_H= ${SRCDIR}/config/cpu/generic/atomicity_mutex/atomicity.h .endif -.if ${MACHINE_ARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" .if exists(${SRCDIR}/config/cpu/generic/atomicity_builtins/atomicity.h) ATOMICITY_H= ${SRCDIR}/config/cpu/generic/atomicity_builtins/atomicity.h .endif Modified: user/imp/tbemd/gnu/usr.bin/Makefile ============================================================================== --- user/imp/tbemd/gnu/usr.bin/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -21,7 +21,7 @@ SUBDIR= ${_binutils} \ sort \ ${_texinfo} -.if ${MACHINE_ARCH} == "mips" +.if ${MACHINE_CPUARCH} == "mips" MK_GDB=no # not yet .endif Modified: user/imp/tbemd/gnu/usr.bin/binutils/Makefile.inc0 ============================================================================== --- user/imp/tbemd/gnu/usr.bin/binutils/Makefile.inc0 Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/binutils/Makefile.inc0 Wed Feb 3 21:29:06 2010 (r203446) @@ -6,13 +6,17 @@ VERSION= "2.15 [FreeBSD] 2004-05-23" -TARGET_ARCH?= ${MACHINE_ARCH} -.if ${TARGET_ARCH} == "amd64" -BINUTILS_ARCH=x86_64 +.if defined(TARGET_ARCH) +TARGET_CPUARCH=${TARGET_ARCH:C/mipse[bl]/mips/:C/armeb/arm/} .else -BINUTILS_ARCH=${TARGET_ARCH} +TARGET_CPUARCH=${MACHINE_CPUARCH} .endif +TARGET_ARCH?= ${MACHINE_ARCH} +BINUTILS_ARCH=${TARGET_ARCH:C/amd64/x86_64/} TARGET_TUPLE?= ${BINUTILS_ARCH}-obrien-freebsd +.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "mipseb" +TARGET_BIG_ENDIAN=t +.endif # RELTOP is the relative path to this point in the source or object # tree, from any subdirectory of same. It gets extra "../" prefixes @@ -22,27 +26,27 @@ RELTOP:= .. RELSRC= ${RELTOP}/../../../contrib/binutils SRCDIR= ${.CURDIR}/${RELSRC} -.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "i386" || \ - ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "mips" +.if ${TARGET_CPUARCH} == "arm" || ${TARGET_CPUARCH} == "i386" || \ + ${TARGET_CPUARCH} == "powerpc" || ${TARGET_CPUARCH} == "mips" CFLAGS+= -DBFD_DEFAULT_TARGET_SIZE=32 .else CFLAGS+= -DBFD_DEFAULT_TARGET_SIZE=64 .endif CFLAGS+= -I. -.if exists(${.CURDIR}/${TARGET_ARCH}) -CFLAGS+= -I${.CURDIR}/${TARGET_ARCH} +.if exists(${.CURDIR}/${TARGET_CPUARCH}) +CFLAGS+= -I${.CURDIR}/${TARGET_CPUARCH} .endif CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/${RELTOP}/libbfd CFLAGS+= -I${.OBJDIR}/${RELTOP}/libbfd CFLAGS+= -I${SRCDIR}/include -.if exists(${.CURDIR}/${TARGET_ARCH}) -.PATH: ${.CURDIR}/${TARGET_ARCH} +.if exists(${.CURDIR}/${TARGET_CPUARCH}) +.PATH: ${.CURDIR}/${TARGET_CPUARCH} .endif -ARCHS= ${TARGET_ARCH} +ARCHS= ${TARGET_CPUARCH} .for _arch in ${CROSS_ARCH} .if (${ARCHS:R:M${_arch:R}} == "") Modified: user/imp/tbemd/gnu/usr.bin/binutils/as/Makefile ============================================================================== --- user/imp/tbemd/gnu/usr.bin/binutils/as/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/binutils/as/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -20,7 +20,7 @@ SRCS+= app.c as.c atof-generic.c atof-ie # DEO: why not used? #SRCS+= itbl-ops.c -.if ${TARGET_ARCH} == "mips" +.if ${TARGET_CPUARCH} == "mips" SRCS+= itbl-ops.c itbl-parse.y itbl-lex.l .endif @@ -32,7 +32,7 @@ SRCS+= tc-ppc.c # change back to tc-sparc.c when new binutils is imported SRCS+= tc-sparc-fixed.c .else -SRCS+= tc-${TARGET_ARCH}.c +SRCS+= tc-${TARGET_CPUARCH}.c .endif .if ${TARGET_ARCH} == "sparc64" @@ -49,7 +49,7 @@ CFLAGS+= -DTARGET_ALIAS=\"${TARGET_TUPLE CFLAGS+= -DVERSION=\"${VERSION}\" CFLAGS+= -D_GNU_SOURCE CFLAGS+= -I${SRCDIR}/gas -I${SRCDIR}/gas/config -I${SRCDIR} -CFLAGS+= -I${.CURDIR} -I${.CURDIR}/${TARGET_ARCH}-freebsd +CFLAGS+= -I${.CURDIR} -I${.CURDIR}/${TARGET_CPUARCH}-freebsd NO_SHARED?= yes Modified: user/imp/tbemd/gnu/usr.bin/binutils/gdb/Makefile ============================================================================== --- user/imp/tbemd/gnu/usr.bin/binutils/gdb/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/binutils/gdb/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -8,13 +8,7 @@ GDBDIR= ${.CURDIR}/../../../../contrib/g .PATH: ${SRCDIR}/opcodes ${SRCDIR}/binutils # For FSF GDB files, use their CPU (arch) name; for our files use ours. -.if ${TARGET_ARCH} == "sparc64" -GDB_CPU= sparc -.elif ${TARGET_ARCH} == "amd64" -GDB_CPU= i386 -.else -GDB_CPU= ${TARGET_ARCH} -.endif +GDB_CPU=${TARGET_CPUARCH:C/amd64/i386/:C/powerpc/rs6000/:C/sparc64/sparc/} NO_SHARED?=yes PROG= gdb @@ -55,7 +49,7 @@ WARNS?= 0 CFLAGS+= -DCROSS_COMPILE=1 .endif CFLAGS+= -DDEFAULT_BFD_ARCH=bfd_${GDB_CPU}_arch -CFLAGS+= -I${.CURDIR}/${TARGET_ARCH} +CFLAGS+= -I${.CURDIR}/${TARGET_CPUARCH} CFLAGS+= -I${SRCDIR}/binutils -I${SRCDIR}/bfd CFLAGS+= -I${GDBDIR}/gdb -I${GDBDIR}/gdb/config CFLAGS+= -I$(.CURDIR) @@ -121,8 +115,8 @@ init.c: ${XSRCS} tm.h: echo '#include "${GDB_CPU}/tm-fbsd.h"' > ${.TARGET} -.if exists(${.CURDIR}/fbsd-kgdb-${TARGET_ARCH}.h) - echo '#include "fbsd-kgdb-${TARGET_ARCH}.h"' >> ${.TARGET} +.if exists(${.CURDIR}/fbsd-kgdb-${TARGET_CPUARCH}.h) + echo '#include "fbsd-kgdb-${TARGET_CPUARCH}.h"' >> ${.TARGET} .endif .for H in nm-fbsd xm-${GDB_CPU} @@ -131,7 +125,7 @@ ${H:C/-.*$//}.h: .endfor kvm-fbsd-machine.h: - ln -sf ${.CURDIR}/kvm-fbsd-${TARGET_ARCH}.h ${.TARGET} + ln -sf ${.CURDIR}/kvm-fbsd-${TARGET_CPUARCH}.h ${.TARGET} GDB_VERSION= "5.2.1 (FreeBSD)" gdbversion.c: Makefile Modified: user/imp/tbemd/gnu/usr.bin/binutils/ld/Makefile.arm ============================================================================== --- user/imp/tbemd/gnu/usr.bin/binutils/ld/Makefile.arm Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/binutils/ld/Makefile.arm Wed Feb 3 21:29:06 2010 (r203446) @@ -1,6 +1,6 @@ # $FreeBSD$ -.if defined(TARGET_BIG_ENDIAN) +.if ${TARGET_ARCH} == "armeb" NATIVE_EMULATION= armelfb_fbsd .else NATIVE_EMULATION= armelf_fbsd Modified: user/imp/tbemd/gnu/usr.bin/binutils/ld/Makefile.mips ============================================================================== --- user/imp/tbemd/gnu/usr.bin/binutils/ld/Makefile.mips Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/binutils/ld/Makefile.mips Wed Feb 3 21:29:06 2010 (r203446) @@ -1,10 +1,8 @@ # $FreeBSD$ -#xxxIMPxxx: size? -#xxxIMPxxx: TARGET_BIG_ENDIAN is lame. We should use the netbsd convention -# of mipsel and mips. +# XXX still need to swizle in size _sz?=32 -.if defined(TARGET_BIG_ENDIAN) +.if ${TARGET_ARCH} == "mipseb" NATIVE_EMULATION=elf${_sz}btsmip_fbsd .else NATIVE_EMULATION=elf${_sz}ltsmip_fbsd Modified: user/imp/tbemd/gnu/usr.bin/binutils/libbfd/Makefile.arm ============================================================================== --- user/imp/tbemd/gnu/usr.bin/binutils/libbfd/Makefile.arm Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/binutils/libbfd/Makefile.arm Wed Feb 3 21:29:06 2010 (r203446) @@ -1,6 +1,6 @@ # $FreeBSD$ -.if defined(TARGET_BIG_ENDIAN) +.if ${TARGET_ARCH} == "armeb" DEFAULT_VECTOR= bfd_elf32_bigarm_vec .else DEFAULT_VECTOR= bfd_elf32_littlearm_vec @@ -14,7 +14,7 @@ SRCS+= cpu-arm.c \ elflink.c VECS+= ${DEFAULT_VECTOR} -.if defined(TARGET_BIG_ENDIAN) +.if ${TARGET_ARCH} == "armeb" VECS+= bfd_elf32_littlearm_vec .else VECS+= bfd_elf32_bigarm_vec Modified: user/imp/tbemd/gnu/usr.bin/binutils/libbfd/Makefile.mips ============================================================================== --- user/imp/tbemd/gnu/usr.bin/binutils/libbfd/Makefile.mips Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/binutils/libbfd/Makefile.mips Wed Feb 3 21:29:06 2010 (r203446) @@ -1,7 +1,10 @@ # $FreeBSD$ -#xxxIMPxxx: endian and size +.if ${TARGET_ARCH} == "mipsel" +DEFAULT_VECTOR= bfd_elf32_tradlittlemips_vec +.else DEFAULT_VECTOR= bfd_elf32_tradbigmips_vec +.endif SRCS+= coff-mips.c \ cpu-mips.c \ Modified: user/imp/tbemd/gnu/usr.bin/cc/Makefile.inc ============================================================================== --- user/imp/tbemd/gnu/usr.bin/cc/Makefile.inc Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/cc/Makefile.inc Wed Feb 3 21:29:06 2010 (r203446) @@ -30,6 +30,13 @@ CFLAGS+= -DLONG_TYPE_SIZE=${LONG_TYPE_SI CFLAGS+= -DCROSS_COMPILE .endif +.if ${TARGET_ARCH} == "armeb" +CFLAGS += -DTARGET_ENDIAN_DEFAULT=MASK_BIG_END +.endif +.if ${TARGET_ARCH} == "mipsel" +CFLAGS += -DTARGET_ENDIAN_DEFAULT=0 +.endif + .if defined(WANT_FORCE_OPTIMIZATION_DOWNGRADE) CFLAGS+= -DFORCE_OPTIMIZATION_DOWNGRADE=${WANT_FORCE_OPTIMIZATION_DOWNGRADE} .endif Modified: user/imp/tbemd/gnu/usr.bin/cc/Makefile.tgt ============================================================================== --- user/imp/tbemd/gnu/usr.bin/cc/Makefile.tgt Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/cc/Makefile.tgt Wed Feb 3 21:29:06 2010 (r203446) @@ -1,16 +1,15 @@ # $FreeBSD$ -TARGET_ARCH?= ${MACHINE_ARCH} +# These assignments duplicate much of the functionality of +# MACHINE_CPUARCH, but there's no easy way to export make functions... -.if ${TARGET_ARCH} == "amd64" -GCC_CPU= i386 -.elif ${TARGET_ARCH} == "powerpc" -GCC_CPU= rs6000 -.elif ${TARGET_ARCH} == "sparc64" -GCC_CPU= sparc +.if defined(TARGET_ARCH) +TARGET_CPUARCH=${TARGET_ARCH:C/mipse[bl]/mips/:C/armeb/arm/} .else -GCC_CPU= ${TARGET_ARCH} +TARGET_CPUARCH=${MACHINE_CPUARCH} .endif +TARGET_ARCH?= ${MACHINE_ARCH} +GCC_CPU=${TARGET_CPUARCH:C/amd64/i386/:C/powerpc/rs6000/:C/sparc64/sparc/} .if ${TARGET_ARCH} == "ia64" TARGET_CPU_DEFAULT= MASK_GNU_AS|MASK_GNU_LD @@ -18,3 +17,6 @@ TARGET_CPU_DEFAULT= MASK_GNU_AS|MASK_GNU .if ${TARGET_ARCH} == "sparc64" TARGET_CPU_DEFAULT= TARGET_CPU_ultrasparc .endif +.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "mipseb" +TARGET_BIG_ENDIAN=t +.endif Modified: user/imp/tbemd/gnu/usr.bin/cc/cc_int/Makefile ============================================================================== --- user/imp/tbemd/gnu/usr.bin/cc/cc_int/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/cc/cc_int/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -75,10 +75,6 @@ OBJS-md+= ${GCC_CPU}-c.o # Target specific, C specific object file C_TARGET_OBJS= -.if ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN) -CFLAGS += -DTARGET_ENDIAN_DEFAULT=MASK_BIG_END -.endif - # Language-specific object files for C and Objective C. C_AND_OBJC_OBJS = attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o \ c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o \ Modified: user/imp/tbemd/gnu/usr.bin/cc/cc_tools/Makefile ============================================================================== --- user/imp/tbemd/gnu/usr.bin/cc/cc_tools/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/cc/cc_tools/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -22,13 +22,13 @@ LIBIBERTY= libiberty.a # The list of headers to go into tm.h # TARGET_INC+= options.h -.if ${TARGET_ARCH} == "amd64" +.if ${TARGET_CPUARCH} == "amd64" TARGET_INC+= i386/biarch64.h .endif -.if ${TARGET_ARCH} != "arm" +.if ${TARGET_CPUARCH} != "arm" TARGET_INC+= ${GCC_CPU}/${GCC_CPU}.h .endif -.if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64" +.if ${TARGET_CPUARCH} == "i386" || ${TARGET_CPUARCH} == "amd64" TARGET_INC+= ${GCC_CPU}/unix.h TARGET_INC+= ${GCC_CPU}/att.h .endif @@ -38,25 +38,25 @@ TARGET_INC+= elfos.h TARGET_INC+= freebsd-native.h TARGET_INC+= freebsd-spec.h TARGET_INC+= freebsd.h -.if ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "amd64" +.if ${TARGET_CPUARCH} != "i386" && ${TARGET_CPUARCH} != "amd64" . if exists(${GCCDIR}/config/${GCC_CPU}/sysv4.h) TARGET_INC+= ${GCC_CPU}/sysv4.h . endif .endif -.if ${TARGET_ARCH} == "amd64" +.if ${TARGET_CPUARCH} == "amd64" TARGET_INC+= ${GCC_CPU}/x86-64.h .endif -.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "mips" +.if ${TARGET_CPUARCH} == "arm" || ${TARGET_CPUARCH} == "mips" TARGET_INC+= ${GCC_CPU}/elf.h .endif -.if ${TARGET_ARCH} == "arm" +.if ${TARGET_CPUARCH} == "arm" TARGET_INC+= ${GCC_CPU}/aout.h .endif TARGET_INC+= ${GCC_CPU}/freebsd.h -.if ${TARGET_ARCH} == "amd64" +.if ${TARGET_CPUARCH} == "amd64" TARGET_INC+= ${GCC_CPU}/freebsd64.h .endif -.if ${TARGET_ARCH} == "arm" +.if ${TARGET_CPUARCH} == "arm" TARGET_INC+= ${GCC_CPU}/arm.h .endif TARGET_INC+= defaults.h @@ -171,11 +171,11 @@ OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/ OPT_FILES+= ${.CURDIR}/${GCC_CPU}-freebsd.opt .endif -.if ${TARGET_ARCH} == "powerpc" +.if ${TARGET_CPUARCH} == "powerpc" OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/sysv4.opt .endif -.if ${TARGET_ARCH} == "sparc64" +.if ${TARGET_CPUARCH} == "sparc64" OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/long-double-switch.opt .endif Modified: user/imp/tbemd/gnu/usr.bin/gdb/Makefile ============================================================================== --- user/imp/tbemd/gnu/usr.bin/gdb/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/gdb/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -2,7 +2,7 @@ SUBDIR= doc libgdb gdb gdbtui kgdb -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "powerpc" +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "powerpc" SUBDIR+=gdbserver .endif Modified: user/imp/tbemd/gnu/usr.bin/gdb/Makefile.inc ============================================================================== --- user/imp/tbemd/gnu/usr.bin/gdb/Makefile.inc Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/gdb/Makefile.inc Wed Feb 3 21:29:06 2010 (r203446) @@ -16,8 +16,16 @@ OBJ_ROOT= ${.OBJDIR}/../.. OBJ_BU= ${OBJ_ROOT}/binutils OBJ_GDB= ${OBJ_ROOT}/gdb -TARGET_ARCH?= ${MACHINE_ARCH} -TARGET_SUBDIR= ${BMAKE_GDB}/arch/${TARGET_ARCH} +# These assignments duplicate much of the functionality of +# MACHINE_CPUARCH, but there's no easy way to export make functions... + +.if defined(TARGET_ARCH) +TARGET_CPUARCH=${TARGET_ARCH:C/mipse[bl]/mips/:C/armeb/arm/} +.else +TARGET_CPUARCH=${MACHINE_CPUARCH} +.endif +TARGET_ARCH?= ${MACHINE_ARCH} +TARGET_SUBDIR= ${BMAKE_GDB}/arch/${TARGET_CPUARCH} .if ${TARGET_ARCH} != ${MACHINE_ARCH} GDB_CROSS_DEBUGGER= @@ -31,7 +39,7 @@ GDB_CROSS_DEBUGGER= CFLAGS+= -DHAVE_CONFIG_H -DRL_NO_COMPAT -DMI_OUT=1 -DTUI=1 CFLAGS+= -I. CFLAGS+= -I${TARGET_SUBDIR} -CFLAGS+= -I${BMAKE_BU}/libbfd -I${BMAKE_BU}/libbfd/${TARGET_ARCH} +CFLAGS+= -I${BMAKE_BU}/libbfd -I${BMAKE_BU}/libbfd/${TARGET_CPUARCH} CFLAGS+= -I${CNTRB_GDB}/gdb CFLAGS+= -I${CNTRB_GDB}/gdb/config CFLAGS+= -I${CNTRB_GDB}/include Modified: user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/Makefile ============================================================================== --- user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -14,19 +14,19 @@ SRCS= inferiors.c mem-break.c regcache.c server.c signals.c target.c utils.c SRCS+= fbsd-low.c -.if ${MACHINE_ARCH} == "i386" +.if ${MACHINE_CPUARCH} == "i386" SRCS+= fbsd-i386-low.c i387-fp.c reg-i386.c .endif -.if ${MACHINE_ARCH} == "arm" +.if ${MACHINE_CPUARCH} == "arm" SRCS+= fbsd-arm-low.c reg-arm.c .endif -.if ${MACHINE_ARCH} == "powerpc" +.if ${MACHINE_CPUARCH} == "powerpc" SRCS+= fbsd-ppc-low.c reg-ppc.c .endif -#CFLAGS+= -I${.CURDIR}/../arch/${MACHINE_ARCH} +#CFLAGS+= -I${.CURDIR}/../arch/${MACHINE_CPUARCH} CFLAGS+= -I${GDBDIR}/gdb/gdbserver CFLAGS+= -I${GDBDIR}/gdb/regformats CFLAGS+= -DNO_MMALLOC -DGDBSERVER Modified: user/imp/tbemd/gnu/usr.bin/gdb/libgdb/Makefile ============================================================================== --- user/imp/tbemd/gnu/usr.bin/gdb/libgdb/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/gnu/usr.bin/gdb/libgdb/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -1,6 +1,14 @@ # $FreeBSD$ -TARGET_ARCH?= ${MACHINE_ARCH} +# These assignments duplicate much of the functionality of +# MACHINE_CPUARCH, but there's no easy way to export make functions... + +.if defined(TARGET_ARCH) +TARGET_CPUARCH=${TARGET_ARCH:C/mipse[bl]/mips/:C/armeb/arm/} +.else +TARGET_CPUARCH=${MACHINE_CPUARCH} +.endif +TARGET_ARCH?= ${MACHINE_ARCH} LIB= gdb INTERNALLIB= Modified: user/imp/tbemd/include/Makefile ============================================================================== --- user/imp/tbemd/include/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/include/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -115,8 +115,8 @@ INCSLINKS+= machine/$i ${INCLUDEDIR}/$i INCSLINKS+= sys/$i ${INCLUDEDIR}/$i .endfor -.if ${MACHINE} != ${MACHINE_ARCH} -_MARCH=${MACHINE_ARCH} +.if ${MACHINE} != ${MACHINE_CPUARCH} +_MARCH=${MACHINE_CPUARCH} .endif .include Modified: user/imp/tbemd/lib/Makefile ============================================================================== --- user/imp/tbemd/lib/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -43,10 +43,10 @@ SUBDIR= ${_csu} libc libbsm libauditd li ${_libusbhid} ${_libusb} ${_libvgl} libwrap liby libz \ ${_bind} -.if exists(${.CURDIR}/csu/${MACHINE_ARCH}-elf) -_csu=csu/${MACHINE_ARCH}-elf -.elif exists(${.CURDIR}/csu/${MACHINE_ARCH}/Makefile) -_csu=csu/${MACHINE_ARCH} +.if exists(${.CURDIR}/csu/${MACHINE_CPUARCH}-elf) +_csu=csu/${MACHINE_CPUARCH}-elf +.elif exists(${.CURDIR}/csu/${MACHINE_CPUARCH}/Makefile) +_csu=csu/${MACHINE_CPUARCH} .else _csu=csu .endif @@ -95,7 +95,7 @@ _libnetgraph= libnetgraph _libypclnt= libypclnt .endif -.if ${MACHINE_ARCH} == "i386" +.if ${MACHINE_CPUARCH} == "i386" .if ${MK_NCP} != "no" _libncp= libncp .endif @@ -103,12 +103,12 @@ _libsmb= libsmb _libvgl= libvgl .endif -.if ${MACHINE_ARCH} == "ia64" +.if ${MACHINE_CPUARCH} == "ia64" _libefi= libefi _libsmb= libsmb .endif -.if ${MACHINE_ARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" .if ${MK_NCP} != "no" _libncp= libncp .endif @@ -116,11 +116,11 @@ _libsmb= libsmb _libvgl= libvgl .endif -.if ${MACHINE_ARCH} == "powerpc" +.if ${MACHINE_CPUARCH} == "powerpc" _libsmb= libsmb .endif -.if ${MACHINE_ARCH} == "sparc64" +.if ${MACHINE_CPUARCH} == "sparc64" _libsmb= libsmb .endif Modified: user/imp/tbemd/lib/bind/config.mk ============================================================================== --- user/imp/tbemd/lib/bind/config.mk Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/bind/config.mk Wed Feb 3 21:29:06 2010 (r203446) @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include # BIND version number .if defined(BIND_DIR) && exists(${BIND_DIR}/version) @@ -45,7 +46,7 @@ CFLAGS+= -DOPENSSL CFLAGS+= -DUSE_MD5 # Endianness -.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64" +.if ${TARGET_ENDIANNESS} == 4321 CFLAGS+= -DWORDS_BIGENDIAN .endif @@ -64,10 +65,10 @@ CFLAGS+= -I${LIB_BIND_DIR} .endif # Use the right version of the atomic.h file from lib/isc -.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" ISC_ATOMIC_ARCH= x86_32 .else -ISC_ATOMIC_ARCH= ${MACHINE_ARCH} +ISC_ATOMIC_ARCH= ${MACHINE_CPUARCH} .endif # Optional features Modified: user/imp/tbemd/lib/libc/Makefile ============================================================================== --- user/imp/tbemd/lib/libc/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/libc/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -15,7 +15,7 @@ LIB=c SHLIB_MAJOR= 7 WARNS?= 2 CFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include -CFLAGS+=-I${.CURDIR}/${MACHINE_ARCH} +CFLAGS+=-I${.CURDIR}/${MACHINE_CPUARCH} CFLAGS+=-DNLS CLEANFILES+=tags INSTALL_PIC_ARCHIVE= @@ -36,7 +36,7 @@ MDASM= MIASM= NOASM= -.include "${.CURDIR}/${MACHINE_ARCH}/Makefile.inc" +.include "${.CURDIR}/${MACHINE_CPUARCH}/Makefile.inc" .include "${.CURDIR}/db/Makefile.inc" .include "${.CURDIR}/compat-43/Makefile.inc" .include "${.CURDIR}/gdtoa/Makefile.inc" @@ -49,9 +49,9 @@ NOASM= .include "${.CURDIR}/net/Makefile.inc" .include "${.CURDIR}/nls/Makefile.inc" .include "${.CURDIR}/posix1e/Makefile.inc" -.if ${MACHINE_ARCH} != "amd64" && \ - ${MACHINE_ARCH} != "ia64" && \ - ${MACHINE_ARCH} != "sparc64" +.if ${MACHINE_CPUARCH} != "amd64" && \ + ${MACHINE_CPUARCH} != "ia64" && \ + ${MACHINE_CPUARCH} != "sparc64" .include "${.CURDIR}/quad/Makefile.inc" .endif .include "${.CURDIR}/regex/Makefile.inc" @@ -64,7 +64,7 @@ NOASM= .include "${.CURDIR}/rpc/Makefile.inc" .include "${.CURDIR}/uuid/Makefile.inc" .include "${.CURDIR}/xdr/Makefile.inc" -.if ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "mips" +.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips" .include "${.CURDIR}/softfloat/Makefile.inc" .endif .if ${MK_NIS} != "no" @@ -109,16 +109,16 @@ KQSRCS= adddi3.c anddi3.c ashldi3.c ashr KSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c index.c mcount.c rindex.c \ strcat.c strcmp.c strcpy.c strlen.c strncpy.c -libkern: libkern.gen libkern.${MACHINE_ARCH} +libkern: libkern.gen libkern.${MACHINE_CPUARCH} libkern.gen: ${KQSRCS} ${KSRCS} cp -p ${.CURDIR}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern -libkern.${MACHINE_ARCH}:: ${KMSRCS} +libkern.${MACHINE_CPUARCH}:: ${KMSRCS} .if defined(KMSRCS) && !empty(KMSRCS) - cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${MACHINE_ARCH} + cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${MACHINE_CPUARCH} .endif - + .include # Disable warnings in contributed sources. Modified: user/imp/tbemd/lib/libc/compat-43/Makefile.inc ============================================================================== --- user/imp/tbemd/lib/libc/compat-43/Makefile.inc Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/libc/compat-43/Makefile.inc Wed Feb 3 21:29:06 2010 (r203446) @@ -2,7 +2,7 @@ # $FreeBSD$ # compat-43 sources -.PATH: ${.CURDIR}/${MACHINE_ARCH}/compat-43 ${.CURDIR}/compat-43 +.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/compat-43 ${.CURDIR}/compat-43 SRCS+= creat.c gethostid.c getwd.c killpg.c sethostid.c setpgrp.c \ setrgid.c setruid.c sigcompat.c Modified: user/imp/tbemd/lib/libc/gen/Makefile.inc ============================================================================== --- user/imp/tbemd/lib/libc/gen/Makefile.inc Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/libc/gen/Makefile.inc Wed Feb 3 21:29:06 2010 (r203446) @@ -2,7 +2,7 @@ # $FreeBSD$ # machine-independent gen sources -.PATH: ${.CURDIR}/${MACHINE_ARCH}/gen ${.CURDIR}/gen +.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/gen ${.CURDIR}/gen SRCS+= __getosreldate.c __xuname.c \ _once_stub.c _pthread_stubs.c _rand48.c _spinlock_stub.c \ @@ -38,8 +38,8 @@ SRCS+= __getosreldate.c __xuname.c \ SYM_MAPS+=${.CURDIR}/gen/Symbol.map # machine-dependent gen sources -.if exists(${.CURDIR}/${MACHINE_ARCH}/gen/Makefile.inc) -.include "${.CURDIR}/${MACHINE_ARCH}/gen/Makefile.inc" +.if exists(${.CURDIR}/${MACHINE_CPUARCH}/gen/Makefile.inc) +.include "${.CURDIR}/${MACHINE_CPUARCH}/gen/Makefile.inc" .endif MAN+= alarm.3 arc4random.3 \ Modified: user/imp/tbemd/lib/libc/locale/Makefile.inc ============================================================================== --- user/imp/tbemd/lib/libc/locale/Makefile.inc Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/libc/locale/Makefile.inc Wed Feb 3 21:29:06 2010 (r203446) @@ -2,7 +2,7 @@ # $FreeBSD$ # locale sources -.PATH: ${.CURDIR}/${MACHINE_ARCH}/locale ${.CURDIR}/locale +.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/locale ${.CURDIR}/locale SRCS+= ascii.c big5.c btowc.c collate.c collcmp.c euc.c fix_grouping.c \ gb18030.c gb2312.c gbk.c isctype.c iswctype.c \ Modified: user/imp/tbemd/lib/libc/quad/Makefile.inc ============================================================================== --- user/imp/tbemd/lib/libc/quad/Makefile.inc Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/libc/quad/Makefile.inc Wed Feb 3 21:29:06 2010 (r203446) @@ -2,9 +2,9 @@ # $FreeBSD$ # Quad support, if needed -.PATH: ${.CURDIR}/${MACHINE_ARCH}/quad ${.CURDIR}/quad +.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/quad ${.CURDIR}/quad -.if ${MACHINE_ARCH} == "i386" +.if ${MACHINE_CPUARCH} == "i386" SRCS+= cmpdi2.c divdi3.c moddi3.c qdivrem.c ucmpdi2.c udivdi3.c umoddi3.c Modified: user/imp/tbemd/lib/libc/softfloat/Makefile.inc ============================================================================== --- user/imp/tbemd/lib/libc/softfloat/Makefile.inc Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/libc/softfloat/Makefile.inc Wed Feb 3 21:29:06 2010 (r203446) @@ -2,10 +2,10 @@ # $FreeBSD$ SOFTFLOAT_BITS?=64 -.PATH: ${MACHINE_ARCH}/softfloat \ +.PATH: ${MACHINE_CPUARCH}/softfloat \ ${.CURDIR}/softfloat/bits${SOFTFLOAT_BITS} ${.CURDIR}/softfloat -CFLAGS+= -I${.CURDIR}/${MACHINE_ARCH}/softfloat -I${.CURDIR}/softfloat +CFLAGS+= -I${.CURDIR}/${MACHINE_CPUARCH}/softfloat -I${.CURDIR}/softfloat CFLAGS+= -DSOFTFLOAT_FOR_GCC SRCS+= softfloat.c Modified: user/imp/tbemd/lib/libc/stdlib/Makefile.inc ============================================================================== --- user/imp/tbemd/lib/libc/stdlib/Makefile.inc Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/libc/stdlib/Makefile.inc Wed Feb 3 21:29:06 2010 (r203446) @@ -2,7 +2,7 @@ # $FreeBSD$ # machine-independent stdlib sources -.PATH: ${.CURDIR}/${MACHINE_ARCH}/stdlib ${.CURDIR}/stdlib +.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/stdlib ${.CURDIR}/stdlib MISRCS+=_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ bsearch.c div.c exit.c getenv.c getopt.c getopt_long.c \ @@ -16,7 +16,7 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c ate SYM_MAPS+= ${.CURDIR}/stdlib/Symbol.map # machine-dependent stdlib sources -.sinclude "${.CURDIR}/${MACHINE_ARCH}/stdlib/Makefile.inc" +.sinclude "${.CURDIR}/${MACHINE_CPUARCH}/stdlib/Makefile.inc" MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \ div.3 exit.3 getenv.3 getopt.3 getopt_long.3 getsubopt.3 \ Modified: user/imp/tbemd/lib/libc/string/Makefile.inc ============================================================================== --- user/imp/tbemd/lib/libc/string/Makefile.inc Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/libc/string/Makefile.inc Wed Feb 3 21:29:06 2010 (r203446) @@ -1,7 +1,7 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # $FreeBSD$ -.PATH: ${.CURDIR}/${MACHINE_ARCH}/string ${.CURDIR}/string +.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/string ${.CURDIR}/string CFLAGS+= -I${.CURDIR}/locale @@ -26,8 +26,8 @@ SYM_MAPS+= ${.CURDIR}/string/Symbol.map # machine-dependent string sources -.if exists(${.CURDIR}/${MACHINE_ARCH}/string/Makefile.inc) -.include "${.CURDIR}/${MACHINE_ARCH}/string/Makefile.inc" +.if exists(${.CURDIR}/${MACHINE_CPUARCH}/string/Makefile.inc) +.include "${.CURDIR}/${MACHINE_CPUARCH}/string/Makefile.inc" .endif MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \ Modified: user/imp/tbemd/lib/libc/sys/Makefile.inc ============================================================================== --- user/imp/tbemd/lib/libc/sys/Makefile.inc Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/libc/sys/Makefile.inc Wed Feb 3 21:29:06 2010 (r203446) @@ -2,7 +2,7 @@ # $FreeBSD$ # sys sources -.PATH: ${.CURDIR}/${MACHINE_ARCH}/sys ${.CURDIR}/sys +.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/sys ${.CURDIR}/sys # Include the generated makefile containing the *complete* list # of syscall names in MIASM. @@ -13,8 +13,8 @@ # MDASM names override the default syscall names in MIASM. # NOASM will prevent the default syscall code from being generated. # -.if exists(${.CURDIR}/${MACHINE_ARCH}/sys/Makefile.inc) -.include "${.CURDIR}/${MACHINE_ARCH}/sys/Makefile.inc" +.if exists(${.CURDIR}/${MACHINE_CPUARCH}/sys/Makefile.inc) +.include "${.CURDIR}/${MACHINE_CPUARCH}/sys/Makefile.inc" .endif # Sources common to both syscall interfaces: Modified: user/imp/tbemd/lib/libc_r/sys/Makefile.inc ============================================================================== --- user/imp/tbemd/lib/libc_r/sys/Makefile.inc Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/libc_r/sys/Makefile.inc Wed Feb 3 21:29:06 2010 (r203446) @@ -1,6 +1,6 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/sys ${.CURDIR}/arch/${MACHINE_ARCH} +.PATH: ${.CURDIR}/sys ${.CURDIR}/arch/${MACHINE_CPUARCH} SRCS+= uthread_error.c _atomic_lock.S Modified: user/imp/tbemd/lib/libcompat/Makefile ============================================================================== --- user/imp/tbemd/lib/libcompat/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/libcompat/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -7,9 +7,9 @@ NO_PIC= WARNS?= 1 -.PATH: ${.CURDIR}/4.1/${MACHINE_ARCH} ${.CURDIR}/4.1 \ - ${.CURDIR}/4.3/${MACHINE_ARCH} ${.CURDIR}/4.3 \ - ${.CURDIR}/4.4/${MACHINE_ARCH} ${.CURDIR}/4.4 \ +.PATH: ${.CURDIR}/4.1/${MACHINE_CPUARCH} ${.CURDIR}/4.1 \ + ${.CURDIR}/4.3/${MACHINE_CPUARCH} ${.CURDIR}/4.3 \ + ${.CURDIR}/4.4/${MACHINE_CPUARCH} ${.CURDIR}/4.4 \ ${.CURDIR}/regexp # compat 4.1 sources Modified: user/imp/tbemd/lib/libdisk/Makefile ============================================================================== --- user/imp/tbemd/lib/libdisk/Makefile Wed Feb 3 21:26:54 2010 (r203445) +++ user/imp/tbemd/lib/libdisk/Makefile Wed Feb 3 21:29:06 2010 (r203446) @@ -1,6 +1,6 @@ # $FreeBSD$ -.if ${MACHINE_ARCH} == "ia64" +.if ${MACHINE_CPUARCH} == "ia64" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Wed Feb 3 22:08:26 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B118106566C; Wed, 3 Feb 2010 22:08:26 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A5E58FC0C; Wed, 3 Feb 2010 22:08:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o13M8Qir022258; Wed, 3 Feb 2010 22:08:26 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o13M8Q35022252; Wed, 3 Feb 2010 22:08:26 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002032208.o13M8Q35022252@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 3 Feb 2010 22:08:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203452 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2010 22:08:26 -0000 Author: luigi Date: Wed Feb 3 22:08:25 2010 New Revision: 203452 URL: http://svn.freebsd.org/changeset/base/203452 Log: portability fixes -- make this code build under Linux and Windows Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_log.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_table.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Wed Feb 3 22:07:50 2010 (r203451) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Wed Feb 3 22:08:25 2010 (r203452) @@ -57,7 +57,7 @@ typedef unsigned long bitmap; * bitmaps ops are critical. Some linux versions have __fls * and the bitmap ops. Some machines have ffs */ -#if !defined(_KERNEL) || defined( __FreeBSD__ ) +#if !defined(_KERNEL) || defined( __FreeBSD__ ) || defined(_WIN32) static inline unsigned long __fls(unsigned long word) { return fls(word) - 1; @@ -92,6 +92,10 @@ void __clear_bit(int ix, bitmap *p) #endif /* !QFQ_DEBUG */ #endif /* !__linux__ */ +#ifdef __MIPSEL__ +#define __clear_bit(ix, pData) (*pData) &= ~(1<<(ix)) +#endif + /*-------------------------------------------*/ /* Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Wed Feb 3 22:07:50 2010 (r203451) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Wed Feb 3 22:08:25 2010 (r203452) @@ -155,11 +155,13 @@ SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUT SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, verbose_limit, CTLFLAG_RW, &VNET_NAME(verbose_limit), 0, "Set upper limit of matches of ipfw rules logged"); +uint32_t dummy_def = IPFW_DEFAULT_RULE; SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, default_rule, CTLFLAG_RD, - NULL, IPFW_DEFAULT_RULE, + &dummy_def, 0, "The default/max possible rule number."); +uint32_t dummy_tables_max = IPFW_TABLES_MAX; SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, tables_max, CTLFLAG_RD, - NULL, IPFW_TABLES_MAX, + &dummy_tables_max, 0, "The maximum number of tables."); SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, default_to_accept, CTLFLAG_RDTUN, &default_to_accept, 0, @@ -344,6 +346,7 @@ iface_match(struct ifnet *ifp, ipfw_insn return(1); } } else { +#ifdef __FreeBSD__ /* and OSX too ? */ struct ifaddr *ia; if_addr_rlock(ifp); @@ -357,6 +360,7 @@ iface_match(struct ifnet *ifp, ipfw_insn } } if_addr_runlock(ifp); +#endif /* __FreeBSD__ */ } return(0); /* no match, fail ... */ } @@ -385,6 +389,9 @@ iface_match(struct ifnet *ifp, ipfw_insn static int verify_path(struct in_addr src, struct ifnet *ifp, u_int fib) { +#ifndef __FreeBSD__ + return 0; +#else struct route ro; struct sockaddr_in *dst; @@ -427,6 +434,7 @@ verify_path(struct in_addr src, struct i /* found valid route */ RTFREE(ro.ro_rt); return 1; +#endif /* __FreeBSD__ */ } #ifdef INET6 @@ -634,9 +642,14 @@ send_reject(struct ip_fw_args *args, int static int check_uidgid(ipfw_insn_u32 *insn, int proto, struct ifnet *oif, struct in_addr dst_ip, u_int16_t dst_port, struct in_addr src_ip, - u_int16_t src_port, struct ucred **uc, int *ugid_lookupp, - struct inpcb *inp) + u_int16_t src_port, int *ugid_lookupp, + struct ucred **uc, struct inpcb *inp) { +#ifndef __FreeBSD__ + return cred_check(insn, proto, oif, + dst_ip, dst_port, src_ip, src_port, + (struct bsd_ucred *)uc, ugid_lookupp, ((struct mbuf *)inp)->m_skb); +#else /* FreeBSD */ struct inpcbinfo *pi; int wildcard; struct inpcb *pcb; @@ -703,6 +716,7 @@ check_uidgid(ipfw_insn_u32 *insn, int pr else if (insn->o.opcode == O_JAIL) match = ((*uc)->cr_prison->pr_id == (int)insn->d[0]); return match; +#endif /* __FreeBSD__ */ } /* @@ -794,7 +808,11 @@ ipfw_chk(struct ip_fw_args *args) * these types of constraints, as well as decrease contention * on pcb related locks. */ +#ifndef __FreeBSD__ + struct bsd_ucred ucred_cache; +#else struct ucred *ucred_cache = NULL; +#endif int ucred_lookup = 0; /* @@ -1233,8 +1251,13 @@ do { \ (ipfw_insn_u32 *)cmd, proto, oif, dst_ip, dst_port, - src_ip, src_port, &ucred_cache, - &ucred_lookup, args->inp); + src_ip, src_port, &ucred_lookup, +#ifdef __FreeBSD__ + &ucred_cache, args->inp); +#else + (void *)&ucred_cache, + (struct inpcb *)args->m); +#endif break; case O_RECV: @@ -1348,13 +1371,22 @@ do { \ (ipfw_insn_u32 *)cmd, proto, oif, dst_ip, dst_port, - src_ip, src_port, &ucred_cache, - &ucred_lookup, args->inp); + src_ip, src_port, &ucred_lookup, +#ifdef __FreeBSD__ + &ucred_cache, args->inp); if (v == 4 /* O_UID */) key = ucred_cache->cr_uid; else if (v == 5 /* O_JAIL */) key = ucred_cache->cr_prison->pr_id; key = htonl(key); +#else /* !__FreeBSD__ */ + (void *)&ucred_cache, + (struct inpcb *)args->m); + if (v ==4 /* O_UID */) + key = ucred_cache.uid; + else if (v == 5 /* O_JAIL */) + key = ucred_cache.xid; +#endif /* !__FreeBSD__ */ } else break; } @@ -1390,7 +1422,13 @@ do { \ INADDR_TO_IFP(src_ip, tif); match = (tif != NULL); + break; } +#ifdef INET6 + /* FALLTHROUGH */ + case O_IP6_SRC_ME: + match= is_ipv6 && search_ip6_addr_net(&args->f_id.src_ip6); +#endif break; case O_IP_DST_SET: @@ -1423,9 +1461,16 @@ do { \ INADDR_TO_IFP(dst_ip, tif); match = (tif != NULL); + break; } +#ifdef INET6 + /* FALLTHROUGH */ + case O_IP6_DST_ME: + match= is_ipv6 && search_ip6_addr_net(&args->f_id.dst_ip6); +#endif break; + case O_IP_SRCPORT: case O_IP_DSTPORT: /* @@ -1691,14 +1736,6 @@ do { \ } break; - case O_IP6_SRC_ME: - match= is_ipv6 && search_ip6_addr_net(&args->f_id.src_ip6); - break; - - case O_IP6_DST_ME: - match= is_ipv6 && search_ip6_addr_net(&args->f_id.dst_ip6); - break; - case O_FLOW6ID: match = is_ipv6 && flow6id_match(args->f_id.flow_id6, @@ -2158,8 +2195,10 @@ do { \ printf("ipfw: ouch!, skip past end of rules, denying packet\n"); } IPFW_RUNLOCK(chain); +#ifdef __FreeBSD__ if (ucred_cache != NULL) crfree(ucred_cache); +#endif return (retval); pullup_failed: Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c Wed Feb 3 22:07:50 2010 (r203451) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c Wed Feb 3 22:08:25 2010 (r203452) @@ -128,7 +128,11 @@ static VNET_DEFINE(struct callout, ipfw_ #define V_ipfw_timeout VNET(ipfw_timeout) static uma_zone_t ipfw_dyn_rule_zone; +#ifndef __FreeBSD__ +DEFINE_SPINLOCK(ipfw_dyn_mtx); +#else static struct mtx ipfw_dyn_mtx; /* mutex guarding dynamic rules */ +#endif #define IPFW_DYN_LOCK_INIT() \ mtx_init(&ipfw_dyn_mtx, "IPFW dynamic rules", NULL, MTX_DEF) @@ -884,6 +888,9 @@ struct mbuf * ipfw_send_pkt(struct mbuf *replyto, struct ipfw_flow_id *id, u_int32_t seq, u_int32_t ack, int flags) { +#ifndef __FreeBSD__ + return NULL; +#else struct mbuf *m; int len, dir; struct ip *h = NULL; /* stupid compiler */ @@ -1020,6 +1027,7 @@ ipfw_send_pkt(struct mbuf *replyto, stru } return (m); +#endif /* __FreeBSD__ */ } /* Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_log.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_log.c Wed Feb 3 22:07:50 2010 (r203451) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_log.c Wed Feb 3 22:08:25 2010 (r203452) @@ -413,6 +413,7 @@ ipfw_log(struct ip_fw *f, u_int hlen, st (ipoff & IP_MF) ? "+" : ""); } } +#ifdef __FreeBSD__ if (oif || m->m_pkthdr.rcvif) log(LOG_SECURITY | LOG_INFO, "ipfw: %d %s %s %s via %s%s\n", @@ -421,6 +422,7 @@ ipfw_log(struct ip_fw *f, u_int hlen, st oif ? oif->if_xname : m->m_pkthdr.rcvif->if_xname, fragment); else +#endif log(LOG_SECURITY | LOG_INFO, "ipfw: %d %s %s [no if info]%s\n", f ? f->rulenum : -1, Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_table.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_table.c Wed Feb 3 22:07:50 2010 (r203451) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_table.c Wed Feb 3 22:08:25 2010 (r203452) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include /* struct ipfw_rule_ref */ #include +#include /* LIST_HEAD */ #include #ifdef MAC From owner-svn-src-user@FreeBSD.ORG Wed Feb 3 22:19:23 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0232E106568F; Wed, 3 Feb 2010 22:19:23 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E6BB68FC0A; Wed, 3 Feb 2010 22:19:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o13MJMXk024759; Wed, 3 Feb 2010 22:19:22 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o13MJMbk024757; Wed, 3 Feb 2010 22:19:22 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002032219.o13MJMbk024757@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 3 Feb 2010 22:19:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203454 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2010 22:19:23 -0000 Author: luigi Date: Wed Feb 3 22:19:22 2010 New Revision: 203454 URL: http://svn.freebsd.org/changeset/base/203454 Log: misplaced line Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Wed Feb 3 22:17:30 2010 (r203453) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Wed Feb 3 22:19:22 2010 (r203454) @@ -1378,7 +1378,6 @@ do { \ key = ucred_cache->cr_uid; else if (v == 5 /* O_JAIL */) key = ucred_cache->cr_prison->pr_id; - key = htonl(key); #else /* !__FreeBSD__ */ (void *)&ucred_cache, (struct inpcb *)args->m); @@ -1387,6 +1386,7 @@ do { \ else if (v == 5 /* O_JAIL */) key = ucred_cache.xid; #endif /* !__FreeBSD__ */ + key = htonl(key); } else break; } From owner-svn-src-user@FreeBSD.ORG Wed Feb 3 23:06:26 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E859106566B for ; Wed, 3 Feb 2010 23:06:26 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from mail.icecube.wisc.edu (trout.icecube.wisc.edu [128.104.255.119]) by mx1.freebsd.org (Postfix) with ESMTP id 613C58FC1A for ; Wed, 3 Feb 2010 23:06:26 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.icecube.wisc.edu (Postfix) with ESMTP id A6981582BD; Wed, 3 Feb 2010 16:34:48 -0600 (CST) X-Virus-Scanned: amavisd-new at icecube.wisc.edu Received: from mail.icecube.wisc.edu ([127.0.0.1]) by localhost (trout.icecube.wisc.edu [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id OZypvfokBk8B; Wed, 3 Feb 2010 16:34:48 -0600 (CST) Received: from wanderer.tachypleus.net (i3-dhcp-172-16-55-200.icecube.wisc.edu [172.16.55.200]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 859B6582A5; Wed, 3 Feb 2010 16:34:48 -0600 (CST) Message-ID: <4B69FA08.2070308@freebsd.org> Date: Wed, 03 Feb 2010 16:34:48 -0600 From: Nathan Whitehorn User-Agent: Thunderbird 2.0.0.23 (X11/20091207) MIME-Version: 1.0 To: Warner Losh References: <201002032129.o13LT7kZ013039@svn.freebsd.org> In-Reply-To: <201002032129.o13LT7kZ013039@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r203446 - in user/imp/tbemd: . bin/pax cddl/lib/libdtrace cddl/lib/libzpool contrib/smbfs etc games/morse gnu/lib/csu gnu/lib/libgcc gnu/lib/libgomp gnu/lib/libstdc++ gnu/usr.bin gnu/us... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2010 23:06:26 -0000 Warner Losh wrote: > Author: imp > Date: Wed Feb 3 21:29:06 2010 > New Revision: 203446 > URL: http://svn.freebsd.org/changeset/base/203446 > > Log: > Introduce MACHINE_CPUARCH. > > MACHINE is the specific kernel architecture for this machine. > MACHINE_ARCH is the specific CPU type (abi, word size, etc). > MACHINE_CPUARCH is the family of CPUs that's supported. > > Most of the tree conflates MACHINE_ARCH and MACHINE_CPUARCH since > historically they have been identical. However, there's now a reason > to to split the two concepts. NetBSD calls this MACHINE_CPU, but > that's already used for something else in FreeBSD, so MACHINE_CPUARCH > was selected instead. > > However, the sources in the tree have had a KLUDGE in the tree called > TARGET_BIG_ENDIAN to select which endian to compile the code for. > However, this is a cumbersome and awkward solution. MACHINE_ARCH > really does need to be different for different endian because users > use it for things like their path. Yet, the source tree also used > MACHINE_ARCH to figure out the MD code to use. This source often > supports multiple MACHINE_ARCHs. 'mips' supports 32 (and soon 64) bit > word sizes as well as big and little endian. 'arm' support both > endians. powerpc will soon support both 32-bit and 64-bit. > > These patches start to unwind this confusion. It implements > MACHINE_ARCH of mipsel, mipseb for the two endians of MIPS, as well as > arm and armeb for ARM. The names for ARM are historical accidents > (ARM was primarily little endian until relatively recently). These > names follow the NetBSD convetions. > > With these changes, "make buildworld TARGET=mips TARGET_ARCH=mipsel" > finishes. armeb and mipseb should work, but haven't been tested yet. > > Committed as one big chunk so that people can comment on the patches > as a whole and suggest improvements. > > Thanks for this! How does this work for ABIs? For big vs. little endian, most if not all of the userland support code is invariant. But in the 64/32 bit case, 32 and 64-bit PowerPC have wildly differing ABIs, to the point that there is extremely little overlap in the support code for things like libc and RTLD, and it doesn't make much sense to point them at the same directories. Should MACHINE_CPUARCH be different here, or is it worth introducing something like MACHINE_ABI as well? I suppose there are also individual hacks in Makefiles... -Nathan From owner-svn-src-user@FreeBSD.ORG Wed Feb 3 23:17:47 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B9D1106566B; Wed, 3 Feb 2010 23:17:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B23A8FC0A; Wed, 3 Feb 2010 23:17:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o13NHlju037665; Wed, 3 Feb 2010 23:17:47 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o13NHlK3037663; Wed, 3 Feb 2010 23:17:47 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201002032317.o13NHlK3037663@svn.freebsd.org> From: Warner Losh Date: Wed, 3 Feb 2010 23:17:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203457 - user/imp/tbemd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2010 23:17:47 -0000 Author: imp Date: Wed Feb 3 23:17:47 2010 New Revision: 203457 URL: http://svn.freebsd.org/changeset/base/203457 Log: Now that you can do builds of BOTH endians at once, you need to have MACHINE_ARCH in the path. But you also need MACHINE for the i386/pc98 case. So use both. This lets mipseb and mipsel be done at the same time into the same MAKEOBJDIRPREFIX tree... Modified: user/imp/tbemd/Makefile.inc1 Modified: user/imp/tbemd/Makefile.inc1 ============================================================================== --- user/imp/tbemd/Makefile.inc1 Wed Feb 3 22:31:51 2010 (r203456) +++ user/imp/tbemd/Makefile.inc1 Wed Feb 3 23:17:47 2010 (r203457) @@ -166,7 +166,7 @@ BUILD_ARCH!= uname -p .if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING) OBJTREE= ${MAKEOBJDIRPREFIX} .else -OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET} +OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} .endif WORLDTMP= ${OBJTREE}${.CURDIR}/tmp # /usr/games added for fortune which depend on strfile From owner-svn-src-user@FreeBSD.ORG Wed Feb 3 23:51:00 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD16A106566B; Wed, 3 Feb 2010 23:51:00 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 930758FC08; Wed, 3 Feb 2010 23:51:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o13Np0xM044957; Wed, 3 Feb 2010 23:51:00 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o13Np0aM044956; Wed, 3 Feb 2010 23:51:00 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002032351.o13Np0aM044956@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Feb 2010 23:51:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203458 - user/kmacy/head_flowtable_v6 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2010 23:51:00 -0000 Author: kmacy Date: Wed Feb 3 23:51:00 2010 New Revision: 203458 URL: http://svn.freebsd.org/changeset/base/203458 Log: create temporary branching for updating flowtable Added: - copied from r203457, head/ Directory Properties: user/kmacy/head_flowtable_v6/ (props changed) From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 00:11:34 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1C9B106566C; Thu, 4 Feb 2010 00:11:34 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FA168FC0C; Thu, 4 Feb 2010 00:11:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o140BYLk049630; Thu, 4 Feb 2010 00:11:34 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o140BYtJ049626; Thu, 4 Feb 2010 00:11:34 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002040011.o140BYtJ049626@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Feb 2010 00:11:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203462 - in user/kmacy/head_flowtable_v6/sys: net netinet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 00:11:34 -0000 Author: kmacy Date: Thu Feb 4 00:11:34 2010 New Revision: 203462 URL: http://svn.freebsd.org/changeset/base/203462 Log: add IPv6 support to flowtable Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c user/kmacy/head_flowtable_v6/sys/net/flowtable.h user/kmacy/head_flowtable_v6/sys/netinet/ip_output.c Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Wed Feb 3 23:59:52 2010 (r203461) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Thu Feb 4 00:11:34 2010 (r203462) @@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. #include "opt_route.h" #include "opt_mpath.h" #include "opt_ddb.h" +#include "opt_inet.h" +#include "opt_inet6.h" #include __FBSDID("$FreeBSD$"); @@ -63,6 +65,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef INET6 +#include +#endif #include #include #include @@ -342,45 +347,123 @@ flowtable_pcpu_unlock(struct flowtable * #define FL_ENTRY_LOCK(table, hash) (table)->ft_lock((table), (hash)) #define FL_ENTRY_UNLOCK(table, hash) (table)->ft_unlock((table), (hash)) -#define FL_STALE (1<<8) -#define FL_IPV6 (1<<9) +#define FL_STALE (1<<8) +#define FL_IPV6 (1<<9) +#define FL_OVERWRITE (1<<10) +#define FL_TCP (1<<11) +#define FL_SCTP (1<<12) +#define FL_UDP (1<<13) -static uint32_t -ipv4_flow_lookup_hash_internal(struct mbuf *m, struct route *ro, - uint32_t *key, uint16_t *flags, uint8_t *protop) +void +flow_invalidate(struct flentry *fle) { - uint16_t sport = 0, dport = 0; - struct ip *ip = NULL; - uint8_t proto = 0; - int iphlen; - uint32_t hash; - struct sockaddr_in *sin; - struct tcphdr *th; - struct udphdr *uh; - struct sctphdr *sh; - if ((V_flowtable_enable == 0) || (V_flowtable_ready == 0)) - return (0); + fle->f_flags |= FL_STALE; +} + +static __inline int +proto_to_flags(uint8_t proto) +{ + int flag; + + switch (proto) { + case IPPROTO_TCP: + flag = FL_TCP; + break; + case IPPROTO_SCTP: + flag = FL_SCTP; + break; + case IPPROTO_UDP: + flag = FL_UDP; + break; + default: + flag = 0; + break; + } + + return (flag); +} + +static __inline int +flags_to_proto(int flags) +{ + int proto, protoflags; + + protoflags = flags & (FL_TCP|FL_SCTP|FL_UDP); + switch (protoflags) { + case FL_TCP: + proto = IPPROTO_TCP; + break; + case FL_SCTP: + proto = IPPROTO_SCTP; + break; + case FL_UDP: + proto = IPPROTO_UDP; + break; + default: + proto = 0; + break; + } + return (proto); +} + +void +flow_to_route(struct flentry *fle, struct route *ro) +{ + struct sockaddr_in *sin = NULL; + struct sockaddr_in6 *sin6 = NULL; + uint32_t *hashkey; + +#ifdef INET6 + if (fle->f_flags & FL_IPV6) { + sin6 = (struct sockaddr_in6 *)&ro->ro_dst; + + sin6->sin6_family = AF_INET6; + sin6->sin6_len = sizeof(*sin); + hashkey = ((struct flentry_v6 *)fle)->fl_flow.ipf_key; + memcpy(&sin6->sin6_addr, &hashkey[1], sizeof (struct in6_addr)); + } else +#endif +#ifdef INET + { + sin = (struct sockaddr_in *)&ro->ro_dst; - key[1] = key[0] = 0; - sin = (struct sockaddr_in *)&ro->ro_dst; - if (m != NULL) { - ip = mtod(m, struct ip *); sin->sin_family = AF_INET; sin->sin_len = sizeof(*sin); - sin->sin_addr = ip->ip_dst; - } else - *flags &= ~FL_HASH_PORTS; + hashkey = ((struct flentry_v4 *)fle)->fl_flow.ipf_key; + sin->sin_addr.s_addr = hashkey[1]; + } +#endif + ; /* terminate INET6 else if no INET4 */ + ro->ro_rt = __DEVOLATILE(struct rtentry *, fle->f_rt); + ro->ro_lle = __DEVOLATILE(struct llentry *, fle->f_lle); +} - key[2] = sin->sin_addr.s_addr; +#ifdef INET +static int +ipv4_mbuf_demarshal(struct mbuf *m, struct sockaddr_in *ssin, + struct sockaddr_in *dsin, uint16_t *flags) +{ + struct ip *ip; + uint8_t proto; + int iphlen; + struct tcphdr *th; + struct udphdr *uh; + struct sctphdr *sh; + uint16_t sport, dport; - if ((*flags & FL_HASH_PORTS) == 0) - goto skipports; + sport = dport = 0; + ip = mtod(m, struct ip *); + dsin->sin_family = AF_INET; + dsin->sin_len = sizeof(*dsin); + dsin->sin_addr = ip->ip_dst; + ssin->sin_family = AF_INET; + ssin->sin_len = sizeof(*dsin); + ssin->sin_addr = ip->ip_dst; proto = ip->ip_p; iphlen = ip->ip_hl << 2; /* XXX options? */ - key[1] = ip->ip_src.s_addr; - + switch (proto) { case IPPROTO_TCP: th = (struct tcphdr *)((caddr_t)ip + iphlen); @@ -401,38 +484,244 @@ ipv4_flow_lookup_hash_internal(struct mb dport = sh->dest_port; break; default: - if (*flags & FL_HASH_PORTS) - goto noop; + return (ENOTSUP); /* no port - hence not a protocol we care about */ break; } - *protop = proto; - /* - * If this is a transmit route cache then - * hash all flows to a given destination to - * the same bucket - */ - if ((*flags & FL_HASH_PORTS) == 0) - proto = sport = dport = 0; + *flags |= proto_to_flags(proto); + ssin->sin_port = sport; + dsin->sin_port = dport; + return (0); +} - ((uint16_t *)key)[0] = sport; - ((uint16_t *)key)[1] = dport; +static uint32_t +ipv4_flow_lookup_hash_internal( + struct sockaddr_in *ssin, struct sockaddr_in *dsin, + uint32_t *key, uint16_t flags) +{ + uint16_t sport, dport; + uint8_t proto; -skipports: - hash = jenkins_hashword(key, 3, V_flow_hashjitter + proto); - if (m != NULL && (m->m_flags & M_FLOWID) == 0) { - m->m_flags |= M_FLOWID; - m->m_pkthdr.flowid = hash; + if ((V_flowtable_enable == 0) || (V_flowtable_ready == 0)) + return (0); + + proto = flags_to_proto(flags); + sport = dport = key[2] = key[1] = key[0] = 0; + if (dsin != NULL) { + key[1] = dsin->sin_addr.s_addr; + dport = dsin->sin_port; + } + if ((ssin != NULL) && (flags & FL_HASH_ALL)) { + key[2] = ssin->sin_addr.s_addr; + sport = ssin->sin_port; + } + if (flags & FL_HASH_ALL) { + ((uint16_t *)key)[0] = sport; + ((uint16_t *)key)[1] = dport; + } + + return (jenkins_hashword(key, 3, V_flow_hashjitter + proto)); +} + +static struct flentry * +flowtable_lookup_mbuf4(struct flowtable *ft, struct mbuf *m) +{ + struct sockaddr ssa, dsa; + uint16_t flags; + struct sockaddr_in *dsin, *ssin; + + dsin = (struct sockaddr_in *)&dsa; + ssin = (struct sockaddr_in *)&ssa; + flags = 0; + if (ipv4_mbuf_demarshal(m, ssin, dsin, &flags) != 0) + return (NULL); + + return (flowtable_lookup(ft, &ssa, &dsa, M_GETFIB(m), flags)); +} +#endif /* INET */ + +#ifdef INET6 +/* + * PULLUP_TO(len, p, T) makes sure that len + sizeof(T) is contiguous, + * then it sets p to point at the offset "len" in the mbuf. WARNING: the + * pointer might become stale after other pullups (but we never use it + * this way). + */ +#define PULLUP_TO(_len, p, T) \ +do { \ + int x = (_len) + sizeof(T); \ + if ((m)->m_len < x) { \ + goto receive_failed; \ + } \ + p = (mtod(m, char *) + (_len)); \ +} while (0) + +#define TCP(p) ((struct tcphdr *)(p)) +#define SCTP(p) ((struct sctphdr *)(p)) +#define UDP(p) ((struct udphdr *)(p)) + +static int +ipv6_mbuf_demarshal(struct mbuf *m, struct sockaddr_in6 *ssin6, + struct sockaddr_in6 *dsin6, uint16_t *flags) +{ + struct ip6_hdr *ip6; + uint8_t proto; + int hlen; + uint16_t src_port, dst_port; + u_short offset; + void *ulp; + + offset = hlen = src_port = dst_port = 0; + ulp = NULL; + ip6 = mtod(m, struct ip6_hdr *); + hlen = sizeof(struct ip6_hdr); + proto = ip6->ip6_nxt; + + while (ulp == NULL) { + switch (proto) { + case IPPROTO_ICMPV6: + case IPPROTO_OSPFIGP: + case IPPROTO_PIM: + case IPPROTO_CARP: + case IPPROTO_ESP: + case IPPROTO_NONE: + ulp = ip6; + break; + case IPPROTO_TCP: + PULLUP_TO(hlen, ulp, struct tcphdr); + dst_port = TCP(ulp)->th_dport; + src_port = TCP(ulp)->th_sport; + *flags = TCP(ulp)->th_flags; + if (*flags & (TH_RST|TH_FIN)) + *flags |= FL_STALE; + break; + case IPPROTO_SCTP: + PULLUP_TO(hlen, ulp, struct sctphdr); + src_port = SCTP(ulp)->src_port; + dst_port = SCTP(ulp)->dest_port; + break; + case IPPROTO_UDP: + PULLUP_TO(hlen, ulp, struct udphdr); + dst_port = UDP(ulp)->uh_dport; + src_port = UDP(ulp)->uh_sport; + break; + case IPPROTO_HOPOPTS: /* RFC 2460 */ + PULLUP_TO(hlen, ulp, struct ip6_hbh); + hlen += (((struct ip6_hbh *)ulp)->ip6h_len + 1) << 3; + proto = ((struct ip6_hbh *)ulp)->ip6h_nxt; + ulp = NULL; + break; + case IPPROTO_ROUTING: /* RFC 2460 */ + PULLUP_TO(hlen, ulp, struct ip6_rthdr); + hlen += (((struct ip6_rthdr *)ulp)->ip6r_len + 1) << 3; + proto = ((struct ip6_rthdr *)ulp)->ip6r_nxt; + ulp = NULL; + break; + case IPPROTO_FRAGMENT: /* RFC 2460 */ + PULLUP_TO(hlen, ulp, struct ip6_frag); + hlen += sizeof (struct ip6_frag); + proto = ((struct ip6_frag *)ulp)->ip6f_nxt; + offset = ((struct ip6_frag *)ulp)->ip6f_offlg & + IP6F_OFF_MASK; + ulp = NULL; + break; + case IPPROTO_DSTOPTS: /* RFC 2460 */ + PULLUP_TO(hlen, ulp, struct ip6_hbh); + hlen += (((struct ip6_hbh *)ulp)->ip6h_len + 1) << 3; + proto = ((struct ip6_hbh *)ulp)->ip6h_nxt; + ulp = NULL; + break; + case IPPROTO_AH: /* RFC 2402 */ + PULLUP_TO(hlen, ulp, struct ip6_ext); + hlen += (((struct ip6_ext *)ulp)->ip6e_len + 2) << 2; + proto = ((struct ip6_ext *)ulp)->ip6e_nxt; + ulp = NULL; + break; + default: + PULLUP_TO(hlen, ulp, struct ip6_ext); + break; + } } - return (hash); -noop: - *protop = proto; + if (src_port == 0) { + receive_failed: + return (ENOTSUP); + } + + dsin6->sin6_family = AF_INET6; + dsin6->sin6_len = sizeof(*dsin6); + memcpy(&dsin6->sin6_addr, &ip6->ip6_dst, sizeof(struct in6_addr)); + + ssin6->sin6_family = AF_INET6; + ssin6->sin6_len = sizeof(*ssin6); + memcpy(&ssin6->sin6_addr, &ip6->ip6_src, sizeof(struct in6_addr)); + *flags |= proto_to_flags(proto); + return (0); } +#define zero_key(key) \ +do { \ + key[0] = 0; \ + key[1] = 0; \ + key[2] = 0; \ + key[3] = 0; \ + key[4] = 0; \ + key[5] = 0; \ + key[6] = 0; \ + key[7] = 0; \ + key[8] = 0; \ +} while (0) + +static uint32_t +ipv6_flow_lookup_hash_internal( + struct sockaddr_in6 *ssin6, struct sockaddr_in6 *dsin6, + uint32_t *key, uint16_t flags) +{ + uint16_t sport, dport; + uint8_t proto; + + if ((V_flowtable_enable == 0) || (V_flowtable_ready == 0)) + return (0); + + proto = flags_to_proto(flags); + zero_key(key); + sport = dport = 0; + if (dsin6 != NULL) { + memcpy(&key[1], &dsin6->sin6_addr, sizeof(struct in6_addr)); + dport = dsin6->sin6_port; + } + if ((ssin6 != NULL) && (flags & FL_HASH_ALL)) { + memcpy(&key[5], &ssin6->sin6_addr, sizeof(struct in6_addr)); + sport = ssin6->sin6_port; + } + if (flags & FL_HASH_ALL) { + ((uint16_t *)key)[0] = sport; + ((uint16_t *)key)[1] = dport; + } + + return (jenkins_hashword(key, 9, V_flow_hashjitter + proto)); +} + +static struct flentry * +flowtable_lookup_mbuf6(struct flowtable *ft, struct mbuf *m) +{ + struct sockaddr ssa, dsa; + struct sockaddr_in6 *dsin6, *ssin6; + uint16_t flags; + + dsin6 = (struct sockaddr_in6 *)&dsa; + ssin6 = (struct sockaddr_in6 *)&ssa; + flags = 0; + if (ipv6_mbuf_demarshal(m, ssin6, dsin6, &flags) != 0) + return (NULL); + + return (flowtable_lookup(ft, &ssa, &dsa, M_GETFIB(m), flags)); +} +#endif /* INET6 */ + static bitstr_t * flowtable_mask(struct flowtable *ft) { @@ -553,6 +842,9 @@ flowtable_insert(struct flowtable *ft, u FL_ENTRY_UNLOCK(ft, hash); uma_zfree((newfle->f_flags & FL_IPV6) ? V_flow_ipv6_zone : V_flow_ipv4_zone, newfle); + + if (flags & FL_OVERWRITE) + goto skip; return (EEXIST); } /* @@ -582,6 +874,21 @@ skip: return (0); } +int +kern_flowtable_insert(struct flowtable *ft, struct sockaddr *ssa, + struct sockaddr *dsa, struct route *ro, uint32_t fibnum, int flags, + uint8_t proto) +{ + uint32_t key[9], hash; + + flags = (ft->ft_flags | flags | FL_OVERWRITE); + + hash = ipv4_flow_lookup_hash_internal((struct sockaddr_in *)ssa, + (struct sockaddr_in *)dsa, key, flags); + + return (flowtable_insert(ft, hash, key, proto, fibnum, ro, flags)); +} + static int flowtable_key_equal(struct flentry *fle, uint32_t *key) { @@ -603,42 +910,74 @@ flowtable_key_equal(struct flentry *fle, return (1); } -int -flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro, uint32_t fibnum) +struct flentry * +flowtable_lookup_mbuf(struct flowtable *ft, struct mbuf *m, int af) +{ + struct flentry *fle = NULL; + +#ifdef INET + if (af == AF_INET) + fle = flowtable_lookup_mbuf4(ft, m); +#endif +#ifdef INET6 + if (af == AF_INET6) + fle = flowtable_lookup_mbuf6(ft, m); +#endif + if (fle != NULL && m != NULL && (m->m_flags & M_FLOWID) == 0) { + m->m_flags |= M_FLOWID; + m->m_pkthdr.flowid = fle->f_fhash; + } + return (fle); +} + +struct flentry * +flowtable_lookup(struct flowtable *ft, struct sockaddr *ssa, + struct sockaddr *dsa, uint32_t fibnum, int flags) { uint32_t key[9], hash; struct flentry *fle; - uint16_t flags; uint8_t proto = 0; int error = 0; struct rtentry *rt; struct llentry *lle; + struct route sro, *ro; - flags = ft->ft_flags; + ro = &sro; ro->ro_rt = NULL; ro->ro_lle = NULL; + hash = 0; + flags |= ft->ft_flags; +#ifdef INET + if (ssa->sa_family == AF_INET) { + struct sockaddr_in *ssin, *dsin; - /* - * The internal hash lookup is the only IPv4 specific bit - * remaining - * - * XXX BZ: to add IPv6 support just add a check for the - * address type in m and ro and an equivalent ipv6 lookup - * function - the rest of the code should automatically - * handle an ipv6 flow (note that m can be NULL in which - * case ro will be set) - */ - hash = ipv4_flow_lookup_hash_internal(m, ro, key, - &flags, &proto); + dsin = (struct sockaddr_in *)dsa; + ssin = (struct sockaddr_in *)ssa; + + hash = ipv4_flow_lookup_hash_internal(ssin, dsin, key, flags); + } +#endif +#ifdef INET6 + if (ssa->sa_family == AF_INET6) { + struct sockaddr_in6 *ssin6, *dsin6; + + dsin6 = (struct sockaddr_in6 *)dsa; + ssin6 = (struct sockaddr_in6 *)ssa; + + hash = ipv6_flow_lookup_hash_internal(ssin6, dsin6, key, flags); + } +#endif + if (hash == 0) + return (NULL); /* * Ports are zero and this isn't a transmit cache * - thus not a protocol for which we need to keep * state - * FL_HASH_PORTS => key[0] != 0 for TCP || UDP || SCTP + * FL_HASH_ALL => key[0] != 0 for TCP || UDP || SCTP */ - if (hash == 0 || (key[0] == 0 && (ft->ft_flags & FL_HASH_PORTS))) - return (ENOENT); + if (hash == 0 || (key[0] == 0 && (ft->ft_flags & FL_HASH_ALL))) + return (NULL); V_flowtable_lookups++; FL_ENTRY_LOCK(ft, hash); @@ -647,6 +986,7 @@ flowtable_lookup(struct flowtable *ft, s goto uncached; } keycheck: + proto = flags_to_proto(flags); rt = __DEVOLATILE(struct rtentry *, fle->f_rt); lle = __DEVOLATILE(struct llentry *, fle->f_lle); if ((rt != NULL) @@ -659,16 +999,15 @@ keycheck: V_flowtable_hits++; fle->f_uptime = time_uptime; fle->f_flags |= flags; - ro->ro_rt = rt; - ro->ro_lle = lle; FL_ENTRY_UNLOCK(ft, hash); - return (0); + return (fle); } else if (fle->f_next != NULL) { fle = fle->f_next; goto keycheck; } FL_ENTRY_UNLOCK(ft, hash); - + if (flags & FL_NOAUTO) + return (NULL); uncached: V_flowtable_misses++; /* @@ -695,9 +1034,8 @@ uncached: if (ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) { RTFREE(rt); ro->ro_rt = NULL; - return (ENOENT); + return (NULL); } - if (rt->rt_flags & RTF_GATEWAY) l3addr = rt->rt_gateway; else @@ -708,7 +1046,7 @@ uncached: if (lle == NULL) { RTFREE(rt); ro->ro_rt = NULL; - return (ENOENT); + return (NULL); } error = flowtable_insert(ft, hash, key, proto, fibnum, ro, flags); @@ -721,7 +1059,7 @@ uncached: } } - return (error); + return ((error) ? NULL : fle); } /* @@ -783,7 +1121,7 @@ flowtable_alloc(int nentry, int flags) * just a cache - so everything is eligible for * replacement after 5s of non-use */ - if (flags & FL_HASH_PORTS) { + if (flags & FL_HASH_ALL) { ft->ft_udp_idle = V_flowtable_udp_expire; ft->ft_syn_idle = V_flowtable_syn_expire; ft->ft_fin_wait_idle = V_flowtable_fin_wait_expire; Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.h ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.h Wed Feb 3 23:59:52 2010 (r203461) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.h Thu Feb 4 00:11:34 2010 (r203462) @@ -34,10 +34,13 @@ $FreeBSD$ #ifdef _KERNEL -#define FL_HASH_PORTS (1<<0) /* hash 4-tuple + protocol */ +#define FL_HASH_ALL (1<<0) /* hash 4-tuple + protocol */ #define FL_PCPU (1<<1) /* pcpu cache */ +#define FL_NOAUTO (1<<2) /* don't automatically add flentry on miss */ struct flowtable; +struct flentry; + VNET_DECLARE(struct flowtable *, ip_ft); #define V_ip_ft VNET(ip_ft) @@ -48,8 +51,18 @@ struct flowtable *flowtable_alloc(int ne * return it in the route. * */ -int flowtable_lookup(struct flowtable *ft, struct mbuf *m, - struct route *ro, uint32_t fibnum); +struct flentry *flowtable_lookup_mbuf(struct flowtable *ft, struct mbuf *m, int af); + +struct flentry *flowtable_lookup(struct flowtable *ft, struct sockaddr *ssa, + struct sockaddr *dsa, uint32_t fibnum, int flags); + +int kern_flowtable_insert(struct flowtable *ft, struct sockaddr *ssa, + struct sockaddr *dsa, struct route *ro, uint32_t fibnum, int flags, + uint8_t proto); + +void flow_invalidate(struct flentry *fl); + +void flow_to_route(struct flentry *fl, struct route *ro); void flowtable_route_flush(struct flowtable *ft, struct rtentry *rt); Modified: user/kmacy/head_flowtable_v6/sys/netinet/ip_output.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/netinet/ip_output.c Wed Feb 3 23:59:52 2010 (r203461) +++ user/kmacy/head_flowtable_v6/sys/netinet/ip_output.c Thu Feb 4 00:11:34 2010 (r203462) @@ -148,14 +148,20 @@ ip_output(struct mbuf *m, struct mbuf *o bzero(ro, sizeof (*ro)); #ifdef FLOWTABLE - /* - * The flow table returns route entries valid for up to 30 - * seconds; we rely on the remainder of ip_output() taking no - * longer than that long for the stability of ro_rt. The - * flow ID assignment must have happened before this point. - */ - if (flowtable_lookup(V_ip_ft, m, ro, M_GETFIB(m)) == 0) - nortfree = 1; + { + struct flentry *fle; + + /* + * The flow table returns route entries valid for up to 30 + * seconds; we rely on the remainder of ip_output() taking no + * longer than that long for the stability of ro_rt. The + * flow ID assignment must have happened before this point. + */ + if ((fle = flowtable_lookup_mbuf(V_ip_ft, m, AF_INET)) != NULL) + flow_to_route(fle, ro); + else + nortfree = 1; + } #endif } From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 00:51:14 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 492251065672; Thu, 4 Feb 2010 00:51:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 381528FC13; Thu, 4 Feb 2010 00:51:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o140pESk058375; Thu, 4 Feb 2010 00:51:14 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o140pELc058373; Thu, 4 Feb 2010 00:51:14 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201002040051.o140pELc058373@svn.freebsd.org> From: Warner Losh Date: Thu, 4 Feb 2010 00:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203464 - user/imp/tbemd/gnu/usr.bin/gdb/kgdb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 00:51:14 -0000 Author: imp Date: Thu Feb 4 00:51:13 2010 New Revision: 203464 URL: http://svn.freebsd.org/changeset/base/203464 Log: Make this build on armeb by using TARGET_CPUARCH instead of TARGET_ARCH. Modified: user/imp/tbemd/gnu/usr.bin/gdb/kgdb/Makefile Modified: user/imp/tbemd/gnu/usr.bin/gdb/kgdb/Makefile ============================================================================== --- user/imp/tbemd/gnu/usr.bin/gdb/kgdb/Makefile Thu Feb 4 00:40:12 2010 (r203463) +++ user/imp/tbemd/gnu/usr.bin/gdb/kgdb/Makefile Thu Feb 4 00:51:13 2010 (r203464) @@ -1,7 +1,7 @@ # $FreeBSD$ PROG= kgdb${GDB_SUFFIX} -SRCS= main.c kld.c kthr.c trgt.c trgt_${TARGET_ARCH}.c +SRCS= main.c kld.c kthr.c trgt.c trgt_${TARGET_CPUARCH}.c WARNS?= 2 BULIBS= ${OBJ_BU}/libbfd/libbfd.a ${OBJ_BU}/libopcodes/libopcodes.a \ From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 00:53:51 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A47791065676; Thu, 4 Feb 2010 00:53:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9152B8FC08; Thu, 4 Feb 2010 00:53:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o140rpk9058996; Thu, 4 Feb 2010 00:53:51 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o140rpaL058991; Thu, 4 Feb 2010 00:53:51 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201002040053.o140rpaL058991@svn.freebsd.org> From: Warner Losh Date: Thu, 4 Feb 2010 00:53:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203465 - in user/imp/tbemd/gnu/usr.bin/gdb: . gdbserver X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 00:53:51 -0000 Author: imp Date: Thu Feb 4 00:53:51 2010 New Revision: 203465 URL: http://svn.freebsd.org/changeset/base/203465 Log: Rename *-ppc.c to *-powerpc.c in gdbserver, then apply a more generic heuristic to see if we need gdbserver or not. Once that doesn't list every architecture. Added: user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-powerpc-low.c - copied unchanged from r203406, user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-ppc-low.c user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-powerpc.c - copied unchanged from r203406, user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-ppc.c Deleted: user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-ppc-low.c user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-ppc.c Modified: user/imp/tbemd/gnu/usr.bin/gdb/Makefile user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/Makefile Modified: user/imp/tbemd/gnu/usr.bin/gdb/Makefile ============================================================================== --- user/imp/tbemd/gnu/usr.bin/gdb/Makefile Thu Feb 4 00:51:13 2010 (r203464) +++ user/imp/tbemd/gnu/usr.bin/gdb/Makefile Thu Feb 4 00:53:51 2010 (r203465) @@ -2,7 +2,7 @@ SUBDIR= doc libgdb gdb gdbtui kgdb -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "powerpc" +.if exists(${.CURDIR}/gdbserver/reg-${MACHINE_CPUARCH}.c) SUBDIR+=gdbserver .endif Modified: user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/Makefile ============================================================================== --- user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/Makefile Thu Feb 4 00:51:13 2010 (r203464) +++ user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/Makefile Thu Feb 4 00:53:51 2010 (r203465) @@ -14,16 +14,10 @@ SRCS= inferiors.c mem-break.c regcache.c server.c signals.c target.c utils.c SRCS+= fbsd-low.c -.if ${MACHINE_CPUARCH} == "i386" -SRCS+= fbsd-i386-low.c i387-fp.c reg-i386.c -.endif +SRCS+= fbsd-${MACHINE_CPUARCH}-low.c reg-${MACHINE_CPUARCH}.c -.if ${MACHINE_CPUARCH} == "arm" -SRCS+= fbsd-arm-low.c reg-arm.c -.endif - -.if ${MACHINE_CPUARCH} == "powerpc" -SRCS+= fbsd-ppc-low.c reg-ppc.c +.if ${MACHINE_CPUARCH} == "i386" +SRCS+= i387-fp.c .endif #CFLAGS+= -I${.CURDIR}/../arch/${MACHINE_CPUARCH} Copied: user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-powerpc-low.c (from r203406, user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-ppc-low.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-powerpc-low.c Thu Feb 4 00:53:51 2010 (r203465, copy of r203406, user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-ppc-low.c) @@ -0,0 +1,156 @@ +/* FreeBSD/PowerPC specific low level interface, for the remote server for + GDB. + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +__FBSDID("$FreeBSD$"); + +#include "server.h" +#include "fbsd-low.h" + +#include +#include + +#define ppc_num_regs 71 + +/* Currently, don't check/send MQ. */ +static int ppc_regmap[] = + { 0, 4, 8, 12, 16, 20, 24, 28, + 32, 36, 40, 44, 48, 52, 56, 60, + 64, 68, 72, 76, 80, 84, 88, 92, + 96, 100, 104, 108, 112, 116, 120, 124, +#if 0 + /* + * XXX on FreeBSD the gdbserver for PowerPC was only tested with FPU-less + * cores i.e. e500. Let's leave the original FPR references around in case + * someone picks up and brings support for AIM-like FPU machines. + */ + PT_FPR0*4, PT_FPR0*4 + 8, PT_FPR0*4+16, PT_FPR0*4+24, + PT_FPR0*4+32, PT_FPR0*4+40, PT_FPR0*4+48, PT_FPR0*4+56, + PT_FPR0*4+64, PT_FPR0*4+72, PT_FPR0*4+80, PT_FPR0*4+88, + PT_FPR0*4+96, PT_FPR0*4+104, PT_FPR0*4+112, PT_FPR0*4+120, + PT_FPR0*4+128, PT_FPR0*4+136, PT_FPR0*4+144, PT_FPR0*4+152, + PT_FPR0*4+160, PT_FPR0*4+168, PT_FPR0*4+176, PT_FPR0*4+184, + PT_FPR0*4+192, PT_FPR0*4+200, PT_FPR0*4+208, PT_FPR0*4+216, + PT_FPR0*4+224, PT_FPR0*4+232, PT_FPR0*4+240, PT_FPR0*4+248, +#endif + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + 144, -1, 132, 128, 140, 136, -1 + }; + +static int +ppc_cannot_store_register (int regno) +{ + /* Some kernels do not allow us to store fpscr. */ + if (regno == find_regno ("fpscr")) + return 2; + + return 0; +} + +static int +ppc_cannot_fetch_register (int regno) +{ + return 0; +} + +static CORE_ADDR +ppc_get_pc (void) +{ + unsigned long pc; + + collect_register_by_name ("pc", &pc); + return (CORE_ADDR) pc; +} + +static void +ppc_set_pc (CORE_ADDR pc) +{ + unsigned long newpc = pc; + + supply_register_by_name ("pc", &newpc); +} + +/* Correct in either endianness. Note that this file is + for PowerPC only, not PowerPC64. + This instruction is "twge r2, r2", which GDB uses as a software + breakpoint. */ +static const unsigned long ppc_breakpoint = 0x7d821008; +#define ppc_breakpoint_len 4 + +static int +ppc_breakpoint_at (CORE_ADDR where) +{ + unsigned long insn; + + (*the_target->read_memory) (where, (char *) &insn, 4); + if (insn == ppc_breakpoint) + return 1; + /* If necessary, recognize more trap instructions here. GDB only uses the + one. */ + return 0; +} + +static void +ppc_fill_gregset (void *buf) +{ + int i; + + for (i = 0; i < ppc_num_regs; i++) + if (ppc_regmap[i] != -1) + collect_register (i, ((char *) buf) + ppc_regmap[i]); + +} + +static void +ppc_store_gregset (const void *buf) +{ + int i; + + for (i = 0; i < ppc_num_regs; i++) + if (ppc_regmap[i] != -1) + supply_register (i, ((char *) buf) + ppc_regmap[i]); + +} + +struct regset_info target_regsets[] = { + { PT_GETREGS, PT_SETREGS, sizeof (struct reg), + GENERAL_REGS, + ppc_fill_gregset, ppc_store_gregset }, + { 0, 0, -1, -1, NULL, NULL } +}; + +struct fbsd_target_ops the_low_target = { + ppc_num_regs, + ppc_regmap, + ppc_cannot_fetch_register, + ppc_cannot_store_register, + ppc_get_pc, + ppc_set_pc, + (const char *) &ppc_breakpoint, + ppc_breakpoint_len, + NULL, + 0, + ppc_breakpoint_at, +}; Copied: user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-powerpc.c (from r203406, user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-ppc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-powerpc.c Thu Feb 4 00:53:51 2010 (r203465, copy of r203406, user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-ppc.c) @@ -0,0 +1,113 @@ +/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */ + +/* A register protocol for GDB, the GNU debugger. + Copyright 2001, 2002 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This file was created with the aid of ``regdat.sh'' and ``../../../../contrib/gdb/gdb/regformats/reg-ppc.dat''. */ + +#include +__FBSDID("$FreeBSD$"); + +#include "regdef.h" +#include "regcache.h" + +struct reg regs_ppc[] = { + { "r0", 0, 32 }, + { "r1", 32, 32 }, + { "r2", 64, 32 }, + { "r3", 96, 32 }, + { "r4", 128, 32 }, + { "r5", 160, 32 }, + { "r6", 192, 32 }, + { "r7", 224, 32 }, + { "r8", 256, 32 }, + { "r9", 288, 32 }, + { "r10", 320, 32 }, + { "r11", 352, 32 }, + { "r12", 384, 32 }, + { "r13", 416, 32 }, + { "r14", 448, 32 }, + { "r15", 480, 32 }, + { "r16", 512, 32 }, + { "r17", 544, 32 }, + { "r18", 576, 32 }, + { "r19", 608, 32 }, + { "r20", 640, 32 }, + { "r21", 672, 32 }, + { "r22", 704, 32 }, + { "r23", 736, 32 }, + { "r24", 768, 32 }, + { "r25", 800, 32 }, + { "r26", 832, 32 }, + { "r27", 864, 32 }, + { "r28", 896, 32 }, + { "r29", 928, 32 }, + { "r30", 960, 32 }, + { "r31", 992, 32 }, + { "f0", 1024, 64 }, + { "f1", 1088, 64 }, + { "f2", 1152, 64 }, + { "f3", 1216, 64 }, + { "f4", 1280, 64 }, + { "f5", 1344, 64 }, + { "f6", 1408, 64 }, + { "f7", 1472, 64 }, + { "f8", 1536, 64 }, + { "f9", 1600, 64 }, + { "f10", 1664, 64 }, + { "f11", 1728, 64 }, + { "f12", 1792, 64 }, + { "f13", 1856, 64 }, + { "f14", 1920, 64 }, + { "f15", 1984, 64 }, + { "f16", 2048, 64 }, + { "f17", 2112, 64 }, + { "f18", 2176, 64 }, + { "f19", 2240, 64 }, + { "f20", 2304, 64 }, + { "f21", 2368, 64 }, + { "f22", 2432, 64 }, + { "f23", 2496, 64 }, + { "f24", 2560, 64 }, + { "f25", 2624, 64 }, + { "f26", 2688, 64 }, + { "f27", 2752, 64 }, + { "f28", 2816, 64 }, + { "f29", 2880, 64 }, + { "f30", 2944, 64 }, + { "f31", 3008, 64 }, + { "pc", 3072, 32 }, + { "ps", 3104, 32 }, + { "cr", 3136, 32 }, + { "lr", 3168, 32 }, + { "ctr", 3200, 32 }, + { "xer", 3232, 32 }, + { "fpscr", 3264, 32 }, +}; + +const char *expedite_regs_ppc[] = { "r1", "pc", 0 }; + +void +init_registers () +{ + set_register_cache (regs_ppc, + sizeof (regs_ppc) / sizeof (regs_ppc[0])); + gdbserver_expedite_regs = expedite_regs_ppc; +} From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 00:57:28 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7BB171065670; Thu, 4 Feb 2010 00:57:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6ABA48FC17; Thu, 4 Feb 2010 00:57:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o140vS84059829; Thu, 4 Feb 2010 00:57:28 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o140vSL7059827; Thu, 4 Feb 2010 00:57:28 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201002040057.o140vSL7059827@svn.freebsd.org> From: Warner Losh Date: Thu, 4 Feb 2010 00:57:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203466 - user/imp/tbemd/contrib/binutils/bfd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 00:57:28 -0000 Author: imp Date: Thu Feb 4 00:57:28 2010 New Revision: 203466 URL: http://svn.freebsd.org/changeset/base/203466 Log: Recognize armeb-*-freebsd* too, otherwise we fail when we try to build armeb binaries because we can't look up the right target. Oops. # do we have vendor branch rules still? Modified: user/imp/tbemd/contrib/binutils/bfd/config.bfd Modified: user/imp/tbemd/contrib/binutils/bfd/config.bfd ============================================================================== --- user/imp/tbemd/contrib/binutils/bfd/config.bfd Thu Feb 4 00:53:51 2010 (r203465) +++ user/imp/tbemd/contrib/binutils/bfd/config.bfd Thu Feb 4 00:57:28 2010 (r203466) @@ -221,6 +221,10 @@ case "${targ}" in targ_defvec=bfd_elf32_littlearm_vec targ_selvecs=bfd_elf32_bigarm_vec ;; + armeb-*-freebsd*) + targ_defvec=bfd_elf32_bigarm_vec + targ_selvecs=bfd_elf32_littlearm_vec + ;; arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \ arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks) targ_defvec=bfd_elf32_littlearm_vec From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 01:07:28 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCB0B1065672; Thu, 4 Feb 2010 01:07:28 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B21D18FC16; Thu, 4 Feb 2010 01:07:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1417S90062045; Thu, 4 Feb 2010 01:07:28 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1417Sk3062043; Thu, 4 Feb 2010 01:07:28 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002040107.o1417Sk3062043@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Feb 2010 01:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203467 - user/kmacy/head_flowtable_v6/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 01:07:29 -0000 Author: kmacy Date: Thu Feb 4 01:07:28 2010 New Revision: 203467 URL: http://svn.freebsd.org/changeset/base/203467 Log: - don't parse ports in ulp header if FL_HASH_ALL is not passed - don't track all TCP header flags in the flentry Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Thu Feb 4 00:57:28 2010 (r203466) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Thu Feb 4 01:07:28 2010 (r203467) @@ -452,7 +452,7 @@ ipv4_mbuf_demarshal(struct mbuf *m, stru struct sctphdr *sh; uint16_t sport, dport; - sport = dport = 0; + proto = sport = dport = 0; ip = mtod(m, struct ip *); dsin->sin_family = AF_INET; dsin->sin_len = sizeof(*dsin); @@ -461,6 +461,9 @@ ipv4_mbuf_demarshal(struct mbuf *m, stru ssin->sin_len = sizeof(*dsin); ssin->sin_addr = ip->ip_dst; + if ((*flags & FL_HASH_ALL) == 0) + goto skipports; + proto = ip->ip_p; iphlen = ip->ip_hl << 2; /* XXX options? */ @@ -469,8 +472,8 @@ ipv4_mbuf_demarshal(struct mbuf *m, stru th = (struct tcphdr *)((caddr_t)ip + iphlen); sport = ntohs(th->th_sport); dport = ntohs(th->th_dport); - *flags |= th->th_flags; - if (*flags & TH_RST) + if ((*flags & FL_HASH_ALL) && + (th->th_flags & (TH_RST|TH_FIN))) *flags |= FL_STALE; break; case IPPROTO_UDP: @@ -491,6 +494,7 @@ ipv4_mbuf_demarshal(struct mbuf *m, stru } *flags |= proto_to_flags(proto); +skipports: ssin->sin_port = sport; dsin->sin_port = dport; return (0); @@ -579,6 +583,9 @@ ipv6_mbuf_demarshal(struct mbuf *m, stru hlen = sizeof(struct ip6_hdr); proto = ip6->ip6_nxt; + if ((*flags & FL_HASH_ALL) == 0) + goto skipports; + while (ulp == NULL) { switch (proto) { case IPPROTO_ICMPV6: @@ -593,8 +600,8 @@ ipv6_mbuf_demarshal(struct mbuf *m, stru PULLUP_TO(hlen, ulp, struct tcphdr); dst_port = TCP(ulp)->th_dport; src_port = TCP(ulp)->th_sport; - *flags = TCP(ulp)->th_flags; - if (*flags & (TH_RST|TH_FIN)) + if ((*flags & FL_HASH_ALL) && + (TCP(ulp)->th_flags & (TH_RST|TH_FIN))) *flags |= FL_STALE; break; case IPPROTO_SCTP: @@ -649,13 +656,16 @@ ipv6_mbuf_demarshal(struct mbuf *m, stru receive_failed: return (ENOTSUP); } - + +skipports: dsin6->sin6_family = AF_INET6; dsin6->sin6_len = sizeof(*dsin6); + dsin6->sin6_port = dst_port; memcpy(&dsin6->sin6_addr, &ip6->ip6_dst, sizeof(struct in6_addr)); ssin6->sin6_family = AF_INET6; ssin6->sin6_len = sizeof(*ssin6); + ssin6->sin6_port = src_port; memcpy(&ssin6->sin6_addr, &ip6->ip6_src, sizeof(struct in6_addr)); *flags |= proto_to_flags(proto); From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 02:17:35 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 884DA106566B; Thu, 4 Feb 2010 02:17:35 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7616C8FC0A; Thu, 4 Feb 2010 02:17:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o142HZiZ077503; Thu, 4 Feb 2010 02:17:35 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o142HZhF077500; Thu, 4 Feb 2010 02:17:35 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002040217.o142HZhF077500@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Feb 2010 02:17:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203468 - in user/kmacy/head_flowtable_v6/sys: net netinet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 02:17:35 -0000 Author: kmacy Date: Thu Feb 4 02:17:35 2010 New Revision: 203468 URL: http://svn.freebsd.org/changeset/base/203468 Log: - initialize ro_dst in flowtable_lookup - set nortfree if we're not holding a local reference Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c user/kmacy/head_flowtable_v6/sys/netinet/ip_output.c Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Thu Feb 4 01:07:28 2010 (r203467) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Thu Feb 4 02:17:35 2010 (r203468) @@ -955,6 +955,7 @@ flowtable_lookup(struct flowtable *ft, s ro = &sro; ro->ro_rt = NULL; ro->ro_lle = NULL; + ro->ro_dst = *dsa; hash = 0; flags |= ft->ft_flags; #ifdef INET Modified: user/kmacy/head_flowtable_v6/sys/netinet/ip_output.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/netinet/ip_output.c Thu Feb 4 01:07:28 2010 (r203467) +++ user/kmacy/head_flowtable_v6/sys/netinet/ip_output.c Thu Feb 4 02:17:35 2010 (r203468) @@ -157,10 +157,10 @@ ip_output(struct mbuf *m, struct mbuf *o * longer than that long for the stability of ro_rt. The * flow ID assignment must have happened before this point. */ - if ((fle = flowtable_lookup_mbuf(V_ip_ft, m, AF_INET)) != NULL) + if ((fle = flowtable_lookup_mbuf(V_ip_ft, m, AF_INET)) != NULL) { flow_to_route(fle, ro); - else nortfree = 1; + } } #endif } From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 03:07:49 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F2C4106566B; Thu, 4 Feb 2010 03:07:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D9A328FC08; Thu, 4 Feb 2010 03:07:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1437mlH088632; Thu, 4 Feb 2010 03:07:48 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1437mwC088629; Thu, 4 Feb 2010 03:07:48 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201002040307.o1437mwC088629@svn.freebsd.org> From: Warner Losh Date: Thu, 4 Feb 2010 03:07:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203469 - user/imp/tbemd/sys/boot/arm/uboot X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 03:07:49 -0000 Author: imp Date: Thu Feb 4 03:07:48 2010 New Revision: 203469 URL: http://svn.freebsd.org/changeset/base/203469 Log: Support building big endian arm too. Added: user/imp/tbemd/sys/boot/arm/uboot/ldscript.armeb - copied, changed from r203406, user/imp/tbemd/sys/boot/arm/uboot/ldscript.arm Modified: user/imp/tbemd/sys/boot/arm/uboot/Makefile user/imp/tbemd/sys/boot/arm/uboot/ldscript.arm Modified: user/imp/tbemd/sys/boot/arm/uboot/Makefile ============================================================================== --- user/imp/tbemd/sys/boot/arm/uboot/Makefile Thu Feb 4 02:17:35 2010 (r203468) +++ user/imp/tbemd/sys/boot/arm/uboot/Makefile Thu Feb 4 03:07:48 2010 (r203469) @@ -64,7 +64,7 @@ CLEANFILES+= vers.c loader.help CFLAGS+= -ffreestanding -LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.arm +LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_ARCH} # Pull in common loader code .PATH: ${.CURDIR}/../../uboot/common Modified: user/imp/tbemd/sys/boot/arm/uboot/ldscript.arm ============================================================================== --- user/imp/tbemd/sys/boot/arm/uboot/ldscript.arm Thu Feb 4 02:17:35 2010 (r203468) +++ user/imp/tbemd/sys/boot/arm/uboot/ldscript.arm Thu Feb 4 03:07:48 2010 (r203469) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ -OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") +OUTPUT_FORMAT("elf32-bigarm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(_start) SECTIONS Copied and modified: user/imp/tbemd/sys/boot/arm/uboot/ldscript.armeb (from r203406, user/imp/tbemd/sys/boot/arm/uboot/ldscript.arm) ============================================================================== --- user/imp/tbemd/sys/boot/arm/uboot/ldscript.arm Tue Feb 2 21:24:19 2010 (r203406, copy source) +++ user/imp/tbemd/sys/boot/arm/uboot/ldscript.armeb Thu Feb 4 03:07:48 2010 (r203469) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ -OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") +OUTPUT_FORMAT("elf32-bigarm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(_start) SECTIONS From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 05:07:21 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F2EB106566C; Thu, 4 Feb 2010 05:07:21 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FA228FC12; Thu, 4 Feb 2010 05:07:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1457L9N016557; Thu, 4 Feb 2010 05:07:21 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1457Lov016554; Thu, 4 Feb 2010 05:07:21 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002040507.o1457Lov016554@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Feb 2010 05:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203473 - user/kmacy/head_flowtable_v6/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 05:07:21 -0000 Author: kmacy Date: Thu Feb 4 05:07:20 2010 New Revision: 203473 URL: http://svn.freebsd.org/changeset/base/203473 Log: - remove proto arg - make kern_flowtable_insert handle v6 and v4 Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c user/kmacy/head_flowtable_v6/sys/net/flowtable.h Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Thu Feb 4 03:30:31 2010 (r203472) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Thu Feb 4 05:07:20 2010 (r203473) @@ -350,9 +350,6 @@ flowtable_pcpu_unlock(struct flowtable * #define FL_STALE (1<<8) #define FL_IPV6 (1<<9) #define FL_OVERWRITE (1<<10) -#define FL_TCP (1<<11) -#define FL_SCTP (1<<12) -#define FL_UDP (1<<13) void flow_invalidate(struct flentry *fle) @@ -812,12 +809,13 @@ flowtable_set_hashkey(struct flentry *fl static int flowtable_insert(struct flowtable *ft, uint32_t hash, uint32_t *key, - uint8_t proto, uint32_t fibnum, struct route *ro, uint16_t flags) + uint32_t fibnum, struct route *ro, uint16_t flags) { struct flentry *fle, *fletail, *newfle, **flep; int depth; uma_zone_t flezone; bitstr_t *mask; + uint8_t proto; flezone = (flags & FL_IPV6) ? V_flow_ipv6_zone : V_flow_ipv4_zone; newfle = uma_zalloc(flezone, M_NOWAIT | M_ZERO); @@ -825,7 +823,8 @@ flowtable_insert(struct flowtable *ft, u return (ENOMEM); newfle->f_flags |= (flags & FL_IPV6); - + proto = flags_to_proto(flags); + FL_ENTRY_LOCK(ft, hash); mask = flowtable_mask(ft); flep = flowtable_entry(ft, hash); @@ -886,17 +885,25 @@ skip: int kern_flowtable_insert(struct flowtable *ft, struct sockaddr *ssa, - struct sockaddr *dsa, struct route *ro, uint32_t fibnum, int flags, - uint8_t proto) + struct sockaddr *dsa, struct route *ro, uint32_t fibnum, int flags) { uint32_t key[9], hash; flags = (ft->ft_flags | flags | FL_OVERWRITE); + hash = 0; - hash = ipv4_flow_lookup_hash_internal((struct sockaddr_in *)ssa, - (struct sockaddr_in *)dsa, key, flags); +#ifdef INET + if (ssa->sa_family == AF_INET) + hash = ipv4_flow_lookup_hash_internal((struct sockaddr_in *)ssa, + (struct sockaddr_in *)dsa, key, flags); +#endif +#ifdef INET6 + if (ssa->sa_family == AF_INET6) + hash = ipv6_flow_lookup_hash_internal((struct sockaddr_in6 *)ssa, + (struct sockaddr_in6 *)dsa, key, flags); +#endif - return (flowtable_insert(ft, hash, key, proto, fibnum, ro, flags)); + return (flowtable_insert(ft, hash, key, fibnum, ro, flags)); } static int @@ -1059,8 +1066,7 @@ uncached: ro->ro_rt = NULL; return (NULL); } - error = flowtable_insert(ft, hash, key, proto, fibnum, - ro, flags); + error = flowtable_insert(ft, hash, key, fibnum, ro, flags); if (error) { RTFREE(rt); Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.h ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.h Thu Feb 4 03:30:31 2010 (r203472) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.h Thu Feb 4 05:07:20 2010 (r203473) @@ -38,6 +38,10 @@ $FreeBSD$ #define FL_PCPU (1<<1) /* pcpu cache */ #define FL_NOAUTO (1<<2) /* don't automatically add flentry on miss */ +#define FL_TCP (1<<11) +#define FL_SCTP (1<<12) +#define FL_UDP (1<<13) + struct flowtable; struct flentry; @@ -57,8 +61,7 @@ struct flentry *flowtable_lookup(struct struct sockaddr *dsa, uint32_t fibnum, int flags); int kern_flowtable_insert(struct flowtable *ft, struct sockaddr *ssa, - struct sockaddr *dsa, struct route *ro, uint32_t fibnum, int flags, - uint8_t proto); + struct sockaddr *dsa, struct route *ro, uint32_t fibnum, int flags); void flow_invalidate(struct flentry *fl); From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 07:24:14 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24BCF1065670; Thu, 4 Feb 2010 07:24:14 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1498A8FC16; Thu, 4 Feb 2010 07:24:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o147ODIa046788; Thu, 4 Feb 2010 07:24:13 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o147OD9l046782; Thu, 4 Feb 2010 07:24:13 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002040724.o147OD9l046782@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 4 Feb 2010 07:24:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203481 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 07:24:14 -0000 Author: luigi Date: Thu Feb 4 07:24:13 2010 New Revision: 203481 URL: http://svn.freebsd.org/changeset/base/203481 Log: portability fix for compilers that do not have C99 initializers Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h Thu Feb 4 07:18:19 2010 (r203480) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h Thu Feb 4 07:24:13 2010 (r203481) @@ -40,9 +40,8 @@ */ struct dn_alg { uint32_t type; /* the scheduler type */ - uint32_t flags; /* DN_MULTIQUEUE if supports multiple queues */ const char *name; /* scheduler name */ - int ref_count; /* XXX number of instances in the system */ + uint32_t flags; /* DN_MULTIQUEUE if supports multiple queues */ /* * The following define the size of 4 optional data structures @@ -62,8 +61,6 @@ struct dn_alg { size_t q_datalen; /* per-queue parameters (e.g. S,F) */ - SLIST_ENTRY(dn_alg) next; /* Next scheduler in the list */ - /* * Methods implemented by the scheduler: * enqueue enqueue packet 'm' on scheduler 's', queue 'q'. @@ -114,8 +111,19 @@ struct dn_alg { int (*free_fsk)(struct dn_fsk *f); int (*new_queue)(struct dn_queue *q); int (*free_queue)(struct dn_queue *q); + + /* run-time fields */ + int ref_count; /* XXX number of instances in the system */ + SLIST_ENTRY(dn_alg) next; /* Next scheduler in the list */ }; +/* MSVC does not support initializers so we need this ugly macro */ +#ifdef _WIN32 +#define _SI(fld) +#else +#define _SI(fld) fld +#endif + /* * Additionally, dummynet exports some functions and macros * to be used by schedulers: Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c Thu Feb 4 07:18:19 2010 (r203480) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c Thu Feb 4 07:24:13 2010 (r203481) @@ -93,15 +93,24 @@ fifo_free_sched(struct dn_sch_inst *si) * data structures, and function pointers. */ static struct dn_alg fifo_desc = { - .type = DN_SCHED_FIFO, - .name = "FIFO", + _SI( .type = ) DN_SCHED_FIFO, + _SI( .name = ) "FIFO", + _SI( .flags = ) 0, - .si_datalen = sizeof(struct dn_queue), + _SI( .schk_datalen = ) 0, + _SI( .si_datalen = ) sizeof(struct dn_queue), + _SI( .q_datalen = ) 0, - .enqueue = fifo_enqueue, - .dequeue = fifo_dequeue, - .new_sched = fifo_new_sched, - .free_sched = fifo_free_sched, + _SI( .enqueue = ) fifo_enqueue, + _SI( .dequeue = ) fifo_dequeue, + _SI( .config = ) NULL, + _SI( .destroy = ) NULL, + _SI( .new_sched = ) fifo_new_sched, + _SI( .free_sched = ) fifo_free_sched, + _SI( .new_fsk = ) NULL, + _SI( .free_fsk = ) NULL, + _SI( .new_queue = ) NULL, + _SI( .free_queue = ) NULL, }; DECLARE_DNSCHED_MODULE(dn_fifo, &fifo_desc); Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Thu Feb 4 07:18:19 2010 (r203480) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Thu Feb 4 07:24:13 2010 (r203481) @@ -791,21 +791,25 @@ qfq_new_sched(struct dn_sch_inst *si) * QFQ scheduler descriptor */ static struct dn_alg qfq_desc = { - .type = DN_SCHED_QFQ, - .name = "QFQ", - .flags = DN_MULTIQUEUE, - - .si_datalen = sizeof(struct qfq_sched), - .q_datalen = sizeof(struct qfq_class) - sizeof(struct dn_queue), - - .enqueue = qfq_enqueue, - .dequeue = qfq_dequeue, - - .new_sched = qfq_new_sched, - .new_fsk = qfq_new_fsk, - - .new_queue = qfq_new_queue, - .free_queue = qfq_free_queue, + _SI( .type = ) DN_SCHED_QFQ, + _SI( .name = ) "QFQ", + _SI( .flags = ) DN_MULTIQUEUE, + + _SI( .schk_datalen = ) 0, + _SI( .si_datalen = ) sizeof(struct qfq_sched), + _SI( .q_datalen = ) sizeof(struct qfq_class) - sizeof(struct dn_queue), + + _SI( .enqueue = ) qfq_enqueue, + _SI( .dequeue = ) qfq_dequeue, + + _SI( .config = ) NULL, + _SI( .destroy = ) NULL, + _SI( .new_sched = ) qfq_new_sched, + _SI( .free_sched = ) NULL, + _SI( .new_fsk = ) qfq_new_fsk, + _SI( .free_fsk = ) NULL, + _SI( .new_queue = ) qfq_new_queue, + _SI( .free_queue = ) qfq_free_queue, }; DECLARE_DNSCHED_MODULE(dn_qfq, &qfq_desc); Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c Thu Feb 4 07:18:19 2010 (r203480) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c Thu Feb 4 07:24:13 2010 (r203481) @@ -276,24 +276,25 @@ rr_free_queue(struct dn_queue *_q) * structures and function pointers. */ static struct dn_alg rr_desc = { - .type = DN_SCHED_RR, - .name = "RR", - .flags = DN_MULTIQUEUE, - - .si_datalen = sizeof(struct rr_si), - .q_datalen = sizeof(struct rr_queue) - sizeof(struct dn_queue), - - .enqueue = rr_enqueue, - .dequeue = rr_dequeue, - - .config = rr_config, - .new_sched = rr_new_sched, - .free_sched = rr_free_sched, - - .new_fsk = rr_new_fsk, - - .new_queue = rr_new_queue, - .free_queue = rr_free_queue, + _SI( .type = ) DN_SCHED_RR, + _SI( .name = ) "RR", + _SI( .flags = ) DN_MULTIQUEUE, + + _SI( .schk_datalen = ) 0, + _SI( .si_datalen = ) sizeof(struct rr_si), + _SI( .q_datalen = ) sizeof(struct rr_queue) - sizeof(struct dn_queue), + + _SI( .enqueue = ) rr_enqueue, + _SI( .dequeue = ) rr_dequeue, + + _SI( .config = ) rr_config, + _SI( .destroy = ) NULL, + _SI( .new_sched = ) rr_new_sched, + _SI( .free_sched = ) rr_free_sched, + _SI( .new_fsk = ) rr_new_fsk, + _SI( .free_fsk = ) NULL, + _SI( .new_queue = ) rr_new_queue, + _SI( .free_queue = ) rr_free_queue, }; Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c Thu Feb 4 07:18:19 2010 (r203480) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c Thu Feb 4 07:24:13 2010 (r203481) @@ -340,24 +340,29 @@ wf2qp_free_queue(struct dn_queue *q) * structures and function pointers. */ static struct dn_alg wf2qp_desc = { - .type = DN_SCHED_WF2QP, - .name = "WF2Q+", - .flags = DN_MULTIQUEUE, + _SI( .type = ) DN_SCHED_WF2QP, + _SI( .name = ) "WF2Q+", + _SI( .flags = ) DN_MULTIQUEUE, /* we need extra space in the si and the queue */ - .si_datalen = sizeof(struct wf2qp_si), - .q_datalen = sizeof(struct wf2qp_queue) - sizeof(struct dn_queue), - - .enqueue = wf2qp_enqueue, - .dequeue = wf2qp_dequeue, - - .new_sched = wf2qp_new_sched, - .free_sched = wf2qp_free_sched, + _SI( .schk_datalen = ) 0, + _SI( .si_datalen = ) sizeof(struct wf2qp_si), + _SI( .q_datalen = ) sizeof(struct wf2qp_queue) - + sizeof(struct dn_queue), + + _SI( .enqueue = ) wf2qp_enqueue, + _SI( .dequeue = ) wf2qp_dequeue, + + _SI( .config = ) NULL, + _SI( .destroy = ) NULL, + _SI( .new_sched = ) wf2qp_new_sched, + _SI( .free_sched = ) wf2qp_free_sched, - .new_fsk = wf2qp_new_fsk, + _SI( .new_fsk = ) wf2qp_new_fsk, + _SI( .free_fsk = ) NULL, - .new_queue = wf2qp_new_queue, - .free_queue = wf2qp_free_queue, + _SI( .new_queue = ) wf2qp_new_queue, + _SI( .free_queue = ) wf2qp_free_queue, }; From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 08:06:19 2010 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AA5A1065676; Thu, 4 Feb 2010 08:06:19 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id DB6A38FC16; Thu, 4 Feb 2010 08:06:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 1D7A99CB0FE; Thu, 4 Feb 2010 08:50:37 +0100 (CET) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MXQ9Bl9J-M-K; Thu, 4 Feb 2010 08:50:35 +0100 (CET) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id DD1AC9CB101; Thu, 4 Feb 2010 08:50:34 +0100 (CET) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id o147oYkU030552; Thu, 4 Feb 2010 08:50:34 +0100 (CET) (envelope-from rdivacky) Date: Thu, 4 Feb 2010 08:50:34 +0100 From: Roman Divacky To: Luigi Rizzo Message-ID: <20100204075034.GA30179@freebsd.org> References: <201002040724.o147OD9l046782@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201002040724.o147OD9l046782@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r203481 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 08:06:19 -0000 On Thu, Feb 04, 2010 at 07:24:13AM +0000, Luigi Rizzo wrote: > Author: luigi > Date: Thu Feb 4 07:24:13 2010 > New Revision: 203481 > URL: http://svn.freebsd.org/changeset/base/203481 > > Log: > portability fix for compilers that do not have C99 initializers C99 in kernel is a must and has been for a long time... I dont think that obfuscating obvious code to be able to support ancient compiler(s) is worth it... From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 09:04:35 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65F6A106566C; Thu, 4 Feb 2010 09:04:35 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 200228FC28; Thu, 4 Feb 2010 09:04:34 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 9550A730A1; Thu, 4 Feb 2010 10:13:16 +0100 (CET) Date: Thu, 4 Feb 2010 10:13:16 +0100 From: Luigi Rizzo To: Roman Divacky Message-ID: <20100204091316.GC81601@onelab2.iet.unipi.it> References: <201002040724.o147OD9l046782@svn.freebsd.org> <20100204075034.GA30179@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100204075034.GA30179@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: Luigi Rizzo , src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r203481 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 09:04:35 -0000 On Thu, Feb 04, 2010 at 08:50:34AM +0100, Roman Divacky wrote: > On Thu, Feb 04, 2010 at 07:24:13AM +0000, Luigi Rizzo wrote: > > Author: luigi > > Date: Thu Feb 4 07:24:13 2010 > > New Revision: 203481 > > URL: http://svn.freebsd.org/changeset/base/203481 > > > > Log: > > portability fix for compilers that do not have C99 initializers > > C99 in kernel is a must and has been for a long time... I dont think > that obfuscating obvious code to be able to support ancient compiler(s) > is worth it... unfortunately this code is shared among multiple platforms (including a Windows NDIS driver and the only way i know to do it is using MSVC), and keeping separate distributions is too expensive in terms of mainteinance. I tried for almost one year not to pollute the code in the tree with #ifdefs and intrusive portability tricks, but the only effect was to slow down development and fixes to the FreeBSD code. I'll try and see if i can find some other tricks to achieve the same result before the code is merged into HEAD. cheers luigi From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 15:26:17 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5369D1065679; Thu, 4 Feb 2010 15:26:17 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44A288FC0C; Thu, 4 Feb 2010 15:26:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o14FQHqb055179; Thu, 4 Feb 2010 15:26:17 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o14FQHvJ055175; Thu, 4 Feb 2010 15:26:17 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002041526.o14FQHvJ055175@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 4 Feb 2010 15:26:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203491 - in user/luigi/ipfw3-head/sys/netinet/ipfw: . test X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 15:26:17 -0000 Author: luigi Date: Thu Feb 4 15:26:16 2010 New Revision: 203491 URL: http://svn.freebsd.org/changeset/base/203491 Log: correct handling of masks. try to build a tarball of test sources Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c user/luigi/ipfw3-head/sys/netinet/ipfw/test/Makefile Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Thu Feb 4 15:17:49 2010 (r203490) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Thu Feb 4 15:26:16 2010 (r203491) @@ -182,7 +182,9 @@ struct dn_fsk { /* kernel side of a flow struct ipfw_flow_id fsk_mask; - /* qht is a hash table of queues, or just a single queue */ + /* qht is a hash table of queues, or just a single queue + * a bit in fs.flags tells us which one + */ struct dn_ht *qht; struct dn_schk *sched; /* Sched we are linked to */ SLIST_ENTRY(dn_fsk) sch_chain; /* list of fsk attached to sched */ Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Thu Feb 4 15:17:49 2010 (r203490) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Thu Feb 4 15:26:16 2010 (r203491) @@ -169,6 +169,27 @@ flow_id_or(struct ipfw_flow_id *src, str return dst; } +static int +nonzero_mask(struct ipfw_flow_id *m) +{ + if (m->dst_port || m->src_port || m->proto) + return 1; + if (IS_IP6_FLOW_ID(m)) { + return + m->dst_ip6.__u6_addr.__u6_addr32[0] || + m->dst_ip6.__u6_addr.__u6_addr32[1] || + m->dst_ip6.__u6_addr.__u6_addr32[2] || + m->dst_ip6.__u6_addr.__u6_addr32[3] || + m->src_ip6.__u6_addr.__u6_addr32[0] || + m->src_ip6.__u6_addr.__u6_addr32[1] || + m->src_ip6.__u6_addr.__u6_addr32[2] || + m->src_ip6.__u6_addr.__u6_addr32[3] || + m->flow_id6; + } else { + return m->dst_ip || m->src_ip; + } +} + /* XXX we may want a better hash function */ static uint32_t flow_id_hash(struct ipfw_flow_id *id) @@ -329,7 +350,7 @@ qht_delete(struct dn_fsk *fs, int flags) fs->fs.fs_nr, flags, fs->qht); if (!fs->qht) return; - if (fs->fs.flags & DN_HAVE_MASK) { + if (fs->fs.flags & DN_QHT_HASH) { dn_ht_scan(fs->qht, q_delete_cb, (void *)(uintptr_t)flags); if (flags & DN_DESTROY) { dn_ht_free(fs->qht, 0); @@ -355,7 +376,7 @@ ipdn_q_find(struct dn_fsk *fs, struct dn template._si = si; template.fs = fs; - if (fs->fs.flags & DN_HAVE_MASK) { + if (fs->fs.flags & DN_QHT_HASH) { struct ipfw_flow_id masked_id; if (fs->qht == NULL) { fs->qht = dn_ht_init(NULL, fs->fs.buckets, @@ -789,7 +810,7 @@ copy_q(struct copy_args *a, struct dn_fs { if (!fs->qht) return 0; - if (fs->fs.flags & DN_HAVE_MASK) + if (fs->fs.flags & DN_QHT_HASH) dn_ht_scan(fs->qht, copy_q_cb, a); else copy_q_cb(fs->qht, a); @@ -805,7 +826,7 @@ copy_flowset(struct copy_args *a, struct ND("flowset %d", fs->fs.fs_nr); if (copy_obj(a->start, a->end, &fs->fs, "flowset", fs->fs.fs_nr)) return DNHT_SCAN_END; - ufs->oid.id = (fs->fs.flags & DN_HAVE_MASK) ? + ufs->oid.id = (fs->fs.flags & DN_QHT_HASH) ? dn_ht_entries(fs->qht) : (fs->qht ? 1 : 0); if (flags) { /* copy queues */ copy_q(a, fs, 0); @@ -930,14 +951,24 @@ fsk_attach(struct dn_fsk *fs, struct dn_ fs->fsk_mask = fs->fs.flow_mask; if (fs->sched->sch.flags & DN_HAVE_MASK) flow_id_or(&fs->sched->sch.sched_mask, &fs->fsk_mask); - if (!fs->qht) - return; - D("XXX TODO requeue from fs %d to sch %d", - fs->fs.fs_nr, s->sch.sched_nr); - /* - * The requeue is complex -- in general we need to - * reclassify every single packet. - */ + if (fs->qht) { + /* + * we must drain qht according to the old + * type, and reinsert according to the new one. + * The requeue is complex -- in general we need to + * reclassify every single packet. + * For the time being, let's hope qht is never set + * when we reach this point. + */ + D("XXX TODO requeue from fs %d to sch %d", + fs->fs.fs_nr, s->sch.sched_nr); + fs->qht = NULL; + } + /* set the new type for qht */ + if (nonzero_mask(&fs->fsk_mask)) + fs->fs.flags |= DN_QHT_HASH; + else + fs->fs.flags &= ~DN_QHT_HASH; } /* update all flowsets which may refer to this scheduler */ Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/test/Makefile ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/test/Makefile Thu Feb 4 15:17:49 2010 (r203490) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/test/Makefile Thu Feb 4 15:26:16 2010 (r203491) @@ -31,3 +31,16 @@ main.o: mylist.h clean: - rm *.o $(TARGETS) *.core + +ALLSRCS = $(SCHED_SRCS) dn_test.h mylist.h \ + dn_sched.h dn_heap.h ip_dn_private.h Makefile +TMPBASE = /tmp/testXYZ +TMPDIR = $(TMPBASE)/test + +tgz: + -rm -rf $(TMPDIR) + mkdir -p $(TMPDIR) + -cp -p $(ALLSRCS) $(TMPDIR) + -(cd ..; cp -p $(ALLSRCS) $(TMPDIR)) + ls -la $(TMPDIR) + (cd $(TMPBASE); tar cvzf /tmp/test.tgz test) From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 17:26:11 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B730106566B; Thu, 4 Feb 2010 17:26:11 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6CCD28FC29; Thu, 4 Feb 2010 17:26:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o14HQBtu081675; Thu, 4 Feb 2010 17:26:11 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o14HQBog081673; Thu, 4 Feb 2010 17:26:11 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002041726.o14HQBog081673@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 4 Feb 2010 17:26:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203495 - user/luigi/ipfw3-head/sys/netinet/ipfw/test X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 17:26:11 -0000 Author: luigi Date: Thu Feb 4 17:26:11 2010 New Revision: 203495 URL: http://svn.freebsd.org/changeset/base/203495 Log: adapt to gmake and linux Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/test/Makefile Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/test/Makefile ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/test/Makefile Thu Feb 4 17:13:38 2010 (r203494) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/test/Makefile Thu Feb 4 17:26:11 2010 (r203495) @@ -1,4 +1,5 @@ # Makefile for building userland tests +# this is written in a form compatible with gmake SCHED_SRCS = test_dn_sched.c SCHED_SRCS += dn_sched_fifo.c @@ -16,15 +17,15 @@ HEAP_OBJS=$(HEAP_SRCS:.c=.o) VPATH= .:.. CFLAGS = -I.. -I. -Wall -Werror -O3 -DIPFW -TARGETS= test_heap test_sched +TARGETS= test_sched # no test_heap by default all: $(TARGETS) test_heap : $(HEAP_OBJS) - $(CC) -o $@ $> + $(CC) -o $@ $(HEAP_OBJS) test_sched : $(SCHED_OBJS) - $(CC) -o $@ $> + $(CC) -o $@ $(SCHED_OBJS) $(SCHED_OBJS): dn_test.h main.o: mylist.h From owner-svn-src-user@FreeBSD.ORG Sat Feb 6 02:01:57 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18CCC106566B; Sat, 6 Feb 2010 02:01:57 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 079B68FC15; Sat, 6 Feb 2010 02:01:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1621uKS019314; Sat, 6 Feb 2010 02:01:56 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1621uH3019310; Sat, 6 Feb 2010 02:01:56 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002060201.o1621uH3019310@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Feb 2010 02:01:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203536 - in user/kmacy/head_flowtable_v6/sys: net netinet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2010 02:01:57 -0000 Author: kmacy Date: Sat Feb 6 02:01:56 2010 New Revision: 203536 URL: http://svn.freebsd.org/changeset/base/203536 Log: - add a name argument to flowtable_alloc for debugging and reporting - make flowtable.c compile with INET only Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c user/kmacy/head_flowtable_v6/sys/net/flowtable.h user/kmacy/head_flowtable_v6/sys/netinet/ip_input.c Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 00:52:42 2010 (r203535) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 02:01:56 2010 (r203536) @@ -159,6 +159,7 @@ struct flowtable { uint32_t ft_syn_idle; uint32_t ft_tcp_idle; + char *ft_name; fl_lock_t *ft_lock; fl_lock_t *ft_unlock; fl_rtalloc_t *ft_rtalloc; @@ -407,12 +408,12 @@ flags_to_proto(int flags) void flow_to_route(struct flentry *fle, struct route *ro) { - struct sockaddr_in *sin = NULL; - struct sockaddr_in6 *sin6 = NULL; - uint32_t *hashkey; + uint32_t *hashkey = NULL; #ifdef INET6 if (fle->f_flags & FL_IPV6) { + struct sockaddr_in6 *sin6; + sin6 = (struct sockaddr_in6 *)&ro->ro_dst; sin6->sin6_family = AF_INET6; @@ -423,6 +424,8 @@ flow_to_route(struct flentry *fle, struc #endif #ifdef INET { + struct sockaddr_in *sin; + sin = (struct sockaddr_in *)&ro->ro_dst; sin->sin_family = AF_INET; @@ -510,14 +513,14 @@ ipv4_flow_lookup_hash_internal( proto = flags_to_proto(flags); sport = dport = key[2] = key[1] = key[0] = 0; - if (dsin != NULL) { - key[1] = dsin->sin_addr.s_addr; - dport = dsin->sin_port; - } if ((ssin != NULL) && (flags & FL_HASH_ALL)) { - key[2] = ssin->sin_addr.s_addr; + key[1] = ssin->sin_addr.s_addr; sport = ssin->sin_port; } + if (dsin != NULL) { + key[2] = dsin->sin_addr.s_addr; + dport = dsin->sin_port; + } if (flags & FL_HASH_ALL) { ((uint16_t *)key)[0] = sport; ((uint16_t *)key)[1] = dport; @@ -902,6 +905,8 @@ kern_flowtable_insert(struct flowtable * hash = ipv6_flow_lookup_hash_internal((struct sockaddr_in6 *)ssa, (struct sockaddr_in6 *)dsa, key, flags); #endif + if (ro->ro_rt == NULL || ro->ro_lle == NULL) + return (EINVAL); return (flowtable_insert(ft, hash, key, fibnum, ro, flags)); } @@ -1085,7 +1090,7 @@ uncached: #define calloc(count, size) malloc((count)*(size), M_DEVBUF, M_WAITOK|M_ZERO) struct flowtable * -flowtable_alloc(int nentry, int flags) +flowtable_alloc(char *name, int nentry, int flags) { struct flowtable *ft, *fttail; int i; @@ -1097,7 +1102,8 @@ flowtable_alloc(int nentry, int flags) ft = malloc(sizeof(struct flowtable), M_RTABLE, M_WAITOK | M_ZERO); - + + ft->ft_name = name; ft->ft_flags = flags; ft->ft_size = nentry; #ifdef RADIX_MPATH @@ -1521,6 +1527,7 @@ flowtable_show_vnet(void) ft = V_flow_list_head; while (ft != NULL) { + printf("name: %s\n", ft->ft_name); if (ft->ft_flags & FL_PCPU) { for (i = 0; i <= mp_maxid; i++) { if (CPU_ABSENT(i)) Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.h ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.h Sat Feb 6 00:52:42 2010 (r203535) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.h Sat Feb 6 02:01:56 2010 (r203536) @@ -48,7 +48,7 @@ struct flentry; VNET_DECLARE(struct flowtable *, ip_ft); #define V_ip_ft VNET(ip_ft) -struct flowtable *flowtable_alloc(int nentry, int flags); +struct flowtable *flowtable_alloc(char *name, int nentry, int flags); /* * Given a flow table, look up the L3 and L2 information and Modified: user/kmacy/head_flowtable_v6/sys/netinet/ip_input.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/netinet/ip_input.c Sat Feb 6 00:52:42 2010 (r203535) +++ user/kmacy/head_flowtable_v6/sys/netinet/ip_input.c Sat Feb 6 02:01:56 2010 (r203536) @@ -328,7 +328,7 @@ ip_init(void) #ifdef FLOWTABLE TUNABLE_INT_FETCH("net.inet.ip.output_flowtable_size", &V_ip_output_flowtable_size); - V_ip_ft = flowtable_alloc(V_ip_output_flowtable_size, FL_PCPU); + V_ip_ft = flowtable_alloc("ipv4", V_ip_output_flowtable_size, FL_PCPU); #endif /* Skip initialization of globals for non-default instances. */ From owner-svn-src-user@FreeBSD.ORG Sat Feb 6 02:04:49 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF8EF1065670; Sat, 6 Feb 2010 02:04:49 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DEF2B8FC15; Sat, 6 Feb 2010 02:04:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1624njn019964; Sat, 6 Feb 2010 02:04:49 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1624nCV019962; Sat, 6 Feb 2010 02:04:49 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002060204.o1624nCV019962@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Feb 2010 02:04:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203537 - user/kmacy/head_flowtable_v6/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2010 02:04:50 -0000 Author: kmacy Date: Sat Feb 6 02:04:49 2010 New Revision: 203537 URL: http://svn.freebsd.org/changeset/base/203537 Log: don't reference undefined sin Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 02:01:56 2010 (r203536) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 02:04:49 2010 (r203537) @@ -417,7 +417,7 @@ flow_to_route(struct flentry *fle, struc sin6 = (struct sockaddr_in6 *)&ro->ro_dst; sin6->sin6_family = AF_INET6; - sin6->sin6_len = sizeof(*sin); + sin6->sin6_len = sizeof(*sin6); hashkey = ((struct flentry_v6 *)fle)->fl_flow.ipf_key; memcpy(&sin6->sin6_addr, &hashkey[1], sizeof (struct in6_addr)); } else From owner-svn-src-user@FreeBSD.ORG Sat Feb 6 04:20:06 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2383106566B; Sat, 6 Feb 2010 04:20:06 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C866F8FC15; Sat, 6 Feb 2010 04:20:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o164K6I5049877; Sat, 6 Feb 2010 04:20:06 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o164K6Ll049875; Sat, 6 Feb 2010 04:20:06 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002060420.o164K6Ll049875@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Feb 2010 04:20:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203538 - user/kmacy/head_flowtable_v6/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2010 04:20:07 -0000 Author: kmacy Date: Sat Feb 6 04:20:06 2010 New Revision: 203538 URL: http://svn.freebsd.org/changeset/base/203538 Log: print IP address and ports Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 02:04:49 2010 (r203537) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 04:20:06 2010 (r203538) @@ -810,6 +810,20 @@ flowtable_set_hashkey(struct flentry *fl hashkey[i] = key[i]; } + +static uint32_t * +flowtable_get_hashkey(struct flentry *fle) +{ + uint32_t *hashkey; + + if (fle->f_flags & FL_IPV6) + hashkey = ((struct flentry_v4 *)fle)->fl_flow.ipf_key; + else + hashkey = ((struct flentry_v6 *)fle)->fl_flow.ipf_key; + + return (hashkey); +} + static int flowtable_insert(struct flowtable *ft, uint32_t hash, uint32_t *key, uint32_t fibnum, struct route *ro, uint16_t flags) @@ -907,7 +921,10 @@ kern_flowtable_insert(struct flowtable * #endif if (ro->ro_rt == NULL || ro->ro_lle == NULL) return (EINVAL); - +#ifdef FLOWTABLE_DEBUG + printf("kern_flowtable_insert: hash=0x%x fibnum=%d flags=0x%x\n", + hash, fibnum, flags); +#endif return (flowtable_insert(ft, hash, key, fibnum, ro, flags)); } @@ -1470,10 +1487,28 @@ flow_show(struct flowtable *ft, struct f { int idle_time; int rt_valid; + uint16_t sport, dport; + uint32_t *hashkey; + char saddr[4*sizeof "123"], daddr[4*sizeof "123"]; idle_time = (int)(time_uptime - fle->f_uptime); rt_valid = fle->f_rt != NULL; - db_printf("hash=0x%08x idle_time=%03d rt=%p ifp=%p", + + if (fle->f_flags & FL_IPV6) + goto skipaddr; + + hashkey = flowtable_get_hashkey(fle); + inet_ntoa_r(*(struct in_addr *) &hashkey[2], daddr); + if (ft->ft_flags & FL_HASH_ALL) { + inet_ntoa_r(*(struct in_addr *) &hashkey[1], saddr); + sport = ((uint16_t *)hashkey)[0]; + dport = ((uint16_t *)hashkey)[1]; + db_printf("%s:%d->%s:%d\n", saddr, sport, daddr, dport); + } else + db_printf("%s:\n", daddr); + +skipaddr: + db_printf("\thash=0x%08x idle_time=%03d rt=%p ifp=%p", fle->f_fhash, idle_time, fle->f_rt, rt_valid ? fle->f_rt->rt_ifp : NULL); if (rt_valid && (fle->f_rt->rt_flags & RTF_UP)) From owner-svn-src-user@FreeBSD.ORG Sat Feb 6 04:34:07 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F2401065670; Sat, 6 Feb 2010 04:34:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EEBD8FC13; Sat, 6 Feb 2010 04:34:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o164Y7DW053046; Sat, 6 Feb 2010 04:34:07 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o164Y7hZ053044; Sat, 6 Feb 2010 04:34:07 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002060434.o164Y7hZ053044@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Feb 2010 04:34:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203540 - user/kmacy/head_flowtable_v6/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2010 04:34:07 -0000 Author: kmacy Date: Sat Feb 6 04:34:07 2010 New Revision: 203540 URL: http://svn.freebsd.org/changeset/base/203540 Log: - store ports in network byte order Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 04:22:54 2010 (r203539) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 04:34:07 2010 (r203540) @@ -470,8 +470,8 @@ ipv4_mbuf_demarshal(struct mbuf *m, stru switch (proto) { case IPPROTO_TCP: th = (struct tcphdr *)((caddr_t)ip + iphlen); - sport = ntohs(th->th_sport); - dport = ntohs(th->th_dport); + sport = th->th_sport; + dport = th->th_dport; if ((*flags & FL_HASH_ALL) && (th->th_flags & (TH_RST|TH_FIN))) *flags |= FL_STALE; @@ -1501,8 +1501,8 @@ flow_show(struct flowtable *ft, struct f inet_ntoa_r(*(struct in_addr *) &hashkey[2], daddr); if (ft->ft_flags & FL_HASH_ALL) { inet_ntoa_r(*(struct in_addr *) &hashkey[1], saddr); - sport = ((uint16_t *)hashkey)[0]; - dport = ((uint16_t *)hashkey)[1]; + sport = ntohs(((uint16_t *)hashkey)[0]); + dport = ntohs(((uint16_t *)hashkey)[1]); db_printf("%s:%d->%s:%d\n", saddr, sport, daddr, dport); } else db_printf("%s:\n", daddr); From owner-svn-src-user@FreeBSD.ORG Sat Feb 6 22:50:50 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6C3F106568D; Sat, 6 Feb 2010 22:50:50 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6A728FC0A; Sat, 6 Feb 2010 22:50:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o16Moor4062307; Sat, 6 Feb 2010 22:50:50 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o16MooKc062305; Sat, 6 Feb 2010 22:50:50 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002062250.o16MooKc062305@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Feb 2010 22:50:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203575 - user/kmacy/head_flowtable_v6/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2010 22:50:50 -0000 Author: kmacy Date: Sat Feb 6 22:50:50 2010 New Revision: 203575 URL: http://svn.freebsd.org/changeset/base/203575 Log: clarify calling convention for llentry_update slightly Modified: user/kmacy/head_flowtable_v6/sys/net/if_llatbl.c Modified: user/kmacy/head_flowtable_v6/sys/net/if_llatbl.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/if_llatbl.c Sat Feb 6 21:22:01 2010 (r203574) +++ user/kmacy/head_flowtable_v6/sys/net/if_llatbl.c Sat Feb 6 22:50:50 2010 (r203575) @@ -111,7 +111,7 @@ llentry_free(struct llentry *lle) /* * Update an llentry for address dst (equivalent to rtalloc for new-arp) - * Caller must pass in a valid struct llentry * + * Caller must pass in a valid struct llentry * (or NULL) * * if found the llentry * is returned referenced and unlocked */ From owner-svn-src-user@FreeBSD.ORG Sat Feb 6 23:00:19 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DDB21065670; Sat, 6 Feb 2010 23:00:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F15AC8FC16; Sat, 6 Feb 2010 23:00:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o16N0I7S064489; Sat, 6 Feb 2010 23:00:18 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o16N0IoN064486; Sat, 6 Feb 2010 23:00:18 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002062300.o16N0IoN064486@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Feb 2010 23:00:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203577 - user/kmacy/head_flowtable_v6/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2010 23:00:19 -0000 Author: kmacy Date: Sat Feb 6 23:00:18 2010 New Revision: 203577 URL: http://svn.freebsd.org/changeset/base/203577 Log: - remove stale ipv6 comment on flow lookup - add per-flowtable debug logging Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c user/kmacy/head_flowtable_v6/sys/net/flowtable.h Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 22:57:24 2010 (r203576) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 23:00:18 2010 (r203577) @@ -187,12 +187,24 @@ static struct cv flowclean_cv; static struct mtx flowclean_lock; static uint32_t flowclean_cycles; +#ifdef FLOWTABLE_DEBUG +#define FLDPRINTF(ft, fmt, ...) \ +do { \ + if ((ft)->ft_flags & FL_DEBUG) \ + printf((fmt), __VA_ARGS__); \ +} while (0); \ + +#else +#define FLDPRINTF(ft, fmt, ...) + +#endif + + /* * TODO: * - Make flowtable stats per-cpu, aggregated at sysctl call time, * to avoid extra cache evictions caused by incrementing a shared * counter - * - add IPv6 support to flow lookup * - add sysctls to resize && flush flow tables * - Add per flowtable sysctls for statistics and configuring timeouts * - add saturation counter to rtentry to support per-packet load-balancing @@ -441,8 +453,8 @@ flow_to_route(struct flentry *fle, struc #ifdef INET static int -ipv4_mbuf_demarshal(struct mbuf *m, struct sockaddr_in *ssin, - struct sockaddr_in *dsin, uint16_t *flags) +ipv4_mbuf_demarshal(struct flowtable *ft, struct mbuf *m, + struct sockaddr_in *ssin, struct sockaddr_in *dsin, uint16_t *flags) { struct ip *ip; uint8_t proto; @@ -461,8 +473,11 @@ ipv4_mbuf_demarshal(struct mbuf *m, stru ssin->sin_len = sizeof(*dsin); ssin->sin_addr = ip->ip_dst; - if ((*flags & FL_HASH_ALL) == 0) + if ((*flags & FL_HASH_ALL) == 0) { + FLDPRINTF(ft, "skip port check flags=0x%x ", + *flags); goto skipports; + } proto = ip->ip_p; iphlen = ip->ip_hl << 2; /* XXX options? */ @@ -487,6 +502,7 @@ ipv4_mbuf_demarshal(struct mbuf *m, stru dport = sh->dest_port; break; default: + FLDPRINTF(ft, "proto=0x%x not supported\n", proto); return (ENOTSUP); /* no port - hence not a protocol we care about */ break; @@ -497,6 +513,19 @@ ipv4_mbuf_demarshal(struct mbuf *m, stru skipports: ssin->sin_port = sport; dsin->sin_port = dport; +#ifdef FLOWTABLE_DEBUG + if (*flags & FL_HASH_ALL) { + char saddr[4*sizeof "123"], daddr[4*sizeof "123"]; + inet_ntoa_r(*(struct in_addr *) &ip->ip_dst, daddr); + inet_ntoa_r(*(struct in_addr *) &ip->ip_src, saddr); + FLDPRINTF(ft, "proto=%d %s:%d->%s:%d\n", + proto, saddr, ntohs(sport), daddr, ntohs(dport)); + } else { + char daddr[4*sizeof "123"]; + inet_ntoa_r(*(struct in_addr *) &ip->ip_dst, daddr); + FLDPRINTF(ft, "proto=%d %s\n", proto, daddr); + } +#endif return (0); } @@ -539,7 +568,7 @@ flowtable_lookup_mbuf4(struct flowtable dsin = (struct sockaddr_in *)&dsa; ssin = (struct sockaddr_in *)&ssa; flags = 0; - if (ipv4_mbuf_demarshal(m, ssin, dsin, &flags) != 0) + if (ipv4_mbuf_demarshal(ft, m, ssin, dsin, &flags) != 0) return (NULL); return (flowtable_lookup(ft, &ssa, &dsa, M_GETFIB(m), flags)); @@ -567,8 +596,8 @@ do { \ #define UDP(p) ((struct udphdr *)(p)) static int -ipv6_mbuf_demarshal(struct mbuf *m, struct sockaddr_in6 *ssin6, - struct sockaddr_in6 *dsin6, uint16_t *flags) +ipv6_mbuf_demarshal(struct flowtable *ft, struct mbuf *m, + struct sockaddr_in6 *ssin6, struct sockaddr_in6 *dsin6, uint16_t *flags) { struct ip6_hdr *ip6; uint8_t proto; @@ -725,7 +754,7 @@ flowtable_lookup_mbuf6(struct flowtable dsin6 = (struct sockaddr_in6 *)&dsa; ssin6 = (struct sockaddr_in6 *)&ssa; flags = 0; - if (ipv6_mbuf_demarshal(m, ssin6, dsin6, &flags) != 0) + if (ipv6_mbuf_demarshal(ft, m, ssin6, dsin6, &flags) != 0) return (NULL); return (flowtable_lookup(ft, &ssa, &dsa, M_GETFIB(m), flags)); @@ -921,10 +950,9 @@ kern_flowtable_insert(struct flowtable * #endif if (ro->ro_rt == NULL || ro->ro_lle == NULL) return (EINVAL); -#ifdef FLOWTABLE_DEBUG - printf("kern_flowtable_insert: hash=0x%x fibnum=%d flags=0x%x\n", + + FLDPRINTF(ft, "kern_flowtable_insert: hash=0x%x fibnum=%d flags=0x%x\n", hash, fibnum, flags); -#endif return (flowtable_insert(ft, hash, key, fibnum, ro, flags)); } @@ -941,7 +969,7 @@ flowtable_key_equal(struct flentry *fle, nwords = 3; hashkey = ((struct flentry_v6 *)fle)->fl_flow.ipf_key; } - + for (i = 0; i < nwords; i++) if (hashkey[i] != key[i]) return (0); @@ -1007,9 +1035,6 @@ flowtable_lookup(struct flowtable *ft, s hash = ipv6_flow_lookup_hash_internal(ssin6, dsin6, key, flags); } #endif - if (hash == 0) - return (NULL); - /* * Ports are zero and this isn't a transmit cache * - thus not a protocol for which we need to keep @@ -1026,6 +1051,8 @@ flowtable_lookup(struct flowtable *ft, s goto uncached; } keycheck: + FLDPRINTF(ft, "doing keycheck on fle=%p hash=0x%x\n", + fle, fle->f_fhash); proto = flags_to_proto(flags); rt = __DEVOLATILE(struct rtentry *, fle->f_rt); lle = __DEVOLATILE(struct llentry *, fle->f_lle); Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.h ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.h Sat Feb 6 22:57:24 2010 (r203576) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.h Sat Feb 6 23:00:18 2010 (r203577) @@ -41,6 +41,7 @@ $FreeBSD$ #define FL_TCP (1<<11) #define FL_SCTP (1<<12) #define FL_UDP (1<<13) +#define FL_DEBUG (1<<14) struct flowtable; struct flentry; From owner-svn-src-user@FreeBSD.ORG Sat Feb 6 23:21:05 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 791B1106566B; Sat, 6 Feb 2010 23:21:05 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 698D88FC08; Sat, 6 Feb 2010 23:21:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o16NL5J4069028; Sat, 6 Feb 2010 23:21:05 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o16NL5Z6069026; Sat, 6 Feb 2010 23:21:05 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002062321.o16NL5Z6069026@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Feb 2010 23:21:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203578 - user/kmacy/head_flowtable_v6/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2010 23:21:05 -0000 Author: kmacy Date: Sat Feb 6 23:21:05 2010 New Revision: 203578 URL: http://svn.freebsd.org/changeset/base/203578 Log: propagate flowtable flags to mbuf demarshal routines Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 23:00:18 2010 (r203577) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 23:21:05 2010 (r203578) @@ -165,7 +165,6 @@ struct flowtable { fl_rtalloc_t *ft_rtalloc; struct mtx *ft_locks; - union flentryp ft_table; bitstr_t *ft_masks[MAXCPU]; bitstr_t *ft_tmpmask; @@ -567,7 +566,7 @@ flowtable_lookup_mbuf4(struct flowtable dsin = (struct sockaddr_in *)&dsa; ssin = (struct sockaddr_in *)&ssa; - flags = 0; + flags = ft->ft_flags; if (ipv4_mbuf_demarshal(ft, m, ssin, dsin, &flags) != 0) return (NULL); @@ -753,7 +752,8 @@ flowtable_lookup_mbuf6(struct flowtable dsin6 = (struct sockaddr_in6 *)&dsa; ssin6 = (struct sockaddr_in6 *)&ssa; - flags = 0; + flags = ft->ft_flags; + if (ipv6_mbuf_demarshal(ft, m, ssin6, dsin6, &flags) != 0) return (NULL); From owner-svn-src-user@FreeBSD.ORG Sat Feb 6 23:30:10 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4226A106568B; Sat, 6 Feb 2010 23:30:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 329FD8FC14; Sat, 6 Feb 2010 23:30:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o16NUAjt071033; Sat, 6 Feb 2010 23:30:10 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o16NUAOQ071031; Sat, 6 Feb 2010 23:30:10 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002062330.o16NUAOQ071031@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Feb 2010 23:30:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203579 - user/kmacy/head_flowtable_v6/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2010 23:30:10 -0000 Author: kmacy Date: Sat Feb 6 23:30:09 2010 New Revision: 203579 URL: http://svn.freebsd.org/changeset/base/203579 Log: don't add entry on miss if FL_NOAUTO is set Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 23:21:05 2010 (r203578) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 23:30:09 2010 (r203579) @@ -1073,9 +1073,10 @@ keycheck: goto keycheck; } FL_ENTRY_UNLOCK(ft, hash); +uncached: if (flags & FL_NOAUTO) return (NULL); -uncached: + V_flowtable_misses++; /* * This bit of code ends up locking the From owner-svn-src-user@FreeBSD.ORG Sat Feb 6 23:47:56 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EABAD1065676; Sat, 6 Feb 2010 23:47:55 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB1EC8FC16; Sat, 6 Feb 2010 23:47:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o16NltwO074932; Sat, 6 Feb 2010 23:47:55 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o16NltC8074929; Sat, 6 Feb 2010 23:47:55 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002062347.o16NltC8074929@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Feb 2010 23:47:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203580 - user/kmacy/head_flowtable_v6/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2010 23:47:56 -0000 Author: kmacy Date: Sat Feb 6 23:47:55 2010 New Revision: 203580 URL: http://svn.freebsd.org/changeset/base/203580 Log: narrow debugging output Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c user/kmacy/head_flowtable_v6/sys/net/flowtable.h Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 23:30:09 2010 (r203579) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 23:47:55 2010 (r203580) @@ -187,14 +187,14 @@ static struct mtx flowclean_lock; static uint32_t flowclean_cycles; #ifdef FLOWTABLE_DEBUG -#define FLDPRINTF(ft, fmt, ...) \ +#define FLDPRINTF(ft, flags, fmt, ...) \ do { \ - if ((ft)->ft_flags & FL_DEBUG) \ + if ((ft)->ft_flags & (flags)) \ printf((fmt), __VA_ARGS__); \ } while (0); \ #else -#define FLDPRINTF(ft, fmt, ...) +#define FLDPRINTF(ft, flags, fmt, ...) #endif @@ -473,7 +473,7 @@ ipv4_mbuf_demarshal(struct flowtable *ft ssin->sin_addr = ip->ip_dst; if ((*flags & FL_HASH_ALL) == 0) { - FLDPRINTF(ft, "skip port check flags=0x%x ", + FLDPRINTF(ft, FL_DEBUG_ALL, "skip port check flags=0x%x ", *flags); goto skipports; } @@ -501,7 +501,7 @@ ipv4_mbuf_demarshal(struct flowtable *ft dport = sh->dest_port; break; default: - FLDPRINTF(ft, "proto=0x%x not supported\n", proto); + FLDPRINTF(ft, FL_DEBUG_ALL, "proto=0x%x not supported\n", proto); return (ENOTSUP); /* no port - hence not a protocol we care about */ break; @@ -513,16 +513,16 @@ skipports: ssin->sin_port = sport; dsin->sin_port = dport; #ifdef FLOWTABLE_DEBUG - if (*flags & FL_HASH_ALL) { + if (*flags & (FL_HASH_ALL|FL_DEBUG_ALL)) { char saddr[4*sizeof "123"], daddr[4*sizeof "123"]; inet_ntoa_r(*(struct in_addr *) &ip->ip_dst, daddr); inet_ntoa_r(*(struct in_addr *) &ip->ip_src, saddr); - FLDPRINTF(ft, "proto=%d %s:%d->%s:%d\n", + FLDPRINTF(ft, FL_DEBUG_ALL, "proto=%d %s:%d->%s:%d\n", proto, saddr, ntohs(sport), daddr, ntohs(dport)); } else { char daddr[4*sizeof "123"]; inet_ntoa_r(*(struct in_addr *) &ip->ip_dst, daddr); - FLDPRINTF(ft, "proto=%d %s\n", proto, daddr); + FLDPRINTF(ft, FL_DEBUG_ALL, "proto=%d %s\n", proto, daddr); } #endif return (0); @@ -951,7 +951,8 @@ kern_flowtable_insert(struct flowtable * if (ro->ro_rt == NULL || ro->ro_lle == NULL) return (EINVAL); - FLDPRINTF(ft, "kern_flowtable_insert: hash=0x%x fibnum=%d flags=0x%x\n", + FLDPRINTF(ft, FL_DEBUG, + "kern_flowtable_insert: hash=0x%x fibnum=%d flags=0x%x\n", hash, fibnum, flags); return (flowtable_insert(ft, hash, key, fibnum, ro, flags)); } @@ -1051,7 +1052,7 @@ flowtable_lookup(struct flowtable *ft, s goto uncached; } keycheck: - FLDPRINTF(ft, "doing keycheck on fle=%p hash=0x%x\n", + FLDPRINTF(ft, FL_DEBUG, "doing keycheck on fle=%p hash=0x%x\n", fle, fle->f_fhash); proto = flags_to_proto(flags); rt = __DEVOLATILE(struct rtentry *, fle->f_rt); Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.h ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.h Sat Feb 6 23:30:09 2010 (r203579) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.h Sat Feb 6 23:47:55 2010 (r203580) @@ -42,6 +42,7 @@ $FreeBSD$ #define FL_SCTP (1<<12) #define FL_UDP (1<<13) #define FL_DEBUG (1<<14) +#define FL_DEBUG_ALL (1<<15) struct flowtable; struct flentry;