|
@@ -71,6 +71,17 @@ static void pxe_tftp_close ( struct pxe_tftp_connection *pxe_tftp, int rc ) {
|
71
|
71
|
pxe_tftp->rc = rc;
|
72
|
72
|
}
|
73
|
73
|
|
|
74
|
+/**
|
|
75
|
+ * Check flow control window
|
|
76
|
+ *
|
|
77
|
+ * @v pxe_tftp PXE TFTP connection
|
|
78
|
+ * @ret len Length of window
|
|
79
|
+ */
|
|
80
|
+static size_t pxe_tftp_xfer_window ( struct pxe_tftp_connection *pxe_tftp ) {
|
|
81
|
+
|
|
82
|
+ return pxe_tftp->blksize;
|
|
83
|
+}
|
|
84
|
+
|
74
|
85
|
/**
|
75
|
86
|
* Receive new data
|
76
|
87
|
*
|
|
@@ -128,6 +139,8 @@ static int pxe_tftp_xfer_deliver ( struct pxe_tftp_connection *pxe_tftp,
|
128
|
139
|
static struct interface_operation pxe_tftp_xfer_ops[] = {
|
129
|
140
|
INTF_OP ( xfer_deliver, struct pxe_tftp_connection *,
|
130
|
141
|
pxe_tftp_xfer_deliver ),
|
|
142
|
+ INTF_OP ( xfer_window, struct pxe_tftp_connection *,
|
|
143
|
+ pxe_tftp_xfer_window ),
|
131
|
144
|
INTF_OP ( intf_close, struct pxe_tftp_connection *, pxe_tftp_close ),
|
132
|
145
|
};
|
133
|
146
|
|
|
@@ -167,19 +180,19 @@ static int pxe_tftp_open ( uint32_t ipaddress, unsigned int port,
|
167
|
180
|
/* Reset PXE TFTP connection structure */
|
168
|
181
|
memset ( &pxe_tftp, 0, sizeof ( pxe_tftp ) );
|
169
|
182
|
intf_init ( &pxe_tftp.xfer, &pxe_tftp_xfer_desc, NULL );
|
|
183
|
+ if ( blksize < TFTP_DEFAULT_BLKSIZE )
|
|
184
|
+ blksize = TFTP_DEFAULT_BLKSIZE;
|
|
185
|
+ pxe_tftp.blksize = blksize;
|
170
|
186
|
pxe_tftp.rc = -EINPROGRESS;
|
171
|
187
|
|
172
|
188
|
/* Construct URI string */
|
173
|
189
|
address.s_addr = ipaddress;
|
174
|
190
|
if ( ! port )
|
175
|
191
|
port = htons ( TFTP_PORT );
|
176
|
|
- if ( blksize < TFTP_DEFAULT_BLKSIZE )
|
177
|
|
- blksize = TFTP_DEFAULT_BLKSIZE;
|
178
|
|
- snprintf ( uri_string, sizeof ( uri_string ),
|
179
|
|
- "tftp%s://%s:%d%s%s?blksize=%zd",
|
180
|
|
- sizeonly ? "size" : "",
|
181
|
|
- inet_ntoa ( address ), ntohs ( port ),
|
182
|
|
- ( ( filename[0] == '/' ) ? "" : "/" ), filename, blksize );
|
|
192
|
+ snprintf ( uri_string, sizeof ( uri_string ), "tftp%s://%s:%d%s%s",
|
|
193
|
+ sizeonly ? "size" : "", inet_ntoa ( address ),
|
|
194
|
+ ntohs ( port ), ( ( filename[0] == '/' ) ? "" : "/" ),
|
|
195
|
+ filename );
|
183
|
196
|
DBG ( " %s", uri_string );
|
184
|
197
|
|
185
|
198
|
/* Open PXE TFTP connection */
|