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.h,v 1.0 2003/04/22 05:40:47 rgb Exp $
19 #ifndef _IPSEC_GLUE_MBUF_H
20 #define _IPSEC_GLUE_MBUF_H
22 #include "IxOsBuffMgt.h"
23 #include "IxOsBuffPoolMgt.h"
25 /* Maximum mbuf header allocate for IPSec driver */
26 #define IPSEC_GLUE_MBUF_HEADER_COUNT 384
28 /* Maximum mbufs allocate for IPSec driver */
29 #define IPSEC_GLUE_MBUF_COUNT 256
31 /* Size of mdata in mbuf */
32 #define IPSEC_GLUE_MBUF_DATA_SIZE 128
35 * Initialize mbufs header pool
36 * The mbuf pool will have maximum IPSEC_GLUE_MBUF_HEADER_COUNT of mbufs. The mbuf header do not have
37 * the mdata pointer attached to it.
44 void ipsec_glue_mbuf_header_init (void);
48 * Get mbuf header from mbuf pool
50 * Param: pMbufPtr [out] pointer to the mbuf pointer
52 * Return: IPSEC_GLUE_STATUS_SUCCESS
53 * IPSEC_GLUE_STATUS_FAIL
56 int ipsec_glue_mbuf_header_get (IX_MBUF **pMbufPtr);
60 * Release mbuf header back into mbuf pool
62 * Param: pMbuf [in] mbuf pointer to be release back to the pool
67 void ipsec_glue_mbuf_header_rel (IX_MBUF *pMbuf);
71 * Initialize mbufs pool
72 * The mbuf pool will have maximum IPSEC_GLUE_MBUF_COUNT of mbufs with mdata pointer attached to it.
79 void ipsec_glue_mbuf_init (void);
83 * Get mbuf header from mbuf pool
85 * Param: pMbufPtr [out] pointer to the mbuf pointer
87 * Return: IPSEC_GLUE_STATUS_SUCCESS
88 * IPSEC_GLUE_STATUS_FAIL
91 int ipsec_glue_mbuf_get (IX_MBUF **pMbufPtr);
95 * Release mbuf back into mbuf pool
97 * Param: pMbuf [in] mbuf pointer to be release back to the pool
102 void ipsec_glue_mbuf_rel (IX_MBUF *pMbuf);
105 #ifdef IX_OSAL_MBUF_PRIV
107 * mbuf_swap_skb : links/unlinks mbuf to skb
109 static inline struct sk_buff *mbuf_swap_skb(IX_OSAL_MBUF *mbuf, struct sk_buff *skb)
111 struct sk_buff *res = IX_OSAL_MBUF_PRIV(mbuf);
113 IX_OSAL_MBUF_PRIV(mbuf) = skb;
118 IX_OSAL_MBUF_MDATA(mbuf) = skb->data;
119 IX_OSAL_MBUF_MLEN(mbuf) = IX_OSAL_MBUF_PKT_LEN(mbuf) = skb->len;
123 #endif /* IX_OSAL_MBUF_PRIV */
125 #endif /*_IPSEC_GLUE_MBUF_H */