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

Loading…
Cancel
Save