Lines Matching full:lldp

2  * @brief LLDP related functions
20 #include <zephyr/net/lldp.h>
36 for (i = 0; i < ARRAY_SIZE(ctx->lldp); i++) { in lldp_find()
37 if (ctx->lldp[i].iface == iface) { in lldp_find()
41 if (found < 0 && ctx->lldp[i].iface == NULL) { in lldp_find()
47 ctx->lldp[found].iface = iface; in lldp_find()
76 static bool lldp_timedout(struct ethernet_lldp *lldp, int64_t timeout) in lldp_timedout() argument
78 return lldp_check_timeout(lldp->tx_timer_start, in lldp_timedout()
79 lldp->tx_timer_timeout, in lldp_timedout()
83 static int lldp_send(struct ethernet_lldp *lldp) in lldp_send() argument
92 if (!lldp->lldpdu) { in lldp_send()
94 NET_DBG("The LLDPDU is not set for lldp %p", lldp); in lldp_send()
99 if (lldp->optional_du && lldp->optional_len) { in lldp_send()
100 len = sizeof(struct net_lldpdu) + lldp->optional_len; in lldp_send()
109 pkt = net_pkt_alloc_with_buffer(lldp->iface, len, AF_UNSPEC, 0, in lldp_send()
118 ret = net_pkt_write(pkt, (uint8_t *)lldp->lldpdu, in lldp_send()
125 if (lldp->optional_du && lldp->optional_len) { in lldp_send()
126 ret = net_pkt_write(pkt, (uint8_t *)lldp->optional_du, in lldp_send()
127 lldp->optional_len); in lldp_send()
144 net_pkt_lladdr_src(pkt)->addr = net_if_get_link_addr(lldp->iface)->addr; in lldp_send()
149 if (net_if_send_data(lldp->iface, pkt) == NET_DROP) { in lldp_send()
155 lldp->tx_timer_start = k_uptime_get(); in lldp_send()
160 static uint32_t lldp_manage_timeouts(struct ethernet_lldp *lldp, int64_t timeout) in lldp_manage_timeouts() argument
164 if (lldp_timedout(lldp, timeout)) { in lldp_manage_timeouts()
165 lldp_send(lldp); in lldp_manage_timeouts()
168 next_timeout = timeout - (lldp->tx_timer_start + in lldp_manage_timeouts()
169 lldp->tx_timer_timeout); in lldp_manage_timeouts()
203 if (ctx->lldp[slot].tx_timer_start != 0) { in lldp_start_timer()
207 ctx->lldp[slot].iface = iface; in lldp_start_timer()
209 sys_slist_append(&lldp_ifaces, &ctx->lldp[slot].node); in lldp_start_timer()
211 ctx->lldp[slot].tx_timer_start = k_uptime_get(); in lldp_start_timer()
212 ctx->lldp[slot].tx_timer_timeout = in lldp_start_timer()
215 lldp_submit_work(ctx->lldp[slot].tx_timer_timeout); in lldp_start_timer()
252 &ctx->lldp[slot].node)) { in lldp_start()
253 ctx->lldp[slot].tx_timer_start = 0; in lldp_start()
285 recv_cb = ctx->lldp[ret].cb; in net_lldp_recv()
310 ctx->lldp[ret].cb = recv_cb; in net_lldp_register_callback()
342 ctx->lldp[i].lldpdu = lldpdu; in net_lldp_config()
357 ctx->lldp[i].optional_du = tlv; in net_lldp_config_optional()
358 ctx->lldp[i].optional_len = len; in net_lldp_config_optional()