On Mon, 2006-03-13 at 21:39 -0500, jamal wrote: > On Tue, 2006-14-03 at 12:29 +1000, Russell Stuart wrote: > > On Sat, 2006-03-11 at 08:11 -0500, jamal wrote: > > > On Fri, 2006-10-02 at 12:33 +1000, Russell Stuart wrote: > > > > This patch adds a "divisor" option to tc's "sample" > > > > clause: > > > > > > While this looks right - can we have more test data with tc filter ls > > > both before and after your fix? Specify divisor of 256 and 16 for > > > example. Show that for the 256 it is the same as before and for 16 it > > > does the right thing. > > > > With patch, divisor 256: > > Thanks. > Looks like it is doing the right thing - Although sometimes the only way > to really see things is to send some traffic.
Take my word for it that I have sent mega bytes of traffic through it. I also used the patch below to view how the u32 filter was classifying things. Stephen - it looks like jamal is happy with this patch. (Jamal - I hope I am not putting words into your mouth.) Could you detail why you didn't add it to CVS, so I can attempt to fix any problems you have with it? Just to be clear, the patch below produces trace. It is an excellent way of debugging a complex u32 filter - but should kept away from production systems. diff -Nur kernel-source-2.6.15.orig/net/sched/cls_u32.c kernel-source-2.6.15/net/sched/cls_u32.c --- kernel-source-2.6.15.orig/net/sched/cls_u32.c 2006-01-03 13:21:10.000000000 +1000 +++ kernel-source-2.6.15/net/sched/cls_u32.c 2006-02-23 17:39:27.000000000 +1000 @@ -58,6 +58,8 @@ #include <net/act_api.h> #include <net/pkt_cls.h> +#define U32_TRACE(x, args...) printk(x, ## args) + struct tc_u_knode { struct tc_u_knode *next; @@ -131,6 +133,11 @@ #endif int i, r; + U32_TRACE( + "u32_classify dev=%s len=%04x proto=%02x src=%08x dst=%08x ports=%08x skblen=%04x ", + skb->dev->name, ((u16*)ptr)[1], ptr[9], + ((u32*)ptr)[3], ((u32*)ptr)[4], ((u32*)ptr)[5], skb->len); + next_ht: n = ht->ht[sel]; @@ -138,6 +145,9 @@ if (n) { struct tc_u32_key *key = n->sel.keys; + + U32_TRACE(" handle=%08x", n->handle); + #ifdef CONFIG_CLS_U32_PERF n->pf->rcnt +=1; j = 0; @@ -146,6 +156,7 @@ #ifdef CONFIG_CLS_U32_MARK if ((skb->nfmark & n->mark.mask) != n->mark.val) { n = n->next; + U32_TRACE("~mark"); goto next_knode; } else { n->mark.success++; @@ -156,8 +167,12 @@ if ((*(u32*)(ptr+key->off+(off2&key->offmask))^key->val)&key->mask) { n = n->next; + U32_TRACE("~%08x=%08x&%08x", + key->val, *(u32*)(ptr+key->off+(off2&key->offmask)), key->mask); goto next_knode; } + U32_TRACE(",%08x=%08x&%08x", + key->val, *(u32*)(ptr+key->off+(off2&key->offmask)), key->mask); #ifdef CONFIG_CLS_U32_PERF n->pf->kcnts[j] +=1; j++; @@ -171,6 +186,7 @@ #ifdef CONFIG_NET_CLS_IND if (!tcf_match_indev(skb, n->indev)) { n = n->next; + U32_TRACE("~in-dev"); goto next_knode; } #endif @@ -180,11 +196,15 @@ r = tcf_exts_exec(skb, &n->exts, res); if (r < 0) { n = n->next; + U32_TRACE("~exts"); goto next_knode; } + U32_TRACE("~OK classid=%08x\n", n->res.classid); + return r; } + U32_TRACE("~class"); n = n->next; goto next_knode; } @@ -198,11 +218,20 @@ ht = n->ht_down; sel = 0; - if (ht->divisor) + + U32_TRACE(",link-%08x", ht->handle); + if (ht->divisor) { + U32_TRACE("(%08x&%08x>>%d)", + *(u32*)(ptr+n->sel.hoff), + n->sel.hmask, n->fshift); sel = ht->divisor&u32_hash_fold(*(u32*)(ptr+n->sel.hoff), &n->sel,n->fshift); + } + U32_TRACE("[%02x]", sel); - if (!(n->sel.flags&(TC_U32_VAROFFSET|TC_U32_OFFSET|TC_U32_EAT))) + if (!(n->sel.flags&(TC_U32_VAROFFSET|TC_U32_OFFSET|TC_U32_EAT))) { + U32_TRACE(":+%d+%d", ptr-skb->nh.raw, off2); goto next_ht; + } if (n->sel.flags&(TC_U32_OFFSET|TC_U32_VAROFFSET)) { off2 = n->sel.off + 3; @@ -215,8 +244,10 @@ off2 = 0; } - if (ptr < skb->tail) + if (ptr < skb->tail) { + U32_TRACE(":+%d+%d", ptr-skb->nh.raw, off2); goto next_ht; + } } /* POP */ @@ -224,8 +255,11 @@ n = stack[sdepth].knode; ht = n->ht_up; ptr = stack[sdepth].ptr; + U32_TRACE(",pop:+%d+%d", ptr-skb->nh.raw, off2); goto check_terminal; } + + U32_TRACE(" FAILED\n"); return -1; deadloop: - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html