Skip to content
Permalink
Browse files

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>
  • Loading branch information...
tbursztyka authored and jukkar committed May 28, 2019
1 parent 845f070 commit c8f7c329a2a38f5f2309df6d636a99fee032a14e
Showing with 17 additions and 22 deletions.
  1. +12 −0 include/net/lldp.h
  2. +5 −22 subsys/net/l2/ethernet/lldp/Kconfig
@@ -41,6 +41,7 @@ extern "C" {
*
* FIXME: implement a similar scheme for subtype 5 (network address).
*/
#if defined(CONFIG_NET_LLDP_CHASSIS_ID_SUBTYPE)
#if (CONFIG_NET_LLDP_CHASSIS_ID_SUBTYPE == 4)
#define NET_LLDP_CHASSIS_ID_VALUE \
{ \
@@ -57,6 +58,10 @@ extern "C" {
#define NET_LLDP_CHASSIS_ID_VALUE CONFIG_NET_LLDP_CHASSIS_ID
#define NET_LLDP_CHASSIS_ID_VALUE_LEN (sizeof(CONFIG_NET_LLDP_CHASSIS_ID) - 1)
#endif
#else
#define NET_LLDP_CHASSIS_ID_VALUE 0
#define NET_LLDP_CHASSIS_ID_VALUE_LEN 0
#endif

/*
* For the Port ID TLV Value, if subtype is a MAC address then we must
@@ -65,6 +70,7 @@ extern "C" {
*
* FIXME: implement a similar scheme for subtype 4 (network address).
*/
#if defined(CONFIG_NET_LLDP_PORT_ID_SUBTYPE)
#if (CONFIG_NET_LLDP_PORT_ID_SUBTYPE == 3)
#define NET_LLDP_PORT_ID_VALUE \
{ \
@@ -81,6 +87,10 @@ extern "C" {
#define NET_LLDP_PORT_ID_VALUE CONFIG_NET_LLDP_PORT_ID
#define NET_LLDP_PORT_ID_VALUE_LEN (sizeof(CONFIG_NET_LLDP_PORT_ID) - 1)
#endif
#else
#define NET_LLDP_PORT_ID_VALUE 0
#define NET_LLDP_PORT_ID_VALUE_LEN 0
#endif

/*
* TLVs Length.
@@ -97,8 +107,10 @@ extern "C" {
* FIXME: when the network interface is about to be ‘disabled’ TTL shall be set
* to zero so LLDP Rx agents can invalidate the entry related to this node.
*/
#if defined(CONFIG_NET_LLDP_TX_INTERVAL) && defined(CONFIG_NET_LLDP_TX_HOLD)
#define NET_LLDP_TTL \
MIN((CONFIG_NET_LLDP_TX_INTERVAL * CONFIG_NET_LLDP_TX_HOLD) + 1, 65535)
#endif


struct net_if;
@@ -4,16 +4,16 @@
# SPDX-License-Identifier: Apache-2.0
#

menu "Link Layer Discovery Protocol (LLDP) options"

config NET_LLDP
bool "Enable LLDP"
menuconfig NET_LLDP
bool "Enable Link Layer Discovery Protocol (LLDP)"
select NET_MGMT
select NET_MGMT_EVENT
help
Enable Link Layer Discovery Protocol (LLDP) Transmit support.
Please refer to IEEE Std 802.1AB for more information.

if NET_LLDP

module = NET_LLDP
module-dep = NET_LOG
module-str = Log level for LLDP
@@ -27,7 +27,6 @@ config NET_LLDP_TX_INTERVAL
int "Time between transmissions in seconds (msgTxInterval)"
default 30
range 1 3600
depends on NET_LLDP
help
Interval between transmissions of LLDPDUs during normal
(non-fast mode) transmission periods. For further information
@@ -37,7 +36,6 @@ config NET_LLDP_TX_HOLD
int "Multiplier of Tx Interval to result on Time to Live value"
default 4
range 1 100
depends on NET_LLDP
help
This value (msgTxHold) is used as a multiplier of
CONFIG_NET_LLDP_TX_INTERVAL, to determine the value to be used
@@ -50,7 +48,6 @@ config NET_LLDP_TX_HOLD
config NET_LLDP_END_LLDPDU_TLV_ENABLED
bool "Enable End of LLDPDU TLV"
default y
depends on NET_LLDP
help
Tells whether LLDPDU packet will have marker at the end of the packet.

@@ -61,7 +58,6 @@ config NET_LLDP_CHASSIS_ID_SUBTYPE
int "Chassis ID TLV subtype"
default 4
range 1 7
depends on NET_LLDP
help
Chassis ID subtype options are defined below.
Please refer to section 8.5.2.2 of the 802.1AB for more info.
@@ -81,47 +77,41 @@ config NET_LLDP_CHASSIS_ID_MAC0
hex "Chassis ID MAC Address Byte 0"
default 0x00
range 0 0xff
depends on NET_LLDP
help
Byte 0 of the MAC address.

config NET_LLDP_CHASSIS_ID_MAC1
hex "Chassis ID MAC Address Byte 1"
default 0x00
range 0 0xff
depends on NET_LLDP
help
Byte 1 of the MAC address.

config NET_LLDP_CHASSIS_ID_MAC2
hex "Chassis ID MAC Address Byte 2"
default 0x5e
range 0 0xff
depends on NET_LLDP
help
Byte 2 of the MAC address.

config NET_LLDP_CHASSIS_ID_MAC3
hex "Chassis ID MAC Address Byte 3"
default 0x00
range 0 0xff
depends on NET_LLDP
help
Byte 3 of the MAC address.

config NET_LLDP_CHASSIS_ID_MAC4
hex "Chassis ID MAC Address Byte 4"
default 0x53
range 0 0xff
depends on NET_LLDP
help
Byte 4 of the MAC address.

config NET_LLDP_CHASSIS_ID_MAC5
hex "Chassis ID MAC Address Byte 5"
default 0x8d
range 0 0xff
depends on NET_LLDP
help
Byte 5 of the MAC address.
endif
@@ -139,7 +129,6 @@ config NET_LLDP_PORT_ID_SUBTYPE
int "Port ID TLV subtype"
default 5
range 1 7
depends on NET_LLDP
help
Port ID subtype options are defined below.
Please refer to section 8.5.3.2 of the 802.1AB for more info.
@@ -159,47 +148,41 @@ config NET_LLDP_PORT_ID_MAC0
hex "Chassis ID MAC Address Byte 0"
default 0x00
range 0 0xff
depends on NET_LLDP
help
Byte 0 of the MAC address.

config NET_LLDP_PORT_ID_MAC1
hex "Chassis ID MAC Address Byte 1"
default 0x00
range 0 0xff
depends on NET_LLDP
help
Byte 1 of the MAC address.

config NET_LLDP_PORT_ID_MAC2
hex "Chassis ID MAC Address Byte 2"
default 0x5e
range 0 0xff
depends on NET_LLDP
help
Byte 2 of the MAC address.

config NET_LLDP_PORT_ID_MAC3
hex "Chassis ID MAC Address Byte 3"
default 0x00
range 0 0xff
depends on NET_LLDP
help
Byte 3 of the MAC address.

config NET_LLDP_PORT_ID_MAC4
hex "Chassis ID MAC Address Byte 4"
default 0x53
range 0 0xff
depends on NET_LLDP
help
Byte 4 of the MAC address.

config NET_LLDP_PORT_ID_MAC5
hex "Chassis ID MAC Address Byte 5"
default 0x8d
range 0 0xff
depends on NET_LLDP
help
Byte 5 of the MAC address.
endif
@@ -210,4 +193,4 @@ config NET_LLDP_PORT_ID
default "PORT_ID_PLACEHOLDER"
endif

endmenu
endif # NET_LLDP

0 comments on commit c8f7c32

Please sign in to comment.
You can’t perform that action at this time.