瀏覽代碼

[ncm] Respect maximum transfer size of the bus

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 年之前
父節點
當前提交
74f57016dc
共有 1 個檔案被更改,包括 3 行新增0 行删除
  1. 3
    0
      src/drivers/net/ncm.c

+ 3
- 0
src/drivers/net/ncm.c 查看文件

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…
取消
儲存