|
|
@ -117,7 +117,7 @@ static uint8_t *upipe_rx(uint8_t *buf, size_t *off) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!upipe->rx_len) { |
|
|
|
if (!upipe->rx_len) { |
|
|
|
if (*buf > 127) { |
|
|
|
if (*buf > IEEE802154_MAX_PHY_PACKET_SIZE) { |
|
|
|
goto flush; |
|
|
|
goto flush; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -128,27 +128,20 @@ static uint8_t *upipe_rx(uint8_t *buf, size_t *off) |
|
|
|
upipe->rx_buf[upipe->rx_off++] = *buf; |
|
|
|
upipe->rx_buf[upipe->rx_off++] = *buf; |
|
|
|
|
|
|
|
|
|
|
|
if (upipe->rx_len == upipe->rx_off) { |
|
|
|
if (upipe->rx_len == upipe->rx_off) { |
|
|
|
struct net_buf *frag; |
|
|
|
pkt = net_pkt_rx_alloc_with_buffer(upipe->iface, upipe->rx_len, |
|
|
|
|
|
|
|
AF_UNSPEC, 0, K_NO_WAIT); |
|
|
|
pkt = net_pkt_rx_alloc(K_NO_WAIT); |
|
|
|
|
|
|
|
if (!pkt) { |
|
|
|
if (!pkt) { |
|
|
|
LOG_DBG("No pkt available"); |
|
|
|
LOG_DBG("No pkt available"); |
|
|
|
goto flush; |
|
|
|
goto flush; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
frag = net_pkt_get_frag(pkt, upipe->rx_len, K_NO_WAIT); |
|
|
|
if (net_pkt_write(pkt, upipe->rx_buf, upipe->rx_len)) { |
|
|
|
if (!frag) { |
|
|
|
LOG_DBG("No content read?"); |
|
|
|
LOG_DBG("No fragment available"); |
|
|
|
|
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
net_pkt_frag_insert(pkt, frag); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memcpy(frag->data, upipe->rx_buf, upipe->rx_len); |
|
|
|
|
|
|
|
net_buf_add(frag, upipe->rx_len); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(CONFIG_IEEE802154_UPIPE_HW_FILTER) |
|
|
|
#if defined(CONFIG_IEEE802154_UPIPE_HW_FILTER) |
|
|
|
if (received_dest_addr_matched(frag->data) == false) { |
|
|
|
if (received_dest_addr_matched(pkt->buffer->data) == false) { |
|
|
|
LOG_DBG("Packet received is not addressed to me"); |
|
|
|
LOG_DBG("Packet received is not addressed to me"); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|