net: flow: fix spelling error
net: flow: do not print warning if get flows is empty

get flows may be empty due to empty table do not print warning

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
flow: fix segfault with get_flows and missing table index
flow: fixup headers

if_flow.h in UAPI is not much smaller only including the necessary
bits for the messaging protocol. We do not want to expose internal
data structures of the kernel. Its much better to only expose the
minimal set of data structures required and let the others evolve
indpendently.

The downside is we need to duplicate structures here.

Finally flow.c and flowlib.c need to be updated for new header
formats.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
flow: add attr.h header file for nla_nest_cancel
flow: add get_header_graph to help menu

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
flow: use instance id in match arguments instead of header id

The header ID may not be unique in the case where a packet may
have multiple stacked headers. For example matching on a VLAN
header is unclear for a Q in Q packet.

Same goes for tunnel packets. Its unclear which UDP header to
match for example when UDP is used for tunnel encapsolation

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
flow: off by one error in find_fields do an explicit uid return

fields are index'ed from 0 in null terminated field
array but uid's start at 1 so we end up returning the wrong
uid value when simply returning 'i'. Also it assumes that the
array index and uid match which is not necessarily true and
has only been true so far because the flow pipeline is generated
this way.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
flow: fix pretty printers for u64 and sscanf

sscanf routines should use SCN types instead of PRN types which are
intended for printf. Also stop using strtoll() it seems more clear
to me to use the sscanf routines throughout.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
net: flow: allow users to input u64 bits in mac addr format

If we detect a MAC aa:bb:cc:dd:ee:ff we consume it and translate
it to a zero padded 64bit value. It can be used for any 64bit
values but really only makes sense for mac addresses.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
net: flow: add dynamic bit to header and include it in pretty printers

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
flow: add new attribute apply_action_group

Currently we use the source boundary to indicate when actions
are applied. When a source boundary is crossed all previous
actions should be applied. However we are currently also using
it to "create" tables inside a source id.

This means its overloaded and confusing. This patch cleans up
the source id and adds a new attr called apply_action_group
which can be used to learn when actions are applied.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
flow: allow longer NET_FLOW strings

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
flow: add support for better_pipeline

Better pipelin is a fictional pipeline used to test the API. It
includes a set of tables and a TCAM that can be used to create
and destroy additional tables.

These were just made up to test some functionality of the API
its not intended to represent any real devices. I'll be adding
a set of other models shortly to test other configurations.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
flow: add makefile support to build test tools

For now its fine to always build test tools, flow is being actively
developed now. Once the tool API settles down we can build them
conditionally.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>