Lines Matching refs:seg_n
54 #define BLOCK_COMPLETE(seg_n) (uint32_t)(((uint64_t)1 << (seg_n + 1)) - 1) argument
61 #define ACK_DELAY(seg_n) \ argument
62 (MIN(2 * seg_n + 1, BT_MESH_SAR_RX_ACK_DELAY_INC_X2) * \
79 uint8_t seg_n; /* Last segment index */ member
105 uint8_t seg_n:5, member
246 for (i = 0; i <= tx->seg_n && tx->nack_count; i++) { in seg_tx_reset()
300 (tx->seg_o <= tx->seg_n) ? in schedule_transmit_continue()
352 net_buf_simple_add_u8(buf, ((seg_o & 0x07) << 5) | tx->seg_n); in seg_tx_buf_build()
405 while (tx->seg_o <= tx->seg_n) { in seg_tx_send_unacked()
425 LOG_DBG("Sending %u/%u", tx->seg_o, tx->seg_n); in seg_tx_send_unacked()
521 tx->seg_n = (sdu->len - 1) / seg_len(!!ctl_op); in send_seg()
524 tx->nack_count = tx->seg_n + 1; in send_seg()
546 tx->seg_n + 1) && in send_seg()
548 LOG_ERR("Not enough space in Friend Queue for %u segments", tx->seg_n + 1); in send_seg()
578 if (seg_o == tx->seg_n) { in send_seg()
586 tx->seg_n + 1, &seg) && in send_seg()
724 for (i = 0; i <= rx->seg_n; i++) { in seg_rx_assemble()
837 if (obo && (tx->nack_count == tx->seg_n + 1 || tx->ack_src == addr)) { in seg_tx_lookup()
897 if (find_msb_set(ack) - 1 > tx->seg_n) { in trans_ack()
904 LOG_DBG("seg %u/%u acked", bit - 1, tx->seg_n); in trans_ack()
1156 rx->block != BLOCK_COMPLETE(rx->seg_n)) { in seg_rx_reset()
1162 for (i = 0; i <= rx->seg_n; i++) { in seg_rx_reset()
1204 if (!rx->in_use || rx->block == BLOCK_COMPLETE(rx->seg_n)) { in seg_ack()
1226 if (rx->seg_n > BT_MESH_SAR_RX_SEG_THRESHOLD) { in seg_ack()
1232 static inline bool sdu_len_is_ok(bool ctl, uint8_t seg_n) in sdu_len_is_ok() argument
1234 return (seg_n < BT_MESH_RX_SEG_MAX); in sdu_len_is_ok()
1274 const uint8_t *hdr, uint8_t seg_n) in seg_rx_is_valid() argument
1276 if (rx->hdr != *hdr || rx->seg_n != seg_n) { in seg_rx_is_valid()
1296 uint8_t seg_n) in seg_rx_alloc() argument
1319 rx->seg_n = seg_n; in seg_rx_alloc()
1326 LOG_DBG("New RX context. Block Complete 0x%08x", BLOCK_COMPLETE(seg_n)); in seg_rx_alloc()
1343 uint8_t seg_n; in trans_seg() local
1365 seg_n = net_buf_simple_pull_u8(buf); in trans_seg()
1366 seg_o |= seg_n >> 5; in trans_seg()
1367 seg_n &= 0x1f; in trans_seg()
1369 LOG_DBG("SeqZero 0x%04x SegO %u SegN %u", seq_zero, seg_o, seg_n); in trans_seg()
1371 if (seg_o > seg_n) { in trans_seg()
1372 LOG_ERR("SegO greater than SegN (%u > %u)", seg_o, seg_n); in trans_seg()
1394 *seg_count = seg_n + 1; in trans_seg()
1405 if (!seg_rx_is_valid(rx, net_rx, hdr, seg_n)) { in trans_seg()
1414 if (rx->block == BLOCK_COMPLETE(rx->seg_n)) { in trans_seg()
1446 if (!sdu_len_is_ok(net_rx->ctl, seg_n)) { in trans_seg()
1493 rx = seg_rx_alloc(net_rx, hdr, seq_auth, seg_n); in trans_seg()
1515 if (seg_o == seg_n) { in trans_seg()
1517 rx->len = seg_n * seg_len(rx->ctl) + buf->len; in trans_seg()
1518 LOG_DBG("Target len %u * %u + %u = %u", seg_n, seg_len(rx->ctl), buf->len, rx->len); in trans_seg()
1541 LOG_DBG("ack delay %u", ACK_DELAY(rx->seg_n)); in trans_seg()
1542 k_work_reschedule(&rx->ack, K_MSEC(ACK_DELAY(rx->seg_n))); in trans_seg()
1554 LOG_DBG("Received %u/%u", seg_o, seg_n); in trans_seg()
1559 if (rx->block != BLOCK_COMPLETE(seg_n)) { in trans_seg()