Jump to content

Packet segmentation

From Wikipedia, the free encyclopedia

Packet segmentation is the division of data into smaller protocol data units before transmission over a computer network. In the Internet protocol suite, the term is most commonly used for sender-side packetization at the transport layer, such as dividing a TCP byte stream into segments or fragmenting a large SCTP user message into multiple DATA chunks and packets.[1][2] Segmentation is usually constrained by the maximum transmission unit (MTU) of the path and by protocol-specific limits such as the maximum segment size (MSS).[3][4][5]

Packet segmentation is distinct from IP fragmentation, which subdivides an already formed IP packet at the network layer, and from link-layer fragmentation performed below IP on some media.[6][7]

Overview

[edit source]

Internet standards commonly discuss segmentation in terms of a packetization layer: the transport- or application-level protocol that is responsible for choosing packet boundaries, such as segment sizes.[8] In TCP, applications exchange an ordered byte stream rather than discrete messages; TCP packetises that stream as needed and does not preserve the boundaries between application write operations.[9][10] RFC 1122 further notes that the TCP PSH flag is not a record marker and is independent of segment boundaries.[10]

Segmentation is typically used so that transmitted units fit within the path MTU while allowing the transport protocol to apply its own reliability, sequencing and congestion-control mechanisms.[8][1] For reliable transports, the receiver reassembles the transmitted units into the service expected by the application. In TCP, that means reconstructing an ordered byte stream rather than restoring the sender's original write calls.[9][10]

Relation to MTU

[edit source]

The size of transmitted segments or packets is constrained by the MTU of the outgoing link and, more importantly, by the smallest MTU on the end-to-end path.[4][5] Classical Path MTU Discovery allows endpoints to discover that limit for IPv4 and IPv6.[4][5] To reduce dependence on ICMP feedback alone, the IETF later standardised Packetization Layer Path MTU Discovery (PLPMTUD) and Datagram Packetization Layer Path MTU Discovery (DPLPMTUD), in which TCP or another packetization layer probes the path with progressively larger packets and adjusts its effective maximum packet size accordingly.[8][11]

In TCP, the receiving endpoint can advertise an MSS option during connection establishment. The MSS is the maximum receive segment size at the TCP endpoint sending the option. Modern guidance is that the advertised MSS should be derived from the effective MTU minus the fixed IP and TCP header sizes, while the actual data carried in a transmitted segment must be reduced further when IP or TCP options are present.[1][3]

Operation in common protocols

[edit source]

TCP is a reliable, ordered byte-stream protocol. Each segment carries a sequence number identifying its first data octet, and acknowledgements indicate the next octet expected by the receiver.[1] Lost data is recovered by retransmission, including after retransmission timeout expiry.[1] Because TCP provides a byte stream rather than a record-oriented service, reassembly restores ordered bytes and not the sender's original message boundaries.[9][10]

UDP and other datagram transports

[edit source]

UDP is a minimal message-passing transport, and each UDP datagram is carried in a single IP packet.[12][13] Large UDP datagrams often require IP fragmentation, which the UDP usage guidelines describe as decreasing communication reliability and efficiency; the guidelines therefore recommend avoiding fragmentation when possible.[12] Modern datagram transports and applications commonly use PMTUD or DPLPMTUD to keep datagrams within path limits instead of relying on fragmentation.[5][11]

SCTP and QUIC

[edit source]

SCTP is message-oriented rather than byte-stream oriented. When converting user messages into DATA chunks, an SCTP endpoint must fragment large user messages into multiple DATA chunks; the receiver normally reassembles the fragmented message before delivery to the application. SCTP may also bundle multiple DATA or control chunks into a single SCTP packet as long as the packet does not exceed the current PMTU.[2]

QUIC runs over UDP datagrams, but defines its own packets and frames above UDP. RFC 9000 states that QUIC packets are carried in UDP datagrams, that one or more QUIC packets can be encapsulated in a single UDP datagram, and that all QUIC packets sent in a datagram must fit within the maximum datagram size.[14] The QUIC DATAGRAM extension is explicitly non-fragmenting: RFC 9221 states that DATAGRAM frames cannot be fragmented, so applications using them must handle size limits imposed by transport parameters and path MTU.[15]

Distinction from fragmentation

[edit source]

In Internet standards, segmentation and fragmentation refer to different mechanisms and different layers. IPv4 allows oversized datagrams to be fragmented at the IP layer for transmission through smaller-packet networks, with reassembly performed by the destination.[6] IPv6 no longer permits routers to fragment traffic in transit: only the source node may send fragments, and RFC 8200 discourages this for applications that can adjust their packets to the measured path MTU.[7]

RFC 8200 also requires every IPv6 link to support an MTU of at least 1280 octets. If a link cannot carry a 1280-octet packet in one piece, link-specific fragmentation and reassembly must be provided below IPv6.[7] As a result, a modern description of packet segmentation should distinguish transport- or application-layer packetization from both IP fragmentation and lower-layer fragmentation mechanisms.[8][7]

Modern implementation

[edit source]

In contemporary operating systems and network adapters, segmentation is often deferred until late in the transmit path. The Linux kernel documents TCP segmentation offload (TSO), Generic Segmentation Offload (GSO), Generic Receive Offload (GRO) and related mechanisms that reduce per-packet processing overhead by carrying large buffers through much of the stack and splitting them into MTU-sized frames later in software or hardware.[16] Microsoft documents comparable task offloads, including Large Send Offload for TCP and UDP Segmentation Offload, in which the operating system provides a large packet plus segmentation metadata to the network interface for final splitting.[17][18]

See also

[edit source]

References

[edit source]
  1. 1 2 3 4 5 "RFC 9293: Transmission Control Protocol (TCP)". RFC Editor. August 2022. Retrieved 6 July 2026.
  2. 1 2 "RFC 9260: Stream Control Transmission Protocol". RFC Editor. December 2021. Retrieved 6 July 2026.
  3. 1 2 "RFC 6691: TCP Options and Maximum Segment Size (MSS)". RFC Editor. July 2012. Retrieved 6 July 2026.
  4. 1 2 3 "RFC 1191: Path MTU Discovery". RFC Editor. November 1990. Retrieved 6 July 2026.
  5. 1 2 3 4 "RFC 8201: Path MTU Discovery for IP Version 6". RFC Editor. July 2017. Retrieved 6 July 2026.
  6. 1 2 "RFC 791: Internet Protocol". RFC Editor. September 1981. Retrieved 6 July 2026.
  7. 1 2 3 4 "RFC 8200: Internet Protocol, Version 6 (IPv6) Specification". RFC Editor. July 2017. Retrieved 6 July 2026.
  8. 1 2 3 4 "RFC 4821: Packetization Layer Path MTU Discovery". RFC Editor. March 2007. Retrieved 6 July 2026.
  9. 1 2 3 "RFC 1180: A TCP/IP Tutorial". RFC Editor. January 1991. Retrieved 6 July 2026.
  10. 1 2 3 4 "RFC 1122: Requirements for Internet Hosts – Communication Layers". RFC Editor. October 1989. Retrieved 6 July 2026.
  11. 1 2 "RFC 8899: Packetization Layer Path MTU Discovery for Datagram Transports". RFC Editor. September 2020. Retrieved 6 July 2026.
  12. 1 2 "RFC 8085: UDP Usage Guidelines". RFC Editor. March 2017. Retrieved 6 July 2026.
  13. "RFC 768: User Datagram Protocol". RFC Editor. August 1980. Retrieved 6 July 2026.
  14. "RFC 9000: QUIC: A UDP-Based Multiplexed and Secure Transport". RFC Editor. May 2021. Retrieved 6 July 2026.
  15. "RFC 9221: An Unreliable Datagram Extension to QUIC". RFC Editor. March 2022. Retrieved 6 July 2026.
  16. "Segmentation Offloads". The Linux Kernel documentation. Retrieved 6 July 2026.
  17. "TCP/IP Task Offload Overview". Microsoft Learn. 27 September 2024. Retrieved 6 July 2026.
  18. "Offload the Segmentation of Large TCP Packets". Microsoft Learn. 31 January 2025. Retrieved 6 July 2026.