introduce M_EXT_RW to allow mbuf external storage R/W.
discussed on tech-net@.
This commit is contained in:
parent
dab9f713b9
commit
52f0c217f7
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_bge.c,v 1.73 2004/05/25 04:38:36 atatat Exp $ */
|
||||
/* $NetBSD: if_bge.c,v 1.74 2004/09/21 21:57:30 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Wind River Systems
|
||||
@ -79,7 +79,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.73 2004/05/25 04:38:36 atatat Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.74 2004/09/21 21:57:30 yamt Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "vlan.h"
|
||||
@ -955,6 +955,7 @@ bge_newbuf_jumbo(sc, i, m)
|
||||
m_new->m_len = m_new->m_pkthdr.len = BGE_JUMBO_FRAMELEN;
|
||||
MEXTADD(m_new, buf, BGE_JUMBO_FRAMELEN, M_DEVBUF,
|
||||
bge_jfree, sc);
|
||||
m_new->m_flags |= M_EXT_RW;
|
||||
} else {
|
||||
m_new = m;
|
||||
m_new->m_data = m_new->m_ext.ext_buf;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_dge.c,v 1.5 2004/05/10 02:36:56 thorpej Exp $ */
|
||||
/* $NetBSD: if_dge.c,v 1.6 2004/09/21 21:57:30 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004, SUNET, Swedish University Computer Network.
|
||||
@ -80,7 +80,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.5 2004/05/10 02:36:56 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.6 2004/09/21 21:57:30 yamt Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "rnd.h"
|
||||
@ -2129,6 +2129,7 @@ dge_add_rxbuf(struct dge_softc *sc, int idx)
|
||||
|
||||
m->m_len = m->m_pkthdr.len = DGE_BUFFER_SIZE;
|
||||
MEXTADD(m, buf, DGE_BUFFER_SIZE, M_DEVBUF, dge_freebuf, sc);
|
||||
m->m_flags |= M_EXT_RW;
|
||||
|
||||
if (rxs->rxs_mbuf != NULL)
|
||||
bus_dmamap_unload(sc->sc_dmat, rxs->rxs_dmamap);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_ti.c,v 1.61 2004/07/27 07:59:51 he Exp $ */
|
||||
/* $NetBSD: if_ti.c,v 1.62 2004/09/21 21:57:30 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999
|
||||
@ -81,7 +81,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.61 2004/07/27 07:59:51 he Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.62 2004/09/21 21:57:30 yamt Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "opt_inet.h"
|
||||
@ -906,6 +906,7 @@ static int ti_newbuf_jumbo(sc, i, m)
|
||||
/* Attach the buffer to the mbuf. */
|
||||
MEXTADD(m_new, (void *)buf, ETHER_MAX_LEN_JUMBO,
|
||||
M_DEVBUF, ti_jfree, sc);
|
||||
m_new->m_flags |= M_EXT_RW;
|
||||
m_new->m_len = m_new->m_pkthdr.len = ETHER_MAX_LEN_JUMBO;
|
||||
} else {
|
||||
m_new = m;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mbuf.h,v 1.98 2004/09/08 12:00:28 yamt Exp $ */
|
||||
/* $NetBSD: mbuf.h,v 1.99 2004/09/21 21:57:30 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1999, 2001 The NetBSD Foundation, Inc.
|
||||
@ -292,6 +292,7 @@ MBUF_DEFINE(mbuf, MHLEN, MLEN);
|
||||
#define M_EXT_CLUSTER 0x01000000 /* ext is a cluster */
|
||||
#define M_EXT_PAGES 0x02000000 /* ext_pgs is valid */
|
||||
#define M_EXT_ROMAP 0x04000000 /* ext mapping is r-o at MMU */
|
||||
#define M_EXT_RW 0x08000000 /* ext storage is writable */
|
||||
|
||||
/* for source-level compatibility */
|
||||
#define M_CLUSTER M_EXT_CLUSTER
|
||||
@ -519,7 +520,7 @@ do { \
|
||||
if ((m)->m_ext.ext_buf != NULL) { \
|
||||
(m)->m_data = (m)->m_ext.ext_buf; \
|
||||
(m)->m_flags = ((m)->m_flags & ~M_EXTCOPYFLAGS) | \
|
||||
M_EXT|M_CLUSTER; \
|
||||
M_EXT|M_CLUSTER|M_EXT_RW; \
|
||||
(m)->m_ext.ext_size = (size); \
|
||||
(m)->m_ext.ext_free = NULL; \
|
||||
(m)->m_ext.ext_arg = (pool_cache); \
|
||||
@ -539,7 +540,8 @@ do { \
|
||||
(caddr_t)malloc((size), mbtypes[(m)->m_type], (how)); \
|
||||
if ((m)->m_ext.ext_buf != NULL) { \
|
||||
(m)->m_data = (m)->m_ext.ext_buf; \
|
||||
(m)->m_flags = ((m)->m_flags & ~M_EXTCOPYFLAGS) | M_EXT;\
|
||||
(m)->m_flags = ((m)->m_flags & ~M_EXTCOPYFLAGS) | \
|
||||
M_EXT|M_EXT_RW; \
|
||||
(m)->m_ext.ext_size = (size); \
|
||||
(m)->m_ext.ext_free = NULL; \
|
||||
(m)->m_ext.ext_arg = NULL; \
|
||||
@ -636,12 +638,13 @@ do { \
|
||||
|
||||
/*
|
||||
* Determine if an mbuf's data area is read-only. This is true
|
||||
* for non-cluster external storage and for clusters that are
|
||||
* being referenced by more than one mbuf.
|
||||
* if external storage is read-only mapped, or not marked as R/W,
|
||||
* or referenced by more than one mbuf.
|
||||
*/
|
||||
#define M_READONLY(m) \
|
||||
(((m)->m_flags & M_EXT) != 0 && \
|
||||
(((m)->m_flags & M_CLUSTER) == 0 || MCLISREFERENCED(m)))
|
||||
(((m)->m_flags & (M_EXT_ROMAP|M_EXT_RW)) != M_EXT_RW || \
|
||||
MCLISREFERENCED(m)))
|
||||
|
||||
/*
|
||||
* Determine if an mbuf's data area is read-only at the MMU.
|
||||
|
Loading…
Reference in New Issue
Block a user