lldpad: refactor VDP cmd interpretor with vdp_cmdok


This patch refactors VDP set command path to use a single
routine to check if the cmd structure is valid.

No functional change here but this will allow us to simplify
the following patch to check the agent type.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
EVB and VDP are only supported on the nearest customer bridge agent.
This patch adds code to fail set commands from lldptool gracefully
with a string that users might understand.

"TLV does not support agent type"

>From 802.1Qbg section D.2.13 EVB TLV

"The EVB TLV is exchanged via LLDP and conforms to the LLDP TLV
specification. The LLDP database carrying the EVB TLV is addressed
using the Nearest Customer Bridge address."

>From 802.1Qbg section 41 VSI discovery and configuration protocol

"When ECP is used as a transport protocol for VDP, ECP uses the
Nearest Customer Bridge group MAC address..."

However existing pre-standard VDP implementation is using the Nearest
Bridge group database so in the existing VDP implementation check
for nearest bridge and fail other agent types.

Future work on standard based VDP implementation will check for
Nearest Customer Bridge.

This reworked patch fixes the remaining issues:
[root@c7b5 lldpad-ncb2]# ./lldptool -i eth2 -t -gncb -V evbcfg -c
fmode=reflectiverelay
capabilities=rte ecp vdp
vsis=3295
rte=15
enableTx=yes
[root@c7b5 lldpad-ncb2]# ./lldptool -i eth2 -t  -V evbcfg -c
TLV does not support agent type
[root@c7b5 lldpad-ncb2]# ./lldptool -i eth2 -t  -V evbcfg -c fmode
TLV does not support agent type
[root@c7b5 lldpad-ncb2]# ./lldptool -i eth2 -t  -V evbcfg
TLV does not support agent type
[root@c7b5 lldpad-ncb2]#

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
vdp22 protocol support for station state machine

This patch adds VDP protocol support for the IEEE 802.1 Qbg
ratified standard. It implements the station state machine
and uses the ECP protocol for communication to the switch.
The destination mac address is the nearest customer bridge.

Both versions of the VDP protocol are supported, level 0.2
(predraft) and ratified standard (also referred to as vdp22).
Which version of the protocol is used is determined by the
configuration file.

A later patch will add the vdp22 protocol bridge state machine.
With vdp22 protocol support for the bridge side, tests can
be run on a special dual network namespace setup.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>