Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp5837049rwj; Wed, 21 Dec 2022 07:38:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXv8SRRqI4HyDkwa7Fgr0rX7NQ78tONolEWt7woaIR4ZFgruN4SV1ZT06q4hgR93anqLCrp9 X-Received: by 2002:a17:903:3311:b0:186:a7ff:e8ad with SMTP id jk17-20020a170903331100b00186a7ffe8admr2548067plb.24.1671637081642; Wed, 21 Dec 2022 07:38:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671637081; cv=none; d=google.com; s=arc-20160816; b=ZZOzES7GEl0eB+PYDZXjVb7krJ6tWNO1b5WNya3FQeJjpLJ8whCRFbaIO+rgjZJQ2z AryqnCbe5yh1w1h0YaTkH8ybGsq6ozoanYWSwN2dowksE81Vd+iz36fFZIdxeeApwonm teOfzauS8X5+nn9WxtebM1YVem7pHj78LjOtAKOCn4KjxkT85TQx03EB9DQ5j2hq1pEP J3eNROYano+jraIIJa+4+BTRmCrSMc7/FvOUJLfryO7ngInXx/F+YcsXl7xABHOVf13R 8BVEADZV1fE0ND0ahdaFPOc1eAZMnK77mztgDhtKViRV3i2fYXRTHuTefkSep3jKVdgg beaw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=25T5buiJct4F2Qt5zVUUN9CA8mwo1WMtnKkPLLIV3kA=; b=UEovccrWaIt7C6/5qsJ6WoQfvjoNzBz+kvGDB5PUIO3gwcLkGcy3512dHDPk6VGcIF B7DMVxhYf8tqQIIYLVCKZbBNXMHFeWsEvjxNiakJJeK7orn3cyJaQaOUdVR4qvg9CmT/ MIPAVtHI7cdeh9wc/krM0QTa0gBu7T5mX9YcRpaShD4erUE8ElEFvsCI6QBvTRxaqx9/ ejBLPKpcssNy4EMRQmj9tKPNejHnxS6a/5bnsWZZKpM61tbKGhYs6NiTGCuUsljcypk2 N3TpU9o2500nUWnr3BEWm+PH7PXRJhn1YuRd8S9wR6fzGifnH7XWJX0MhcbJXp1I0e2b ywWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=1c8AfhC3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a170902ced200b00178b95aa01fsi18885596plg.614.2022.12.21.07.37.52; Wed, 21 Dec 2022 07:38:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=1c8AfhC3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234770AbiLUP0c (ORCPT + 68 others); Wed, 21 Dec 2022 10:26:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234653AbiLUPZu (ORCPT ); Wed, 21 Dec 2022 10:25:50 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A9BAA471 for ; Wed, 21 Dec 2022 07:25:49 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id m19so22437030edj.8 for ; Wed, 21 Dec 2022 07:25:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=25T5buiJct4F2Qt5zVUUN9CA8mwo1WMtnKkPLLIV3kA=; b=1c8AfhC3Ur9TqK1Z7HDC/dZOmCzNppS0f7O/CcrgO2/LQ/+vijBcIdwQfQ6Qo45kYG 5WE7kHQv6QsDd0Uq0NQ4ahbqz9iG88Gc5xlruJpSdUIq3kPIzqWFa3o6hqpr/KbLUlf5 /mgOQqbdxjH9H8BWr7Npz4LwNubw98FKQoLFciUVupsc1REtrExj9Jv3Zv6A/sLghqkI KopXHmPu1VX+N8H3uL3Ay6OUJyZOJgyZrD8mfx7+lTVS7qUtbsqu97nj09sxa1Ellv+x l4ysG8Gb2MYN7xwxly0O6bLfiI71HSGh9FY0s2xPfA8B2sTbhZ2C3LTaeLkdBI/NLd9b SxfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=25T5buiJct4F2Qt5zVUUN9CA8mwo1WMtnKkPLLIV3kA=; b=EZOamDeE8A2ELAdsrmoocjpzjAaz5YKt+aAw6V+kWQ2DeMBjftn5tjte/4majiq54x mo5STu9TRqi/hDWuPCFEOhJLRIzIqzWumoNC269RDEpD8bD6k1rWHfMa9BjJanpv2ytQ +U+JJ6ooeOExaU/RYHyIuJ/9Jo3aN7JP4XAjV5Z3HX4GKfP47G5KrBrWL8d1vXmYzRm+ Ee4r1cAcIGQLEVLUDut2RLmzhy2qYX55rKCzn2IzQnNnHTJ2+f5mlseXIFEw+Nd3QzVM CvK8ep1npQqZ+rnpqXeqoQdF34d5kGSFKyo89RlYKfjml4i6qKXRJ65CGsUk0Ab61Cbd gQ9Q== X-Gm-Message-State: AFqh2koGxZjsUo8yIzHuINw7PE2zhyHLfaJsGLBMOMbBNR8yaJyhyBwi ch5tptmF17rWvi4XqFeEZvjlJg== X-Received: by 2002:a05:6402:790:b0:470:1e5a:a333 with SMTP id d16-20020a056402079000b004701e5aa333mr1648304edy.34.1671636348039; Wed, 21 Dec 2022 07:25:48 -0800 (PST) Received: from blmsp.fritz.box ([2001:4091:a245:805c:8713:84e4:2a9e:cbe8]) by smtp.gmail.com with ESMTPSA id n19-20020aa7c793000000b0045cf4f72b04sm7105428eds.94.2022.12.21.07.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Dec 2022 07:25:47 -0800 (PST) From: Markus Schneider-Pargmann To: Marc Kleine-Budde , Chandrasekar Ramakrishnan , Wolfgang Grandegger Cc: Vincent MAILHOL , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Markus Schneider-Pargmann Subject: [PATCH 08/18] can: m_can: Write transmit header and data in one transaction Date: Wed, 21 Dec 2022 16:25:27 +0100 Message-Id: <20221221152537.751564-9-msp@baylibre.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221221152537.751564-1-msp@baylibre.com> References: <20221221152537.751564-1-msp@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Combine header and data before writing to the transmit fifo to reduce the overhead for peripheral chips. Signed-off-by: Markus Schneider-Pargmann --- drivers/net/can/m_can/m_can.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index bcd3bcdc5123..9b5ad222aef7 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -1657,6 +1657,7 @@ static netdev_tx_t m_can_tx_handler(struct m_can_classdev *cdev) m_can_write(cdev, M_CAN_TXBAR, 0x1); /* End of xmit function for version 3.0.x */ } else { + char buf[TXB_ELEMENT_SIZE]; /* Transmit routine for version >= v3.1.x */ txfqs = m_can_read(cdev, M_CAN_TXFQS); @@ -1696,12 +1697,11 @@ static netdev_tx_t m_can_tx_handler(struct m_can_classdev *cdev) fifo_header.dlc = FIELD_PREP(TX_BUF_MM_MASK, putidx) | FIELD_PREP(TX_BUF_DLC_MASK, can_fd_len2dlc(cf->len)) | fdflags | TX_BUF_EFC; - err = m_can_fifo_write(cdev, putidx, M_CAN_FIFO_ID, &fifo_header, 2); - if (err) - goto out_fail; + memcpy(buf, &fifo_header, 8); + memcpy(&buf[8], &cf->data, cf->len); - err = m_can_fifo_write(cdev, putidx, M_CAN_FIFO_DATA, - cf->data, DIV_ROUND_UP(cf->len, 4)); + err = m_can_fifo_write(cdev, putidx, M_CAN_FIFO_ID, + buf, 8 + DIV_ROUND_UP(cf->len, 4)); if (err) goto out_fail; -- 2.38.1