2 * All very trivial - the simpler the better I say. We try and keep
3 * quqes of netbufs by squirreling a pointer away below the data area.
4 * This is done by the ppp_nb_alloc function. As long as everyone
5 * uses the ppp shrink and grow functions we should be o.k. This code
6 * has now been modified to keep the mark_t stuff nhere as well since
7 * we probably shafted that good and proper in the last version. oops !
16 #include <sys/types.h>
17 #include <kernserv/prototypes.h>
21 u_char q_low, q_high, q_max;
27 int low, high, max, len, dropped;
32 #define NB_EXTRA (sizeof(mark_t)+sizeof(netbuf_t))
35 nb_set_next(netbuf_t nb, netbuf_t ptr)
37 if(nb) bcopy(&ptr,nb_map(nb)-sizeof(netbuf_t),sizeof(netbuf_t));
41 nb_get_next(netbuf_t nb, netbuf_t *ptr)
43 if(nb && ptr) bcopy(nb_map(nb)-sizeof(netbuf_t),ptr,sizeof(netbuf_t));
47 nb_set_mark(netbuf_t nb, mark_t ptr)
49 if(nb) bcopy(&ptr,nb_map(nb)-NB_EXTRA,sizeof(mark_t));
53 nb_get_mark(netbuf_t nb, mark_t *ptr)
55 if(nb && ptr) bcopy(nb_map(nb)-NB_EXTRA,ptr,sizeof(mark_t));
59 ppp_nb_shrink_top(netbuf_t nb, unsigned int size)
64 nb_get_mark(nb,&mark);
65 nb_shrink_top(nb,size);
71 ppp_nb_grow_top(netbuf_t nb, unsigned int size)
76 nb_get_mark(nb,&mark);
82 static inline netbuf_t
83 ppp_nb_alloc(unsigned int size)
90 nb_shrink_top(nb,NB_EXTRA);
96 #endif /* __NBQ_H__ */