How are bytes transmitted via WiFi?

In your example, the top layer is TCP/IP. This runs on the main CPU of your laptop (say). It knows it is sending packets on the wifi interface (it could just as well be an ethernet interface). In theory, TCP/IP it would know how big of packets can be sent on that interface, and traditionally that is set to 1500 bytes because that is what ethernet supports. For wireless, this number is somewhat arbitrary, as you shall see, but a number is needed and I think it is normally set to 1500.

So TCP/IP splits up the data into 1500 byte (or smaller) packets and passes them to the wifi interface.

So the top layer of the wifi protocols tells the lower layers that it has 1500 bytes of data to send. Eventually a request is sent over the air to the wifi router that you need to send data. Based on the radio conditions and other users on the same wifi router, you will be granted permission to send so many bytes in the next time period. I'm not sure long each time period is in wifi, but on LTE it is 1 mS. Depending on how much load is on the wifi system, you might get to send your next chunk on the next time period, or you might have to wait some number of time periods to give others a chance.

Let's say wifi says you can only send 100 bytes. So you send 100 bytes in a chunk. For technical reasons the bits within this chunk are scrambled around (known as interleaving), together with redundant bits for error correction, but the receiving end knows about this and puts everything back in the original order. There are also sequence numbers and flags in the packets (the MAC-layer header) so the receiving end (i.e. the wifi router) knows how this chunk of data is part of the original packet. This allows the wifi router to reassembly the chunks to get the original TCP/IP packet (length 1500) and ship it out to the internet.

This process is known as segmentation and reassembly (SAR)

/r/ECE Thread Parent