[ncm] Respect maximum transfer size of the bus
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
7b6765ff1b
commit
74f57016dc
@ -157,6 +157,7 @@ static struct usb_endpoint_driver_operations ncm_intr_operations = {
|
|||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int ncm_in_prefill ( struct ncm_device *ncm ) {
|
static int ncm_in_prefill ( struct ncm_device *ncm ) {
|
||||||
|
struct usb_bus *bus = ncm->bus;
|
||||||
size_t mtu;
|
size_t mtu;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
int rc;
|
int rc;
|
||||||
@ -178,6 +179,8 @@ static int ncm_in_prefill ( struct ncm_device *ncm ) {
|
|||||||
/* Attempt allocation at this MTU */
|
/* Attempt allocation at this MTU */
|
||||||
if ( mtu > NCM_MAX_NTB_INPUT_SIZE )
|
if ( mtu > NCM_MAX_NTB_INPUT_SIZE )
|
||||||
continue;
|
continue;
|
||||||
|
if ( mtu > bus->mtu )
|
||||||
|
continue;
|
||||||
count = ( NCM_IN_MIN_SIZE / mtu );
|
count = ( NCM_IN_MIN_SIZE / mtu );
|
||||||
if ( count < NCM_IN_MIN_COUNT )
|
if ( count < NCM_IN_MIN_COUNT )
|
||||||
count = NCM_IN_MIN_COUNT;
|
count = NCM_IN_MIN_COUNT;
|
||||||
|
Reference in New Issue
Block a user