Filter ...
More...
Go to the source code of this file.
|
function dev | addHW5tupleFilter (filter, queue, priority) |
| Installs a 5tuple filter on the device. More...
|
|
function dev | filterTimestamps (queue, offset, ntype, ver) |
| Filter PTP time stamp packets by inspecting the PTP version and type field. More...
|
|
function mod | create5TupleFilter (socket, acx, numCategories, maxNRules) |
| Creates a new 5tuple filter / packet classifier. More...
|
|
function mg_filter_5tuple | bindValuesToCategory (values, category) |
| Bind an array of result values to a filter category. More...
|
|
function mg_filter_5tuple | bindBitmaskToCategory (bitmask, category) |
| Bind a BitMask to a filter category. More...
|
|
function mg_filter_5tuple | allocateRule () |
| Allocates memory for one 5 tuple rule. More...
|
|
function mg_filter_5tuple | addRule (rule, priority, category_mask, value) |
| Adds a rule to the filter. More...
|
|
function mg_filter_5tuple | build (numCategories) |
| Builds the filter with the currently added rules. More...
|
|
function mg_filter_5tuple | classifyBurst (pkts, inMask) |
| Perform packet classification for a burst of packets Will do memory violation, when Masks or Values are not correctly bound to categories. More...
|
|
Filter ...
- Todo:
- TODO docu
Definition in file filter.lua.
function dev addHW5tupleFilter |
( |
filter |
, |
|
|
queue |
, |
|
|
priority |
|
|
) |
| |
Installs a 5tuple filter on the device.
Matching packets will be redirected into the specified rx queue NOTE: this is currently only tested for X540 NICs, and will probably also work for 82599 and other ixgbe NICs. Use on other NICs might result in undefined behavior.
- Parameters
-
filter | A table describing the filter. Possible fields are src_ip : Sourche IPv4 Address dst_ip : Destination IPv4 Address src_port : Source L4 port dst_port : Destination L4 port l4protocol: L4 Protocol type supported protocols: ip.PROTO_ICMP, ip.PROTO_TCP, ip.PROTO_UDP If a non supported type is given, the filter will only match on protocols, which are not supported. All fields are optional. If a field is not present, or nil, the filter will ignore this field when checking for a match. |
queue | RX Queue, where packets, matching this filter will be redirected |
priority | optional (default = 1) The priority of this filter rule. 7 is the highest priority and 1 the lowest priority. |
function mg_filter_5tuple addRule |
( |
rule |
, |
|
|
priority |
, |
|
|
category_mask |
, |
|
|
value |
|
|
) |
| |
Adds a rule to the filter.
- Parameters
-
rule | the rule to be added (ctype "struct mg_5tuple_rule") priority of the rule. Higher number -> higher priority bitmask for the categories, this rule should apply 32bit integer value associated with this rule. Value is not allowed to be 0 |
function mg_filter_5tuple allocateRule |
( |
| ) |
|
Allocates memory for one 5 tuple rule.
- Returns
- ctype object "struct mg_5tuple_rule"
function mg_filter_5tuple bindBitmaskToCategory |
( |
bitmask |
, |
|
|
category |
|
|
) |
| |
Bind a BitMask to a filter category.
On Classification the corresponding bits in the bitmask are set, when a rule matches a packet, for the corresponding category. One Bitmask can be bound to multiple categories. The result will be a bitwise OR of the Bitmasks, which would be filled for each category.
- Parameters
-
bitmask | Bitmask to be bound to a category. May also be a number. In this case a new BitMask will be allocated and bound to the specified category. |
category | optional (default = bind the specified bitmask to all not yet bound categories), The category the bitmask should be bound to |
- Returns
- the bitmask, which was bound
function mg_filter_5tuple bindValuesToCategory |
( |
values |
, |
|
|
category |
|
|
) |
| |
Bind an array of result values to a filter category.
One array of values can be boun to multiple categories. After classification it will contain mixed values of all categories it was bound to.
- Parameters
-
values | Array of values to be bound to a category. May also be a number. In this case a new Array will be allocated and bound to the specified category. |
category | optional (default = bind the specified array to all not yet bound categories), The category the array should be bound to |
- Returns
- the array, which was bound
function mg_filter_5tuple build |
( |
numCategories |
| ) |
|
Builds the filter with the currently added rules.
Should be executed after adding rules
- Parameters
-
optional | (default = number of Categories, set at 5tuple filter creation time) numCategories maximum number of categories, which are in use. |
function mg_filter_5tuple classifyBurst |
( |
pkts |
, |
|
|
inMask |
|
|
) |
| |
Perform packet classification for a burst of packets Will do memory violation, when Masks or Values are not correctly bound to categories.
- Parameters
-
pkts | Array of mbufs. Mbufs should contain valid IPv4 packets with a normal ethernet header (no VLAN tags). A L4 Protocol header has to be present, to avoid reading at invalid memory address. |
inMask | bitMask, specifying on which packets the filter should be applied |
- Returns
- 0 on successfull completion.
function mod create5TupleFilter |
( |
socket |
, |
|
|
acx |
, |
|
|
numCategories |
, |
|
|
maxNRules |
|
|
) |
| |
Creates a new 5tuple filter / packet classifier.
- Parameters
-
socket | optional (default: socket of calling thread), CPU socket, where memory for the filter should be allocated. |
acx | experimental use only. should be nil. |
numCategories | number of categories, this filter should support |
maxNRules | optional (default = 10), maximum number of rules. |
- Returns
- a wrapper table for the created filter
function dev filterTimestamps |
( |
queue |
, |
|
|
offset |
, |
|
|
ntype |
, |
|
|
ver |
|
|
) |
| |
Filter PTP time stamp packets by inspecting the PTP version and type field.
Packets with PTP version 2 are matched with this filter.
- Parameters
-
queue | |
offset | the offset of the PTP version field |
ntype | the PTP type to look for, default = 0 |
ver | the PTP version to look for, default = 2 |
- Examples:
- quality-of-service-test.lua.