Thread (48 messages) flat view 48 messages, 8 authors, 2021-08-28

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

From: Vladimir Oltean <olteanv@gmail.com>
Date: 2021-08-22 22:48:25
Also in: linux-devicetree, lkml

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?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help