netdev
[Top] [All Lists]

[RFC] ematch API, u32 ematch, nbyte ematch, basic classifier

To: Jamal Hadi Salim <hadi@xxxxxxxxxx>
Subject: [RFC] ematch API, u32 ematch, nbyte ematch, basic classifier
From: Thomas Graf <tgraf@xxxxxxx>
Date: Mon, 3 Jan 2005 13:56:35 +0100
Cc: netdev@xxxxxxxxxxx
Sender: netdev-bounce@xxxxxxxxxxx
Jamal et al,

I attached 4 patches of a first ematch implementation. Comments
and suggestions very much appreciated. Compiles but untested.

Patch 1: ematch API

API visible to classifier:

tcf_em_tree_validate(tp, tlv, tree)
  tlv: ematches TLV
  tree: temporary struct tcf_ematch_tree

  Validates the data in the TLV and builds the ematch tree
  upon the temporary variable.

tcf_em_tree_change(tp, dst, src)
  dst: destination ematch tree (from classifier private data)
  src: source ematch tree (temporary tree from _validate)

  Replaces the ematch tree in the classifier with the temporary
  tree.
 
tcf_em_tree_destroy(tp, tree)
  Destroys an ematch tree

tcf_em_tree_dump(skb, tree, tlv_type)
  tlv_type: T of ematches TLV (classifier specific)

  Dumps the ematch tree to the skb with given tlv_type.

tcf_em_tree_match(skb, tree, res)
  res: struct tcf_result *

  Macro returning 1 if no ematches are configured, otherwise
  the tree is evaulated and 1 is returned if the tree matches.

The complete API is also visible if ematch is not configured but
will result in empty macros/structures. Those need to be
improved though.

API visible to ematches:

  tcf_em_register(ops)
  tcf_em_unregister(ops)

  ematches must at least provide the following callbacks:

  change, match
 
  Optional callbacks are: destroy, dump  

  kind must be set to a unique ID, i thought about declaring
  1..2^16 to ematches within the mainline tree and have the
  rest declared as to be used for private use to avoid collisions.

Patch 2: u32 ematch

  Is an ematch based on the existing u32 match but allows to
  specify the layer and is able to read u32 values if alignment
  does not allow direct access. Additionally it supports
  the operands, eq, lt, gt. It is a few ticks slower than the
  existing match but worth it. However, it does not support
  the neat nexthdr via hashing as u32 does which is the main
  problem before u32 can make proper use of it.

Patch 3: nbyte ematch

  Compares n bytes at specified offset. To be used for IPv6
  address matches to avoid 4 ANDed u32 matches.

Patch 4: Basic Classifier

  This is the most basic classifier possible doing nothing more
  than executing extensions and ematches. It follows the
  architecture of u32 and fw by storing a filter list in tp->root.
  This eventually makes fw obsolete once meta ematch is available.
  I didn't copy the u32/fw code but rather made use of the list.h.

pskbs are completely unhandled so far as I'm still not sure
how to do it properly.

Cheers

Attachment: 01_ematch.diff
Description: Text document

Attachment: 02_em_u32.diff
Description: Text document

Attachment: 03_em_nbyte.diff
Description: Text document

Attachment: 04_cls_basic.diff
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>