netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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, dri-devel@lists.freedesktop.org,
	bcm-kernel-feedback-list@broadcom.com, justinpopo6@gmail.com,
	f.fainelli@gmail.com, davem@davemloft.net, 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, conor@kernel.org,
	Florian Fainelli <florian.fainelli@broadcom.com>
Subject: Re: [PATCH net-next v4 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
Date: Wed, 24 May 2023 11:19:35 +0200	[thread overview]
Message-ID: <ZG3Wp2HhwLrwpvHq@corigine.com> (raw)
In-Reply-To: <1684878827-40672-4-git-send-email-justin.chen@broadcom.com>

On Tue, May 23, 2023 at 02:53:44PM -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>

Hi Justin,

Reviewed-by: Simon Horman <simon.horman@corigine.com>

As I see there will be a v5 I have added a few nits from my side.
Feel free to ignore them as you see fit.

...

> +int bcmasp_netfilt_check_dup(struct bcmasp_intf *intf,
> +			     struct ethtool_rx_flow_spec *fs)

nit: the return type of this function could be bool

> +{
> +	struct bcmasp_priv *priv = intf->parent;
> +	struct ethtool_rx_flow_spec *cur;
> +	size_t fs_size = 0;
> +	int i;
> +
> +	for (i = 0; i < NUM_NET_FILTERS; i++) {
> +		if (!priv->net_filters[i].claimed ||
> +		    priv->net_filters[i].port != intf->port)
> +			continue;
> +
> +		cur = &priv->net_filters[i].fs;
> +
> +		if (cur->flow_type != fs->flow_type ||
> +		    cur->ring_cookie != fs->ring_cookie)
> +			continue;
> +
> +		switch (fs->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) {
> +		case ETHER_FLOW:
> +			fs_size = sizeof(struct ethhdr);
> +			break;
> +		case IP_USER_FLOW:
> +			fs_size = sizeof(struct ethtool_usrip4_spec);
> +			break;
> +		case TCP_V6_FLOW:
> +		case UDP_V6_FLOW:
> +			fs_size = sizeof(struct ethtool_tcpip6_spec);
> +			break;
> +		case TCP_V4_FLOW:
> +		case UDP_V4_FLOW:
> +			fs_size = sizeof(struct ethtool_tcpip4_spec);
> +			break;
> +		default:
> +			continue;
> +		}
> +
> +		if (memcmp(&cur->h_u, &fs->h_u, fs_size) ||
> +		    memcmp(&cur->m_u, &fs->m_u, fs_size))
> +			continue;
> +
> +		if (cur->flow_type & FLOW_EXT) {
> +			if (cur->h_ext.vlan_etype != fs->h_ext.vlan_etype ||
> +			    cur->m_ext.vlan_etype != fs->m_ext.vlan_etype ||
> +			    cur->h_ext.vlan_tci != fs->h_ext.vlan_tci ||
> +			    cur->m_ext.vlan_tci != fs->m_ext.vlan_tci ||
> +			    cur->h_ext.data[0] != fs->h_ext.data[0])
> +				continue;
> +		}
> +		if (cur->flow_type & FLOW_MAC_EXT) {
> +			if (memcmp(&cur->h_ext.h_dest,
> +				   &fs->h_ext.h_dest, ETH_ALEN) ||
> +			    memcmp(&cur->m_ext.h_dest,
> +				   &fs->m_ext.h_dest, ETH_ALEN))
> +				continue;
> +		}
> +
> +		return 1;
> +	}
> +
> +	return 0;
> +}

...

> +static int bcmasp_is_port_valid(struct bcmasp_priv *priv, int port)
> +{
> +	/* Quick sanity check
> +	 *   Ports 0/1 reserved for unimac
> +	 *   Max supported ports is 2
> +	 */
> +	return (port == 0 || port == 1);

nit: unnecessary parentheses

> +}

...


  reply	other threads:[~2023-05-24  9:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23 21:53 [PATCH net-next v4 0/6] Brcm ASP 2.0 Ethernet Controller Justin Chen
2023-05-23 21:53 ` [PATCH net-next v4 1/6] dt-bindings: net: brcm,unimac-mdio: Add asp-v2.0 Justin Chen
2023-05-24  9:23   ` Simon Horman
2023-05-23 21:53 ` [PATCH net-next v4 2/6] dt-bindings: net: Brcm ASP 2.0 Ethernet controller Justin Chen
2023-05-23 22:18   ` Rob Herring
2023-05-23 22:54   ` Conor Dooley
2023-05-23 23:27     ` Justin Chen
2023-05-24  6:51       ` Conor Dooley
2023-05-24  6:56         ` Conor Dooley
2023-05-24 21:47           ` Justin Chen
2023-05-24 21:54             ` Conor Dooley
2023-05-23 21:53 ` [PATCH net-next v4 3/6] net: bcmasp: Add support for ASP2.0 " Justin Chen
2023-05-24  9:19   ` Simon Horman [this message]
2023-05-23 21:53 ` [PATCH net-next v4 4/6] net: phy: mdio-bcm-unimac: Add asp v2.0 support Justin Chen
2023-05-24  9:24   ` Simon Horman
2023-05-23 21:53 ` [PATCH net-next v4 5/6] net: phy: bcm7xxx: Add EPHY entry for 74165 Justin Chen
2023-05-24  9:24   ` Simon Horman
2023-05-23 21:53 ` [PATCH net-next v4 6/6] MAINTAINERS: ASP 2.0 Ethernet driver maintainers Justin Chen
2023-05-24  9:22   ` Simon Horman

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=ZG3Wp2HhwLrwpvHq@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=christian.koenig@amd.com \
    --cc=conor@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hkallweit1@gmail.com \
    --cc=justin.chen@broadcom.com \
    --cc=justinpopo6@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).