From patchwork Fri Nov 22 22:15:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3656 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2971541386 for ; Fri, 22 Nov 2024 23:17:09 +0100 (CET) Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-38236ca50d5sf1243334f8f.0 for ; Fri, 22 Nov 2024 14:17:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1732313829; cv=pass; d=google.com; s=arc-20240605; b=V3VJX2hTtfldC2Yy9l8/TSaudZKjo6uxLVO7ZW+iy0K06gmPWxlR0Kh3HKqfnt/iM0 npnbwPGNooM76lZ8JQNqrwQnPX3i2iIa0dTP2+f9J++qxemxbx6+h/BCgyHAVKwc57ss ySyfU6ZxpHSPdt67WPjvWbhT8e89KujUgzwuepTEcjhCnkgwwpEwv7QoaD9+jK/iZU13 jKynqAfpBkAq6HKl4XX3GljefUL8Abl0nsNJBDxMHT+CSZ7qqGmI0UiDhCpj7VDexvoa HtRZtn8BOpmxRoXgR+RbhgnOtdyUdzFvSVz3ItGJ0VdYSuUb9TYexljfucPM81LUFINf MZIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Es6RimG++8dpan1LDniA2M0F2kF0f2jZyhd+8CkCQbI=; fh=xtC8pSftClC/b2D7t7bHZzcAB/KpYf/NAYiXQfTkVKY=; b=Dabobst34A4sc4xYSOnIeDWkXBfKxhYMLU9f6/zzSxY4fMeeg3cgqQJXWAicAUT04m k1/iOEoTLn+2ZyqaqoD5CBbW7imM/U6qac0M9t3+93mtWWykhVHHmVmw1Nq6/AdzV9RZ FVIRBzzA8uHYAIcrMO4H15GyJmTgEhZOD+dt4fenQHSj8DLlhI9NtT9ygKqECKAtzDaD iHaPL2AdhsYUNSamBPRc7yKi76i+2hmg3vHSo5NtbLeJsaF3k4OhAxTIwqM2z/j6g1hc e497YYl67X4MHY8CXBCjdo14FPBfHyHB/FjGjXBWPGZkcLknwPxE+kvrvTdYfTu+NF3v 8FBQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hKbk7kOt; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1732313829; x=1732918629; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=Es6RimG++8dpan1LDniA2M0F2kF0f2jZyhd+8CkCQbI=; b=DNtVZhGXkeeaU/Og7qcUnoD5Fo3rjwYMd5pAEnyESPL1aax1pSRsc3geL2GcN8dHZc uoJr7NhJiJCy52gXiTqD1tetPTScb6LRCMQJAXV1JpPxFRe6IvZQZykoXlJUt0prlGd1 FT5fVk4B3tZlYyYCNMcTzMvFKcP0i7+cthiBY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732313829; x=1732918629; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Es6RimG++8dpan1LDniA2M0F2kF0f2jZyhd+8CkCQbI=; b=LkIj4aBEPww3+eQMUKXGr9T9fWdMHLBt4KrBaunQ9m1/J+tywYeU2zlsy+4KqN6m+y pKmJfeEqZj1N0AeVeh61PVfiFVmv8wDvglVVPVpuxijuZa8S5FFcdHwzGnJeTX43AKSc pbembbB4yzW06DJiH7iq6JdkdBS+/1sbkYeTUmx9yu5SVAj3yYKZiKvDhx5KrLhA9Fix HaSg6mMW/B2TWZCX92jukWs7FmTT7AgADBm1hvu3OxoH6sEbVIoRMA5+iwEl5VUuqMDl udurNiVOGJtM0Q4aWjpzH3+owaoOI3MqE2vsOjWwxDTNW5fkeZZDb4z3iD7ZLQ/zJM+I mmnQ== X-Forwarded-Encrypted: i=2; AJvYcCXrirkAMhX3i0ZNsdPK7Vw3PdLDwcZyl0BwTNVahgl4iJWxuQhhcQWASlrrORiZKwrj8/SPCucyj1VNJJzY@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzJiQhDIDIiXh7Yfsc7tinRZq2RKhmIOvnblifkplNvGwk1lsPK GXom5eEE5fxiX2PeCvXdZELLERsOVv2EHO65g6EWjimk0p39SPPy22woLki07a0PTA== X-Google-Smtp-Source: AGHT+IE5vQDjqjEZgSTcGVSoxsrysF9Od223WTQP0PIrmlOIGRNOGpSqEEV7lchH8DMZdT4eAXNSLw== X-Received: by 2002:a05:6000:1884:b0:382:6f2:df7b with SMTP id ffacd0b85a97d-38260b44d61mr3772791f8f.12.1732313828835; Fri, 22 Nov 2024 14:17:08 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:c48a:0:b0:5cf:a22:1a30 with SMTP id 4fb4d7f45d1cf-5d007cc5acdls263227a12.0.-pod-prod-02-eu; Fri, 22 Nov 2024 14:17:07 -0800 (PST) X-Received: by 2002:a17:907:7816:b0:aa4:a814:3f69 with SMTP id a640c23a62f3a-aa50990b34emr385887066b.4.1732313826835; Fri, 22 Nov 2024 14:17:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732313826; cv=none; d=google.com; s=arc-20240605; b=l3ki6TvnMvD/5dgJsxwrPWF3yLHfOdViwU7oP3u2trifbwP0i8vT/uStTqXJbz+SQR 5gk1peNP7fm7jZXNortDKXhzxILgxrgzQ/EN+Eo9F56QKrF7f4RGE/HBYsI439ZdZ0/x FpIYt5r1/FPjNlepAceolyPP/ubdVjO7SuNtyWPWa2xo5C4A3u7vkmLzONAQM1hlxdHH ZgQV9GfdzfwvgyO+j54BcugucXvhbIq/bUiRwmjHlzu1d7fBJC2Y0eYitDeKa+aS45M5 CNAGA7BdUTBNV0cDfMKvqjWjSpFWkNoCEr1F+K6+GXyWcEFrw/oiyt4UgEit5LHGUXxs YUkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=koSu2Qr3uUTmv0FA1/R7W/a8VprfWgcqXI/05k6MgFU=; fh=/4mtQbNQtOE6CKCtX2glb6X+KMMzJuj6HH/pLudJy9E=; b=NbaU26a3zCmq8NQ7DlR/ojzSKhq4Op139n58ss5VJ7PpDqMocdl8/po0U+9gCdkGai dAKRPQPCXzGi737t955rkWGWQR6MqZwQH+RQmBqqCnO1nASjMM/UvwppdX7bIHZRk7pB JZResvxm4NkfaivD87KITC4H+MG/9ASBNCnmXVXaR9CAw9F7NMdVhjWLdi8Uk3J+T7Pm zRl3EytArRmgWQIMm+Mk2XwyyM3KdZKKRQhi4BuPvL+KC/sA2qWYkhXYq+K498R8Pt8A pqDnzcHjCGq98gRvI820IhYdPgJVjqMW7y1FZH/ljNGj5EIx00/tmjjmNI1TLHFbg38C /XEQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hKbk7kOt; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-aa527369a43sor32841266b.14.2024.11.22.14.17.06 for (Google Transport Security); Fri, 22 Nov 2024 14:17:06 -0800 (PST) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Gm-Gg: ASbGncs+Sm+y5oSlDMOwKiQKfaVv/1qDY+I6CuJ7lfdws2gMl47TA5RRNDulLKEA8/1 SBa5ulQ1nzOoSak/sbXzHnXhR/q35UAKLrBK7iipGbjQjO0iqgOt8RpjRPUn0vry0FZY40BPT3o G9nRDUdg3FIbd2x6DQ6lSQkbK346TqfjgAWT8mESO4QwVsPlAF3oJsPBrUnCl20twO6dRkeIwmV kUK10HL59Q7exrySVRQiwps3k8dGIxDVIXfj9xlph6tAlJKYLnQph1XnGtExq6Errt61kxCRj7T +oHeEnvC8ulbZxM90y5ZSCtcXqtmnnvkMpc6elo8KHpRKiStFll1CBQPyyqp66Vk6BB5IKhSmDK SdXnJ7bp1dJPQK66P X-Received: by 2002:a17:906:31da:b0:aa5:30c0:384b with SMTP id a640c23a62f3a-aa530c03aecmr47395466b.24.1732313826492; Fri, 22 Nov 2024 14:17:06 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-54-94-193.retail.telecomitalia.it. [82.54.94.193]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b52fcebsm148226466b.127.2024.11.22.14.17.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 14:17:06 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Chen-Yu Tsai , Gerhard Bertelsmann , Jernej Skrabec , Marc Kleine-Budde , Maxime Ripard , Samuel Holland , Vincent Mailhol , linux-arm-kernel@lists.infradead.org, linux-can@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 10/12] can: sun4i_can: fix {rx,tx}_errors statistics Date: Fri, 22 Nov 2024 23:15:51 +0100 Message-ID: <20241122221650.633981-11-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241122221650.633981-1-dario.binacchi@amarulasolutions.com> References: <20241122221650.633981-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hKbk7kOt; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The sun4i_can_err() function only incremented the receive error counter and never the transmit error counter, even if the STA_ERR_DIR flag reported that an error had occurred during transmission. Increment the receive/transmit error counter based on the value of the STA_ERR_DIR flag. Fixes: 0738eff14d81 ("can: Allwinner A10/A20 CAN Controller support - Kernel module") Signed-off-by: Dario Binacchi --- Changes in v2: - Update statistics even if skb allocation fails drivers/net/can/sun4i_can.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c index 840b972498c1..5285bb0b7c69 100644 --- a/drivers/net/can/sun4i_can.c +++ b/drivers/net/can/sun4i_can.c @@ -579,7 +579,6 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) /* bus error interrupt */ netdev_dbg(dev, "bus error interrupt\n"); priv->can.can_stats.bus_error++; - stats->rx_errors++; if (likely(skb)) { ecc = readl(priv->base + SUN4I_REG_STA_ADDR); @@ -601,9 +600,15 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) >> 16; break; } - /* error occurred during transmission? */ - if ((ecc & SUN4I_STA_ERR_DIR) == 0) + } + + /* error occurred during transmission? */ + if ((ecc & SUN4I_STA_ERR_DIR) == 0) { + if (likely(skb)) cf->data[2] |= CAN_ERR_PROT_TX; + stats->tx_errors++; + } else { + stats->rx_errors++; } } if (isrc & SUN4I_INT_ERR_PASSIVE) {