netmap: Fix a queue length check in the generic port rx path

The check is ok by default, since the default value of
netmap_generic_ringsize is 1024.  But we should check against the
configured "ring" size.

Reviewed by:	vmaffione
MFC after:	1 week
Sponsored by:	Zenarmor
Sponsored by:	OPNsense
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D38062
This commit is contained in:
Mark Johnston 2023-01-23 14:41:55 -05:00
parent 56c438fcd4
commit 539437c828

View File

@ -838,7 +838,7 @@ generic_rx_handler(struct ifnet *ifp, struct mbuf *m)
nm_prlim(2, "Warning: driver pushed up big packet "
"(size=%d)", (int)MBUF_LEN(m));
m_freem(m);
} else if (unlikely(mbq_len(&kring->rx_queue) > 1024)) {
} else if (unlikely(mbq_len(&kring->rx_queue) > na->num_rx_desc)) {
m_freem(m);
} else {
mbq_safe_enqueue(&kring->rx_queue, m);