mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 09:38:37 +08:00
netdev_upperhalf.c: support alloc iob from CAN buffer pool
when the network card type is NET_LL_CAN, packets are defaultly allocated from the can buffer. Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
committed by
Alan C. Assis
parent
3e025b5a03
commit
6144b51848
@@ -1705,7 +1705,17 @@ FAR netpkt_t *netpkt_alloc(FAR struct netdev_lowerhalf_s *dev,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkt = iob_tryalloc(false);
|
#ifdef CONFIG_NET_CAN
|
||||||
|
if (dev->netdev.d_lltype == NET_LL_CAN)
|
||||||
|
{
|
||||||
|
pkt = can_iob_timedalloc(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
pkt = iob_tryalloc(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (pkt == NULL)
|
if (pkt == NULL)
|
||||||
{
|
{
|
||||||
atomic_fetch_add(&dev->quota_ptr[type], 1);
|
atomic_fetch_add(&dev->quota_ptr[type], 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user