Received: with ECARTIS (v1.0.0; list netdev); Sun, 23 Jan 2005 16:55:27 -0800 (PST) Received: from b.mx.projectdream.org (eth0-0.arisu.projectdream.org [194.158.4.191]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id j0O0tNfs002122 for ; Sun, 23 Jan 2005 16:55:23 -0800 Received: from postel.suug.ch (postel.suug.ch [195.134.158.23]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by b.mx.projectdream.org (Postfix) with ESMTP id 61EEC85; Mon, 24 Jan 2005 01:55:00 +0100 (CET) Received: by postel.suug.ch (Postfix, from userid 10001) id C7EB61C0EA; Mon, 24 Jan 2005 01:55:43 +0100 (CET) Date: Mon, 24 Jan 2005 01:55:43 +0100 From: Thomas Graf To: Patrick McHardy Cc: "David S. Miller" , netdev@oss.sgi.com Subject: Re: [PATCH 2/6] PKT_SCHED: Simple comparison ematch (cmp) Message-ID: <20050124005543.GM23931@postel.suug.ch> References: <20050123230012.GB23931@postel.suug.ch> <20050123230221.GD23931@postel.suug.ch> <41F43DD4.8070306@trash.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41F43DD4.8070306@trash.net> X-Virus-Scanned: ClamAV 0.80/650/Sun Jan 2 19:00:02 2005 clamav-milter version 0.80j on 127.0.0.1 X-Virus-Status: Clean X-archive-position: 689 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: tgraf@suug.ch Precedence: bulk X-list: netdev Content-Length: 838 Lines: 29 * Patrick McHardy <41F43DD4.8070306@trash.net> 2005-01-24 01:14 > Thomas Graf wrote: > >+static int em_cmp_match(struct sk_buff *skb, struct tcf_ematch *em, > >+ struct tcf_pkt_info *info) > >+{ > >+ struct tcf_em_cmp *cmp = (struct tcf_em_cmp *) em->data; > >+ unsigned char *ptr = tcf_get_base_ptr(skb, cmp->layer) + cmp->off; > >+ u32 val = 0; > >+ > >+ if (!tcf_valid_offset(skb, ptr, cmp->align)) > >+ return 0; > >+ > >+ switch (cmp->align) { > >+ case TCF_EM_ALIGN_U8: > >+ val = *ptr; > >+ break; > >+ > >+ case TCF_EM_ALIGN_U16: > >+ val = *ptr << 8; > >+ val |= *(ptr+1); > >+ > >+ if (cmp_needs_transformation(cmp)) > >+ val = be16_to_cpu(val); > > > > > Why not simply convert cmp->val in userspace ? To allow comparing with lt and gt. I favoured transforming over byte order specific comparison routines.