The TCP Selective Acknowledgement option (specified in RFC2018) provides a mechanism for the receiver to indicate packets that have been received out of order (e.g. due to earlier dropped packets). iPXE often operates in environments in which there is a high probability of packet loss. For example, the legacy USB keyboard emulation in some BIOSes involves polling the USB bus from within a system management interrupt: this introduces an invisible delay of around 500us which is long enough for around 40 full-length packets to be dropped. Similarly, almost all 1Gbps USB2 devices will eventually end up dropping packets because the USB2 bus does not provide enough bandwidth to sustain a 1Gbps stream, and most devices will not provide enough internal buffering to hold a full TCP window's worth of received packets. Add support for sending TCP Selective Acknowledgements. This provides the sender with more detailed information about which packets have been lost, and so allows for a more efficient retransmission strategy. We include a SACK-permitted option in our SYN packet, since experimentation shows that at least Linux peers will not include a SACK-permitted option in the SYN-ACK packet if one was not present in the initial SYN. (RFC2018 does not seem to mandate this behaviour, but it is consistent with the approach taken in RFC1323.) We ignore any received SACK options; this is safe to do since SACK is only ever advisory and we never have to send non-trivial amounts of data. Since our TCP receive queue is a candidate for cache discarding under low memory conditions, we may end up discarding data that has been reported as received via a SACK option. This is permitted by RFC2018. We follow the stricture that SACK blocks must not report data which is no longer held by the receiver: previously-reported blocks are validated against the current receive queue before being included within the current SACK block list. Experiments in a qemu VM using forced packet drops (by setting NETDEV_DISCARD_RATE to 32) show that implementing SACK improves throughput by around 400%. Experiments with a USB2 NIC (an SMSC7500) show that implementing SACK improves throughput by around 700%, increasing the download rate from 35Mbps up to 250Mbps (which is approximately the usable bandwidth limit for USB2). Signed-off-by: Michael Brown <mcb30@ipxe.org>tags/v1.20.1
|
|
||
79 |
|
79 |
|
80 |
|
80 |
|
81 |
|
81 |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
82 |
|
124 |
|
83 |
|
125 |
|
84 |
|
126 |
|
|
|
||
102 |
|
144 |
|
103 |
|
145 |
|
104 |
|
146 |
|
|
147 |
|
|
|
148 |
|
|
105 |
|
149 |
|
106 |
|
150 |
|
107 |
|
151 |
|
|
|
||
104 |
|
104 |
|
105 |
|
105 |
|
106 |
|
106 |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
107 |
|
110 |
|
108 |
|
111 |
|
109 |
|
112 |
|
|
|
||
129 |
|
132 |
|
130 |
|
133 |
|
131 |
|
134 |
|
|
135 |
|
|
|
136 |
|
|
132 |
|
137 |
|
133 |
|
138 |
|
134 |
|
139 |
|
|
|
||
143 |
|
148 |
|
144 |
|
149 |
|
145 |
|
150 |
|
|
151 |
|
|
|
152 |
|
|
146 |
|
153 |
|
147 |
|
154 |
|
148 |
|
155 |
|
|
|
||
449 |
|
456 |
|
450 |
|
457 |
|
451 |
|
458 |
|
|
459 |
|
|
|
460 |
|
|
|
461 |
|
|
|
462 |
|
|
|
463 |
|
|
|
464 |
|
|
|
465 |
|
|
|
466 |
|
|
|
467 |
|
|
|
468 |
|
|
|
469 |
|
|
|
470 |
|
|
|
471 |
|
|
|
472 |
|
|
|
473 |
|
|
|
474 |
|
|
|
475 |
|
|
|
476 |
|
|
|
477 |
|
|
|
478 |
|
|
|
479 |
|
|
|
480 |
|
|
|
481 |
|
|
|
482 |
|
|
|
483 |
|
|
|
484 |
|
|
|
485 |
|
|
|
486 |
|
|
|
487 |
|
|
|
488 |
|
|
|
489 |
|
|
|
490 |
|
|
|
491 |
|
|
|
492 |
|
|
|
493 |
|
|
|
494 |
|
|
|
495 |
|
|
|
496 |
|
|
|
497 |
|
|
|
498 |
|
|
|
499 |
|
|
|
500 |
|
|
|
501 |
|
|
|
502 |
|
|
|
503 |
|
|
|
504 |
|
|
|
505 |
|
|
|
506 |
|
|
|
507 |
|
|
|
508 |
|
|
|
509 |
|
|
|
510 |
|
|
|
511 |
|
|
|
512 |
|
|
|
513 |
|
|
|
514 |
|
|
|
515 |
|
|
|
516 |
|
|
|
517 |
|
|
|
518 |
|
|
|
519 |
|
|
|
520 |
|
|
|
521 |
|
|
|
522 |
|
|
|
523 |
|
|
|
524 |
|
|
|
525 |
|
|
|
526 |
|
|
|
527 |
|
|
|
528 |
|
|
|
529 |
|
|
|
530 |
|
|
|
531 |
|
|
|
532 |
|
|
|
533 |
|
|
|
534 |
|
|
|
535 |
|
|
|
536 |
|
|
|
537 |
|
|
|
538 |
|
|
|
539 |
|
|
|
540 |
|
|
|
541 |
|
|
|
542 |
|
|
|
543 |
|
|
|
544 |
|
|
|
545 |
|
|
|
546 |
|
|
452 |
|
547 |
|
453 |
|
548 |
|
454 |
|
549 |
|
|
|
||
493 |
|
588 |
|
494 |
|
589 |
|
495 |
|
590 |
|
496 |
|
|
|
|
591 |
|
|
497 |
|
592 |
|
498 |
|
593 |
|
|
594 |
|
|
499 |
|
595 |
|
500 |
|
596 |
|
501 |
|
597 |
|
|
|
||
503 |
|
599 |
|
504 |
|
600 |
|
505 |
|
601 |
|
506 |
|
|
|
|
602 |
|
|
507 |
|
603 |
|
508 |
|
604 |
|
509 |
|
605 |
|
510 |
|
606 |
|
511 |
|
607 |
|
|
608 |
|
|
|
609 |
|
|
|
610 |
|
|
512 |
|
611 |
|
513 |
|
612 |
|
|
613 |
|
|
|
614 |
|
|
514 |
|
615 |
|
|
616 |
|
|
515 |
|
617 |
|
516 |
|
618 |
|
517 |
|
619 |
|
|
|
||
590 |
|
692 |
|
591 |
|
693 |
|
592 |
|
694 |
|
|
695 |
|
|
|
696 |
|
|
|
697 |
|
|
|
698 |
|
|
593 |
|
699 |
|
594 |
|
700 |
|
595 |
|
701 |
|
|
|
||
599 |
|
705 |
|
600 |
|
706 |
|
601 |
|
707 |
|
|
708 |
|
|
|
709 |
|
|
|
710 |
|
|
|
711 |
|
|
|
712 |
|
|
|
713 |
|
|
|
714 |
|
|
|
715 |
|
|
|
716 |
|
|
|
717 |
|
|
|
718 |
|
|
|
719 |
|
|
|
720 |
|
|
|
721 |
|
|
|
722 |
|
|
602 |
|
723 |
|
603 |
|
724 |
|
604 |
|
725 |
|
|
|
||
635 |
|
756 |
|
636 |
|
757 |
|
637 |
|
758 |
|
|
759 |
|
|
|
760 |
|
|
|
761 |
|
|
|
762 |
|
|
|
763 |
|
|
|
764 |
|
|
|
765 |
|
|
|
766 |
|
|
|
767 |
|
|
|
768 |
|
|
|
769 |
|
|
638 |
|
770 |
|
639 |
|
771 |
|
640 |
|
772 |
|
|
|
||
804 |
|
936 |
|
805 |
|
937 |
|
806 |
|
938 |
|
|
939 |
|
|
|
940 |
|
|
|
941 |
|
|
|
942 |
|
|
|
943 |
|
|
|
944 |
|
|
807 |
|
945 |
|
808 |
|
946 |
|
809 |
|
947 |
|
|
|
||
823 |
|
961 |
|
824 |
|
962 |
|
825 |
|
963 |
|
|
964 |
|
|
826 |
|
965 |
|
827 |
|
966 |
|
828 |
|
967 |
|
|
|
||
840 |
|
979 |
|
841 |
|
980 |
|
842 |
|
981 |
|
|
982 |
|
|
|
983 |
|
|
|
984 |
|
|
|
985 |
|
|
|
986 |
|
|
|
987 |
|
|
|
988 |
|
|
|
989 |
|
|
|
990 |
|
|
|
991 |
|
|
843 |
|
992 |
|
844 |
|
993 |
|
845 |
|
994 |
|
|
|
||
860 |
|
1009 |
|
861 |
|
1010 |
|
862 |
|
1011 |
|
|
1012 |
|
|
|
1013 |
|
|
863 |
|
1014 |
|
864 |
|
1015 |
|
865 |
|
1016 |
|
|
|
||
1070 |
|
1221 |
|
1071 |
|
1222 |
|
1072 |
|
1223 |
|
|
1224 |
|
|
1073 |
|
1225 |
|
1074 |
|
1226 |
|
1075 |
|
1227 |
|
|
|
||
1077 |
|
1229 |
|
1078 |
|
1230 |
|
1079 |
|
1231 |
|
|
1232 |
|
|
1080 |
|
1233 |
|
1081 |
|
1234 |
|
1082 |
|
1235 |
|
|
|
||
1087 |
|
1240 |
|
1088 |
|
1241 |
|
1089 |
|
1242 |
|
1090 |
|
|
|
|
1243 |
|
|
1091 |
|
1244 |
|
1092 |
|
1245 |
|
1093 |
|
1246 |
|
|
|
||
1096 |
|
1249 |
|
1097 |
|
1250 |
|
1098 |
|
1251 |
|
|
1252 |
|
|
1099 |
|
1253 |
|
1100 |
|
1254 |
|
1101 |
|
1255 |
|
|
|
||
1289 |
|
1443 |
|
1290 |
|
1444 |
|
1291 |
|
1445 |
|
1292 |
|
|
|
|
1446 |
|
|
1293 |
|
1447 |
|
1294 |
|
1448 |
|
1295 |
|
1449 |
|