X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0a7de7458d150b5d4dffc935ba399be265ef0a1a..eb6b6ca394357805f2bdba989abae309f718b4d8:/bsd/sys/mbuf.h diff --git a/bsd/sys/mbuf.h b/bsd/sys/mbuf.h index afa2424a8..ff2653d96 100644 --- a/bsd/sys/mbuf.h +++ b/bsd/sys/mbuf.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2018 Apple Inc. All rights reserved. + * Copyright (c) 1999-2019 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -210,6 +210,8 @@ struct m_drvaux_tag { #define PF_TAG_HDR_INET 0x8 /* hdr points to IPv4 */ #define PF_TAG_HDR_INET6 0x10 /* hdr points to IPv6 */ #endif /* PF_ECN */ +#define PF_TAG_REASSEMBLED 0x20 /* pkt reassembled by PF */ +#define PF_TAG_REFRAGMENTED 0x40 /* pkt refragmented by PF */ /* * PF mbuf tag */ @@ -223,6 +225,17 @@ struct pf_mtag { #endif /* PF_ECN */ }; +/* + * PF fragment tag + */ +struct pf_fragment_tag { + uint32_t ft_id; /* fragment id */ + uint16_t ft_hdrlen; /* header length of reassembled pkt */ + uint16_t ft_unfragpartlen; /* length of the per-fragment headers */ + uint16_t ft_extoff; /* last extension header offset or 0 */ + uint16_t ft_maxlen; /* maximum fragment payload length */ +}; + /* * TCP mbuf tag */ @@ -311,7 +324,7 @@ struct driver_mtag_ { * Protocol specific mbuf tag (at most one protocol metadata per mbuf). * * Care must be taken to ensure that they are mutually exclusive, e.g. - * IPSec policy ID implies no TCP segment offload (which is fine given + * IPsec policy ID implies no TCP segment offload (which is fine given * that the former is used on the virtual ipsec interface that does * not advertise the TSO capability.) */ @@ -433,7 +446,7 @@ struct pkthdr { #define bufstatus_if _pkt_bsr.if_data #define bufstatus_sndbuf _pkt_bsr.sndbuf_data }; - u_int64_t pkt_timestamp; /* enqueue time */ + u_int64_t pkt_timestamp; /* TX: enqueue time, RX: receive timestamp */ /* * Tags (external and built-in) @@ -481,6 +494,20 @@ struct pkthdr { #define FLOWSRC_PF 3 /* flow ID generated by PF */ #define FLOWSRC_CHANNEL 4 /* flow ID generated by channel */ +/* + * FLOWSRC_MPKL_INPUT is not a true flow data source and is used for + * multi-layer packet logging. We're usurping the pkt_flowsrc field because + * the mbuf packet header ran out of space and pkt_flowsrc is normally + * used on output so we assume we can safely overwrite the normal semantic of + * the field. + * This value is meant to be used on incoming packet from a lower level protocol + * to pass information to some upper level protocol. When FLOWSRC_MPKL_INPUT + * is set, the following fields are used: + * - pkt_proto: the IP protocol ID of the lower level protocol + * - pkt_flowid: the identifier of the packet at the lower protocol. + * For example ESP would set pkt_proto to IPPROTO_ESP and pkt_flowid to the SPI. + */ + /* * Packet flags. Unlike m_flags, all packet flags are copied along when * copying m_pkthdr, i.e. no equivalent of M_COPYFLAGS here. These flags @@ -660,11 +687,14 @@ struct mbuf { */ /* VLAN tag present */ -#define CSUM_VLAN_TAG_VALID 0x10000 /* vlan_tag field is valid */ +#define CSUM_VLAN_TAG_VALID 0x00010000 /* vlan_tag field is valid */ + +/* checksum start adjustment has been done */ +#define CSUM_ADJUST_DONE 0x00020000 /* TCP Segment Offloading requested on this mbuf */ -#define CSUM_TSO_IPV4 0x100000 /* This mbuf needs to be segmented by the NIC */ -#define CSUM_TSO_IPV6 0x200000 /* This mbuf needs to be segmented by the NIC */ +#define CSUM_TSO_IPV4 0x00100000 /* This mbuf needs to be segmented by the NIC */ +#define CSUM_TSO_IPV6 0x00200000 /* This mbuf needs to be segmented by the NIC */ #define TSO_IPV4_OK(_ifp, _m) \ (((_ifp)->if_hwassist & IFNET_TSO_IPV4) && \ @@ -1017,7 +1047,7 @@ struct name { \ #define MBUFQ_LAST(head) \ (((head)->mq_last == &MBUFQ_FIRST(head)) ? NULL : \ ((struct mbuf *)(void *)((char *)(head)->mq_last - \ - (size_t)(&MBUFQ_NEXT((struct mbuf *)0))))) + __builtin_offsetof(struct mbuf, m_nextpkt)))) #define max_linkhdr P2ROUNDUP(_max_linkhdr, sizeof (u_int32_t)) #define max_protohdr P2ROUNDUP(_max_protohdr, sizeof (u_int32_t)) @@ -1228,7 +1258,7 @@ struct mbuf; #define M_COPYM_MUST_COPY_HDR 3 /* MUST copy pkthdr from old to new */ #define M_COPYM_MUST_MOVE_HDR 4 /* MUST move pkthdr from old to new */ -extern void m_freem(struct mbuf *); +extern void m_freem(struct mbuf *) __XNU_INTERNAL(m_freem); extern u_int64_t mcl_to_paddr(char *); extern void m_adj(struct mbuf *, int); extern void m_cat(struct mbuf *, struct mbuf *); @@ -1379,7 +1409,7 @@ __private_extern__ caddr_t m_16kalloc(int); __private_extern__ void m_16kfree(caddr_t, u_int, caddr_t); __private_extern__ struct mbuf *m_m16kget(struct mbuf *, int); __private_extern__ int m_reinit(struct mbuf *, int); -__private_extern__ struct mbuf *m_free(struct mbuf *); +__private_extern__ struct mbuf *m_free(struct mbuf *) __XNU_INTERNAL(m_free); __private_extern__ struct mbuf *m_getclr(int, int); __private_extern__ struct mbuf *m_getptr(struct mbuf *, int, int *); __private_extern__ unsigned int m_length(struct mbuf *); @@ -1478,6 +1508,7 @@ enum { KERNEL_TAG_TYPE_IPSEC = 10, KERNEL_TAG_TYPE_DRVAUX = 11, KERNEL_TAG_TYPE_CFIL_UDP = 13, + KERNEL_TAG_TYPE_PF_REASS = 14, }; /* Packet tag routines */