/*
- * Copyright (c) 2008-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2008-2011 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@constant MBUF_EXT Indicates this mbuf has external data.
@constant MBUF_PKTHDR Indicates this mbuf has a packet header.
@constant MBUF_EOR Indicates this mbuf is the end of a record.
+ @constant MBUF_LOOP Indicates this packet is looped back.
@constant MBUF_BCAST Indicates this packet will be sent or was
received as a brodcast.
@constant MBUF_MCAST Indicates this packet will be sent or was
MBUF_EXT = 0x0001, /* has associated external storage */
MBUF_PKTHDR = 0x0002, /* start of record */
MBUF_EOR = 0x0004, /* end of record */
+ MBUF_LOOP = 0x0040, /* packet is looped back */
MBUF_BCAST = 0x0100, /* send/received as link-level broadcast */
MBUF_MCAST = 0x0200, /* send/received as link-level multicast */
MBUF_FRAG = 0x0400, /* packet is a fragment of a larger packet */
MBUF_FIRSTFRAG = 0x0800, /* packet is first fragment */
MBUF_LASTFRAG = 0x1000, /* packet is last fragment */
- MBUF_PROMISC = 0x2000 /* packet is promiscuous */
+ MBUF_PROMISC = 0x2000, /* packet is promiscuous */
+ MBUF_HASFCS = 0x4000 /* packet has FCS */
};
typedef u_int32_t mbuf_flags_t;
calculated yet.
@constant MBUF_CSUM_REQ_UDP Indicates the UDP checksum has not been
calculated yet.
+ @constant MBUF_CSUM_REQ_TCPIPV6 Indicates the TCP checksum for IPv6
+ has not been calculated yet.
+ @constant MBUF_CSUM_REQ_UDPIPV6 Indicates the UDP checksum for IPv6
+ has not been calculated yet.
*/
enum {
MBUF_TSO_IPV4 = 0x100000,
#endif /* KERNEL_PRIVATE */
MBUF_CSUM_REQ_IP = 0x0001,
MBUF_CSUM_REQ_TCP = 0x0002,
- MBUF_CSUM_REQ_UDP = 0x0004
+ MBUF_CSUM_REQ_UDP = 0x0004,
+ MBUF_CSUM_REQ_TCPIPV6 = 0x0020,
+ MBUF_CSUM_REQ_UDPIPV6 = 0x0040
};
typedef u_int32_t mbuf_csum_request_flags_t;
hardware should be passed as the second parameter of
mbuf_set_csum_performed. The hardware calculated checksum value
can be retrieved using the second parameter passed to
- mbuf_get_csum_performed.
+ mbuf_get_csum_performed. This should be done for IPv4 or IPv6.
@constant MBUF_CSUM_PSEUDO_HDR If set, this indicates that the
checksum value for MBUF_CSUM_DID_DATA includes the pseudo header
value. If this is not set, the stack will calculate the pseudo
*/
extern u_int32_t mbuf_get_mhlen(void);
+/*!
+ @function mbuf_get_minclsize
+ @discussion This routine returns the minimum number of data bytes
+ before an external cluster is used. This is equivalent to the
+ legacy MINCLSIZE macro.
+ @result The minimum number of bytes before a cluster will be used.
+ */
+extern u_int32_t mbuf_get_minclsize(void);
+
/*!
@function mbuf_clear_csum_performed
@discussion Clears the hardware checksum flags and values.
*/
extern void mbuf_stats(struct mbuf_stat *stats);
-#ifdef KERNEL_PRIVATE
-/*
- @enum mbuf_priority_t
- @abstract Priority of a packet.
- @discussion Some mbufs represent packets containing application data.
- The priority of the application data is represented by the
- mbuf priority, as determined by the system.
- @constant MBUF_PRIORITY_NORMAL Indicates the packet contains
- normal priority data.
- @constant MBUF_PRIORITY_BACKGROUND Indicates the packet contains
- background priority data.
- */
-typedef enum {
- MBUF_PRIORITY_NORMAL = 0,
- MBUF_PRIORITY_BACKGROUND = 1
-} mbuf_priority_t;
-/*
- @function mbuf_get_priority
- @discussion Get the priority value of the packet.
- @param mbuf The mbuf to obtain the priority value from.
- @result The priority value of the packet.
- */
-extern mbuf_priority_t mbuf_get_priority(mbuf_t mbuf);
-
-/*
+/*!
@enum mbuf_traffic_class_t
@abstract Traffic class of a packet
@discussion Property that represent the category of traffic of a packet.
*/
typedef enum {
#ifdef XNU_KERNEL_PRIVATE
- MBUF_TC_NONE = -1,
+ MBUF_TC_UNSPEC = -1, /* Internal: not specified */
#endif
- MBUF_TC_BE = 0,
+ MBUF_TC_BE = 0,
MBUF_TC_BK = 1,
MBUF_TC_VI = 2,
MBUF_TC_VO = 3
+#ifdef XNU_KERNEL_PRIVATE
+ ,
+ MBUF_TC_MAX = 4 /* Internal: traffic class count */
+#endif
} mbuf_traffic_class_t;
-/*
+/*!
@function mbuf_get_traffic_class
@discussion Get the traffic class of an mbuf packet
@param mbuf The mbuf to get the traffic class of.
*/
extern mbuf_traffic_class_t mbuf_get_traffic_class(mbuf_t mbuf);
-/*
+/*!
@function mbuf_set_traffic_class
@discussion Set the traffic class of an mbuf packet.
@param mbuf The mbuf to set the traffic class on.
- @ac The traffic class
+ @tc The traffic class
@result 0 on success, EINVAL if bad paramater is passed
*/
extern errno_t mbuf_set_traffic_class(mbuf_t mbuf, mbuf_traffic_class_t tc);
+
+/*!
+ @function mbuf_is_traffic_class_privileged
+ @discussion Returns the privileged status of the traffic class
+ of the packet specified by the mbuf.
+ @param mbuf The mbuf to retrieve the status from.
+ @result Non-zero if privileged, 0 otherwise.
+ */
+extern int mbuf_is_traffic_class_privileged(mbuf_t mbuf);
+
+#ifdef KERNEL_PRIVATE
+/*!
+ @enum mbuf_svc_class_t
+ @abstract Service class of a packet
+ @discussion Property that represents the category of service
+ of a packet. This information may be used by the driver
+ and at the link level.
+ @constant MBUF_SC_BK_SYS "Background System-Initiated", high delay
+ tolerant, high loss tolerant, elastic flow, variable size &
+ long-lived.
+ @constant MBUF_SC_BK "Background", user-initiated, high delay tolerant,
+ high loss tolerant, elastic flow, variable size. This level
+ corresponds to WMM access class "BG", or MBUF_TC_BK.
+ @constant MBUF_SC_BE "Best Effort", unclassified/standard. This is
+ the default service class; pretty much a mix of everything.
+ This level corresponds to WMM access class "BE" or MBUF_TC_BE.
+ @constant MBUF_SC_RD
+ "Responsive Data", a notch higher than "Best Effort", medium
+ delay tolerant, medium loss tolerant, elastic flow, bursty,
+ long-lived.
+ @constant MBUF_SC_OAM "Operations, Administration, and Management",
+ medium delay tolerant, low-medium loss tolerant, elastic &
+ inelastic flows, variable size.
+ @constant MBUF_SC_AV "Multimedia Audio/Video Streaming", medium delay
+ tolerant, low-medium loss tolerant, elastic flow, constant
+ packet interval, variable rate & size.
+ @constant MBUF_SC_RV "Responsive Multimedia Audio/Video", low delay
+ tolerant, low-medium loss tolerant, elastic flow, variable
+ packet interval, rate and size.
+ @constant MBUF_SC_VI "Interactive Video", low delay tolerant, low-
+ medium loss tolerant, elastic flow, constant packet interval,
+ variable rate & size. This level corresponds to WMM access
+ class "VI" or MBUF_TC_VI.
+ @constant MBUF_SC_VO "Interactive Voice", low delay tolerant, low loss
+ tolerant, inelastic flow, constant packet rate, somewhat fixed
+ size. This level corresponds to WMM access class "VO" or
+ MBUF_TC_VO.
+ @constant MBUF_SC_CTL "Network Control", low delay tolerant, low loss
+ tolerant, inelastic flow, rate is short & burst, variable size.
+*/
+typedef enum {
+#ifdef XNU_KERNEL_PRIVATE
+ MBUF_SC_UNSPEC = -1, /* Internal: not specified */
+#endif
+ MBUF_SC_BK_SYS = 0x00080090, /* lowest class */
+ MBUF_SC_BK = 0x00100080,
+
+ MBUF_SC_BE = 0x00000000,
+ MBUF_SC_RD = 0x00180010,
+ MBUF_SC_OAM = 0x00200020,
+
+ MBUF_SC_AV = 0x00280120,
+ MBUF_SC_RV = 0x00300110,
+ MBUF_SC_VI = 0x00380100,
+
+ MBUF_SC_VO = 0x00400180,
+ MBUF_SC_CTL = 0x00480190, /* highest class */
+} mbuf_svc_class_t;
+
+/*!
+ @function mbuf_get_service_class
+ @discussion Get the service class of an mbuf packet
+ @param mbuf The mbuf to get the service class of.
+ @result The service class
+*/
+extern mbuf_svc_class_t mbuf_get_service_class(mbuf_t mbuf);
+
+/*!
+ @function mbuf_set_servicec_class
+ @discussion Set the service class of an mbuf packet.
+ @param mbuf The mbuf to set the service class on.
+ @sc The service class
+ @result 0 on success, EINVAL if bad paramater is passed
+*/
+extern errno_t mbuf_set_service_class(mbuf_t mbuf, mbuf_svc_class_t sc);
+
+/*!
+ @function mbuf_is_service_class_privileged
+ @discussion Returns the privileged status of the service class
+ of the packet specified by the mbuf.
+ @param mbuf The mbuf to retrieve the status from.
+ @result Non-zero if privileged, 0 otherwise.
+ */
+extern int mbuf_is_service_class_privileged(mbuf_t mbuf);
+
+/*
+ @enum mbuf_pkthdr_aux_flags_t
+ @abstract Constants defining mbuf auxiliary flags. Only the flags
+ listed below can be retrieved.
+ @constant MBUF_PKTAUXF_INET_RESOLVE_RTR Indicates this is an ARP
+ request packet, whose target is the address of the default
+ IPv4 router.
+ @constant MBUF_PKTAUXF_INET6_RESOLVE_RTR Indicates this is an ICMPv6
+ Neighbor Solicitation packet, whose target is the address of
+ the default IPv6 router.
+ */
+enum {
+ MBUF_PKTAUXF_INET_RESOLVE_RTR = 0x0004,
+ MBUF_PKTAUXF_INET6_RESOLVE_RTR = 0x0008,
+};
+typedef u_int32_t mbuf_pkthdr_aux_flags_t;
+
+/*
+ @function mbuf_pkthdr_aux_flags
+ @discussion Returns the auxiliary flags of a packet.
+ @param mbuf The mbuf containing the packet header.
+ @param paux_flags Pointer to mbuf_pkthdr_aux_flags_t variable.
+ @result 0 upon success otherwise the errno error.
+*/
+extern errno_t mbuf_pkthdr_aux_flags(mbuf_t mbuf,
+ mbuf_pkthdr_aux_flags_t *paux_flags);
#endif /* KERNEL_PRIVATE */
/* IF_QUEUE interaction */