- vlanmc_priv.vid = vlanmc->vid;
- vlanmc_priv.priority = vlanmc->priority;
- vlanmc_priv.untag = vlanmc->untag;
- vlanmc_priv.member = vlanmc->member;
- vlanmc_priv.stag_mbr = 0;
- vlanmc_priv.stag_idx = 0;
- vlanmc_priv.fid = vlanmc->fid;
-
- addr = RTL8366RB_VLAN_MEMCONF_BASE + (index * 3);
-
- tableaddr = (u16 *)&vlanmc_priv;
- data = *tableaddr;
-
- err = rtl8366_smi_write_reg(smi, addr, data);
- if (err)
- return err;
-
- addr = RTL8366RB_VLAN_MEMCONF_BASE + 1 + (index * 3);
-
- tableaddr++;
- data = *tableaddr;
-
- err = rtl8366_smi_write_reg(smi, addr, data);
- if (err)
- return err;
-
- addr = RTL8366RB_VLAN_MEMCONF_BASE + 2 + (index * 3);
-
- tableaddr++;
- data = *tableaddr;
+ data[0] = (vlanmc->vid & RTL8366RB_VLAN_VID_MASK) |
+ ((vlanmc->priority & RTL8366RB_VLAN_PRIORITY_MASK) <<
+ RTL8366RB_VLAN_PRIORITY_SHIFT);
+ data[1] = (vlanmc->member & RTL8366RB_VLAN_MEMBER_MASK) |
+ ((vlanmc->untag & RTL8366RB_VLAN_UNTAG_MASK) <<
+ RTL8366RB_VLAN_UNTAG_SHIFT);
+ data[2] = vlanmc->fid & RTL8366RB_VLAN_FID_MASK;
+
+ for (i = 0; i < 3; i++) {
+ err = rtl8366_smi_write_reg(smi,
+ RTL8366RB_VLAN_MC_BASE(index) + i,
+ data[i]);
+ if (err)
+ return err;
+ }