mbuf.h (236170) | mbuf.h (236332) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 | 1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 |
31 * $FreeBSD: head/sys/sys/mbuf.h 236170 2012-05-28 09:30:13Z bz $ | 31 * $FreeBSD: head/sys/sys/mbuf.h 236332 2012-05-30 20:56:07Z tuexen $ |
32 */ 33 34#ifndef _SYS_MBUF_H_ 35#define _SYS_MBUF_H_ 36 37/* XXX: These includes suck. Sorry! */ 38#include <sys/queue.h> 39#ifdef _KERNEL --- 70 unchanged lines hidden (view full) --- 110/* 111 * Record/packet header in first mbuf of chain; valid only if M_PKTHDR is set. 112 */ 113struct pkthdr { 114 struct ifnet *rcvif; /* rcv interface */ 115 /* variables for ip and tcp reassembly */ 116 void *header; /* pointer to packet header */ 117 int len; /* total packet length */ | 32 */ 33 34#ifndef _SYS_MBUF_H_ 35#define _SYS_MBUF_H_ 36 37/* XXX: These includes suck. Sorry! */ 38#include <sys/queue.h> 39#ifdef _KERNEL --- 70 unchanged lines hidden (view full) --- 110/* 111 * Record/packet header in first mbuf of chain; valid only if M_PKTHDR is set. 112 */ 113struct pkthdr { 114 struct ifnet *rcvif; /* rcv interface */ 115 /* variables for ip and tcp reassembly */ 116 void *header; /* pointer to packet header */ 117 int len; /* total packet length */ |
118 uint32_t flowid; /* packet's 4-tuple system | 118 uint32_t flowid; /* packet's 4-tuple system |
119 * flow identifier 120 */ 121 /* variables for hardware checksum */ 122 int csum_flags; /* flags regarding checksum */ 123 int csum_data; /* data field used by csum routines */ 124 u_int16_t tso_segsz; /* TSO segment size */ 125 union { 126 u_int16_t vt_vtag; /* Ethernet 802.1p+q vlan tag */ --- 151 unchanged lines hidden (view full) --- 278 */ 279#define CSUM_IP 0x0001 /* will csum IP */ 280#define CSUM_TCP 0x0002 /* will csum TCP */ 281#define CSUM_UDP 0x0004 /* will csum UDP */ 282#define CSUM_IP_FRAGS 0x0008 /* will csum IP fragments */ 283#define CSUM_FRAGMENT 0x0010 /* will do IP fragmentation */ 284#define CSUM_TSO 0x0020 /* will do TSO */ 285#define CSUM_SCTP 0x0040 /* will csum SCTP */ | 119 * flow identifier 120 */ 121 /* variables for hardware checksum */ 122 int csum_flags; /* flags regarding checksum */ 123 int csum_data; /* data field used by csum routines */ 124 u_int16_t tso_segsz; /* TSO segment size */ 125 union { 126 u_int16_t vt_vtag; /* Ethernet 802.1p+q vlan tag */ --- 151 unchanged lines hidden (view full) --- 278 */ 279#define CSUM_IP 0x0001 /* will csum IP */ 280#define CSUM_TCP 0x0002 /* will csum TCP */ 281#define CSUM_UDP 0x0004 /* will csum UDP */ 282#define CSUM_IP_FRAGS 0x0008 /* will csum IP fragments */ 283#define CSUM_FRAGMENT 0x0010 /* will do IP fragmentation */ 284#define CSUM_TSO 0x0020 /* will do TSO */ 285#define CSUM_SCTP 0x0040 /* will csum SCTP */ |
286/* CSUM_SCTP_IPV6 0x0080 will csum IPv6/SCTP */ | 286#define CSUM_SCTP_IPV6 0x0080 /* will csum IPv6/SCTP */ |
287 288#define CSUM_IP_CHECKED 0x0100 /* did csum IP */ 289#define CSUM_IP_VALID 0x0200 /* ... the csum is valid */ 290#define CSUM_DATA_VALID 0x0400 /* csum_data field is valid */ 291#define CSUM_PSEUDO_HDR 0x0800 /* csum_data has pseudo hdr */ 292#define CSUM_SCTP_VALID 0x1000 /* SCTP checksum is valid */ 293#define CSUM_UDP_IPV6 0x2000 /* will csum IPv6/UDP */ 294#define CSUM_TCP_IPV6 0x4000 /* will csum IPv6/TCP */ --- 127 unchanged lines hidden (view full) --- 422void mb_free_ext(struct mbuf *); 423static __inline struct mbuf *m_last(struct mbuf *m); 424int m_pkthdr_init(struct mbuf *m, int how); 425 426static __inline int 427m_gettype(int size) 428{ 429 int type; | 287 288#define CSUM_IP_CHECKED 0x0100 /* did csum IP */ 289#define CSUM_IP_VALID 0x0200 /* ... the csum is valid */ 290#define CSUM_DATA_VALID 0x0400 /* csum_data field is valid */ 291#define CSUM_PSEUDO_HDR 0x0800 /* csum_data has pseudo hdr */ 292#define CSUM_SCTP_VALID 0x1000 /* SCTP checksum is valid */ 293#define CSUM_UDP_IPV6 0x2000 /* will csum IPv6/UDP */ 294#define CSUM_TCP_IPV6 0x4000 /* will csum IPv6/TCP */ --- 127 unchanged lines hidden (view full) --- 422void mb_free_ext(struct mbuf *); 423static __inline struct mbuf *m_last(struct mbuf *m); 424int m_pkthdr_init(struct mbuf *m, int how); 425 426static __inline int 427m_gettype(int size) 428{ 429 int type; |
430 | 430 |
431 switch (size) { 432 case MSIZE: 433 type = EXT_MBUF; 434 break; 435 case MCLBYTES: 436 type = EXT_CLUSTER; 437 break; 438#if MJUMPAGESIZE != MCLBYTES --- 13 unchanged lines hidden (view full) --- 452 453 return (type); 454} 455 456static __inline uma_zone_t 457m_getzone(int size) 458{ 459 uma_zone_t zone; | 431 switch (size) { 432 case MSIZE: 433 type = EXT_MBUF; 434 break; 435 case MCLBYTES: 436 type = EXT_CLUSTER; 437 break; 438#if MJUMPAGESIZE != MCLBYTES --- 13 unchanged lines hidden (view full) --- 452 453 return (type); 454} 455 456static __inline uma_zone_t 457m_getzone(int size) 458{ 459 uma_zone_t zone; |
460 | 460 |
461 switch (size) { 462 case MCLBYTES: 463 zone = zone_clust; 464 break; 465#if MJUMPAGESIZE != MCLBYTES 466 case MJUMPAGESIZE: 467 zone = zone_jumbop; 468 break; --- 165 unchanged lines hidden (view full) --- 634 635static __inline void 636m_free_fast(struct mbuf *m) 637{ 638#ifdef INVARIANTS 639 if (m->m_flags & M_PKTHDR) 640 KASSERT(SLIST_EMPTY(&m->m_pkthdr.tags), ("doing fast free of mbuf with tags")); 641#endif | 461 switch (size) { 462 case MCLBYTES: 463 zone = zone_clust; 464 break; 465#if MJUMPAGESIZE != MCLBYTES 466 case MJUMPAGESIZE: 467 zone = zone_jumbop; 468 break; --- 165 unchanged lines hidden (view full) --- 634 635static __inline void 636m_free_fast(struct mbuf *m) 637{ 638#ifdef INVARIANTS 639 if (m->m_flags & M_PKTHDR) 640 KASSERT(SLIST_EMPTY(&m->m_pkthdr.tags), ("doing fast free of mbuf with tags")); 641#endif |
642 | 642 |
643 uma_zfree_arg(zone_mbuf, m, (void *)MB_NOTAGS); 644} 645 646static __inline struct mbuf * 647m_free(struct mbuf *m) 648{ 649 struct mbuf *n = m->m_next; 650 --- 43 unchanged lines hidden (view full) --- 694 return (uma_zalloc_arg(zone, m, how)); 695} 696 697static __inline void 698m_cljset(struct mbuf *m, void *cl, int type) 699{ 700 uma_zone_t zone; 701 int size; | 643 uma_zfree_arg(zone_mbuf, m, (void *)MB_NOTAGS); 644} 645 646static __inline struct mbuf * 647m_free(struct mbuf *m) 648{ 649 struct mbuf *n = m->m_next; 650 --- 43 unchanged lines hidden (view full) --- 694 return (uma_zalloc_arg(zone, m, how)); 695} 696 697static __inline void 698m_cljset(struct mbuf *m, void *cl, int type) 699{ 700 uma_zone_t zone; 701 int size; |
702 | 702 |
703 switch (type) { 704 case EXT_CLUSTER: 705 size = MCLBYTES; 706 zone = zone_clust; 707 break; 708#if MJUMPAGESIZE != MCLBYTES 709 case EXT_JUMBOP: 710 size = MJUMPAGESIZE; --- 35 unchanged lines hidden (view full) --- 746 747 while (m->m_next) 748 m = m->m_next; 749 return (m); 750} 751 752extern void (*m_addr_chg_pf_p)(struct mbuf *m); 753 | 703 switch (type) { 704 case EXT_CLUSTER: 705 size = MCLBYTES; 706 zone = zone_clust; 707 break; 708#if MJUMPAGESIZE != MCLBYTES 709 case EXT_JUMBOP: 710 size = MJUMPAGESIZE; --- 35 unchanged lines hidden (view full) --- 746 747 while (m->m_next) 748 m = m->m_next; 749 return (m); 750} 751 752extern void (*m_addr_chg_pf_p)(struct mbuf *m); 753 |
754static __inline void | 754static __inline void |
755m_addr_changed(struct mbuf *m) 756{ 757 758 if (m_addr_chg_pf_p) 759 m_addr_chg_pf_p(m); 760} 761 762/* --- 351 unchanged lines hidden (view full) --- 1114 1115/* get the fib from an mbuf and if it is not set, return the default */ 1116#define M_GETFIB(_m) \ 1117 ((((_m)->m_flags & M_FIB) >> M_FIBSHIFT) & M_FIBMASK) 1118 1119#define M_SETFIB(_m, _fib) do { \ 1120 _m->m_flags &= ~M_FIB; \ 1121 _m->m_flags |= (((_fib) << M_FIBSHIFT) & M_FIB); \ | 755m_addr_changed(struct mbuf *m) 756{ 757 758 if (m_addr_chg_pf_p) 759 m_addr_chg_pf_p(m); 760} 761 762/* --- 351 unchanged lines hidden (view full) --- 1114 1115/* get the fib from an mbuf and if it is not set, return the default */ 1116#define M_GETFIB(_m) \ 1117 ((((_m)->m_flags & M_FIB) >> M_FIBSHIFT) & M_FIBMASK) 1118 1119#define M_SETFIB(_m, _fib) do { \ 1120 _m->m_flags &= ~M_FIB; \ 1121 _m->m_flags |= (((_fib) << M_FIBSHIFT) & M_FIB); \ |
1122} while (0) | 1122} while (0) |
1123 1124#endif /* _KERNEL */ 1125 1126#ifdef MBUF_PROFILING 1127 void m_profile(struct mbuf *m); 1128 #define M_PROFILE(m) m_profile(m) 1129#else 1130 #define M_PROFILE(m) 1131#endif 1132 1133 1134#endif /* !_SYS_MBUF_H_ */ | 1123 1124#endif /* _KERNEL */ 1125 1126#ifdef MBUF_PROFILING 1127 void m_profile(struct mbuf *m); 1128 #define M_PROFILE(m) m_profile(m) 1129#else 1130 #define M_PROFILE(m) 1131#endif 1132 1133 1134#endif /* !_SYS_MBUF_H_ */ |