Skip to content

Commit 0888b9f

Browse files
jukkargalak
authored andcommitted
doc: net: Fix LLDP documentation
The LLDP documentation was missing descriptions for enums and structs. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 5378672 commit 0888b9f

File tree

1 file changed

+39
-24
lines changed

1 file changed

+39
-24
lines changed

include/net/lldp.h

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
extern "C" {
2525
#endif
2626

27+
/** @cond INTERNAL_HIDDEN */
28+
2729
#define LLDP_TLV_GET_LENGTH(type_length) (type_length & BIT_MASK(9))
2830
#define LLDP_TLV_GET_TYPE(type_length) ((u8_t)(type_length >> 9))
2931

@@ -101,46 +103,59 @@ extern "C" {
101103

102104
struct net_if;
103105

104-
/* TLV Types. Please refer to table 8-1 from IEEE 802.1AB standard. */
106+
/** @endcond */
107+
108+
/** TLV Types. Please refer to table 8-1 from IEEE 802.1AB standard. */
105109
enum net_lldp_tlv_type {
106-
LLDP_TLV_END_LLDPDU = 0,
107-
LLDP_TLV_CHASSIS_ID,
108-
LLDP_TLV_PORT_ID,
109-
LLDP_TLV_TTL,
110-
LLDP_TLV_PORT_DESC,
111-
LLDP_TLV_SYSTEM_NAME,
112-
LLDP_TLV_SYSTEM_DESC,
113-
LLDP_TLV_SYSTEM_CAPABILITIES,
114-
LLDP_TLV_MANAGEMENT_ADDR,
110+
LLDP_TLV_END_LLDPDU = 0, /**< End Of LLDPDU (optional) */
111+
LLDP_TLV_CHASSIS_ID = 1, /**< Chassis ID (mandatory) */
112+
LLDP_TLV_PORT_ID = 2, /**< Port ID (mandatory) */
113+
LLDP_TLV_TTL = 3, /**< Time To Live (mandatory) */
114+
LLDP_TLV_PORT_DESC = 4, /**< Port Description (optional) */
115+
LLDP_TLV_SYSTEM_NAME = 5, /**< System Name (optional) */
116+
LLDP_TLV_SYSTEM_DESC = 6, /**< System Description (optional) */
117+
LLDP_TLV_SYSTEM_CAPABILITIES = 7, /**< System Capability (optional) */
118+
LLDP_TLV_MANAGEMENT_ADDR = 8, /**< Management Address (optional) */
115119
/* Types 9 - 126 are reserved. */
116-
LLDP_TLV_ORG_SPECIFIC = 127
120+
LLDP_TLV_ORG_SPECIFIC = 127, /**< Org specific TLVs (optional) */
117121
};
118122

123+
/** Chassis ID TLV, see chapter 8.5.2 in IEEE 802.1AB */
119124
struct net_lldp_chassis_tlv {
120-
uint16_t type_length; /* 7 bits for type, 9 bits for length */
121-
uint8_t subtype; /* ID subtype. */
125+
/** 7 bits for type, 9 bits for length */
126+
uint16_t type_length;
127+
/** ID subtype */
128+
uint8_t subtype;
129+
/** Chassis ID value */
122130
uint8_t value[NET_LLDP_CHASSIS_ID_VALUE_LEN];
123131
} __packed;
124132

133+
/** Port ID TLV, see chapter 8.5.3 in IEEE 802.1AB */
125134
struct net_lldp_port_tlv {
126-
uint16_t type_length; /* 7 bits for type, 9 bits for length */
127-
uint8_t subtype; /* ID subtype. */
135+
/** 7 bits for type, 9 bits for length */
136+
uint16_t type_length;
137+
/** ID subtype */
138+
uint8_t subtype;
139+
/** Port ID value */
128140
uint8_t value[NET_LLDP_PORT_ID_VALUE_LEN];
129141
} __packed;
130142

143+
/** Time To Live TLV, see chapter 8.5.4 in IEEE 802.1AB */
131144
struct net_lldp_time_to_live_tlv {
132-
uint16_t type_length; /* 7 bits for type, 9 bits for length */
133-
uint16_t ttl; /* Time to live */
145+
/** 7 bits for type, 9 bits for length */
146+
uint16_t type_length;
147+
/** Time To Live (TTL) value */
148+
uint16_t ttl;
134149
} __packed;
135150

136-
/*
151+
/**
137152
* LLDP Data Unit (LLDPDU) shall contain the following ordered TLVs
138-
* as stated in "8.2 LLDPDU format" from the Spec.
153+
* as stated in "8.2 LLDPDU format" from the IEEE 802.1AB
139154
*/
140155
struct net_lldpdu {
141-
struct net_lldp_chassis_tlv chassis_id; /* Mandatory TLV */
142-
struct net_lldp_port_tlv port_id; /* Mandatory TLV */
143-
struct net_lldp_time_to_live_tlv ttl; /* Mandatory TLV */
156+
struct net_lldp_chassis_tlv chassis_id; /**< Mandatory Chassis TLV */
157+
struct net_lldp_port_tlv port_id; /**< Mandatory Port TLV */
158+
struct net_lldp_time_to_live_tlv ttl; /**< Mandatory TTL TLV */
144159
} __packed;
145160

146161
/**
@@ -205,25 +220,25 @@ int net_lldp_register_callback(struct net_if *iface, net_lldp_recv_cb_t cb);
205220
*/
206221
enum net_verdict net_lldp_recv(struct net_if *iface, struct net_pkt *pkt);
207222

208-
#if defined(CONFIG_NET_LLDP)
209223
/**
210224
* @brief Set LLDP protocol data unit (LLDPDU) for the network interface.
211225
*
212226
* @param iface Network interface
213227
*
214228
* @return <0 if error, index in lldp array if iface is found there
215229
*/
230+
#if defined(CONFIG_NET_LLDP)
216231
int net_lldp_set_lldpdu(struct net_if *iface);
217232
#else
218233
#define net_lldp_set_lldpdu(iface)
219234
#endif
220235

221-
#if defined(CONFIG_NET_LLDP)
222236
/**
223237
* @brief Unset LLDP protocol data unit (LLDPDU) for the network interface.
224238
*
225239
* @param iface Network interface
226240
*/
241+
#if defined(CONFIG_NET_LLDP)
227242
void net_lldp_unset_lldpdu(struct net_if *iface);
228243
#else
229244
#define net_lldp_unset_lldpdu(iface)

0 commit comments

Comments
 (0)