Re: [PATCH] spi: sh-msiof: Fix the limit of data length when calculating the length of words

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Geert-san,

Always thanks for your replies!

On 2019/04/03 18:24, Geert Uytterhoeven wrote:
Hi Hoan,

On Wed, Apr 3, 2019 at 11:17 AM Nguyen An Hoan <na-hoan@xxxxxxxxxxx> wrote:
From: Hoan Nguyen An <na-hoan@xxxxxxxxxxx>

We can use each word (data length) of 32bits (4 bytes),
so that if the length is greater than 3bytes, we can
align it with 4bytes of words.

Signed-off-by: Hoan Nguyen An <na-hoan@xxxxxxxxxxx>
Thanks for your patch!

---
  drivers/spi/spi-sh-msiof.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index e2eb466..1552c14 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -930,7 +930,7 @@ static int sh_msiof_transfer_one(struct spi_controller *ctlr,
         if (!spi_controller_is_slave(p->ctlr))
                 sh_msiof_spi_set_clk_regs(p, clk_get_rate(p->clk), t->speed_hz);

-       while (ctlr->dma_tx && len > 15) {
+       while (ctlr->dma_tx && len > 3) {
This check is here to avoid using DMA (which incurs DMA setup overhead)
for short transfers.
Have you measured the performance impact of your change?

Perhaps the code should be changed to:

     #define DMA_MIN_LEN     16

     while (ctlr->dma_tx && len >= DMA_MIN_LEN) {


Here the DMA feature for this driver has been initialized with the probe() function,
which means that DMA will, if possible, use default.
But when you add a patch to support DMA, You said DMA is only effective
with 32 bits, so that DMA here serves data as multiples of 32 bits.
I don't think the data length causes a cost for DMA when it's always used by default if possible (was initialized with the probe () function) and if the data is a 32bits multiple. In the opposite direction, have you measured the performance of using DMA
if the data is greater than or equal to 16 bytes instead of 4 bytes?


Thank You!

Hoan.


                 /*
                  *  DMA supports 32-bit words only, hence pack 8-bit and 16-bit
                  *  words, with byte resp. word swapping.
@@ -974,7 +974,7 @@ static int sh_msiof_transfer_one(struct spi_controller *ctlr,
                         return 0;
         }

-       if (bits <= 8 && len > 15) {
+       if (bits <= 8 && len > 3) {
Likewise.

                 bits = 32;
                 swab = true;
         } else {
Gr{oetje,eeting}s,

                         Geert




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux