/*
- * Copyright (c) 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2008-2010 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);
+/*!
+ @enum mbuf_traffic_class_t
+ @abstract Traffic class of a packet
+ @discussion Property that represent the category of traffic of a packet.
+ This information may be used by the driver and at the link level.
+ @constant MBUF_TC_BE Best effort, normal class.
+ @constant MBUF_TC_BK Background, low priority or bulk traffic.
+ @constant MBUF_TC_VI Interactive video, constant bit rate, low latency.
+ @constant MBUF_TC_VO Interactive voice, constant bit rate, lowest latency.
+*/
+typedef enum {
+#ifdef XNU_KERNEL_PRIVATE
+ MBUF_TC_UNSPEC = -1, /* Internal: not specified */
+#endif
+ 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.
+ @result The traffic class
+*/
+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
+ @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);
+
/* IF_QUEUE interaction */
#define IF_ENQUEUE_MBUF(ifq, m) { \