Re: [RFC PATCH net-next 4/5] net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC

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

 



On Sun, Aug 22, 2021 at 09:31:42PM +0200, Alvin Šipraga wrote:
> +static bool rtl8365mb_is_vlan_valid(struct realtek_smi *smi, unsigned int vlan)

Maybe it would be more efficient to make smi->ops->is_vlan_valid optional?

> +{
> +	if (vlan > RTL8365MB_VIDMAX)
> +		return false;
> +
> +	return true;
> +}
> +
> +static int rtl8365mb_enable_vlan(struct realtek_smi *smi, bool enable)
> +{
> +	dev_dbg(smi->dev, "%s VLAN\n", enable ? "enable" : "disable");
> +	return regmap_update_bits(
> +		smi->map, RTL8365MB_VLAN_CTRL_REG, RTL8365MB_VLAN_CTRL_EN_MASK,
> +		FIELD_PREP(RTL8365MB_VLAN_CTRL_EN_MASK, enable ? 1 : 0));
> +}
> +
> +static int rtl8365mb_enable_vlan4k(struct realtek_smi *smi, bool enable)
> +{
> +	return rtl8365mb_enable_vlan(smi, enable);
> +}

I'm not going to lie, the realtek_smi_ops VLAN methods seem highly
cryptic to me. Why do you do the same thing from .enable_vlan4k as from
.enable_vlan? What are these supposed to do in the first place?
Or to quote from rtl8366_vlan_add: "what's with this 4k business?"

Also, stupid question: what do you need the VLAN ops for if you haven't
implemented .port_bridge_join and .port_bridge_leave? How have you
tested them?



[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