Hi again, Felipe Balbi <balbi@xxxxxxxxxx> writes: >>>> Enabling SG allows enabling GSO (generic segmentation offload) feature >>>> of linux networking layer. This increases TCP throughput with NCM >>>> on Cortex-A15+USB3380 based device from 300 Mbit/s to 1.1 Gbit/s. >>>> >>>> Signed-off-by: Jussi Kivilinna <jussi.kivilinna@xxxxxxxxxxx> >>> >>> this is AWESOME!! :-) But here's the thing, any chance we can build this >>> in u_ether.c ? Also, NETIF_F_SG should be conditional on >>> gadget->sg_supported so that we don't break UDCs that don't support >>> sglists. >>> >> >> Actually, no sglists are passed to UDC. Reason why this work >> with minimal changes for NCM is that NCM does tx buffering >> in its wrap function.. 'ncm_wrap_ntb' copies input skbuffs to >> larger skbuff, so enabling SG is only matter of changing that >> skbuff data copy from 'memcpy' to 'skb_copy_bits' (and changing >> CRC calculation work with skbuff fragments). Since NCM already >> does copying, SG can be enabled for NCM without extra overhead. > > aha, understood. Now what if we skip copying altogether? If we have an > sg and a UDC that supports sg (gadget->sg_supported = 1), then we can > avoid copying, right? perhaps this is the crud of the change (still need to check for sg_supported)? diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index 5f562c1ec795..f3497cba32ec 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c @@ -235,7 +235,7 @@ rx_submit(struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags) */ skb_reserve(skb, NET_IP_ALIGN); - req->buf = skb->data; + req->num_sgs = skb_to_sgvec(skb, req->sg, 0, skb->len); req->length = size; req->complete = rx_complete; req->context = skb; -- balbi
Attachment:
signature.asc
Description: PGP signature