Lines Matching +full:time +full:- +full:slot

8  * SPDX-License-Identifier: Apache-2.0
34 int i, found = -1; in lldp_find()
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()
51 return -ENOENT; in lldp_find()
64 static bool lldp_check_timeout(int64_t start, uint32_t time, int64_t timeout) in lldp_check_timeout() argument
66 start += time; in lldp_check_timeout()
78 return lldp_check_timeout(lldp->tx_timer_start, in lldp_timedout()
79 lldp->tx_timer_timeout, in lldp_timedout()
92 if (!lldp->lldpdu) { in lldp_send()
95 ret = -EINVAL; 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()
112 ret = -ENOMEM; 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()
145 net_pkt_lladdr_src(pkt)->len = sizeof(struct net_eth_addr); in lldp_send()
146 net_pkt_lladdr_dst(pkt)->addr = (uint8_t *)lldp_multicast_eth_addr.addr; in lldp_send()
147 net_pkt_lladdr_dst(pkt)->len = sizeof(struct net_eth_addr); in lldp_send()
149 if (net_if_send_data(lldp->iface, pkt) == NET_DROP) { in lldp_send()
151 ret = -EIO; in lldp_send()
155 lldp->tx_timer_start = k_uptime_get(); in lldp_send()
168 next_timeout = timeout - (lldp->tx_timer_start + in lldp_manage_timeouts()
169 lldp->tx_timer_timeout); in lldp_manage_timeouts()
176 uint32_t timeout_update = UINT32_MAX - 1; in lldp_tx_timeout()
191 if (timeout_update < (UINT32_MAX - 1)) { in lldp_tx_timeout()
200 int slot) in lldp_start_timer() argument
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()
221 return -ENOENT; in lldp_check_iface()
225 return -ESRCH; in lldp_check_iface()
234 int ret, slot; in lldp_start() local
248 slot = ret; in lldp_start()
252 &ctx->lldp[slot].node)) { in lldp_start()
253 ctx->lldp[slot].tx_timer_start = 0; in lldp_start()
261 lldp_start_timer(ctx, iface, slot); 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()