#
# Copyright (c) 2016 Intel Corporation.
#
# SPDX-License-Identifier: Apache-2.0
#

menuconfig NET_L2_IEEE802154
	bool "Enable IEEE 802.15.4 Radio"
	default n
	help
	  Add support for low rate WPAN IEEE 802.15.4 technology.

if NET_L2_IEEE802154

config NET_L2_IEEE802154_MGMT
	bool
	select NET_MGMT
	select NET_MGMT_EVENT
	default n

config NET_DEBUG_L2_IEEE802154
	bool "Enable IEEE 802.15.4 stack debug messages"
	default n
	depends on NET_LOG
	help
	  Enable it if you want to see what's happening. Only useful
	  for developers.

config NET_L2_IEEE802154_ACK_REPLY
	bool "Enable IEEE 802.15.4 ACK reply logic"
	default y
	help
	  Enable inner stack's logic on handling ACK request. Note that
	  if the hw driver has an AUTOACK feature, this is then unnecessary.

choice
	prompt "Device features level support"
	default NET_L2_IEEE802154_ORFD
	help
	  Select which features level you want on the device. Depending on it,
	  the device might expose more or less 802.15.4 protocol features.

config NET_L2_IEEE802154_ORFD
	bool "Support only an OVERLY Reduced Functionality Device"
	help
	  This is a TEST ONLY support. Do not use that in production!
	  This is not spec compliant. This is added for 2 reasons:
	  to support legacy stack behavior and for testing. PAN ID is fixed
	  as well as the channel. The device is not able to scan, associate
	  to a PAN or anything else like that. You have been warned.

config NET_L2_IEEE802154_RFD
	bool "Support Reduced Functionality Device level"
	select NET_L2_IEEE802154_MGMT
	help
	  This is the level for PAN device, not PAN coordinator. This will make
	  possible to do active and/or passive scans, as well as associating
	  and disassociating to/from a PAN. Current support is very fragile,
	  thus it is not set as the default level
endchoice

config NET_L2_IEEE802154_SHELL
	bool "Enable IEEE 802.15.4 shell module"
	default n
	select CONSOLE_SHELL
	depends on NET_L2_IEEE802154_RFD
	help
	This can be used for testing 15.4 through the console via exposing
	a shell module named "ieee15_4".

config NET_L2_IEEE802154_ACK_SET
	bool "Expose ACK request setting"
	default n
	depends on NET_L2_IEEE802154_ORFD
	select NET_L2_IEEE802154_MGMT
	help
	  Enable a network management request to let upper layers to force
	  requesting a ACK on any DATA frames. Such setting can be found
	  useful if one needs to send a buffer "reliably". Note however, this
	  becomes utterly useless if application protocol already handles
	  reliability like TCP.

config NET_L2_IEEE802154_ORFD_PAN_ID
	hex "IEEE 802.15.4 fixed PAN ID"
	depends on NET_L2_IEEE802154_ORFD
	default 0xabcd
	help
	  The fixed PAN ID to use for the ORFD.

config NET_L2_IEEE802154_ORFD_CHANNEL
	int "IEEE 802.15.4 fixed channel"
	depends on NET_L2_IEEE802154_ORFD
	default 26
	help
	  The fixed channel to use for the ORFD.

config NET_L2_IEEE802154_FRAGMENT
	bool "Enable 802.15.4 fragmentation support"
	default y
	depends on NET_6LO
	help
	  If IPv6 packets size more than 802.15.4 MTU, packet is fragmented
	  and reassemble incoming packets according to RFC4944/6282.

config NET_L2_IEEE802154_FRAGMENT_REASS_CACHE_SIZE
	int "IEEE 802.15.4 Reassembly cache size"
	depends on NET_L2_IEEE802154_FRAGMENT
	default 1
	help
	  Simultaneoulsy reassemble 802.15.4 fragments depending on
	  cache size.

config NET_L2_IEEE802154_REASSEMBLY_TIMEOUT
	int "IEEE 802.15.4 Reassembly timeout in seconds"
	depends on NET_L2_IEEE802154_FRAGMENT
	default 5
	range 1 60
	help
	  Reassembly timer will start as soon as first packet received
	  from peer. Reassembly should be finished within a given time.
	  Otherwise all accumulated fragments are dropped.

config  NET_DEBUG_L2_IEEE802154_FRAGMENT
	bool "Enable debug support for IEEE 802.15.4 fragmentation"
	depends on NET_L2_IEEE802154_FRAGMENT && NET_LOG
	default n

source "subsys/net/ip/l2/ieee802154/Kconfig.radio"

endif
