lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 16 Jun 2020 20:34:43 +0800
From:   Macpaul Lin <macpaul.lin@...iatek.com>
To:     Chunfeng Yun <chunfeng.yun@...iatek.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Felipe Balbi <balbi@...nel.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Michał Mirosław <mirq-linux@...e.qmqm.pl>,
        Sergey Organov <sorganov@...il.com>,
        Fabrice Gasnier <fabrice.gasnier@...com>,
        <linux-usb@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-mediatek@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>
CC:     Mediatek WSD Upstream <wsd_upstream@...iatek.com>,
        Macpaul Lin <macpaul.lin@...iatek.com>,
        Macpaul Lin <macpaul.lin@...il.com>
Subject: [PATCH 1/2] usb: gadget: introduce flag for large request

Some USB hardware like DMA engine can help to process (split) the data
of each URB request into small packets. For example, the max packet size
of high speed is 512 bytes. These kinds of hardware can help to split
the continue Tx/Rx data requests into packets just at the max packet
size during transmission. Hence upper layer software can reduce some
effort for queueing many requests back and forth for larger data.

Here we introduce "can_exceed_maxp" flag in gadget when these kinds of
hardware is ready to support these operations.

Signed-off-by: Macpaul Lin <macpaul.lin@...iatek.com>
---
 drivers/usb/mtu3/mtu3_qmu.c |   11 ++++++++++-
 include/linux/usb/gadget.h  |    1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/mtu3/mtu3_qmu.c b/drivers/usb/mtu3/mtu3_qmu.c
index 3f414f9..2b51a20 100644
--- a/drivers/usb/mtu3/mtu3_qmu.c
+++ b/drivers/usb/mtu3/mtu3_qmu.c
@@ -620,7 +620,7 @@ irqreturn_t mtu3_qmu_isr(struct mtu3 *mtu)
 
 int mtu3_qmu_init(struct mtu3 *mtu)
 {
-
+	int i;
 	compiletime_assert(QMU_GPD_SIZE == 16, "QMU_GPD size SHOULD be 16B");
 
 	mtu->qmu_gpd_pool = dma_pool_create("QMU_GPD", mtu->dev,
@@ -629,10 +629,19 @@ int mtu3_qmu_init(struct mtu3 *mtu)
 	if (!mtu->qmu_gpd_pool)
 		return -ENOMEM;
 
+	/* Let gadget know we can process request larger than max packet */
+	for (i = 1; i < mtu->num_eps; i++)
+		mtu->ep_array[i].ep.can_exceed_maxp = 1;
+
 	return 0;
 }
 
 void mtu3_qmu_exit(struct mtu3 *mtu)
 {
+	int i;
 	dma_pool_destroy(mtu->qmu_gpd_pool);
+
+	/* Disable large request support */
+	for (i = 1; i < mtu->num_eps; i++)
+		mtu->ep_array[i].ep.can_exceed_maxp = 0;
 }
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 6a17817..60e0645 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -236,6 +236,7 @@ struct usb_ep {
 	unsigned		max_streams:16;
 	unsigned		mult:2;
 	unsigned		maxburst:5;
+	unsigned		can_exceed_maxp:1;
 	u8			address;
 	const struct usb_endpoint_descriptor	*desc;
 	const struct usb_ss_ep_comp_descriptor	*comp_desc;
-- 
1.7.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ