Message ID | 20230530144637.4746-1-mailhol.vincent@wanadoo.fr |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2236877vqr; Tue, 30 May 2023 07:49:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4aOlKfcV+P112JeVH6J+UinLtr2Bhjf/gHVjAFRmH+sG2PI7eHJyhroHy+NwMCGOAdg0oZ X-Received: by 2002:a05:6a20:a58c:b0:10d:3134:10d7 with SMTP id bc12-20020a056a20a58c00b0010d313410d7mr2977956pzb.27.1685458182493; Tue, 30 May 2023 07:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685458182; cv=none; d=google.com; s=arc-20160816; b=qOSI0UPar1I7nKHbCsCN1Pp8Z5L9rwLJJoyYbu/82ObMG+TCz33xZsHPNxFTS8Asyz i3AFcDWzk4q00rj/OptpTDhL+UIxIc4ulvHfZaUEidvaNW/4hXLspRVhApULvuZjvfCo m4WPYoXLNw2YAaJJ4M08T18T9JfYqwJJ5eE+z19pqX0JzoU1WPYeJkdxIH5YVci0kGnv g7SqdzHmNvCHRWKqm2PJskT4ho8uTl6IW5U5YZMIdadqujhwy+ldOoR0FE83XVVICwUC VyickpKmHENTSQ1gNusOgDIKmPDZrtwdPUzzUNX9mQ4CP4IiMCBaXBey6xzDBYjeH76J FiXQ== 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:sender :dkim-signature; bh=A1pwOgc9n/HYgJgD3pK1AViRx5U8Q3xr/lijbDwiXcs=; b=xhx0oMR8BUN8pf8eJ9CvciJ6EMN4GMcsGOmzkhZm1yha/xqFRkbcyLyaOWZMat5Pvp 70zys4Up7s4U0azjOy0vvMjZpvrKXQ8OnH7i4p5ILbGfhFn7KQDRZR8qBkiprpd5IhGT FTwjBWWBqRMLLOzbsu11jOrynwrw9UpC75iMt/iYtl7/bBTgYi6tWZkUMeDF5LsJt8/1 auoQvZuPpshpVDOzxmWVwQmw7uFnvnI68iBmzEH4XwdaIjz3fYHoOHzrV1DiwUm2/ygF WICXzb10C4QqR8zbE75IwuntGNayIs8PrYDj4Czy4za7VjUZBgvPXahCdlxK8m/IaOqT TUCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="ItLNle/A"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a654145000000b0053f29391fd0si473585pgp.234.2023.05.30.07.49.27; Tue, 30 May 2023 07:49:42 -0700 (PDT) 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=@gmail.com header.s=20221208 header.b="ItLNle/A"; 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 S232083AbjE3OrM (ORCPT <rfc822;andrewvogler123@gmail.com> + 99 others); Tue, 30 May 2023 10:47:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbjE3OrL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 30 May 2023 10:47:11 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09D74A7; Tue, 30 May 2023 07:47:10 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-64d2da69fdfso5257297b3a.0; Tue, 30 May 2023 07:47:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685458029; x=1688050029; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=A1pwOgc9n/HYgJgD3pK1AViRx5U8Q3xr/lijbDwiXcs=; b=ItLNle/AtaJDssP0ydBaLH2dQdKFKRG0Fhn9BmqYS4D2kqvSylS++lU2JSMsVpvu3T 2IJ8Myu1OgVnVxKFQ+i74r7vo0pAa7L7NYq7r9WxfPq6XY0rx3hQXKwXdQ/QmVyNGdtN sMmDOPgQYe+fJkaPUoMMYbX1c9uYVz9dOXb8mNLQ3fO1Y/6C7xuFhBzCIPSE4JHPtqz4 XjB7ArA026DlXk+NESgMCTHDf2IIAWBsDg5WRhvNDjID4c+SO9STC2rBljjuEffjveHq J6OvQO8yniEnhe0tl5DMZ2iDdF3oCIFq69ooLrxpxWuCfRsew5klhNnOlHmUkY8xswOn MG6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685458029; x=1688050029; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=A1pwOgc9n/HYgJgD3pK1AViRx5U8Q3xr/lijbDwiXcs=; b=F+VN9odUS73sR3fL5wG3bSpd7dHN9/gfDAFY9fntGXIHEp29D9my0EEUnHAcKEEGnk xERX8pVEQ8Ytq8tP5+2mAPTkhYCb5qJG56tAsB9tJb7/Plh3XNRPS627pHGl5idrIqTH xdyt/awPjLKqGaGhZmylXllaN+gtxk8O3KfiDV6GgxrItaoKS/CZGbl3ccoqIb1/1uqv /4jTO+avphgbt4OupyjczsAYyRR5vMfWAFTbvJpccCV0hR5J1iE9pBEXr3pjwhBYj5Yj RR3JF4BaQeFImEqm0dGvs7I68uHN6MbZ/owA/6BJ2UZFOWV1tsd+kkmV5YguxtB3loCU oFPg== X-Gm-Message-State: AC+VfDxwbTae/+WCCrHmtYy5ACyT8ZIe4WS6xeYCa4xtOZ6XCWg1+j9C ZHXrJSaK4FRn9n/POjUQsn0= X-Received: by 2002:a05:6a00:9a5:b0:641:39cb:1716 with SMTP id u37-20020a056a0009a500b0064139cb1716mr3537861pfg.20.1685458029243; Tue, 30 May 2023 07:47:09 -0700 (PDT) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id e3-20020aa78c43000000b0063a04905379sm1703193pfd.137.2023.05.30.07.47.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 07:47:08 -0700 (PDT) Sender: Vincent Mailhol <vincent.mailhol@gmail.com> From: Vincent Mailhol <mailhol.vincent@wanadoo.fr> To: Marc Kleine-Budde <mkl@pengutronix.de>, linux-can@vger.kernel.org, Thomas.Kopp@microchip.com Cc: Oliver Hartkopp <socketcan@hartkopp.net>, netdev@vger.kernel.org, marex@denx.de, Simon Horman <simon.horman@corigine.com>, linux-kernel@vger.kernel.org, Vincent Mailhol <mailhol.vincent@wanadoo.fr> Subject: [PATCH v3 0/3] can: length: fix definitions and add bit length calculation Date: Tue, 30 May 2023 23:46:34 +0900 Message-Id: <20230530144637.4746-1-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230507155506.3179711-1-mailhol.vincent@wanadoo.fr> References: <20230507155506.3179711-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767330999157407456?= X-GMAIL-MSGID: =?utf-8?q?1767330999157407456?= |
Series |
can: length: fix definitions and add bit length calculation
|
|
Message
Vincent Mailhol
May 30, 2023, 2:46 p.m. UTC
When created in [1], frames length definitions were added to implement byte queue limits (bql). Because bql expects lengths in bytes, bit length definitions were not considered back then. Recently, a need to refer to the exact frame length in bits, with CAN bit stuffing, appeared in [2]. This series introduces can_frame_bits(): a function-like macro that can calculate the exact size of a CAN(-FD) frame in bits with or without bitsuffing. [1] commit 85d99c3e2a13 ("can: length: can_skb_get_frame_len(): introduce function to get data length of frame in data link layer") Link: https://git.kernel.org/torvalds/c/85d99c3e2a13 [2] RE: [PATCH] can: mcp251xfd: Increase poll timeout Link: https://lore.kernel.org/linux-can/BL3PR11MB64846C83ACD04E9330B0FE66FB729@BL3PR11MB6484.namprd11.prod.outlook.com/ * Changelog * v2 -> v3: * turn can_frame_bits() and can_frame_bytes() into function-like macros. The fact that inline functions can not be used to initialize constant structure fields was bothering me. I did my best to make the macro look as less ugly as possible. * as reported by Simon Horman, add missing document for the is_fd argument of can_frame_bits(). Link: https://lore.kernel.org/linux-can/20230523065218.51227-1-mailhol.vincent@wanadoo.fr/ v1 -> v2: * as suggested by Thomas Kopp, add a new patch to the series to fix the stuff bit count and the fixed stuff bits definitions * and another patch to fix documentation of the Remote Request Substitution (RRS). * refactor the length definition. Instead of using individual macro, rely on an inline function. One reason is to minimize the number of definitions. An other reason is that because the dynamic bit stuff is calculated differently for CAN and CAN-FD, it is just not possible to multiply the existing CANFD_FRAME_OVERHEAD_SFF/EFF by the overhead ratio to get the bitsuffing: for CAN-FD, the CRC field is already stuffed by the fix stuff bits and is out of scope of the dynamic bitstuffing. Link: https://lore.kernel.org/linux-can/20230507155506.3179711-1-mailhol.vincent@wanadoo.fr/ Vincent Mailhol (3): can: length: fix bitstuffing count can: length: fix description of the RRS field can: length: refactor frame lengths definition to add size in bits drivers/net/can/dev/length.c | 15 +- include/linux/can/length.h | 295 +++++++++++++++++++++++++---------- 2 files changed, 213 insertions(+), 97 deletions(-)