lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 31 Jul 2021 18:19:11 +0300
From:   Vladimir Oltean <olteanv@...il.com>
To:     Prasanna Vengateshan <prasanna.vengateshan@...rochip.com>
Cc:     andrew@...n.ch, netdev@...r.kernel.org, robh+dt@...nel.org,
        UNGLinuxDriver@...rochip.com, Woojung.Huh@...rochip.com,
        hkallweit1@...il.com, linux@...linux.org.uk, davem@...emloft.net,
        kuba@...nel.org, linux-kernel@...r.kernel.org,
        vivien.didelot@...il.com, f.fainelli@...il.com,
        devicetree@...r.kernel.org
Subject: Re: [PATCH v3 net-next 09/10] net: dsa: microchip: add support for
 fdb and mdb management

On Fri, Jul 23, 2021 at 11:01:07PM +0530, Prasanna Vengateshan wrote:
> +static int lan937x_port_fdb_add(struct dsa_switch *ds, int port,
> +				const unsigned char *addr, u16 vid)
> +{
> +	struct ksz_device *dev = ds->priv;
> +	u8 fid = lan937x_get_fid(vid);
> +	u32 alu_table[4];
> +	int ret, i;
> +	u32 data;
> +	u8 val;
> +
> +	mutex_lock(&dev->alu_mutex);
> +
> +	/* Accessing two ALU tables through loop */
> +	for (i = 0; i < ALU_STA_DYN_CNT; i++) {
> +		/* find any entry with mac & fid */
> +		data = fid << ALU_FID_INDEX_S;
> +		data |= ((addr[0] << 8) | addr[1]);

Maybe upper_32_bits(ether_addr_to_u64(addr)) and
lower_32_bits(ether_addr_to_u64(addr)) would be slightly easier on the
eye?

> +		if (alu_table[0] & ALU_V_STATIC_VALID) {
> +			/* read ALU entry */
> +			ret = lan937x_read_table(dev, alu_table);
> +			if (ret < 0) {
> +				dev_err(dev->dev, "Failed to read ALU table\n");
> +				break;
> +			}
> +
> +			/* clear forwarding port */
> +			alu_table[1] &= ~BIT(port);
> +
> +			/* if there is no port to forward, clear table */
> +			if ((alu_table[1] & ALU_V_PORT_MAP) == 0) {
> +				alu_table[0] = 0;
> +				alu_table[1] = 0;
> +				alu_table[2] = 0;
> +				alu_table[3] = 0;

memset?

> +			}
> +		} else {
> +			alu_table[0] = 0;
> +			alu_table[1] = 0;
> +			alu_table[2] = 0;
> +			alu_table[3] = 0;
> +		}
> +
> +		ret = lan937x_write_table(dev, alu_table);
> +		if (ret < 0)
> +			break;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ