From patchwork Fri Oct 11 16:23:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3568 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3C50C3F332 for ; Fri, 11 Oct 2024 18:23:49 +0200 (CEST) Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2fad1771626sf19497931fa.2 for ; Fri, 11 Oct 2024 09:23:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728663828; cv=pass; d=google.com; s=arc-20240605; b=SeblKf9mjOy7IL6taHdGKjcYAp//+MMiOdxFVEoBVF/Hb3qlf0fo36phI+8Ujt8PBg e9BnFI/iibxFXV5nFW+4xgNZCE6v0yEvHAuk5FuX/u/c/sho5LFAqqFGV2ek0zB+7POH g5Ehg54h8BuRZ3xKXFe4hzsWbcpQDnwet1iTJcEKFc3WjJdHC5AlZcZZNHoAFzEAQRKL lyGnJIa7/oK847LMDoPWEa+1fpWPLZ7+yZMJNt/6t+8i6RmuL5LGOYV+FEA5vdpzQdvb v5hRjC64dRWbL6mHuMRrJnnQanllE69Yzz22VsQ2A9BbzdnzajM030coKY7KiCRE95Ax PX2g== 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=XNdQMRxO7cVWxuD6icp5GLH5UeoKd7OQUcs2ZLNxhMg=; fh=16MRkmWIA1oqSoqVOSY7ZEEZd896U55xd+QGd9p5p7k=; b=IMD87aqQP1clnpqxx+lRxYCeO+jy4CHobhLCqxLmy5r1sSPBj3/AGwqRVgkDkT8LXv xII8rr3mTrI/S4zqJXqT3IftvLwJ9H/wFx27cDofZIgzVAgPloHbt893+xX6+1mFI5gc iH9vdw39IF9bWos7PKj6GkitV7XY5VvsYc/Yrvv49UvJR4WogbHhyXtGzYg/6HCS3mY/ fmdqIowxbnTup/1et99gKLVC2xe/fhW/LSD2IuqFlBjGz3F9jgkKm7QBUx69nr5uljdY qAGIUkBie6qpIxfbbh19W0IOd1z9BXDg+0c4E2AQ9xLquy7mXd/IYloREBCBCbYnjlbU SsyA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ULzAGHwG; 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=1728663828; x=1729268628; 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=XNdQMRxO7cVWxuD6icp5GLH5UeoKd7OQUcs2ZLNxhMg=; b=Csfg0wVOljy9/lRTV7aOVxLVdtCjWK+0D7tdCANGCt0M0Yar+pgqR4tQMivp5Dhzqb /lStX5tgozCZalXbV+MeoGfA8ccVTlPn6Zk/YPZATUmGNbh53M86An6g6UyNNQyyF2GG pI4LV1KgxFFt+ffyFF2cv61lNQPZdYfKKiSr0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728663828; x=1729268628; 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=XNdQMRxO7cVWxuD6icp5GLH5UeoKd7OQUcs2ZLNxhMg=; b=q2PpwhQflWi2U4sksFCcMAXvlzCU8wWGdlOKglKN9I6SbyCX7NiLS7VG0bTe2q4AfS /0roWSi9/r6rjgd06sxwEv1WcOr0omjrRQsVG4Cez+y3JArBKmHYkn7iNB0bjw2e11c+ oQF+Ru0T6hZRa4rtxHU+CVTMVw72tjGz2iYJZ569uKvN+C+GP05yTxEPr5LmtC+heFWz mPO9t/LZ3S2GKvsWT634aEoB78WTLqDKsSxzcw+ijr4Ttl3Oe98/cX9TB9ehkQX9DycT aoDOQ3Otar16Zol4rR/OU2BflK2uR8Jg2e1jFcttqv44pmS+vj8Hj2lk6A6kcONmMApj IZaA== X-Forwarded-Encrypted: i=2; AJvYcCURql4pthdKKiZBhLl82ePXltkz85kB0lsjpXYj/HPL8hwzMTHbbj8PlgQI/vbh5yoCZyuics+oMCG+ixY5@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxServV78EwPMc9uF0UJ6w6zPCBnywAimTZCz45osLCH1Se8pcv VleLBPhe1czh1x5kBwftHbpnlh6chtyv2lxztmWRRWk4n+VV7sDyUrpbMqem/ly8WA== X-Google-Smtp-Source: AGHT+IE/Wm4y9WaZbkAe6qinJ5MDOTb0EnYqU1Gt69fjuYnAhzQtFk1X7BaWv3vVFklm+y0w0kJfDQ== X-Received: by 2002:a05:651c:1546:b0:2ef:1b1f:4b4f with SMTP id 38308e7fff4ca-2fb3f2d1b1cmr707441fa.34.1728663828430; Fri, 11 Oct 2024 09:23:48 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:4314:b0:5c4:651d:a532 with SMTP id 4fb4d7f45d1cf-5c9338a4c28ls131144a12.0.-pod-prod-06-eu; Fri, 11 Oct 2024 09:23:47 -0700 (PDT) X-Received: by 2002:a17:907:7296:b0:a91:158f:6693 with SMTP id a640c23a62f3a-a99e39cfc56mr24333866b.9.1728663826755; Fri, 11 Oct 2024 09:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728663826; cv=none; d=google.com; s=arc-20240605; b=cKuMkaWXVOoFeMqBPjADMRCj0eY/j6yLONO98J5eDQfciKzhhsYGjOn0c0JCa8cRl3 JwifT0nFXYXbRQUQiAD5nUOlu9acKClElXiGc0DgdXk8O6DgODEyf7co/Z7hXWscbC3y fBi9MDRp+aZTmrSt6u4wFFeGTG3XiN/oz/cerJ4lRDkhk90Ys18GJobXw/5IyNthBH+d QYqTlc7wtHapgTMHQNWpOlJI4HZatL6CTIzEueg3Pa08HvBXp8UB6R4UyttYX+EqNnbQ 3rIKuov9tCignqw6Wv+Vmd1as87s3C/AeWz+tQABaZwDxf+XX31C1B7DUt/ntf2GvFPY mjLg== 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=fWUGm4hFKdFTmtAVfL6AreAZCHr4wergqksaNPubSFY=; fh=bW3oFOv0XHBefUz3obU0AkR4GIxgTUcq9BdItYoBfi8=; b=Rq7MHuMgBB23edkgzdJf93hmHR/OqDUVSlwkbJcRtypHtm9E7/vJMGnUbnPuFQygZm a2vfXLggizq8ccKyuDP0gkfbQohjVa38GMoMSE7bBcOUkShnsVmJjOK5wzHb4iv3FFTF Uk4RSTZAyWRSiuYICLn+D96jNP++BZi0metwWp+PjLEew6CA+U+WTH0Y6LnwgroYtCgo 9GHETplHFI3LrkxRWd6m3J/Pz7OwuScdIu9I/Ik1v/aJMUcJ4QZCrQkxIgA0fm/hGbsE xadmukPMt6VDzOMK2KnZXyKKqYOz9E9B9ukpI/+a8nQusamsiQYH53gG1NOnPYktIs5/ wPJw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ULzAGHwG; 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-a99a80e05a6sor155781766b.20.2024.10.11.09.23.46 for (Google Transport Security); Fri, 11 Oct 2024 09:23:46 -0700 (PDT) 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-Received: by 2002:a17:907:948c:b0:a99:4f40:3e82 with SMTP id a640c23a62f3a-a99e39cf797mr26854366b.7.1728663826162; Fri, 11 Oct 2024 09:23:46 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.40.11]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80c0222sm229891266b.140.2024.10.11.09.23.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 09:23:45 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Cc: michael@amarulasolutions.com Subject: [PATCH 3/6] can: dev: add helper macros to setup an error frame Date: Fri, 11 Oct 2024 18:23:38 +0200 Message-ID: <20241011162341.606443-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011162341.606443-1-dario.binacchi@amarulasolutions.com> References: <20241011162341.606443-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=ULzAGHwG; 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: , Signed-off-by: Dario Binacchi Change-Id: I27a5eebfb6ee74d2af3e8455d96af9dc317bca24 --- include/linux/can/dev.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 374b6121ea3e..018b9e942ed9 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h @@ -21,6 +21,29 @@ #include #include +#define CAN_FRAME_ERROR_INIT(cf) \ + cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR + +#define CAN_FRAME_SET_ERR_BIT0(cf) \ + cf->data[2] |= CAN_ERR_PROT_BIT0 + +#define CAN_FRAME_SET_ERR_BIT1(cf) \ + cf->data[2] |= CAN_ERR_PROT_BIT1 + +#define CAN_FRAME_SET_ERR_ACK(cf) \ + cf->can_id |= CAN_ERR_ACK; \ + cf->data[3] = CAN_ERR_PROT_LOC_ACK + +#define CAN_FRAME_SET_ERR_CRC(cf) \ + cf->data[2] |= CAN_ERR_PROT_BIT; \ + cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ; + +#define CAN_FRAME_SET_ERR_FORM(cf) \ + cf->data[2] |= CAN_ERR_PROT_FORM; + +#define CAN_FRAME_SET_ERR_STUFF(cf) \ + cf->data[2] |= CAN_ERR_PROT_STUFF; + /* * CAN mode */