From patchwork Fri Sep 29 14:12:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 14723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp4127337vqu; Fri, 29 Sep 2023 08:43:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEPMGZg2NVt+psFVEXyuBqFhB7xmsUghMRUAQQhCdP8yp+sFsIS6XXT/f18xGl2qTXzMN9i X-Received: by 2002:a17:902:ed0b:b0:1c5:b4a1:ff3 with SMTP id b11-20020a170902ed0b00b001c5b4a10ff3mr4433094pld.40.1696002207811; Fri, 29 Sep 2023 08:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696002207; cv=none; d=google.com; s=arc-20160816; b=fQQ5ovUXWBOhf5oxxBUR6O/wSuq8GvSsNgGvg+uQeAy+BgleSwcAwDcEF2GlbHrBPR NgTP+nK9sMDYdC4wVQaCPFwqE0rU0xLYQlogK/AnrHF8PJL8zTfTan6lOk9oazhCXYJT giZTjIYXHEvhTm+ww6kpooltGg2IGcQxPRb69RUbv3fJvg7ZhAK7+3/vtdjWImHihYmN Xn//FqomSM3uJsL3ddJlwB2IkZhcsSi/2H22L+vJhHlwAIY20QVnTAg3h6FIc/YDBn6J da2nghL7HBqtlRIjJGsgOrj8BZtMvLO2jybbuogLsBTbkexECE7qKbYNeYUs10G4WAXR jBDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Uo4m8TJwh5ppVOXwkoM0SRHlHtGCNDCaW2WabCnIhNc=; fh=EtuWLR14IhIbZM+E+fYn4isj1Y+iLrncbbgmHIVUFEQ=; b=ZpcbTE05iMA+/hTBVhBOnXGlBVD4thF34zvb+vcUFP6ISXCTxAM3KRgZRUiNOoG6Zo JQto+eFoToXsLZlMhLTGiwShlK36uLfYGsj94USuhJd3qIh29VtPMoZE+fU7HFsW8nWp +XmWIiRqkSbaIDPSP18+wIldijND1zVZO1mwlhySyfqZ0JixRR7mXcTBXlO5sMbLhgVQ yhkhXvH5Tg/P0UDHgut6HofJjB67IINwmY4zsGg7Jy+lO/qYaUtho0DfiXYnQrT4WWix RUKKomV6c/UNYK57FdfrrqYqlZs0iAtzvfIcB50o8X/A372TLhxKJX5pj6eT6+qnaWCd Kdrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=R68uuOG5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id x3-20020a170902a38300b001c3e40dfff0si1620977pla.359.2023.09.29.08.43.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 08:43:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=R68uuOG5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id DDB45833AB26; Fri, 29 Sep 2023 07:13:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233217AbjI2ONS (ORCPT + 20 others); Fri, 29 Sep 2023 10:13:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233145AbjI2ONQ (ORCPT ); Fri, 29 Sep 2023 10:13:16 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DEA91AC for ; Fri, 29 Sep 2023 07:13:11 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4054f790190so132448435e9.2 for ; Fri, 29 Sep 2023 07:13:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695996789; x=1696601589; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Uo4m8TJwh5ppVOXwkoM0SRHlHtGCNDCaW2WabCnIhNc=; b=R68uuOG5GMCjK3EA489VkOEKmJIH+4Ij5u+s2p+0vvc79M1JDbwneDbCj6l9303XG8 47ijBMu5UleXzehgABt1QS0VbnV899DnUcQq8nYiLSNw2ZPnv512N8Hy5XpO+uTCp10r iqy91XtNpBetHiCxzUZO+TqtdUzyFNNwgS28veS50enGskyP7tbTxmyCkVCNG4HnpPrh Man2pl5MnHvTQsdg94PhfSr1w/e7W0V2zz1gKOp7rb9Zxb/eJelMAEa0WLuwsSOmKOpj j40LFu5saQksZQLuR9HogD+UcH6p2cg2eP6wjQEnpGCH4tppom7EAdd50c04ijT65Zgg hzvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695996789; x=1696601589; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Uo4m8TJwh5ppVOXwkoM0SRHlHtGCNDCaW2WabCnIhNc=; b=jNr9VXsEoYacCXFIrwsYOU34bOmu5S4BcDmNz2UgbTYU+54flzluZ+edAdvRap4+AY oyfwWzf/tG6YUG1OG0KXpCgHjH8YaRazCJJLaQmEh605cJa4jO1yeCfBjeD4ofobzH3U CkPawzDbihfo/6jm2ZytnMeKwRzf8/5AiQdsQP4ZpiTZwZIWEQ2YrMU6tCN2P0nw+bC5 NEiPsNrvExTgvK0/wgocbvhwxi0b3SD4agq3U50SpjGUInEJixoaJe1d2FIxPO9TygWY 4jqcKTkP3WxWmnI3L3vCd2Jj3pTWq4T+0LLPvuaVnyO3amHP01IpYzaS4kwwSdaSf+8j I+LQ== X-Gm-Message-State: AOJu0Yzio+jVd0xXzh4kXXYPqRwkGEHD3q3KVElZDAsbGZmmTc1VqEpe sybmVdHxanzYzEOHoqqoBzb0Kg== X-Received: by 2002:a1c:4b13:0:b0:405:3dee:3515 with SMTP id y19-20020a1c4b13000000b004053dee3515mr4077408wma.27.1695996789350; Fri, 29 Sep 2023 07:13:09 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4091:a246:8222:dbda:9cd9:39cc:f174]) by smtp.gmail.com with ESMTPSA id t25-20020a7bc3d9000000b00405391f485fsm1513068wmj.41.2023.09.29.07.13.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 07:13:08 -0700 (PDT) From: Markus Schneider-Pargmann To: Marc Kleine-Budde , Chandrasekar Ramakrishnan , Wolfgang Grandegger Cc: Vincent MAILHOL , Simon Horman , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Julien Panis , Judith Mendez , Markus Schneider-Pargmann Subject: [PATCH v6 00/14] can: m_can: Optimizations for m_can/tcan part 2 Date: Fri, 29 Sep 2023 16:12:50 +0200 Message-Id: <20230929141304.3934380-1-msp@baylibre.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 29 Sep 2023 07:13:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778387211402355362 X-GMAIL-MSGID: 1778387211402355362 Hi Marc, Simon, Martin and everyone, v6 is a rebase on v6.6. As there was a conflicting change merged for v6.6 which introduced irq polling, I had to modify the patches that touch the hrtimer. @Simon: I removed a couple of your reviewed-by tags because of the changes. @Martin: as the functionality changed, I did not apply your Tested-by tag as I may have introduced new bugs with the changes. The series implements many small and bigger throughput improvements and adds rx/tx coalescing at the end. Based on v6.6-rc2. Also available at https://gitlab.baylibre.com/msp8/linux/-/tree/topic/mcan-optimization/v6.6?ref_type=heads Best, Markus Changes in v6: - Rebased to v6.6-rc2 - Added two small changes for the newly integrated polling feature - Reuse the polling hrtimer for coalescing as the timer used for coalescing has a similar purpose as the one for polling. Also polling and coalescing will never be active at the same time. Changes in v5: - Add back parenthesis in m_can_set_coalesce(). This will make checkpatch unhappy but gcc happy. - Remove unused fifo_header variable in m_can_tx_handler(). - Rebased to v6.5-rc1 Changes in v4: - Create and use struct m_can_fifo_element in m_can_tx_handler - Fix memcpy_and_pad to copy the full buffer - Fixed a few checkpatch warnings - Change putidx to be unsigned - Print hard_xmit error only once when TX FIFO is full Changes in v3: - Remove parenthesis in error messages - Use memcpy_and_pad for buffer copy in 'can: m_can: Write transmit header and data in one transaction'. - Replace spin_lock with spin_lock_irqsave. I got a report of a interrupt that was calling start_xmit just after the netqueue was woken up before the locked region was exited. spin_lock_irqsave should fix this. I attached the full stack at the end of the mail if someone wants to know. - Rebased to v6.3-rc1. - Removed tcan4x5x patches from this series. Changes in v2: - Rebased on v6.2-rc5 - Fixed missing/broken accounting for non peripheral m_can devices. previous versions: v1 - https://lore.kernel.org/lkml/20221221152537.751564-1-msp@baylibre.com v2 - https://lore.kernel.org/lkml/20230125195059.630377-1-msp@baylibre.com v3 - https://lore.kernel.org/lkml/20230315110546.2518305-1-msp@baylibre.com/ v4 - https://lore.kernel.org/lkml/20230621092350.3130866-1-msp@baylibre.com/ v5 - https://lore.kernel.org/lkml/20230718075708.958094-1-msp@baylibre.com Markus Schneider-Pargmann (14): can: m_can: Start/Cancel polling timer together with interrupts can: m_can: Move hrtimer init to m_can_class_register can: m_can: Write transmit header and data in one transaction can: m_can: Implement receive coalescing can: m_can: Implement transmit coalescing can: m_can: Add rx coalescing ethtool support can: m_can: Add tx coalescing ethtool support can: m_can: Use u32 for putidx can: m_can: Cache tx putidx can: m_can: Use the workqueue as queue can: m_can: Introduce a tx_fifo_in_flight counter can: m_can: Use tx_fifo_in_flight for netif_queue control can: m_can: Implement BQL can: m_can: Implement transmit submission coalescing drivers/net/can/m_can/m_can.c | 559 ++++++++++++++++++------- drivers/net/can/m_can/m_can.h | 34 +- drivers/net/can/m_can/m_can_platform.c | 4 - 3 files changed, 447 insertions(+), 150 deletions(-) base-commit: ce9ecca0238b140b88f43859b211c9fdfd8e5b70 Reviewed-by: Simon Horman Tested-by: Martin Hundebøll