svn commit: r294996 - head/sys/dev/sfxge
Gleb Smirnoff
glebius at FreeBSD.org
Thu Jan 28 16:51:58 UTC 2016
Author: glebius
Date: Thu Jan 28 16:51:56 2016
New Revision: 294996
URL: https://svnweb.freebsd.org/changeset/base/294996
Log:
Use m_getjcl() instead of manually selecting zone.
Reviewed by: arybchik
Modified:
head/sys/dev/sfxge/sfxge.h
head/sys/dev/sfxge/sfxge_rx.c
Modified: head/sys/dev/sfxge/sfxge.h
==============================================================================
--- head/sys/dev/sfxge/sfxge.h Thu Jan 28 16:05:46 2016 (r294995)
+++ head/sys/dev/sfxge/sfxge.h Thu Jan 28 16:51:56 2016 (r294996)
@@ -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;
Modified: head/sys/dev/sfxge/sfxge_rx.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_rx.c Thu Jan 28 16:05:46 2016 (r294995)
+++ head/sys/dev/sfxge/sfxge_rx.c Thu Jan 28 16:51:56 2016 (r294996)
@@ -205,25 +205,6 @@ sfxge_rx_schedule_refill(struct sfxge_rx
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, un
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.
More information about the svn-src-all
mailing list