[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZGtURVrdqz536ai7@corigine.com>
Date: Mon, 22 May 2023 13:38:45 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Justin Chen <justin.chen@...adcom.com>
Cc: netdev@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
bcm-kernel-feedback-list@...adcom.com, justinpopo6@...il.com,
f.fainelli@...il.com, davem@...emloft.net,
florian.fainelli@...adcom.com, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, opendmb@...il.com,
andrew@...n.ch, hkallweit1@...il.com, linux@...linux.org.uk,
richardcochran@...il.com, sumit.semwal@...aro.org,
christian.koenig@....com
Subject: Re: [PATCH net-next v3 3/6] net: bcmasp: Add support for ASP2.0
Ethernet controller
On Fri, May 19, 2023 at 02:19:41PM -0700, Justin Chen wrote:
> Add support for the Broadcom ASP 2.0 Ethernet controller which is first
> introduced with 72165. This controller features two distinct Ethernet
> ports that can be independently operated.
>
> This patch supports:
>
> - Wake-on-LAN using magic packets
> - basic ethtool operations (link, counters, message level)
> - MAC destination address filtering (promiscuous, ALL_MULTI, etc.)
>
> Signed-off-by: Florian Fainelli <florian.fainelli@...adcom.com>
> Signed-off-by: Justin Chen <justin.chen@...adcom.com>
...
> +static int bcmasp_netfilt_get_reg_offset(struct bcmasp_priv *priv,
> + struct bcmasp_net_filter *nfilt,
> + enum asp_netfilt_reg_type reg_type,
> + u32 offset)
> +{
> + u32 block_index, filter_sel;
> +
> + if (offset < 32) {
> + block_index = ASP_RX_FILTER_NET_L2;
> + filter_sel = nfilt->hw_index;
> + } else if (offset < 64) {
> + block_index = ASP_RX_FILTER_NET_L2;
> + filter_sel = nfilt->hw_index + 1;
> + } else if (offset < 96) {
> + block_index = ASP_RX_FILTER_NET_L3_0;
> + filter_sel = nfilt->hw_index;
> + } else if (offset < 128) {
> + block_index = ASP_RX_FILTER_NET_L3_0;
> + filter_sel = nfilt->hw_index + 1;
> + } else if (offset < 160) {
> + block_index = ASP_RX_FILTER_NET_L3_1;
> + filter_sel = nfilt->hw_index;
> + } else if (offset < 192) {
> + block_index = ASP_RX_FILTER_NET_L3_1;
> + filter_sel = nfilt->hw_index + 1;
> + } else if (offset < 224) {
> + block_index = ASP_RX_FILTER_NET_L4;
> + filter_sel = nfilt->hw_index;
> + } else if (offset < 256) {
> + block_index = ASP_RX_FILTER_NET_L4;
> + filter_sel = nfilt->hw_index + 1;
> + }
Hi Justin,
Perhaps it is not possible.
But it seems to me that it would be nice to have:
else {
return -EINVAL;
}
Otherwise, if that case does occur, block_index and filter_sel
will be used uninitialised.
> +
> + switch (reg_type) {
> + case ASP_NETFILT_MATCH:
> + return ASP_RX_FILTER_NET_PAT(filter_sel, block_index,
> + (offset % 32));
> + case ASP_NETFILT_MASK:
> + return ASP_RX_FILTER_NET_MASK(filter_sel, block_index,
> + (offset % 32));
> + default:
> + return -EINVAL;
> + }
> +}
...
Powered by blists - more mailing lists