Merge the 3 copies of m_getcl() so that fast ipsec compiles again together
with net80211. XXX: We don't really have an m_getcl(), we just emulate it.
This commit is contained in:
parent
11f5327084
commit
3b9c87155a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fw_port.h,v 1.4 2005/08/26 11:20:33 drochner Exp $ */
|
||||
/* $NetBSD: fw_port.h,v 1.5 2005/12/04 19:15:21 christos Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2004 KIYOHARA Takashi
|
||||
* All rights reserved.
|
||||
@ -1111,18 +1111,6 @@ struct fw_hwaddr {
|
||||
#define m_tag_locate(m, cookie, type, t) \
|
||||
m_tag_find((m), (type), (t))
|
||||
|
||||
static __inline struct mbuf *
|
||||
m_getcl(int how, short type, int flags)
|
||||
{
|
||||
struct mbuf *m;
|
||||
|
||||
m = m_gethdr(how, type);
|
||||
if (m != NULL)
|
||||
m_clget(m, how);
|
||||
|
||||
return (m);
|
||||
}
|
||||
|
||||
/*
|
||||
* bus_dma macros for NetBSD
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uipc_mbuf2.c,v 1.19 2005/05/06 09:40:40 martin Exp $ */
|
||||
/* $NetBSD: uipc_mbuf2.c,v 1.20 2005/12/04 19:15:21 christos Exp $ */
|
||||
/* $KAME: uipc_mbuf2.c,v 1.29 2001/02/14 13:42:10 itojun Exp $ */
|
||||
|
||||
/*
|
||||
@ -62,7 +62,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf2.c,v 1.19 2005/05/06 09:40:40 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf2.c,v 1.20 2005/12/04 19:15:21 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -223,6 +223,35 @@ ok:
|
||||
return n;
|
||||
}
|
||||
|
||||
/*
|
||||
* FreeBSD 4.6 introduced m_getcl(), which performs `fast' allocation
|
||||
* mbuf clusters from a cache of recently-freed clusters. (If the cache
|
||||
* is empty, new clusters are allocated en-masse).
|
||||
* On NetBSD, for now, implement the `cache' as a function
|
||||
* using normal NetBSD mbuf/cluster allocation macros. Replace this
|
||||
* with fast-cache code, if and when NetBSD implements one.
|
||||
*/
|
||||
struct mbuf *
|
||||
m_getcl(int how, int type, int flags)
|
||||
{
|
||||
struct mbuf *mp;
|
||||
|
||||
if ((flags & M_PKTHDR) != 0)
|
||||
MGETHDR(mp, how, type);
|
||||
else
|
||||
MGET(mp, how, type);
|
||||
|
||||
if (mp == NULL)
|
||||
return NULL;
|
||||
|
||||
MCLGET(mp, how);
|
||||
if ((mp->m_flags & M_EXT) != 0)
|
||||
return mp;
|
||||
|
||||
m_free(mp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get a packet tag structure along with specified data following. */
|
||||
struct m_tag *
|
||||
m_tag_get(int type, int len, int wait)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ieee80211_netbsd.c,v 1.10 2005/11/25 17:33:56 thorpej Exp $ */
|
||||
/* $NetBSD: ieee80211_netbsd.c,v 1.11 2005/12/04 19:15:21 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2003-2005 Sam Leffler, Errno Consulting
|
||||
* All rights reserved.
|
||||
@ -30,7 +30,7 @@
|
||||
#ifdef __FreeBSD__
|
||||
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_freebsd.c,v 1.8 2005/08/08 18:46:35 sam Exp $");
|
||||
#else
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_netbsd.c,v 1.10 2005/11/25 17:33:56 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_netbsd.c,v 1.11 2005/12/04 19:15:21 christos Exp $");
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -507,28 +507,6 @@ if_printf(struct ifnet *ifp, const char *fmt, ...)
|
||||
return;
|
||||
}
|
||||
|
||||
struct mbuf *
|
||||
m_getcl(int how, int type, int flags)
|
||||
{
|
||||
struct mbuf *m;
|
||||
|
||||
if ((flags & M_PKTHDR) != 0)
|
||||
MGETHDR(m, how, type);
|
||||
else
|
||||
MGET(m, how, type);
|
||||
|
||||
if (m == NULL)
|
||||
return NULL;
|
||||
|
||||
MCLGET(m, flags);
|
||||
|
||||
if ((m->m_flags & M_EXT) == 0) {
|
||||
m_free(m);
|
||||
return NULL;
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
/*
|
||||
* Append the specified data to the indicated mbuf chain,
|
||||
* Extend the mbuf chain if the new data does not fit in
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ieee80211_netbsd.h,v 1.7 2005/11/18 16:40:09 skrll Exp $ */
|
||||
/* $NetBSD: ieee80211_netbsd.h,v 1.8 2005/12/04 19:15:21 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2003-2005 Sam Leffler, Errno Consulting
|
||||
* All rights reserved.
|
||||
@ -259,7 +259,6 @@ struct ieee80211_michael_event {
|
||||
var = nextvar)
|
||||
|
||||
void if_printf(struct ifnet *, const char *, ...);
|
||||
struct mbuf *m_getcl(int, int, int);
|
||||
int m_append(struct mbuf *, int, const caddr_t);
|
||||
void get_random_bytes(void *, size_t);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ipsec_osdep.h,v 1.13 2005/08/18 00:30:59 yamt Exp $ */
|
||||
/* $NetBSD: ipsec_osdep.h,v 1.14 2005/12/04 19:15:21 christos Exp $ */
|
||||
/* $FreeBSD: /repoman/r/ncvs/src/sys/netipsec/ipsec_osdep.h,v 1.1 2003/09/29 22:47:45 sam Exp $ */
|
||||
|
||||
/*
|
||||
@ -116,33 +116,10 @@ read_random(void *bufp, u_int len)
|
||||
|
||||
/*
|
||||
* 5. Fast mbuf-cluster allocation.
|
||||
* FreeBSD 4.6 introduce m_getcl(), which performs `fast' allocation
|
||||
* mbuf clusters from a cache of recently-freed clusters. (If the cache
|
||||
* is empty, new clusters are allocated en-masse).
|
||||
* On NetBSD, for now, implement the `cache' as an inline function
|
||||
*using normal NetBSD mbuf/cluster allocation macros. Replace this
|
||||
* with fast-cache code, if and when NetBSD implements one.
|
||||
*/
|
||||
#ifdef __NetBSD__
|
||||
static __inline struct mbuf *
|
||||
m_getcl(int how, short type, int flags)
|
||||
{
|
||||
struct mbuf *mp;
|
||||
if (flags & M_PKTHDR)
|
||||
MGETHDR(mp, how, type);
|
||||
else
|
||||
MGET(mp, how, type);
|
||||
if (mp == NULL)
|
||||
return NULL;
|
||||
|
||||
MCLGET(mp, how);
|
||||
if ((mp->m_flags & M_EXT) == 0) {
|
||||
m_free(mp);
|
||||
mp = NULL;
|
||||
}
|
||||
return mp;
|
||||
}
|
||||
#endif /* __NetBSD__ */
|
||||
/*
|
||||
* nothing.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 6. Network output macros
|
||||
|
Loading…
Reference in New Issue
Block a user