On 13.09.2022 16:41:10, Rhett Aultman wrote: > From: Vasanth Sadhasivan > > DMA allocated buffers are a precious resource. If there is no need for DMA > allocations, then it might be worth to use non-dma allocated buffers. > After testing the gs_usb driver with and without DMA allocation, there > does not seem to be a significant change in latency or cpu utilization > either way. Therefore, DMA allocation is not necessary and removed. > > Co-developed-by: Rhett Aultman > Signed-off-by: Rhett Aultman > Signed-off-by: Vasanth Sadhasivan > --- > drivers/net/can/usb/gs_usb.c | 38 ++++++++++-------------------------- > 1 file changed, 10 insertions(+), 28 deletions(-) > > diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c > index baf749c8cda3..1bfc775c62c5 100644 > --- a/drivers/net/can/usb/gs_usb.c > +++ b/drivers/net/can/usb/gs_usb.c > @@ -269,7 +269,6 @@ struct gs_can { > struct usb_anchor tx_submitted; > atomic_t active_tx_urbs; > void *rxbuf[GS_MAX_RX_URBS]; > - dma_addr_t rxbuf_dma[GS_MAX_RX_URBS]; > }; > > /* usb interface struct */ > @@ -587,9 +586,7 @@ static void gs_usb_xmit_callback(struct urb *urb) > > if (urb->status) > netdev_info(netdev, "usb xmit fail %u\n", txc->echo_id); > - > - usb_free_coherent(urb->dev, urb->transfer_buffer_length, > - urb->transfer_buffer, urb->transfer_dma); > + devm_kfree(&urb->dev->dev, urb->transfer_buffer); Consider using the URB_FREE_BUFFER flag: | https://elixir.bootlin.com/linux/v5.19/source/include/linux/usb.h#L1330 and standard kmalloc() (i.e. not devm_kmalloc()). The USB stack will take care of kfree()ing the buffer associated with each URB. regards, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |