lldpad: stop dcbx from overwriting adminstatus

The DCBX protocol would by default attempt to set the interfaces
adminstatus to rxtx if the hardware was DCB capable. This is a
good default for devices but if an admin disables TX we should
not continue to reset it via DCBX.

This fixes the checks in the DCBX modules to only do the auto
enable when the adminstatus has not been set by the user.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdpnl rename vsiid_fmt to vsi_idfmt

Rename structure member to make it consistent with
other structure members. All structure member names
start with vsi_xxxx.

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

Remove the mynla_xxx functions and use the libnl library
provided ones.
Also check if there is enough space to construct the
netlink message.

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

Remove the mynla_xxx functions and use the nla_xxx functions
provided by libnl.

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

This patches fixes some minor issues:
- return cmd_success instead of 0
- return cmd_failure instead of 1
- fix memory leak when new destination not accepted
- Read module identifier the correct way
- Remove white space at end of line.

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

Change values for defines so they match the bits
in the IEEE 802.1 Qbg ratified standard.

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

Define VDP protocol subtype for IEEE 802.1 Qbg
ratified standard.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdp22 set vlanid to include qos

Set the vlan identifier correctly to include the QoS
bits. Vlanid and QoS are separate fields in the vdpnl_vsi
interface structure, but compacted into one field in the
vsi22 structure.

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

Add a function to query the state of the interface if
it supports VDP22 protocol. This function will be needed
later when the command line interface tool tests whether
a VSI command is applicable or not.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdp22 add support for command line interface

Add support to send VSI commands from an interface which
attached to lldpad and uses the control interface to
send data back and forth to lldpad.
The functions vdp22_request() and vdp22_status() get an
additional parameter to identifier the command interface
used. A value of 0 stands for the old netlink interface
messages used for draft 0.2 and a value of 1 stands
for the control interface attached to by a client tool
such lldp_tool.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdp22 support for command messages from attached client

Add support for an attached client program to send commands
to the VPD22 module using the lldpad control interface.
The client program attaches to lldpad and thus can receive
data back from lldpad. This interface is used to submit
VSI commands from a client via the lldpad control interface
to lldpad. As the client program is attached to lldpads
control interface, it can receive a reply from lldpad.

The data exchange will be done using ascii strings.

File qbg/vdp22_cmds.c handles reception and argument
parsing.
File qbg/vdp_ascii.c deals with conversion from ascii
string to binary data and vice versa with parameter
checking for sensible values.

Function vdp_uuid2str has been moved from qbg_utils.c
to file vdp_ascii.c

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdp22 call back to client support

Support response from lldpad to client program attached
to the control interface of lldpad. The response is waited for
by the client program to get the response of the issued VSI
association commands.
This path is also used when the switch issues an de-association
command to terminate a VSI association.

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

Add function clif_pending_wait() to specify a maximum
wait time to wait for an event message from lldpad.
The event message is transmitted via the control interface.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
clif support for sending vdp22 commands to lldpad

Add support to send IEEE 802.1 Qbg ratified standard VDP protocol
commands to the VDP22 module.

3 new functions are introduced and included in the liblldp_clif library:
clif_vsi: Sends an VSI association request to lldpad.
clif_vsievt: Wait for an event from lldpad for a certain time. The event
	message contains the switch response for the VSI request.
clif_vsiwait: Combines clif_vsi and clif_vsievt functions.

These functions operate on the VDP22 module and can not be used to
address the VDP module which implements the IEEE 801.2 Qbg draft 0.2.
The interface for draft 0.2 is the netlink message interface.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdptest use liblldp_clif library for vdp22 test cases

Use the library liblldp_clif and its new functions
clif_vsi, clif_vsievt and clif_vsiwait to communicate with
lldpad and trigger test cases for vdp22 module.

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

Fix 2 command line invocations.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
lldpad: fix ECP 2.2 ethertype and allow VDP to support VEB mode

This patch fixes the following issues:

 - change the ether type of ECP2.2 to 0x8940 as per the standard

 - 802.1QBG's VDP is for supporting both VEPA and VEB as a means to
   let the upstream switch know about the VM's and their virtual-ports
   irrespective of the traffic pattern. So, irrespective of whether
   the reflective relay is configured or not evb22 modules should be
   started. So, the check in evb22_timer() is dropped.

This patch is from Paddu I helped him with the formatting a bit is
all.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
vdp22 reduce delay before executing vdp22

Reduce the delay from 100 milli seconds down to 2 milli
seconds. This delay is needed to allow the EVB22 protocol
to send out a confirmation to acknowledge the reception
of the EVB22 message.
After the delay of 2 milli seconds, the VDP22 state machine
is triggered to handle the VDP22 message.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
liblldp_clif add documentation for new functions

Add documentation for the new functions clif_vsi, clif_vsiwait and
clif_vsievt.

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

Add minor fix to use one define for the protocol ecp22
ethernet type value.

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