From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1DFFC54E8D for ; Mon, 11 May 2020 16:39:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 977A020714 for ; Mon, 11 May 2020 16:39:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FOM1p5id"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="kRR8fAIc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 977A020714 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lunn.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=q/ScnaKQVhFKCe+ON12SrzLdc94S6oDDfild2x08LZM=; b=FOM1p5idEUq5zY ttAUiLD0HRcYyki9mkUa7k7peQ1TP7JdcVThRoPjrh1glhEiApW4zZWwC8HuNo5MnHzXBDQ4LIAiY hdKg9SBg8CZl32bLAh9mDzziE30PKXnshhZZVSojno47h+A4cW9vmzgSck3EU1l+mlceQi/Uxt8Sj aemEF766KvCeeg2z+y34bnuLtlCguA7ky+ffQGWh3Uw325daq3WyYGbgWCeWcqHmpreucAkSPiJgB ZwU9O5YQ29/bX+A9I/zP95pJ45kf9ycwyOg0GSpumsJkYtLyByygNkOUI+kqZdSKhUVdyrZpQx1If T9gMeQpSC0YNm+q4+v5Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYBSh-0001co-7r; Mon, 11 May 2020 16:39:27 +0000 Received: from vps0.lunn.ch ([185.16.172.187]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYBSX-0001T1-Rw; Mon, 11 May 2020 16:39:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=PO2c3L65UWqL1EcOkY6DtrTcnu4QOhrD4mFFAvp9mOQ=; b=kRR8fAIckpSJoyBIVZvk5Ch9q/ 8NsxPE3cQU+6IoWGenHjd+iDoF4PopnCIiln9GsylXeZN+Gmg4aLn2Gh/1wGK/q2s53Oi1jc9iamT 2W8dv+rlBtfIaLOlx01u831Bev6nPjrTpk8VeQZez+6vCAEUVxnsA+6FTKo0EkYG12fU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.93) (envelope-from ) id 1jYBSM-001sLM-JX; Mon, 11 May 2020 18:39:06 +0200 Date: Mon, 11 May 2020 18:39:06 +0200 From: Andrew Lunn To: Bartosz Golaszewski Subject: Re: [PATCH v2 05/14] net: core: provide priv_to_netdev() Message-ID: <20200511163906.GD413878@lunn.ch> References: <20200511150759.18766-1-brgl@bgdev.pl> <20200511150759.18766-6-brgl@bgdev.pl> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200511150759.18766-6-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200511_093918_802187_E13702EB X-CRM114-Status: UNSURE ( 9.02 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Edwin Peer , devicetree@vger.kernel.org, Stephane Le Provost , Arnd Bergmann , Bartosz Golaszewski , netdev@vger.kernel.org, Sean Wang , linux-kernel@vger.kernel.org, Pedro Tsai , "David S . Miller" , Fabien Parent , Rob Herring , linux-mediatek@lists.infradead.org, Andrew Perepech , John Crispin , Matthias Brugger , Jakub Kicinski , Mark Lee , linux-arm-kernel@lists.infradead.org, Heiner Kallweit Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Mon, May 11, 2020 at 05:07:50PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Appropriate amount of extra memory for private data is allocated at > the end of struct net_device. We have a helper - netdev_priv() - that > returns its address but we don't have the reverse: a function which > given the address of the private data, returns the address of struct > net_device. > > This has caused many drivers to store the pointer to net_device in > the private data structure, which basically means storing the pointer > to a structure in this very structure. To some extent, that is the way it is done now. To do anything else just makes your driver different and so harder to maintain. Is 4/8 bytes for a pointer really worth being different? Andrew _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AE4AC54E8E for ; Mon, 11 May 2020 16:39:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D5F8C20720 for ; Mon, 11 May 2020 16:39:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="g0SQtr0u"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="kRR8fAIc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5F8C20720 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lunn.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=J7xR5cFuohqRHyMIG0WS+Tq8v939bE/B/NzmkicjEMU=; b=g0SQtr0uVPzwUH 6+WnLhZm1x1M30nvGHm9xifNMIruD+TVpOAAkb+pcfit08iDUpouCWOu/T3lGE1nTulAHrEu0yM9j +QYJ4hue59DP3HbDJsuWhEFeQC9GjSJfWvX07E2SFhW4mRazDcccmwLBKyiyySEQr6kpMFqGCd791 YkRW4VwoC3RQ9PxJKbNuwY6bhmwHpQt6DSRsqgNCBdYVLdTTx10wUzpaABmRslZO86M+kQPS9776Q XjVJLBh4Ky0ZZPHX29G1mqjq9XxfjpfROV7dDJjoPS26sCDwqWRf3mJ4ievU4zLgwCBoKhragYXFT Axq3VMfyzQizC/lPDfRQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYBSb-0001V6-U0; Mon, 11 May 2020 16:39:21 +0000 Received: from vps0.lunn.ch ([185.16.172.187]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYBSX-0001T1-Rw; Mon, 11 May 2020 16:39:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=PO2c3L65UWqL1EcOkY6DtrTcnu4QOhrD4mFFAvp9mOQ=; b=kRR8fAIckpSJoyBIVZvk5Ch9q/ 8NsxPE3cQU+6IoWGenHjd+iDoF4PopnCIiln9GsylXeZN+Gmg4aLn2Gh/1wGK/q2s53Oi1jc9iamT 2W8dv+rlBtfIaLOlx01u831Bev6nPjrTpk8VeQZez+6vCAEUVxnsA+6FTKo0EkYG12fU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.93) (envelope-from ) id 1jYBSM-001sLM-JX; Mon, 11 May 2020 18:39:06 +0200 Date: Mon, 11 May 2020 18:39:06 +0200 From: Andrew Lunn To: Bartosz Golaszewski Subject: Re: [PATCH v2 05/14] net: core: provide priv_to_netdev() Message-ID: <20200511163906.GD413878@lunn.ch> References: <20200511150759.18766-1-brgl@bgdev.pl> <20200511150759.18766-6-brgl@bgdev.pl> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200511150759.18766-6-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200511_093918_802187_E13702EB X-CRM114-Status: UNSURE ( 9.02 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Edwin Peer , devicetree@vger.kernel.org, Stephane Le Provost , Arnd Bergmann , Bartosz Golaszewski , netdev@vger.kernel.org, Sean Wang , linux-kernel@vger.kernel.org, Pedro Tsai , "David S . Miller" , Fabien Parent , Rob Herring , linux-mediatek@lists.infradead.org, Andrew Perepech , John Crispin , Matthias Brugger , Jakub Kicinski , Mark Lee , linux-arm-kernel@lists.infradead.org, Heiner Kallweit Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, May 11, 2020 at 05:07:50PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Appropriate amount of extra memory for private data is allocated at > the end of struct net_device. We have a helper - netdev_priv() - that > returns its address but we don't have the reverse: a function which > given the address of the private data, returns the address of struct > net_device. > > This has caused many drivers to store the pointer to net_device in > the private data structure, which basically means storing the pointer > to a structure in this very structure. To some extent, that is the way it is done now. To do anything else just makes your driver different and so harder to maintain. Is 4/8 bytes for a pointer really worth being different? Andrew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA627C54E8F for ; Mon, 11 May 2020 16:39:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA36520714 for ; Mon, 11 May 2020 16:39:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="kRR8fAIc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729550AbgEKQjR (ORCPT ); Mon, 11 May 2020 12:39:17 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:54004 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728556AbgEKQjQ (ORCPT ); Mon, 11 May 2020 12:39:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=PO2c3L65UWqL1EcOkY6DtrTcnu4QOhrD4mFFAvp9mOQ=; b=kRR8fAIckpSJoyBIVZvk5Ch9q/ 8NsxPE3cQU+6IoWGenHjd+iDoF4PopnCIiln9GsylXeZN+Gmg4aLn2Gh/1wGK/q2s53Oi1jc9iamT 2W8dv+rlBtfIaLOlx01u831Bev6nPjrTpk8VeQZez+6vCAEUVxnsA+6FTKo0EkYG12fU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.93) (envelope-from ) id 1jYBSM-001sLM-JX; Mon, 11 May 2020 18:39:06 +0200 Date: Mon, 11 May 2020 18:39:06 +0200 From: Andrew Lunn To: Bartosz Golaszewski Cc: Rob Herring , "David S . Miller" , Matthias Brugger , John Crispin , Sean Wang , Mark Lee , Jakub Kicinski , Arnd Bergmann , Fabien Parent , Heiner Kallweit , Edwin Peer , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Stephane Le Provost , Pedro Tsai , Andrew Perepech , Bartosz Golaszewski Subject: Re: [PATCH v2 05/14] net: core: provide priv_to_netdev() Message-ID: <20200511163906.GD413878@lunn.ch> References: <20200511150759.18766-1-brgl@bgdev.pl> <20200511150759.18766-6-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200511150759.18766-6-brgl@bgdev.pl> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Mon, May 11, 2020 at 05:07:50PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Appropriate amount of extra memory for private data is allocated at > the end of struct net_device. We have a helper - netdev_priv() - that > returns its address but we don't have the reverse: a function which > given the address of the private data, returns the address of struct > net_device. > > This has caused many drivers to store the pointer to net_device in > the private data structure, which basically means storing the pointer > to a structure in this very structure. To some extent, that is the way it is done now. To do anything else just makes your driver different and so harder to maintain. Is 4/8 bytes for a pointer really worth being different? Andrew