Split OVS_ARGTYPE_GROUP_PI into 2 arg types

Namely, into OVS_ARGTYPE_FLOW_PI_GROUP and OVS_ARGTYPE_NETBUFFER_PI_GROUP.
This will help for refactoring / cleaning up code where we will perform
translations args -> attrs and attrs -> args using arrays, instead of
switch case-s.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Move encap & uspace tunnel arg types in OVS_ARGTYPE enum

We are renouncing the separation of group arg types: they will no longer
be in a 'groups' section, but arranged as they are nested in messages.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Rename OVS_ARGTYPE_GROUP_PI_ENCAPSULATION

Into OVS_ARGTYPE_PI_ENCAP_GROUP: we are renouncing the section 'groups'
for arg types, therefore, we should change the naming convention:
OVS_ARGTYPE_GROUP_<arg_name> into OVS_ARGTYPE_<arg_name>_GROUP.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Rename OVS_ARGTYPE_GROUP_PI_TUNNEL

Into OVS_ARGTYPE_PI_TUNNEL_GROUP: we are renouncing the section 'groups'
for arg types, therefore, we should change the naming convention:
OVS_ARGTYPE_GROUP_<arg_name> into OVS_ARGTYPE_<arg_name>_GROUP.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Split OVS_ARGTYPE_GROUP_ACTIONS into 3 arg types

Namely, into OVS_ARGTYPE_FLOW_ACTIONS_GROUP,
OVS_ARGTYPE_NETBUFFER_ACTIONS_GROUP and
OVS_ARGTYPE_ACTION_SAMPLE_ACTIONS_GROUP.

This will help for refactoring / cleaning up code where we will perform
translations args -> attrs and attrs -> args using arrays, instead of
switch case-s.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Rename OVS_ARGTYPE_ACTION_UPCALL_GROUP

Into OVS_ARGTYPE_ACTION_UPCALL_GROUP. And move from section 'groups'
to sections 'actions' in OVS_ARGTYPE enum.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Rename OVS_ARGTYPE_GROUP_ACTIONS_SAMPLE

Into OVS_ARGTYPE_ACTION_SAMPLE_GROUP. And move from section 'groups'
to sections 'actions' in OVS_ARGTYPE enum.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Rename OVS_ARGTYPE_GROUP_ACTIONS_SETINFO

Into OVS_ARGTYPE_ACTION_SETINFO_GROUP. And move from section 'groups'
to sections 'actions' in OVS_ARGTYPE enum.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Rename OVS_ARGTYPE_FLOW_MASK_GROUP

Into OVS_ARGTYPE_FLOW_MASK_GROUP. And move from section 'groups'
to sections 'actions' in OVS_ARGTYPE enum.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Rename OVS_ARGTYPE_GROUP_OFPORT_OPTIONS

Into OVS_ARGTYPE_OFPORT_OPTIONS_GROUP. And move from section 'groups'
to sections 'actions' in OVS_ARGTYPE enum.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Change values for arg types main & invalid

invalid is more natural to be zero, while the specific value of pseudo
group called 'main' is irrelevant (it must only be unique).

This change is needed if we change switch cases to arrays: the default
value of uninitialized values in a static variable is 0, which should
correspond with 'invalid' arg type.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Correct the names for several first & last arg types

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Rename NETBUFFER -> PACKET in arg type names

PACKET is a more proper name. NETBUFFER seems to refer more to the NDIS
NET_BUFFER, but we send only the buffer represented by the NET_BUFFER,
with additional info.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Refactor ArgToAttribute.c/.h: switch cases

ArgToAttribute.c uses lots of switches with lots of cases, in order to
transform an argument type (used in kernel) to an attribute type (used in
userspace). It is much shorter code if we use arrays instead of switch cases.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Correct func IsArgTypeGroup

The argument types for groups no longer follow the same rules
as before. Therefore, we must change the function to reflect this.
Also, GetParentGroupType is Argument.c used a manual check for
'is arg type group'.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Renounce OVS_ARGTYPE_GROUP_MAIN

Reason: if we use arrays instead of switch cases for arg types,
it is clearer & shorter if we use specific group types instead
of generic 'main'. I.e. we should use pseudo arg types, datapath,
flow, packet, ofport. This will allow easier lookup of arg type
specific things, because we will be able to store an array of
all groups, identifiable by 'group type' only (msg target type
not being needed at all).

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Use arrays of groups in _FindGroup

Instead of switch cases.
- Now we can use arrays of groups (we use pseudo arg types instead of arg type
'main'
- we need to update s_argsToAttribs: add the rest of arg groups.
- we need to update s_argsToAttribs: must be an array of structs. Each
struct will hold a ptr to the correspondig group.

The resulting code will be shorter, and clearer.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Add attributes MAX in Attribute.h

When converting from attributes to arguments, we will need to know
the boundaries for groups: min attr type and max attr type.
min attr type is always 0.
max attr type must be determined.

For this purpose, we add MAX attr types for each group in Attribute.h

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Refactor AttrToArgument.c/.h: switch cases

AttrToArgument.c uses lots of switches with lots of cases, in order to
transform an argument type (used in kernel) to an attribute type (used
in userspace). It is much shorter code if we use arrays instead of
switch cases.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Move arg verification code in new file

Argument and Argument group verification code is very large (~1400
lines). It is best to move this code into a separate .c file, for better
readability.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>