Skip to contentSkip to conversation

net: tftp: Add client support for RFC 7440

PATCH Superseded Ramon Fried 1 participant 1 message May 18, 2020 Networking

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 net: tftp: Add client support for RFC 7440

Add support for RFC 7440: "TFTP Windowsize Option".

This optional feature allows the client and server to negotiate a window size of consecutive blocks to send as an alternative for replacing the single-block lockstep schema.

windowsize can be defined statically during compilation by setting CONFIG_TFTP_WINDOWSIZE, or defined in runtime by setting an environment variable: "tftpwindowsize" If not defined, the windowsize is set to 1, meaning that it behaves as it was never defined.

Choosing the appropriate windowsize depends on the specific network topology, underlying NIC.
You should test various windowsize scenarios and see which best work for you.

Setting a windowsize too big can actually decreases performance.

---
v2:
* Don't send windowsize option on tftpput, as it's not implemented yet.
* Don't send NACK for every out of order block that arrives, one nack is enough.
v3:
* Add option CONFIG_TFTP_WINDOWSIZE to kconfig with default 1.
* Fixed some spelling errors.
* Took assignment out of a loop.
* simplified variable increment.

 README      |  5 ++++
 net/Kconfig |  9 +++++++
 net/tftp.c  | 77 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 84 insertions(+), 7 deletions(-)
README +5 -0
index be9e6391d6..686474a2f1 100644
@@ -3522,6 +3522,11 @@ List of environment variables (most likely not complete):
 		  downloads succeed with high packet loss rates, or with
 		  unreliable TFTP servers or client hardware.
 
+  tftpwindowsize	- if this is set, the value is used for TFTP's
+		  window size as described by RFC 7440.
+		  This means the count of blocks we can receive before
+		  sending ack to server.
+
   vlan		- When set to a value < 4095 the traffic over
 		  Ethernet is encapsulated/received over 802.1q
 		  VLAN tagged frames.
net/Kconfig +9 -0
index ac6d0cf8a6..7916ae305f 100644
@@ -49,4 +49,13 @@ config TFTP_BLOCKSIZE
 	  almost-MTU block sizes.
 	  You can also activate CONFIG_IP_DEFRAG to set a larger block.
 
+config TFTP_WINDOWSIZE
+	int "TFTP window size"
+	default 1
+	help
+	  Default TFTP window size.
+	  RFC7440 defines an optional window size of transmits,
+	  before an ack response is required.
+	  The default TFTP implementation implies a window size of 1.
+
 endif   # if NET
net/tftp.c +70 -7

144 lines not on this page · raw message

Signature · 1 line
2.26.2