2 * IPSEC_GLUE_MBUF interface code.
3 * Copyright 2003 Intel Corporation All Rights Reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 RCSID $Id: ipsec_glue_mbuf.c,v 1.0 2003/04/22 05:40:47 rgb Exp $
19 #include "ipsec_glue_mbuf.h"
21 IX_MBUF_POOL *pIpsecMbufHdrPool; /* mbuf header pool pointer */
22 IX_MBUF *pIpsecMbufHdr;
23 UINT32 mbufHdrAreaMemSize;
25 IX_MBUF_POOL *pIpsecMbufPool; /* Mbuf pool pointer */
29 /* Initialize mbuf header pool */
30 void ipsec_glue_mbuf_header_init (void)
32 pIpsecMbufHdr = IX_MBUF_POOL_MBUF_AREA_ALLOC(IPSEC_GLUE_MBUF_HEADER_COUNT, mbufHdrAreaMemSize);
34 /* initialize mbuf header pool */
35 IX_MBUF_POOL_INIT_NO_ALLOC(
39 IPSEC_GLUE_MBUF_HEADER_COUNT,
41 "IXP425 IPSec driver Mbuf Header Pool");
45 /* Get mbuf from mbuf header pool */
46 int ipsec_glue_mbuf_header_get (IX_MBUF **pMbufPtr)
48 if ((IX_MBUF_POOL_GET(pIpsecMbufHdrPool, pMbufPtr)) == IX_SUCCESS)
50 IX_MBUF_MDATA (*pMbufPtr) = NULL;
51 IX_MBUF_NEXT_PKT_IN_CHAIN_PTR (*pMbufPtr) = NULL;
59 /* Release mbuf back into mbuf header pool */
60 void ipsec_glue_mbuf_header_rel (IX_MBUF *pMbuf)
62 IX_MBUF_POOL_PUT (pMbuf);
66 /* Initialize mbuf pool */
67 void ipsec_glue_mbuf_init (void)
70 /* initialize mbuf pool */
73 IPSEC_GLUE_MBUF_COUNT,
74 IPSEC_GLUE_MBUF_DATA_SIZE,
75 "IXP425 IPSec driver Mbuf Pool");
79 /* Get mbuf from mbuf pool */
80 int ipsec_glue_mbuf_get (IX_MBUF **pMbufPtr)
82 if ((IX_MBUF_POOL_GET(pIpsecMbufPool, pMbufPtr)) == IX_SUCCESS)
89 /* Release mbuf back into mbuf pool */
90 void ipsec_glue_mbuf_rel (IX_MBUF *pMbuf)
92 IX_MBUF_POOL_PUT (pMbuf);