zephyr/subsys/net/l2/ethernet/lldp/Kconfig
Ulf Magnusson eddd98f811 kconfig: Replace some single-symbol 'if's with 'depends on'
I think people might be reading differences into 'if' and 'depends on'
that aren't there, like maybe 'if' being needed to "hide" a symbol,
while 'depends on' just adds a dependency.

There are no differences between 'if' and 'depends on'. 'if' is just a
shorthand for 'depends on'. They work the same when it comes to creating
implicit menus too.

The way symbols get "hidden" is through their dependencies not being
satisfied ('if'/'depends on' get copied up as a dependency on the
prompt).

Since 'if' and 'depends on' are the same, an 'if' with just a single
symbol in it can be replaced with a 'depends on'. IMO, it's best to
avoid 'if' there as a style choice too, because it confuses people into
thinking there's deep Kconfig magic going on that requires 'if'.

Going for 'depends on' can also remove some nested 'if's, which
generates nicer symbol information and docs, because nested 'if's really
are so simple/dumb that they just add the dependencies from both 'if's
to all symbols within.

Replace a bunch of single-symbol 'if's with 'depends on' to despam the
Kconfig files a bit and make it clearer how things work. Also do some
other minor related dependency refactoring.

The replacement isn't complete. Will fix up the rest later. Splitting it
a bit to make it more manageable.

(Everything above is true for choices, menus, and comments as well.)

Detected by tweaking the Kconfiglib parsing code. It's impossible to
detect after parsing, because 'if' turns into 'depends on'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-08 08:32:42 -05:00

192 lines
4.5 KiB
Plaintext

# Copyright (c) 2017 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0
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
module-help = Enables core LLDP code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
#
# LLDP Tx state machine config
#
config NET_LLDP_TX_INTERVAL
int "Time between transmissions in seconds (msgTxInterval)"
default 30
range 1 3600
help
Interval between transmissions of LLDPDUs during normal
(non-fast mode) transmission periods. For further information
please refer to section 9.2.5.7 of the LLDP spec.
config NET_LLDP_TX_HOLD
int "Multiplier of Tx Interval to result on Time to Live value"
default 4
range 1 100
help
This value (msgTxHold) is used as a multiplier of
CONFIG_NET_LLDP_TX_INTERVAL, to determine the value to be used
as Time to Live in LLDP frames. For further information please
refer to section 9.2.5.6 of the LLDP spec.
#
# End of LLDPDU TLV CONFIG
#
config NET_LLDP_END_LLDPDU_TLV_ENABLED
bool "Enable End of LLDPDU TLV"
default y
help
Tells whether LLDPDU packet will have marker at the end of the packet.
#
# CHASSIS ID TLV CONFIG
#
config NET_LLDP_CHASSIS_ID_SUBTYPE
int "Chassis ID TLV subtype"
default 4
range 1 7
help
Chassis ID subtype options are defined below.
Please refer to section 8.5.2.2 of the 802.1AB for more info.
Subtype 1 = Chassis component
Subtype 2 = Interface alias
Subtype 3 = Port component
Subtype 4 = MAC address
Subtype 5 = Network address
Subtype 6 = Interface name
Subtype 7 = Locally assigned
If subtype 4 is selected, MAC address, then configs
NET_LLDP_CHASSIS_ID_MAC0 through NET_LLDP_CHASSIS_ID_MAC5 must
be defined, otherwise you must use NET_LLDP_CHASSIS_ID instead.
if NET_LLDP_CHASSIS_ID_SUBTYPE = 4
config NET_LLDP_CHASSIS_ID_MAC0
hex "Chassis ID MAC Address Byte 0"
default 0x00
range 0 0xff
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
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
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
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
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
help
Byte 5 of the MAC address.
endif
config NET_LLDP_CHASSIS_ID
string "Chassis ID value"
default "CHASSIS_ID_PLACEHOLDER"
depends on NET_LLDP_CHASSIS_ID_SUBTYPE != 4
#
# PORT ID TLV CONFIG
#
config NET_LLDP_PORT_ID_SUBTYPE
int "Port ID TLV subtype"
default 5
range 1 7
help
Port ID subtype options are defined below.
Please refer to section 8.5.3.2 of the 802.1AB for more info.
Subtype 1 = Interface alias
Subtype 2 = Port component
Subtype 3 = MAC address
Subtype 4 = Network address
Subtype 5 = Interface name
Subtype 6 = Agent circuit ID
Subtype 7 = Locally assigned
If subtype 3 is selected (MAC address) then configs
NET_LLDP_PORT_ID_MAC0 through NET_LLDP_PORT_ID_MAC5 must
be defined, otherwise you must use NET_LLDP_PORT_ID instead.
if NET_LLDP_PORT_ID_SUBTYPE = 3
config NET_LLDP_PORT_ID_MAC0
hex "Chassis ID MAC Address Byte 0"
default 0x00
range 0 0xff
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
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
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
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
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
help
Byte 5 of the MAC address.
endif
config NET_LLDP_PORT_ID
string "Port ID value"
default "PORT_ID_PLACEHOLDER"
depends on NET_LLDP_PORT_ID_SUBTYPE != 3
endif # NET_LLDP