From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FC8BC49ED7 for ; Mon, 16 Sep 2019 14:24:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F3C9E20830 for ; Mon, 16 Sep 2019 14:24:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388638AbfIPOYU (ORCPT ); Mon, 16 Sep 2019 10:24:20 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:35875 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388541AbfIPOYT (ORCPT ); Mon, 16 Sep 2019 10:24:19 -0400 Received: from kresse.hi.pengutronix.de ([2001:67c:670:100:1d::2a]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1i9rvN-0002y0-MR; Mon, 16 Sep 2019 16:24:17 +0200 Message-ID: Subject: Re: [PATCH 3/4] serial: imx: adapt rx buffer and dma periods From: Lucas Stach To: Philipp Puschmann , linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, jslaby@suse.com, vkoul@kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, gregkh@linuxfoundation.org, dmaengine@vger.kernel.org, dan.j.williams@intel.com, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Date: Mon, 16 Sep 2019 16:24:17 +0200 In-Reply-To: <20190911144943.21554-4-philipp.puschmann@emlix.com> References: <20190911144943.21554-1-philipp.puschmann@emlix.com> <20190911144943.21554-4-philipp.puschmann@emlix.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::2a X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mi, 2019-09-11 at 16:49 +0200, Philipp Puschmann wrote: > Using only 4 DMA periods for UART RX is very few if we have a high > frequency of small transfers - like in our case using Bluetooth with many > small packets via UART - causing many dma transfers but in each only > filling a fraction of a single buffer. Such a case may lead to the > situation that DMA RX transfer is triggered but no buffer is available. > While we have addressed the dma handling already we still want to avoid > UART RX FIFO overrun. So we decrease the size of the buffers and increase > their number and the total buffer size. > > Signed-off-by: Philipp Puschmann Reasoning seems sound: Reviewed-by: Lucas Stach > --- > drivers/tty/serial/imx.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index 57d6e6ba556e..cdc51569237c 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -1028,8 +1028,6 @@ static void imx_uart_timeout(struct timer_list *t) > } > } > > -#define RX_BUF_SIZE (PAGE_SIZE) > - > /* > * There are two kinds of RX DMA interrupts(such as in the MX6Q): > * [1] the RX DMA buffer is full. > @@ -1112,7 +1110,8 @@ static void imx_uart_dma_rx_callback(void *data) > } > > /* RX DMA buffer periods */ > -#define RX_DMA_PERIODS 4 > +#define RX_DMA_PERIODS 16 > +#define RX_BUF_SIZE (PAGE_SIZE / 4) > > static int imx_uart_start_rx_dma(struct imx_port *sport) > {