Message ID | 1592310884-4307-1-git-send-email-macpaul.lin@mediatek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] usb: gadget: introduce flag for large request | expand |
On Tue, Jun 16, 2020 at 08:34:43PM +0800, Macpaul Lin wrote: > 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. This isn't needed. All UDC drivers must be able to support requests that are larger than the maxpacket size. Alan Stern
Alan Stern <stern@rowland.harvard.edu> 於 2020年6月16日 週二 下午10:05寫道: > > On Tue, Jun 16, 2020 at 08:34:43PM +0800, Macpaul Lin wrote: > > 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. > > This isn't needed. All UDC drivers must be able to support requests that > are larger than the maxpacket size. > > Alan Stern Thanks for your reply, could we just modify the patch 2 (u_serial.c) for improving better performance? I'm not sure why there was a restriction about max packet. Isn't there any historical reason?
Hi, Macpaul Lin <macpaul.lin@mediatek.com> writes: > 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@mediatek.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; every driver does this without this flag. This is unnecessary.
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;
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@mediatek.com> --- drivers/usb/mtu3/mtu3_qmu.c | 11 ++++++++++- include/linux/usb/gadget.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-)