Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1077029lqt; Fri, 7 Jun 2024 07:27:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXA2kBF6GHGOFYQfs5tLkQRCnP1LnyTJ45zrAkKJGZF9MvJX4GHgU4LT0EnIjKkB2hdpqzt7Go8timHhcUbkiC9/L7dgOtUOBEtkBaDDw== X-Google-Smtp-Source: AGHT+IESbZjFJZusASu75NGDRABZw9WIprBbBZMee2AO7N6LAWUoJLZfefED/L8FAUCmJRlskyWT X-Received: by 2002:a81:84ca:0:b0:61a:bc2d:5186 with SMTP id 00721157ae682-62cd56622famr26308157b3.32.1717770466328; Fri, 07 Jun 2024 07:27:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717770466; cv=pass; d=google.com; s=arc-20160816; b=iBRf0Ooyq07fSoEB5AsH/JzKlcLLc9Nxcy3bcrSV38K8juhMdV8DWOw20CHa4WS/LC XcwxJKswRI3feDbBlYSkAM/9BnZ8QI4JxLy5y/FDsNA4KZgXvVmEjrh2JFRcMq0m4wHJ zX4RN7qgOf2xeUfr2Gld+u7QmXZvlod8ETWrO1HuKM9Jh5BgRUUCfU0Jmd31g2I/hNI+ iwmnhhJxMIoi/XTnBsybLcrvpkWRPCoe1KMvi79m0GvWPkH497fUwE1jhqX4i3EiD66h wVuin4gBRarAz8BpO359L2H8WR1XUcZavzRUj9ZM3E10exNhEeKucpQ5TWufV7eMPJEY DHQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:message-id:references:in-reply-to:organization:subject :cc:to:from:date:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence; bh=3Gs1JWaBiJJ+fnApBgeVl1Y7ZJRJCST5Ot3+ioseBqk=; fh=tZs145GEaRpRPd94tXd2oOgS8dsYTYmNF2MdEJfhwBc=; b=f0rtHGM97ous9s+gkjQ0ACJIfnL5xKMlMpoaUIaVXc/V7Up+ukaffju4NnuWDyMCxa tcMzXyjKekK6pGN3nL9V6jPIYHDsqDKZD368IsHhl+Jz/s+D9yrlNUdSbTLnB8Z/6Q1G 0TkqQmA1CBjX+8j0poXJ/oU82+AcCbYWiDJBV/4Qhil4OSC2+Ui6LwuQ6nYHhX3mWPYg HuNgALqw4p3Cz1fHdJUIoqDcAotQJIUV8k/FHDAKDfgvhMGNKKzzSSQ+pnN4ec3pAsVm kUxexay2Aw2pMkv/rjEU8EvzQgK/vNkEKTz2m2tAcOEgDpqfUNoEqpNOZwdshF1BTagy g4oA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=dev.tdt.de); spf=pass (google.com: domain of linux-kernel+bounces-206263-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206263-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6b04f995192si41709216d6.314.2024.06.07.07.27.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 07:27:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206263-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=dev.tdt.de); spf=pass (google.com: domain of linux-kernel+bounces-206263-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206263-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id AF5201C22EA6 for ; Fri, 7 Jun 2024 14:27:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE2A5195990; Fri, 7 Jun 2024 14:27:11 +0000 (UTC) Received: from mxout70.expurgate.net (mxout70.expurgate.net [194.37.255.70]) (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 483A8194AD3; Fri, 7 Jun 2024 14:27:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.37.255.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717770431; cv=none; b=pX7rc7ttavXPOZbchLg67X9k8z0DbqiBHFyUfCDyLJFmJOZdV02wUBLeo91A2dDwyyZQc0fKcLAjGdMz2dqBvx8pH2VKNOZesinh9KjyUHdZqy9PZtVdS/aX4TwUpBC+l9kZEH2uOPKW+9JhhfEVKZRnFtiKOr3sTUFLZBHkIIY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717770431; c=relaxed/simple; bh=s/wAF2MKyNyCf80HDbawVNiWCXO6QMjFhK7UDLN3ixk=; h=MIME-Version:Content-Type:Date:From:To:Cc:Subject:In-Reply-To: References:Message-ID; b=BvU+Hl0gOV6hFB5xKAbjda13Th5UrLY4AyxJ+IgqnZMFUDuUeqOk9yc8W5DLxLYIx3L7tMIA17nojS4NdmCOn2WVSshYicKcDY0KUq2Yr7G0krABl8SmAxQYq0A4XLRLBZ0o+2BMc9IakZCU1l1cgldkdZK8P0oF1c0yQk6p8vI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dev.tdt.de; spf=pass smtp.mailfrom=dev.tdt.de; arc=none smtp.client-ip=194.37.255.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dev.tdt.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dev.tdt.de Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1sFaYc-008Qz7-Od; Fri, 07 Jun 2024 16:27:06 +0200 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sFaYc-00EhMZ-5Z; Fri, 07 Jun 2024 16:27:06 +0200 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id BF4D5240053; Fri, 7 Jun 2024 16:27:05 +0200 (CEST) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 4A07B240050; Fri, 7 Jun 2024 16:27:05 +0200 (CEST) Received: from mail.dev.tdt.de (localhost [IPv6:::1]) by mail.dev.tdt.de (Postfix) with ESMTP id D257E3849A; Fri, 7 Jun 2024 16:27:04 +0200 (CEST) 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; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 07 Jun 2024 16:27:04 +0200 From: Martin Schiller To: Vladimir Oltean Cc: martin.blumenstingl@googlemail.com, hauke@hauke-m.de, andrew@lunn.ch, f.fainelli@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 12/13] net: dsa: lantiq_gswip: Add and use a GSWIP_TABLE_MAC_BRIDGE_FID macro Organization: TDT AG In-Reply-To: <20240607113652.6ryt5gg72he2madn@skbuf> References: <20240606085234.565551-1-ms@dev.tdt.de> <20240606085234.565551-13-ms@dev.tdt.de> <20240607113652.6ryt5gg72he2madn@skbuf> Message-ID: X-Sender: ms@dev.tdt.de User-Agent: Roundcube Webmail/1.3.17 X-purgate-ID: 151534::1717770426-CDC4D8CF-65FA3DE4/0/0 X-purgate: clean X-purgate-type: clean On 2024-06-07 13:36, Vladimir Oltean wrote: > On Thu, Jun 06, 2024 at 10:52:33AM +0200, Martin Schiller wrote: >> From: Martin Blumenstingl >> >> Only bits [5:0] in mac_bridge.key[3] are reserved for the FID. Add a >> macro so this becomes obvious when reading the driver code. >> >> Signed-off-by: Martin Blumenstingl >> >> --- >> drivers/net/dsa/lantiq_gswip.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/dsa/lantiq_gswip.c >> b/drivers/net/dsa/lantiq_gswip.c >> index f2faee112e33..4bb894e75b81 100644 >> --- a/drivers/net/dsa/lantiq_gswip.c >> +++ b/drivers/net/dsa/lantiq_gswip.c >> @@ -238,6 +238,7 @@ >> #define GSWIP_TABLE_MAC_BRIDGE 0x0b >> #define GSWIP_TABLE_MAC_BRIDGE_STATIC BIT(0) /* Static not, aging >> entry */ >> #define GSWIP_TABLE_MAC_BRIDGE_PORT GENMASK(7, 4) /* Port on learned >> entries */ >> +#define GSWIP_TABLE_MAC_BRIDGE_FID GENMASK(5, 0) /* Filtering >> identifier */ >> >> #define XRX200_GPHY_FW_ALIGN (16 * 1024) >> >> @@ -1385,7 +1386,7 @@ static int gswip_port_fdb(struct dsa_switch *ds, >> int port, >> mac_bridge.key[0] = addr[5] | (addr[4] << 8); >> mac_bridge.key[1] = addr[3] | (addr[2] << 8); >> mac_bridge.key[2] = addr[1] | (addr[0] << 8); >> - mac_bridge.key[3] = fid; >> + mac_bridge.key[3] = FIELD_PREP(GSWIP_TABLE_MAC_BRIDGE_FID, fid); >> mac_bridge.val[0] = add ? BIT(port) : 0; /* port map */ >> mac_bridge.val[1] = GSWIP_TABLE_MAC_BRIDGE_STATIC; >> mac_bridge.valid = add; >> -- >> 2.39.2 > > On second thought, I disagree with the naming scheme of the > GSWIP_TABLE_MAC_BRIDGE_* macros. It is completely non obvious that they > are non-overlapping, because they have the same name prefix, but: > _STATIC applies to gswip_pce_table_entry :: val[1] > _PORT applies to gswip_pce_table_entry :: val[0] > _FID applies to gswip_pce_table_entry :: key[3] > > I think it's all too easy to use the wrong macro on the wrong register > field. > If the macros incorporated names like VAL1, KEY3 etc, it would be much > more obvious. Could you please do that? OK, so I'll change the macro names to GSWIP_TABLE_MAC_BRIDGE_KEY3_FID GSWIP_TABLE_MAC_BRIDGE_VAL0_PORT GSWIP_TABLE_MAC_BRIDGE_VAL1_STATIC Also the comment of GSWIP_TABLE_MAC_BRIDGE_VAL1_STATIC should be changed to /* Static, not aging entry */ While looking again at this diff above, I noticed that val[0] is set incorrectly. Shouldn't it be either "port << 4" or (after the previous patch) "FIELD_PREP(GSWIP_TABLE_MAC_BRIDGE_PORT, port);" instead of "BIT(port)"?