rtnl netlink message construction support

Add some more helper functions to construct and parse
a netlink message. The new functions follow the scheme
introduced with commit 2710e03e21f4aaa712cd664f35dda79c81599119.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdp set size of filter data list to zero

The VDP protocol draft 0.2 does not support the
return of changed VLAN identifiers from the switch to
the station. There is no need to return changes in
the filter data to the originator of the VSI request.
So set the size of the filter information data to
zero and nothing is returned.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdp22 support tracing for manager id

With VPD22 protocol the manager identifer can be up
to 16 bytes containing non-printable characters. To trace
a VSI protofile and display a printable manager identifer
and also maintain backward compatability with draft 0.2
(where the manager id was a 1 byte number) and new function
is introduced.
It prints 1 byte manager ids as a number and other manager
as text when they consist entirely of printable characters.
If not the manager id is printed as a UUID.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdp22 remove pcp and ps from structure definition

Remove the Priority code point (PCP) and PCP Significant (PS)
members from the structure fid22. Both members are now stored
in the upper bits in the vlan identifier. This is the same format
as in the TLV definition.

Compare MAC address and group identifiers in the filter
data only when the filter information format indicates
valid data.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdp22 returned changed filter information from switch

In IEEE802.1 Qbg ratified standard the switch may return changed
filter information. For example VLAN and/or QoS can be altered.
This patch adds a function to change the filter information
data send by the VSI profile to those settings returned from
the switch.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdp22 remove default error status on VSI end

Remove the default error status when an VSI is terminated
and no specific status error is set.
Instead the status error is set when detected.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdp22 add support for KEEP bit and KEEP state transition

Add support for the KEEP bit support and handle the correct
state transition for the KEEP bit. Currently this state
transition is not supported and generate an ABRT core dump.
Also return the correct status error which KEEP bit set.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdpnl add support for new netlink message format

Add support for new netlink message format to support
16 byte manager identifier, the hint bits (migration to
and migration from indicator), the group identifier.
Also mark changed VLAN/QoS fields and return them to
the originator.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdp22-bridge support for error generation

For testing purposes the lldpad process can run a bridge.
In normal environment it returns always ok. When compiled
with BUILD_DEBUG the bridge processing code uses certain
type identifier and type version identifiers to provoke
error and return these error to test error handling on the
station side.
The scheme is enhanced to provoke more errors for testing.

This is only temporary until the lldpad configuration file
is enhanced by a bridge configuration section to describe
which VSI profile to accept and deny.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdpnl: initialize vdpnl_mac to prevent segfault

In the vdptest man pages the following profile is given as an example:

	name=thomas2,mgrid=1,typeid=123452,typeidver=1,hints=none\
		uuid=a1412857-60f7-4ce1-e95a-2164943f53dd,\
		map=2-52:54:00:8e:50:53-9999,map=0/10-52:54:00:8e:50:54-8888

When this profile is used as a basic test, it causes lldpad to segfault
and vdptest to fail. The command used is:

	sudo ./vdptest -i eth5 -Aname=thomas2,mgrid=1,typeid=123452,\
	typeidver=1,hints=none,uuid=a1412857-60f7-4ce1-e95a-2164943f53dd,\
	map=2-52:54:00:8e:50:53-9999,map=0/10-52:54:00:8e:50:54-8888\
	-a thomas2,w=10,r=2

If vlan == 0 then vdp22_alloc_vsi() sets the VDP22_RETURN_VID flag and
in vdp22_status the following code is performed (and maclist == NULL):

	if (p->flags & VDP22_RETURN_VID) {
		vsi->maclist->vlan = p->fdata[0].vlan;
		...
	}

The attached changes assume that there is only one MAC/VLAN pair but it
seems consistent with the existing code.

Signed-off-by: Philbert Lin <philbert.lin@intel.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdptest: add additional notes to man page

Some aspects to vdptest are not intuitive. The examples at the bottom of
the man page give the impression that vdptest maintains state throughout
calls. Additionally the expected return code causes confusion when
testing out the listed commands. Notes have been added to clarify.

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