Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp327365lqb; Tue, 28 May 2024 17:43:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUoJ4mu6WilVI1R3tRq75dP1M7vVvmqpfJ2/yxsgLQ5qSto4cQBGE8SpO5M9GaUznO30/SovVWkQc6Ag6xp9ki6MqnXDh7wJ+4//G/Y/g== X-Google-Smtp-Source: AGHT+IGtn/ybOcnvuCiv1vWLSCXxYZlSqR8gQQ1yI18Si6ckqqisLmWSsMw2omkhBFAw0XLkH7O8 X-Received: by 2002:a2e:9283:0:b0:2e2:b716:e67c with SMTP id 38308e7fff4ca-2e95b07b024mr87905351fa.7.1716943381723; Tue, 28 May 2024 17:43:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716943381; cv=pass; d=google.com; s=arc-20160816; b=BGL3Lyn/tGvFhvKscccjJG6eVHqAovMs0nQrw7pqjjdgCGUq5Y8tkiFDO0VtoEJ4hH 9Xyx1UYInSltqpmN1B4PifiQUfaaaNHB0VsH+31/nCh8rBQ5umtN94Tpcgr+OHbWHcjt psEhsbph7yeg8bP2kzfoTI4p1C8AAWJ+J2VloSMSHp0po+7f+oxDZUHi4W8LSyLEPLuB I91S13v/lXMEJA+KKNKvw9hxQC1gdvHY6bgOxnWHEIbOm1Us4lvx6RGGsq5uFJV646DU 9lBEVYog80yJj43o995I189aXMD0C00pOrIc5qVZEaTvd4Bq0EBrrs23h5+PQGwQY5p0 dOPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=WflDhWuIKFSE4VI0LhJHAyqT5VpRL1lsy5EGHvWuXlA=; fh=jC+qtQHAS/kDrbQmvrkFsEn1a2NulwwQPLECrDrOgBw=; b=WK929EL5q1obxEVpZTju4O38J8hQ3uvlRYhV5m1UYh1E2s2qgKsdFW6Q0YiarySmYv +wzilrH77W3ucPUxo7QQF9ZMjamLB1rqy0i7fT6gFqy6aUxOajSRZWqEaYwFWFRTVPKI eaTvZwUO1lnL9mKyWzR5hearitBl53Trl8GZovt9u0HJ0lIF95AzEbIerf+jLExn9wwO j2tn6yD2kpOICtoHaLaWIg3i2xZkGqdJ0y1H+vsV9RpxR3vUWxwVNoe9uM+wW8//VfrS Zx6zxN1sQi4FqvtEGyIjhYrUeUNkp6qee4vJChB8GareoYyFtFYuppaXgI7GMDO7wYpI HHSg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-193270-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193270-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-579ffbb0298si506401a12.292.2024.05.28.17.43.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 17:43:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193270-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-193270-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193270-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6CFBD1F260A4 for ; Wed, 29 May 2024 00:43:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E50315A841; Wed, 29 May 2024 00:42:51 +0000 (UTC) Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6690A17E8E4; Wed, 29 May 2024 00:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716943371; cv=none; b=Nu5j690vFv/UySKHSvFi1PeL0bpBRg7CIP8D2oclrhl3tg8zbkvuREs9slN+CJmMbfNramUtBRCiI4rBLmfyY0dWmZCIz8wJrnQ/ipiUWbiz5D2ZYWVB2xIAVcqM2nlx8iFRnA5QNTaPYy8/P3Sdz0ohUf/KPNI2YwutQFGpZlM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716943371; c=relaxed/simple; bh=ZucRrcqp4AB/Cp4ujq9cnHGw0SFHWRa7X600q2cNIQs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dWZl1+UQjcX8qfsV58CW2SF9KtZRNCzs3kR2KrPF7P18QjAypIjPbDiWsjcrmQlD6k9Ae+J5FsbQPRJeuW+o2RFpuXb8TW7ZBtHax0LzJ3tXlxTOFrgU4Go7kymhC/ZEtm0QBizyzaE4+c4+dz0P57nHuDrl2HP6FvtY0/BOkvk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.97.1) (envelope-from ) id 1sC7Of-000000006rU-2SV6; Wed, 29 May 2024 00:42:29 +0000 Date: Wed, 29 May 2024 01:42:21 +0100 From: Daniel Golle To: Elad Yifee Cc: Felix Fietkau , Sean Wang , Mark Lee , Lorenzo Bianconi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH net-next v4] net: ethernet: mtk_eth_soc: ppe: add support for multiple PPEs Message-ID: References: <20240511122659.13838-1-eladwf@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240511122659.13838-1-eladwf@gmail.com> Hi Elad, now that net-next is opened again I finally also had some time to take a deeper look at your patch ;) On Sat, May 11, 2024 at 03:26:53PM GMT, Elad Yifee wrote: > Add the missing pieces to allow multiple PPEs units, one for each GMAC. > [...] > diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c > index 179c0230655a..67e19bd25f7a 100644 > --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c > +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c > [...] > @@ -1311,6 +1311,7 @@ struct mtk_eth { > struct mtk_mac { > int id; > phy_interface_t interface; > + u8 ppe_idx; I think it would be smarter to just use ifindex % mtk_get_ppe_num(eth) Reasons: - no need for an additional field in mtk_mac - works for all net_device, not just mtk_eth type > int speed; > struct device_node *of_node; > struct phylink *phylink; > @@ -1421,6 +1422,14 @@ static inline u32 mtk_get_ib2_multicast_mask(struct mtk_eth *eth) > return MTK_FOE_IB2_MULTICAST; > } > > +static inline u8 mtk_get_ppe_num(struct mtk_eth *eth) > +{ > + if (!eth->soc->offload_version) > + return 0; > + > + return eth->soc->version; Overloading the coincidentally identical hw version and number of PPEs doesn't feel quite right. Better extend struct mtk_reg_map and turn the gdma_to_ppe field into an array. Then the number of PPEs for a specific SoC is the size of that array. Reasons: - we already got that mtk_reg_map structure for hw abstraction, no need to introduce more SoC-specific macros like MTK_GDMA_TO_PPEx. - no need for mtk_get_ppe_num inline function, or at least no overloading of offload_version meaning. Cheers Daniel