mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
We have some space in the external mbufs so use this space for
the external buffer reference count. This saves us a malloc() + free() per small receive mbuf.
This commit is contained in:
parent
7672807356
commit
908b018b49
2 changed files with 5 additions and 2 deletions
|
|
@ -426,8 +426,9 @@ hatm_rx_buffer(struct hatm_softc *sc, u_int group, u_int handle)
|
|||
c0->hdr.chunkno, chunkno));
|
||||
|
||||
if (m != NULL) {
|
||||
m->m_ext.ref_cnt = &c0->hdr.ref_cnt;
|
||||
m_extadd(m, (void *)c0, MBUF0_SIZE,
|
||||
hatm_mbuf0_free, sc, M_PKTHDR, EXT_NET_DRV);
|
||||
hatm_mbuf0_free, sc, M_PKTHDR, EXT_EXTREF);
|
||||
m->m_data += MBUF0_OFFSET;
|
||||
} else
|
||||
hatm_mbuf0_free(c0, sc);
|
||||
|
|
@ -442,8 +443,9 @@ hatm_rx_buffer(struct hatm_softc *sc, u_int group, u_int handle)
|
|||
c1->hdr.chunkno, chunkno));
|
||||
|
||||
if (m != NULL) {
|
||||
m->m_ext.ref_cnt = &c1->hdr.ref_cnt;
|
||||
m_extadd(m, (void *)c1, MBUF1_SIZE,
|
||||
hatm_mbuf1_free, sc, M_PKTHDR, EXT_NET_DRV);
|
||||
hatm_mbuf1_free, sc, M_PKTHDR, EXT_EXTREF);
|
||||
m->m_data += MBUF1_OFFSET;
|
||||
} else
|
||||
hatm_mbuf1_free(c1, sc);
|
||||
|
|
|
|||
|
|
@ -275,6 +275,7 @@ struct mbuf_page {
|
|||
struct mbuf_chunk_hdr {
|
||||
uint16_t pageno;
|
||||
uint16_t chunkno;
|
||||
u_int ref_cnt;
|
||||
};
|
||||
|
||||
#define MBUFX_STORAGE_SIZE(X) (MBUF##X##_CHUNK \
|
||||
|
|
|
|||
Loading…
Reference in a new issue