Use m_getjcl() instead of manually selecting zone.

Reviewed by:	arybchik
This commit is contained in:
Gleb Smirnoff 2016-01-28 16:51:56 +00:00
parent 79b67faaf6
commit 009d75e764
2 changed files with 7 additions and 25 deletions

View File

@ -273,7 +273,7 @@ struct sfxge_softc {
size_t rx_prefix_size;
size_t rx_buffer_size;
size_t rx_buffer_align;
uma_zone_t rx_buffer_zone;
int rx_cluster_size;
unsigned int evq_max;
unsigned int evq_count;

View File

@ -205,25 +205,6 @@ sfxge_rx_schedule_refill(struct sfxge_rxq *rxq, boolean_t retrying)
sfxge_rx_post_refill, rxq);
}
static struct mbuf *sfxge_rx_alloc_mbuf(struct sfxge_softc *sc)
{
struct mb_args args;
struct mbuf *m;
/* Allocate mbuf structure */
args.flags = M_PKTHDR;
args.type = MT_DATA;
m = (struct mbuf *)uma_zalloc_arg(zone_mbuf, &args, M_NOWAIT);
/* Allocate (and attach) packet buffer */
if (m != NULL && !uma_zalloc_arg(sc->rx_buffer_zone, m, M_NOWAIT)) {
uma_zfree(zone_mbuf, m);
m = NULL;
}
return (m);
}
#define SFXGE_REFILL_BATCH 64
static void
@ -273,7 +254,8 @@ sfxge_rx_qfill(struct sfxge_rxq *rxq, unsigned int target, boolean_t retrying)
KASSERT(rx_desc->mbuf == NULL, ("rx_desc->mbuf != NULL"));
rx_desc->flags = EFX_DISCARD;
m = rx_desc->mbuf = sfxge_rx_alloc_mbuf(sc);
m = rx_desc->mbuf = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR,
sc->rx_cluster_size);
if (m == NULL)
break;
@ -1125,13 +1107,13 @@ sfxge_rx_start(struct sfxge_softc *sc)
/* Select zone for packet buffers */
if (reserved <= MCLBYTES)
sc->rx_buffer_zone = zone_clust;
sc->rx_cluster_size = MCLBYTES;
else if (reserved <= MJUMPAGESIZE)
sc->rx_buffer_zone = zone_jumbop;
sc->rx_cluster_size = MJUMPAGESIZE;
else if (reserved <= MJUM9BYTES)
sc->rx_buffer_zone = zone_jumbo9;
sc->rx_cluster_size = MJUM9BYTES;
else
sc->rx_buffer_zone = zone_jumbo16;
sc->rx_cluster_size = MJUM16BYTES;
/*
* Set up the scale table. Enable all hash types and hash insertion.