[PATCH net-next v3 3/8] net: qualcomm: ipqess: introduce the Qualcomm IPQESS driver

Romain Gantois romain.gantois at bootlin.com
Wed Nov 15 07:07:32 PST 2023


On Wed, 15 Nov 2023, Wojciech Drewek wrote:
...
> > +static int ipqess_port_vlan_rx_add_vid(struct net_device *dev, __be16 proto,
> > +				       u16 vid)
> > +{
> > +	struct ipqess_port *port = netdev_priv(dev);
> > +	struct switchdev_obj_port_vlan vlan = {
> > +		.obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN,
> > +		.vid = vid,
> > +		/* This API only allows programming tagged, non-PVID VIDs */
> > +		.flags = 0,
> > +	};
> > +	struct netlink_ext_ack extack = {0};
> > +	int ret;
> > +
> > +	/* User port... */
> > +	ret = ipqess_port_do_vlan_add(port->sw->priv, port->index, &vlan, &extack);
> > +	if (ret) {
> > +		if (extack._msg)
> > +			netdev_err(dev, "%s\n", extack._msg);
> > +		return ret;
> > +	}
> > +
> > +	/* And CPU port... */
> > +	ret = ipqess_port_do_vlan_add(port->sw->priv, 0, &vlan, &extack);
> > +	if (ret) {
> 
> Should we delete vlan from user port if this fails?
I'll have to look into how and when this API is called in more detail but I 
think this would indeed make sense.

> > +
> > +	/* Flush the FDB table */
> > +	qca8k_fdb_flush(priv);
> > +
> > +	if (ret < 0)
> > +		goto devlink_free;
> > +
> > +	/* set Port0 status */
> > +	reg  = QCA8K_PORT_STATUS_LINK_AUTO;
> > +	reg |= QCA8K_PORT_STATUS_DUPLEX;
> > +	reg |= QCA8K_PORT_STATUS_SPEED_1000;
> > +	reg |= QCA8K_PORT_STATUS_RXFLOW;
> > +	reg |= QCA8K_PORT_STATUS_TXFLOW;
> > +	reg |= QCA8K_PORT_STATUS_TXMAC | QCA8K_PORT_STATUS_RXMAC;
> > +	qca8k_write(priv, QCA8K_REG_PORT_STATUS(0), reg);
> > +	sw->port0_enabled = true;
> > +
> > +	return 0;
> > +
> > +devlink_free:
> 
> Why is it called devlink_free, I don't see any connection to devlink.
I think this is leftover from a previous version of this function, where it 
interacted with devlink. I'll rename it to error.

Best,

-- 
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



More information about the linux-arm-kernel mailing list