Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06bc785f authored by Ajay Agarwal's avatar Ajay Agarwal Committed by Gerrit - the friendly Code Review server
Browse files

USB: f_diag: Report Max request size as 16k for ChipIdea



ChipIdea controller can be queued a maximum packet size of 16KB.
If a request larger than this size arrives on IN endpoint,
request is failed. Fix this by limiting the max request size to
16k if the controller is ChipIdea.

Change-Id: Iac696addc9b1ca50e78ae66f73f5b66bd3100c1c
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: default avatarPratham Pratap <prathampratap@codeaurora.org>
parent 7e82e435
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -462,6 +462,7 @@ int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read)
}
EXPORT_SYMBOL(usb_diag_alloc_req);
#define DWC3_MAX_REQUEST_SIZE (16 * 1024 * 1024)
#define CI_MAX_REQUEST_SIZE   (16 * 1024)
/**
 * usb_diag_request_size - Max request size for controller
 * @ch: Channel handler
@@ -471,6 +472,12 @@ EXPORT_SYMBOL(usb_diag_alloc_req);
 */
int usb_diag_request_size(struct usb_diag_ch *ch)
{
	struct diag_context *ctxt = ch->priv_usb;
	struct usb_composite_dev *cdev = ctxt->cdev;

	if (cdev->gadget->is_chipidea)
		return CI_MAX_REQUEST_SIZE;

	return DWC3_MAX_REQUEST_SIZE;
}
EXPORT_SYMBOL(usb_diag_request_size);