Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4483450rwd; Sun, 4 Jun 2023 06:20:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Lb5ChWQ7O3uFkvt91CG62NyZLEEy9ROnY6eMN85lT8xl9GaFd62gmDv+SJ1EAo6NdejAG X-Received: by 2002:a17:90a:8281:b0:256:16e:e9dd with SMTP id g1-20020a17090a828100b00256016ee9ddmr2703312pjn.32.1685884840736; Sun, 04 Jun 2023 06:20:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685884840; cv=none; d=google.com; s=arc-20160816; b=oKu/EHMLGjcCfLKUxa8/WHgyr2XtkC4bHMtwBsUur3UvSP2MsKVjYzr8m/hpBCknsi K0ulkQF1v07iKT/ASm45ZvaTLro9yFGvUUPeVsiuXCjHJ/oUxvIU+GJj0fiJ072eQxp4 Zf8DPWZ/5q+8XUFYLkVqqX6FFV5yOfQET38OsRcMto2AucrN8oo4nHYUHaQ8EtatA/hL o4dRjUhKQ9s+8YJPGHW2/o4jqKfoXtqfySJT/TMacN1bdFqtyVTeFcoc7L/A1yfJr+YY KdxDqv4zfdOT31ZOxX+oyRxvekXyZZfDggtx29IHueBCApudbG+Hc9VsuYGHjqn8SV9e HQJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ehsXLibKE7EsdL7h37Ey3hxWw2NtYcUCkyRCtwhN2Ag=; b=OpHWoOk+kMrHIWIGkQTRAuaQDuq9y5jydFNtVg1b3S6vrYgeE4X6IfklWCymO1eMqL j/4kbv4WPErWqFA2N1+K3cQA73v4VgMNSnqpCDNvCikmJJUcMMm3id8iJsoxE1tz/NZw pcJ562ZENzWIi04S9ZHvXAlt7BWedOPEHGMejCinpusHRjSU0cOqu+fK4r7tfK5fSRKJ 2yElkuqNaKduVvyp5mDCadsdWoKsGVkNU/ioxo+RCnb/S9PPOiYtyuzDgr0DLu899LgX qM4hd1lZJ+1dFn7T+rn+b56bzrkalhLaNEErRGZO4wPrVID7UAxI6Y0uDf92jGAlvxxU xnuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ho+w3R3e; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a27-20020a63705b000000b00536e6520663si4237941pgn.388.2023.06.04.06.20.28; Sun, 04 Jun 2023 06:20:40 -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=ho+w3R3e; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231856AbjFDNI2 (ORCPT + 99 others); Sun, 4 Jun 2023 09:08:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231828AbjFDNIV (ORCPT ); Sun, 4 Jun 2023 09:08:21 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4BB31A8; Sun, 4 Jun 2023 06:08:13 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-51456392cbbso10430978a12.0; Sun, 04 Jun 2023 06:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685884092; x=1688476092; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=ehsXLibKE7EsdL7h37Ey3hxWw2NtYcUCkyRCtwhN2Ag=; b=ho+w3R3eBSHT8APyM7DlSIiJgXHu4swFXy6oR7N4hSWfBv4/VSLDlCoenkxDecIIlT 2+LSHeMWaiAkSJRBhQOF0gj8sXyagxD4+joGAovn0s8rgH4HAIg2vLslWxfoyu9ui6Fu OlGh3SmmHNly48F0zQ4V/bEY/w6BNQ8D7iN64zGovx2m6blJc24vJnmkCGgr904JwbHJ rRNMnRblhHbjaonYZhEO1tajssgFtoPZb8r4PLZ/J7ypsYZKbwhSe/TIVbaiZ+Tett0f tLQ+5rBRC84k0ATMBhVTl2UcI9J8XkHk+h6psOo3h0xlqUICdWWX9pyvfey8ekmv1MZF XDbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685884092; x=1688476092; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ehsXLibKE7EsdL7h37Ey3hxWw2NtYcUCkyRCtwhN2Ag=; b=iBMWsl98xz5aVyHXlxaOpmlnobLjmHXmEhuNdOMlIkq7b6ts4+iRiviOW8CpxgkK5a l8QEbi5bYf53IvjR9y/kYlyHRInLt3Rs2lZuAQyXlje0A1pVrJ8Ngpj1OXsApxr0C2NN /4ybihCS3JUvmJIE6kD3vx1mdYwUi7vML8uJYO+TJGrH7u2CtnQvhx7nOwqAaWQ0d6Ub he/iD4R/N0FtgFAtgb/e2noFKh+4w+sleEIGnJbVoXOx4QNqOw252DF1t26BQcZzJ5Mx v36qfXp4NIkXzwoVgFrX7U5JIyFPNxzmjJ7hA3PR3UquZL1xtf/2BFtHcQPUzr5yhEH0 GucQ== X-Gm-Message-State: AC+VfDwpTnIHJBQMBl4X63HIVmspVTZDvu1CJ9sGOKj/DBPAdcBeJTab vNSH7FeBvxNCjrHtq5P/5cQ= X-Received: by 2002:a05:6402:34c4:b0:516:5b18:a9f1 with SMTP id w4-20020a05640234c400b005165b18a9f1mr836092edc.0.1685884091938; Sun, 04 Jun 2023 06:08:11 -0700 (PDT) Received: from skbuf ([188.27.184.189]) by smtp.gmail.com with ESMTPSA id b9-20020aa7dc09000000b005149e64260esm2773600edu.16.2023.06.04.06.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jun 2023 06:08:11 -0700 (PDT) Date: Sun, 4 Jun 2023 16:08:08 +0300 From: Vladimir Oltean To: =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= Cc: Sean Wang , Landen Chao , DENG Qingfang , Daniel Golle , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , Richard van Schagen , Richard van Schagen , Frank Wunderlich , Bartel Eerdekens , erkin.bozoglu@xeront.com, mithat.guner@xeront.com, 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 25/30] net: dsa: mt7530: properly set MT7531_CPU_PMAP Message-ID: <20230604130808.3lxuz5ezsouhku57@skbuf> References: <20230522121532.86610-1-arinc.unal@arinc9.com> <20230522121532.86610-1-arinc.unal@arinc9.com> <20230522121532.86610-26-arinc.unal@arinc9.com> <20230522121532.86610-26-arinc.unal@arinc9.com> <20230526155124.sps74wayui6bydao@skbuf> <9423a818-f9c0-d867-7f7d-27f05e1536b9@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9423a818-f9c0-d867-7f7d-27f05e1536b9@arinc9.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 04, 2023 at 11:21:48AM +0300, Arınç ÜNAL wrote: > > Stylistically, the existence of an indirect call to priv->info->cpu_port_config() > > per switch family is a bit dissonant with an explicit check for device id later > > in the same function. > > mt753x_cpu_port_enable() is not being called from priv->info->cpu_port_config() > though. Quite the other way around. I'm saying that mt753x_cpu_port_enable(), the function whose logic you're changing, already has a mechanism to execute code specific to one switch family. > I'm not sure how I would do this without the device ID check here. Hmm, by defining a new mt7530_cpu_port_config() procedure for ID_MT7621 and ID_MT7530? Although in a different thread we are perhaps challenging the idea that what is currently in priv->info->cpu_port_config() is useful - at least half of it are manual invocations of phylink methods which are possibly not needed. If after the removal of those, it no longer makes sense to have priv->info->cpu_port_config() at all, then I'm not saying that the explicit check for device id here doesn't make sense. Just that it's not in harmony with what currently exists 3 lines above. > > > -#define MT7531_CPU_PMAP_MASK GENMASK(7, 0) > > > +#define MT7531_CPU_PMAP(x) ((x) & 0xff) > > > > You can leave this as ((x) & GENMASK(7, 0)) > > Now that I've read Russell's comment on the previous patch, the below would > be even better? > > MT7531_CPU_PMAP(x) FIELD_PREP(MT7531_CPU_PMAP_MASK, x) > > > > > > +#define MT7531_CPU_PMAP_MASK MT7531_CPU_PMAP(~0) > > > > There's no other user of MT7531_CPU_PMAP_MASK, you can remove this. > > Should I do above or remove this? No specific preference. If you want to make this driver start using FIELD_PREP() then go ahead.