Lines Matching refs:lldp
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()
119 ret = net_pkt_write(pkt, (uint8_t *)lldp->lldpdu, in lldp_send()
126 if (lldp->optional_du && lldp->optional_len) { in lldp_send()
127 ret = net_pkt_write(pkt, (uint8_t *)lldp->optional_du, in lldp_send()
128 lldp->optional_len); in lldp_send()
146 net_if_get_link_addr(lldp->iface)); in lldp_send()
155 if (net_if_try_send_data(lldp->iface, pkt, K_NO_WAIT) == NET_DROP) { in lldp_send()
161 lldp->tx_timer_start = k_uptime_get(); in lldp_send()
166 static uint32_t lldp_manage_timeouts(struct ethernet_lldp *lldp, int64_t timeout) in lldp_manage_timeouts() argument
170 if (lldp_timedout(lldp, timeout)) { in lldp_manage_timeouts()
171 lldp_send(lldp); in lldp_manage_timeouts()
174 next_timeout = timeout - (lldp->tx_timer_start + in lldp_manage_timeouts()
175 lldp->tx_timer_timeout); in lldp_manage_timeouts()
209 if (ctx->lldp[slot].tx_timer_start != 0) { in lldp_start_timer()
213 ctx->lldp[slot].iface = iface; in lldp_start_timer()
215 sys_slist_append(&lldp_ifaces, &ctx->lldp[slot].node); in lldp_start_timer()
217 ctx->lldp[slot].tx_timer_start = k_uptime_get(); in lldp_start_timer()
218 ctx->lldp[slot].tx_timer_timeout = in lldp_start_timer()
221 lldp_submit_work(ctx->lldp[slot].tx_timer_timeout); in lldp_start_timer()
258 &ctx->lldp[slot].node)) { in lldp_start()
259 ctx->lldp[slot].tx_timer_start = 0; in lldp_start()
298 recv_cb = ctx->lldp[ret].cb; in net_lldp_recv()
325 ctx->lldp[ret].cb = recv_cb; in net_lldp_register_callback()
357 ctx->lldp[i].lldpdu = lldpdu; in net_lldp_config()
372 ctx->lldp[i].optional_du = tlv; in net_lldp_config_optional()
373 ctx->lldp[i].optional_len = len; in net_lldp_config_optional()