Commit graph

12 commits

Author SHA1 Message Date
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Tomasz Bursztyka c8f7c329a2 net/lldp: Simplify Kconfig file
Let's remove depends on NET_LLDP from all the options. It avoids this:
 # CONFIG_NET_LLDP is not set
 # CONFIG_NET_LLDP_LOG_LEVEL_OFF is not set
 # CONFIG_NET_LLDP_LOG_LEVEL_ERR is not set
 # CONFIG_NET_LLDP_LOG_LEVEL_WRN is not set
 # CONFIG_NET_LLDP_LOG_LEVEL_INF is not set
 # CONFIG_NET_LLDP_LOG_LEVEL_DBG is not set
 CONFIG_NET_LLDP_LOG_LEVEL_DEFAULT=y
 CONFIG_NET_LLDP_LOG_LEVEL=3
 CONFIG_NET_LLDP_CHASSIS_ID="CHASSIS_ID_PLACEHOLDER"
 CONFIG_NET_LLDP_PORT_ID="PORT_ID_PLACEHOLDER"

And instead it will generate this:
 # CONFIG_NET_LLDP is not set

Make the menu as an enablement config option as well.

Adapting lldp header file relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-07-10 15:24:32 +03:00
Jukka Rissanen c3cf543452 net: ethernet: lldp: Use short types for ints
Instead of uint16_t and uint8_t, use u16_t and u8_t types.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-27 10:13:16 -05:00
Jukka Rissanen 0888b9f85c doc: net: Fix LLDP documentation
The LLDP documentation was missing descriptions for enums
and structs.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-27 10:13:16 -05:00
Andrei Emeltchenko a9090c9538 net: lldp: Move optional End TLV to send function
In a case we have optional TLVs we need to send End TLV in the very
end.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-09 16:02:11 -05:00
Andrei Emeltchenko 480f93fbb5 net: lldp: Add optional TLV API
Add possibility to set optional TLVs to LLDP DU.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-09 16:02:11 -05:00
Andrei Emeltchenko fba09bffb2 net: lldp: Move LLDP structure definition to lldp
Move duplicated structure definitions to lldp subsystem from
drivers.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-09 16:02:11 -05:00
Jukka Rissanen 52dc50dc6b net: lldp: Allow generation of documentation
No need to hide the symbols in the header file if CONFIG_NET_LLDP
is not enabled. This also allows the documentation to be generated
properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-01 09:45:06 +01:00
Carlos Stuart 75f77db432 include: misc: util.h: Rename min/max to MIN/MAX
There are issues using lowercase min and max macros when compiling a C++
application with a third-party toolchain such as GNU ARM Embedded when
using some STL headers i.e. <chrono>.

This is because there are actual C++ functions called min and max
defined in some of the STL headers and these macros interfere with them.
By changing the macros to UPPERCASE, which is consistent with almost all
other pre-processor macros this naming conflict is avoided.

All files that use these macros have been updated.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-14 22:16:03 -05:00
Flavio Ceolin 67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -04:00
Andrei Emeltchenko e1757277ae net: lldp: Implement LLDP RX API
Add RX API to LLDP. Caller should register callback which is called
from ethernet_recv().

Fixes #9407

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-09-11 10:55:01 +03:00
Jesus Sanchez-Palencia 598276262c net: l2: Add support for Link Layer Discovery Protocol (LLDP)
The LLDP protocol defines 2 separate agents, the Transmitters and
the Receivers. For the context of Zephyr, we are only interested in
the Tx agent, thus we drop any LLDP frames received by Zephyr.

LLDP frames are basically composed by an ethernet header followed by
the LLDP Protocol Data Unit (LLDPDU). The LLDPDU is composed by several
TLVs, some of them being mandatory and some optional.

Our approach here is having TLVs fully configured from Kconfig, thus
having the entire LLDPDU constructed on build time.

The commit adds NET_ETH_PTYPE_LLDP definition and related handling.

If CONFIG_NET_LLDP is enabled then ethernet_context has a pointer to
the struct net_lldpdu that belongs to that ethernet interface. Also
when CONFIG_NET_LLDP is enabled, the LLDP state machine will start to
send packets when network interface is coming up.

Currently the LLDP state machine is just a k_delayed_work() sending the
LLDPDU at a given period (defined by CONFIG_NET_LLDP_TX_INTERVAL).

Fixes #3233

Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-08 09:53:24 +03:00