Re: [PATCH net-next v4 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
> Signed-off-by: Justin Chen <justin.chen@xxxxxxxxxxxx>

Hi Justin,

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

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

> +}

...




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux