Improve memory allocation errors handling on receive.
This commit is contained in:
parent
a7e0f01a3d
commit
b42e3ec60b
@ -241,7 +241,12 @@ ntb_net_rx_handler(struct ntb_transport_qp *qp, void *qp_data, void *data,
|
||||
struct mbuf *m = data;
|
||||
struct ifnet *ifp = qp_data;
|
||||
|
||||
CTR0(KTR_NTB, "RX: rx handler");
|
||||
CTR1(KTR_NTB, "RX: rx handler (%d)", len);
|
||||
if (len < 0) {
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
m->m_pkthdr.csum_flags = CSUM_IP_CHECKED | CSUM_IP_VALID;
|
||||
(*ifp->if_input)(ifp, m);
|
||||
}
|
||||
|
@ -877,6 +877,8 @@ ntb_memcpy_rx(struct ntb_transport_qp *qp, struct ntb_queue_entry *entry,
|
||||
CTR2(KTR_NTB, "RX: copying %d bytes from offset %p", len, offset);
|
||||
|
||||
entry->buf = (void *)m_devget(offset, len, 0, ifp, NULL);
|
||||
if (entry->buf == NULL)
|
||||
entry->len = -ENOMEM;
|
||||
|
||||
/* Ensure that the data is globally visible before clearing the flag */
|
||||
wmb();
|
||||
|
Loading…
Reference in New Issue
Block a user