Browse Source

[ncm] Respect maximum transfer size of the bus

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
74f57016dc
1 changed files with 3 additions and 0 deletions
  1. 3
    0
      src/drivers/net/ncm.c

+ 3
- 0
src/drivers/net/ncm.c View File

157
  * @ret rc		Return status code
157
  * @ret rc		Return status code
158
  */
158
  */
159
 static int ncm_in_prefill ( struct ncm_device *ncm ) {
159
 static int ncm_in_prefill ( struct ncm_device *ncm ) {
160
+	struct usb_bus *bus = ncm->bus;
160
 	size_t mtu;
161
 	size_t mtu;
161
 	unsigned int count;
162
 	unsigned int count;
162
 	int rc;
163
 	int rc;
178
 		/* Attempt allocation at this MTU */
179
 		/* Attempt allocation at this MTU */
179
 		if ( mtu > NCM_MAX_NTB_INPUT_SIZE )
180
 		if ( mtu > NCM_MAX_NTB_INPUT_SIZE )
180
 			continue;
181
 			continue;
182
+		if ( mtu > bus->mtu )
183
+			continue;
181
 		count = ( NCM_IN_MIN_SIZE / mtu );
184
 		count = ( NCM_IN_MIN_SIZE / mtu );
182
 		if ( count < NCM_IN_MIN_COUNT )
185
 		if ( count < NCM_IN_MIN_COUNT )
183
 			count = NCM_IN_MIN_COUNT;
186
 			count = NCM_IN_MIN_COUNT;

Loading…
Cancel
Save