The sequence number and acknowledgement number in the TCP header is specified to contain byte counts. However, a lot of resources, including RFCs, say that "lost segments are retransmitted" instead of "lost bytes are retransmitted".
If, for example, 4 500-byte segments were sent and the 2th and 3th segment got lost, is it allowed to retransmit bytes 500-1500 (previously sent in the 2th and 3th segment) as one segment? If yes, what are the advantages and disadvantages of retransmitting it as one segment? Does any common implementation do it? Here I assume that the MTU is big enough for the combined package all the time (the reason for the 2th and 3th segment being transmitted separately could be e.g. that Nagle's algorithm is disabled).
Does it make a difference for this question whether selective acknowledgements are used or not? Selective acknowledgements are required to avoid retransmitting the 4th segment. But does it have any other effect (on the 2th and 3th segment) in this scenario?
Looking at the Linux kernel source code, it seems like it puts segments into the output queue. It can sub-divide segments that are already in the queue (in the case the MTU decreases). In the TCP implementation I didn't see any code that reassembles smaller segments into bigger ones. However I could imagine that the TCP segmentation offload (TSO) could result in bigger segments being transmitted. I don't know if it's even possible to find out the exact segmentation boundaries. Would there be any benefit from a protocol-theoretic perspective?