aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2015-03-16 05:39:41 +0000
committerMichael Brown <mcb30@ipxe.org>2015-03-16 15:40:54 +0000
commit74f57016dcec849315f7af52cdc429c676748267 (patch)
tree34d12144758483c009ee065b09de47fa739f8991
parent7b6765ff1b13f088f2ac41556b8639a35bd6b893 (diff)
downloadipxe-74f57016dcec849315f7af52cdc429c676748267.tar.gz
[ncm] Respect maximum transfer size of the bus
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/drivers/net/ncm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/drivers/net/ncm.c b/src/drivers/net/ncm.c
index 8620985b3..10728d2a1 100644
--- a/src/drivers/net/ncm.c
+++ b/src/drivers/net/ncm.c
@@ -157,6 +157,7 @@ static struct usb_endpoint_driver_operations ncm_intr_operations = {
* @ret rc Return status code
*/
static int ncm_in_prefill ( struct ncm_device *ncm ) {
+ struct usb_bus *bus = ncm->bus;
size_t mtu;
unsigned int count;
int rc;
@@ -178,6 +179,8 @@ static int ncm_in_prefill ( struct ncm_device *ncm ) {
/* Attempt allocation at this MTU */
if ( mtu > NCM_MAX_NTB_INPUT_SIZE )
continue;
+ if ( mtu > bus->mtu )
+ continue;
count = ( NCM_IN_MIN_SIZE / mtu );
if ( count < NCM_IN_MIN_COUNT )
count = NCM_IN_MIN_COUNT;