From patchwork Sat Aug 7 13:07:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 493818 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=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 AA789C432BE for ; Sat, 7 Aug 2021 13:08:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8540361154 for ; Sat, 7 Aug 2021 13:08:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232265AbhHGNI1 (ORCPT ); Sat, 7 Aug 2021 09:08:27 -0400 Received: from smtp-32.italiaonline.it ([213.209.10.32]:42629 "EHLO libero.it" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232176AbhHGNI0 (ORCPT ); Sat, 7 Aug 2021 09:08:26 -0400 Received: from passgat-Modern-14-A10M.homenet.telecomitalia.it ([82.60.87.158]) by smtp-32.iol.local with ESMTPA id CM3WmQm3XPvRTCM3amIfYI; Sat, 07 Aug 2021 15:08:07 +0200 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2021; t=1628341687; bh=whE/smR+GfQX6eqwPlzh75+C188l9V5ywfgFh/erjGo=; h=From; b=oYgZU853/nnrWGJwIz/IlbPnBsKer7Vppx2tKf7T6sjTf+Dx2HD+NKj68oqWWm8O9 vT80vbCzUPsQdbSNou21+C6mJnmKTAFoAViB31MELxFj/wYgdMyI51C291wmTnjdaG waQ8i2dmQQAhhgDhM+cKawj4XEk2zYSbnZh5Rlh+O09cgG1RUfS28wWu1zxofGfnJd dbDILumkTyoM3e2SSEb1jeWo4Y+agPQCLip5pHNDeBcQCXzOmQ2m8awwqHQlxkfksJ HlJBJjvvc17l7WPnRnZ/bK8pp9ZmkVkf9M6+YTtuBqbz5Pfeq+VEjfPrhp1WPkPay3 H+fD3vyugPJMA== X-CNFS-Analysis: v=2.4 cv=NqgUz+RJ c=1 sm=1 tr=0 ts=610e85b7 cx=a_exe a=Hc/BMeSBGyun2kpB8NmEvQ==:117 a=Hc/BMeSBGyun2kpB8NmEvQ==:17 a=gu6fZOg2AAAA:8 a=8Szu4Ex1LEpqERUTuRwA:9 a=-FEs8UIgK8oA:10 a=NWVoK91CQyQA:10 a=2RSlZUUhi9gRBrsHwhhZ:22 From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Gianluca Falavigna , Dario Binacchi , Andrew Lunn , "David S. Miller" , Jakub Kicinski , Marc Kleine-Budde , Oliver Hartkopp , Tong Zhang , Vincent Mailhol , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v3 0/4] can: c_can: cache frames to operate as a true FIFO Date: Sat, 7 Aug 2021 15:07:56 +0200 Message-Id: <20210807130800.5246-1-dariobin@libero.it> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4xfJ9UyNdh2EUq9EiRVjihG6s1usW765LlWJv078A5wh5ixuN84y3IBvMwgw4lUiJZrSrqatSlsGEif4bXSpE9eDXh5dZTHBgwrVuLevzoH/tuxkjXnUKo ytfTjkVuo7m47wqHrv9xlhT+LwRHLDgn8rby2qn1v26OePvCUEvnNImjG/5pwt5xi6e8ukqvUXkQlh1nQmMEvi+uOt7aNNQQzYIKNtL1kDq1hdeJCAYbIk+u OUoY//Km+tOjia3+ngzxWnBDeCsLTGGE+UfyFj/Ic3WryEPqShxSUK7H05ybmSx90qeQXPSPsWqN+amu1NYzRuPffwyKKO7TSw6cdjMkk1rVuVb4IHpmDIMv FLCjHqNZRSX+XTcLMxbv8rhWCRUl7aaIwZn/rD5mZ789oO+7QPcTnS6uvdA30Tl5cLXUSeXzsvnerEvKVfSkWgqhOFnF4jva+f0bDLfrW8xZF7I8yDKqhODR N3xgAYqJrn4OdUFckDW2UPw1aT7Jqa/HA+QYmx8wTHoYIrFSuzNrFy/6gjssczAtFg+unHEflG46I6cs2zn/o0KHtoraVGZkbaAfV4pe6LLuEQRYPLN6VPUW KbsQ2eHQaVqhdyRVzxoT1+eED54vHFVs9fWhkHpz3CWZig== Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Performance tests of the c_can driver led to the patch that gives the series its name. I also added two patches not really related to the topic of the series. Run test succesfully on a custom board having two CAN ports. I connected the CAN1 port to the CAN2 port with a cable. Then I opened two terminals. On one I issued a dump command and on the other the transmit command used in the tests described in https://marc.info/?l=linux-can&m=139746476821294&w=2. Terminal-1: $ ip link set can1 type can bitrate $ ip link set up can1 $ candump can1 >/tmp/can-test- Terminal-2 $ ip link set can0 type can bitrate $ ip link set up can0 $ time cangen can0 -g0 -p1 -I5A5 -L0 -x -n 1000000 Then I applied the following commands to the file generated by the dump command: $ wc -l # ca $ egrep -v ' can1 5A5 \[0\]' /tmp/can-test- | wc -l # cb I repeated the tests for 1000000, 500000, 250000 and 125000 bitrates, before and after applying the series. Here are the results: Before applying the series: bitrate time ca cb 125000 6m 42.71s 1000000 0 250000 3m 23.28s 1000000 0 500000 1m 44.04s 1000000 0 1000000 1m 8.44s 1000000 0 After applying ring-FIFO series: bitrate time ca cb 125000 6m 40.48s 1000000 0 250000 3m 20.80s 1000000 0 500000 1m 42.56s 1000000 0 1000000 1m 7.89s 1000000 0 Changes in v3: - Remove the transmission spin_lock. - Use IF_RX in c_can_do_tx(). Changes in v2: - Move c_can_get_tx_free() from c_can_main.c to c_can.h. Dario Binacchi (4): can: c_can: remove struct c_can_priv::priv field can: c_can: exit c_can_do_tx() early if no frames have been sent can: c_can: support tx ring algorithm can: c_can: cache frames to operate as a true FIFO drivers/net/can/c_can/c_can.h | 25 ++++++- drivers/net/can/c_can/c_can_main.c | 95 +++++++++++++++++++------- drivers/net/can/c_can/c_can_platform.c | 1 - 3 files changed, 94 insertions(+), 27 deletions(-)