From: Simon Horman <simon.horman@corigine•com>
To: Justin Chen <justin.chen@broadcom•com>
Cc: netdev@vger•kernel.org, devicetree@vger•kernel.org,
linux-kernel@vger•kernel.org, linux-media@vger•kernel.org,
dri-devel@lists•freedesktop.org,
bcm-kernel-feedback-list@broadcom•com, justinpopo6@gmail•com,
f.fainelli@gmail•com, davem@davemloft•net,
florian.fainelli@broadcom•com, edumazet@google•com,
kuba@kernel•org, pabeni@redhat•com, robh+dt@kernel•org,
krzysztof.kozlowski+dt@linaro•org, opendmb@gmail•com,
andrew@lunn•ch, hkallweit1@gmail•com, linux@armlinux•org.uk,
richardcochran@gmail•com, sumit.semwal@linaro•org,
christian.koenig@amd•com
Subject: Re: [PATCH net-next v3 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
Date: Mon, 22 May 2023 13:38:45 +0200 [thread overview]
Message-ID: <ZGtURVrdqz536ai7@corigine.com> (raw)
In-Reply-To: <1684531184-14009-4-git-send-email-justin.chen@broadcom.com>
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@broadcom•com>
> Signed-off-by: Justin Chen <justin.chen@broadcom•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;
> + }
> +}
...
next prev parent reply other threads:[~2023-05-22 11:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-19 21:19 [PATCH net-next v3 0/6] Brcm ASP 2.0 Ethernet Controller Justin Chen
2023-05-19 21:19 ` [PATCH net-next v3 1/6] dt-bindings: net: brcm,unimac-mdio: Add asp-v2.0 Justin Chen
2023-05-22 18:17 ` Conor Dooley
2023-05-22 18:25 ` Florian Fainelli
2023-05-22 18:38 ` Conor Dooley
2023-05-19 21:19 ` [PATCH net-next v3 2/6] dt-bindings: net: Brcm ASP 2.0 Ethernet controller Justin Chen
2023-05-22 18:27 ` Conor Dooley
2023-05-22 18:48 ` Justin Chen
2023-05-19 21:19 ` [PATCH net-next v3 3/6] net: bcmasp: Add support for ASP2.0 " Justin Chen
2023-05-20 4:43 ` Jakub Kicinski
2023-05-21 9:05 ` kernel test robot
2023-05-22 11:34 ` Simon Horman
2023-05-22 11:38 ` Simon Horman [this message]
2023-05-19 21:19 ` [PATCH net-next v3 4/6] net: phy: mdio-bcm-unimac: Add asp v2.0 support Justin Chen
2023-05-19 21:19 ` [PATCH net-next v3 5/6] net: phy: bcm7xxx: Add EPHY entry for 74165 Justin Chen
2023-05-19 21:19 ` [PATCH net-next v3 6/6] MAINTAINERS: ASP 2.0 Ethernet driver maintainers Justin Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZGtURVrdqz536ai7@corigine.com \
--to=simon.horman@corigine$(echo .)com \
--cc=andrew@lunn$(echo .)ch \
--cc=bcm-kernel-feedback-list@broadcom$(echo .)com \
--cc=christian.koenig@amd$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=devicetree@vger$(echo .)kernel.org \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=edumazet@google$(echo .)com \
--cc=f.fainelli@gmail$(echo .)com \
--cc=florian.fainelli@broadcom$(echo .)com \
--cc=hkallweit1@gmail$(echo .)com \
--cc=justin.chen@broadcom$(echo .)com \
--cc=justinpopo6@gmail$(echo .)com \
--cc=krzysztof.kozlowski+dt@linaro$(echo .)org \
--cc=kuba@kernel$(echo .)org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-media@vger$(echo .)kernel.org \
--cc=linux@armlinux$(echo .)org.uk \
--cc=netdev@vger$(echo .)kernel.org \
--cc=opendmb@gmail$(echo .)com \
--cc=pabeni@redhat$(echo .)com \
--cc=richardcochran@gmail$(echo .)com \
--cc=robh+dt@kernel$(echo .)org \
--cc=sumit.semwal@linaro$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox