Received: by 10.223.185.116 with SMTP id b49csp2629843wrg; Mon, 5 Mar 2018 06:17:15 -0800 (PST) X-Google-Smtp-Source: AG47ELuMGlS67nhUi195LHC1l0Z5tlu39ckyyeXY7QpT32h5N5yCZwm4ENK1td+eTHcgHA72mJnm X-Received: by 10.98.225.2 with SMTP id q2mr15372790pfh.23.1520259435502; Mon, 05 Mar 2018 06:17:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520259435; cv=none; d=google.com; s=arc-20160816; b=MkKw6JIZt1n42LOUm4xWHqje4KiH2nrKCIYitlJ97g60G0MKh9Pi6jjWoO/ZmTE60Z oTWHI6lTzpjjkowEEC5pZp4P+Dyq4IGh+DiC+dtZ6osUVuVhe2ssQNpcN5T5UCEcVd1E XwXYFs4Ut0JW1+QSMjC1qlQxQfp/p2t4ZoV/Wpw0nQvUre34NtsS4I1Uq4mmUukAfo4G dzp45/wq5tjupmQCZi0UquZdpJLCq3ED/k1BgeKwNco9fkEZHU6KAJiL/hB69/twTTIH V6Exo8vpW55VhMKeu9hhMlyC9vNUudSOvaN7JahbVGYOCx80Qe4C1cbZt2PJHjBfvys9 4L3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=iDE2qYAOdWVc9D4NxS3RWiGcJa8qxEAGBzUhBYE6DIk=; b=qV1v0crhbtN4z5OhIR1eWZmBZTR9THgwKMcRD8kIaefwsplSSehUOFgzactQVcVfRE pfRg+zJ0fenPLcDaYY5wDnHvgHwd52TIZHADDmY3B3mWR31v9OWGW9TeQZhylW9BYqWp rnKJg96rX/TQBEFBSFOGTwr6Y9HydrMqqO0zKOCb/WAP26Wwqzx0/f4N3mnXAMSDCi2N S4B01vHeGdkVxaEFaGJLIQ2cPNPyo/tEV7HUJQoTPP9EmNSaslUyP95AqibeB6IrcF0/ ApAuYOcWg+sguIPJ+0H4nuI5j5QoyanPRwHa5SszWEPgIrkP8JCQzscpTJRdLrjJSqVx l4Aw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9si7912515pgq.743.2018.03.05.06.17.01; Mon, 05 Mar 2018 06:17:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934957AbeCEM4R (ORCPT + 99 others); Mon, 5 Mar 2018 07:56:17 -0500 Received: from mail.bootlin.com ([62.4.15.54]:56450 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933973AbeCEM4Q (ORCPT ); Mon, 5 Mar 2018 07:56:16 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 686F42046F; Mon, 5 Mar 2018 13:56:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id 08C2C203B1; Mon, 5 Mar 2018 13:56:03 +0100 (CET) Date: Mon, 5 Mar 2018 13:56:04 +0100 From: Antoine Tenart To: Thomas Petazzoni Cc: Antoine Tenart , davem@davemloft.net, Stefan Chulski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, maxime.chevallier@bootlin.com, gregory.clement@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, ymarkman@marvell.com, mw@semihalf.com Subject: Re: [PATCH net-next 1/5] net: mvpp2: use the same buffer pool for all ports Message-ID: <20180305125604.GJ1156@kwain> References: <20180302154044.25204-1-antoine.tenart@bootlin.com> <20180302154044.25204-2-antoine.tenart@bootlin.com> <20180302170159.258bcdbc@windsurf.lan> <20180305104813.GI1156@kwain> <20180305134148.3bbba514@windsurf.home> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180305134148.3bbba514@windsurf.home> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thomas, On Mon, Mar 05, 2018 at 01:41:48PM +0100, Thomas Petazzoni wrote: > On Mon, 5 Mar 2018 11:48:13 +0100, Antoine Tenart wrote: > > > > > +static void mvpp2_setup_bm_pool(void) > > > > +{ > > > > + /* Short pool */ > > > > + mvpp2_pools[MVPP2_BM_SHORT].buf_num = MVPP2_BM_SHORT_BUF_NUM; > > > > + mvpp2_pools[MVPP2_BM_SHORT].pkt_size = MVPP2_BM_SHORT_PKT_SIZE; > > > > + > > > > + /* Long pool */ > > > > + mvpp2_pools[MVPP2_BM_LONG].buf_num = MVPP2_BM_LONG_BUF_NUM; > > > > + mvpp2_pools[MVPP2_BM_LONG].pkt_size = MVPP2_BM_LONG_PKT_SIZE; > > > > +} > > > > > > ? > > > > I wanted to do this, but it's no possible as MVPP2_BM_SHORT_PKT_SIZE and > > MVPP2_BM_LONG_PKT_SIZE use a core definition which expands at some point > > to __max(...) which has to be called from within a function. > > Hum, weird: > > #define MVPP2_BM_LONG_PKT_SIZE MVPP2_RX_MAX_PKT_SIZE(MVPP2_BM_LONG_FRAME_SIZE) > #define MVPP2_BM_LONG_FRAME_SIZE 2048 > > #define MVPP2_RX_MAX_PKT_SIZE(total_size) \ > ((total_size) - NET_SKB_PAD - MVPP2_SKB_SHINFO_SIZE) > > #define MVPP2_SKB_SHINFO_SIZE \ > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) > > #define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES) > > I don't really see a __max(...) call. NET_SKB_PAD expends to __max(...). > And if this value really expands depending on other values, then it > isn't really a constant, and should be considered as a constant, no? Well, the padding isn't truly a constant for some reasons, you can see an explanation here: https://elixir.bootlin.com/linux/latest/source/include/linux/skbuff.h#L2446 But this value can only change at compile time, so it really depends on what is the definition of a constant is :) Antoine -- Antoine T?nart, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com