Issue Description
swconfig could not set VLANID > 128
- $ swconfig dev switch0 vlan 100 set ports '0t 1'
- ok
-
# swconfig dev switch0 vlan 4090 set ports '0t 1'
- failed
switch config
swconfig
- root@oakridge:/proc# swconfig
- swconfig dev <dev> [port <port>|vlan <vlan>] (help|set <key> <value>|get <key>|load <config>|show)
- root@oakridge:/proc# swconfig dev eth0 show
- Global attributes:
- enable_vlan: 1
- max_frame_size: 1528
- dump_arl: MAC: 78:4f:43:53:c5:e3 PORTMAP: 0x04
- MAC: fc:ad:0f:06:9f:90 PORTMAP: 0x01
- MAC: e4:a4:71:fb:49:10 PORTMAP: 0x04
- MAC: f4:0f:24:2d:da:08 PORTMAP: 0x04
- MAC: a4:f1:e8:8e:d9:ce PORTMAP: 0x04
- MAC: f4:0f:24:28:cb:ba PORTMAP: 0x04
- MAC: 00:ae:0c:2b:1c:ed PORTMAP: 0x04
- MAC: e0:1c:41:e8:ff:80 PORTMAP: 0x04
- MAC: e0:1c:41:e8:ff:86 PORTMAP: 0x04
- MAC: a8:88:08:ea:ce:2b PORTMAP: 0x04
- MAC: 00:ec:ac:ce:80:8c PORTMAP: 0x04
- MAC: 98:e7:f4:96:80:1e PORTMAP: 0x04
- MAC: 38:a4:ed:a1:db:aa PORTMAP: 0x04
- MAC: 00:e0:4c:68:03:b7 PORTMAP: 0x04
- MAC: 70:14:a6:cd:8a:c2 PORTMAP: 0x04
- MAC: fc:ad:0f:06:a5:20 PORTMAP: 0x04
-
- igmp_snooping: ???
- Port 0:
- mib: Port 0 MIB counters
- RxBroad : 41
- RxPause : 0
- RxMulti : 35
- RxFcsErr : 0
- RxAlignErr : 0
- RxRunt : 0
- RxFragment : 0
- Rx64Byte : 181
- Rx128Byte : 263
- Rx256Byte : 173
- Rx512Byte : 7
- Rx1024Byte : 0
- Rx1518Byte : 0
- RxMaxByte : 0
- RxTooLong : 0
- RxGoodByte : 73830
- RxBadByte : 0
- RxOverFlow : 0
- Filtered : 30
- TxBroad : 3373
- TxPause : 0
- TxMulti : 3821
- TxUnderRun : 0
- Tx64Byte : 0
- Tx128Byte : 4875
- Tx256Byte : 1551
- Tx512Byte : 1105
- Tx1024Byte : 159
- Tx1518Byte : 21
- TxMaxByte : 1
- TxOverSize : 0
- TxByte : 1233825
- TxCollision : 0
- TxAbortCol : 0
- TxMultiCol : 0
- TxSingleCol : 0
- TxExcDefer : 0
- TxDefer : 0
- TxLateCol : 0
-
- pvid: 0
- link: port:0 link:up speed:1000baseT full-duplex txflow rxflow
- Port 1:
- mib: Port 1 MIB counters
- RxBroad : 0
- RxPause : 0
- RxMulti : 0
- RxFcsErr : 0
- RxAlignErr : 0
- RxRunt : 0
- RxFragment : 0
- Rx64Byte : 0
- Rx128Byte : 0
- Rx256Byte : 0
- Rx512Byte : 0
- Rx1024Byte : 0
- Rx1518Byte : 0
- RxMaxByte : 0
- RxTooLong : 0
- RxGoodByte : 0
- RxBadByte : 0
- RxOverFlow : 0
- Filtered : 0
- TxBroad : 0
- TxPause : 0
- TxMulti : 0
- TxUnderRun : 0
- Tx64Byte : 0
- Tx128Byte : 0
- Tx256Byte : 0
- Tx512Byte : 0
- Tx1024Byte : 0
- Tx1518Byte : 0
- TxMaxByte : 0
- TxOverSize : 0
- TxByte : 0
- TxCollision : 0
- TxAbortCol : 0
- TxMultiCol : 0
- TxSingleCol : 0
- TxExcDefer : 0
- TxDefer : 0
- TxLateCol : 0
-
- pvid: 1
- link: port:1 link:down
- Port 2:
- mib: Port 2 MIB counters
- RxBroad : 3376
- RxPause : 0
- RxMulti : 3824
- RxFcsErr : 0
- RxAlignErr : 0
- RxRunt : 0
- RxFragment : 0
- Rx64Byte : 1545
- Rx128Byte : 3340
- Rx256Byte : 1592
- Rx512Byte : 1065
- Rx1024Byte : 156
- Rx1518Byte : 22
- RxMaxByte : 0
- RxTooLong : 0
- RxGoodByte : 1204383
- RxBadByte : 0
- RxOverFlow : 0
- Filtered : 8
- TxBroad : 36
- TxPause : 0
- TxMulti : 10
- TxUnderRun : 0
- Tx64Byte : 263
- Tx128Byte : 159
- Tx256Byte : 168
- Tx512Byte : 4
- Tx1024Byte : 0
- Tx1518Byte : 0
- TxMaxByte : 0
- TxOverSize : 0
- TxByte : 68312
- TxCollision : 0
- TxAbortCol : 0
- TxMultiCol : 0
- TxSingleCol : 0
- TxExcDefer : 0
- TxDefer : 0
- TxLateCol : 0
-
- pvid: 2
- link: port:2 link:up speed:1000baseT full-duplex auto
- Port 3:
- mib: Port 3 MIB counters
- RxBroad : 0
- RxPause : 0
- RxMulti : 0
- RxFcsErr : 0
- RxAlignErr : 0
- RxRunt : 0
- RxFragment : 0
- Rx64Byte : 0
- Rx128Byte : 0
- Rx256Byte : 0
- Rx512Byte : 0
- Rx1024Byte : 0
- Rx1518Byte : 0
- RxMaxByte : 0
- RxTooLong : 0
- RxGoodByte : 0
- RxBadByte : 0
- RxOverFlow : 0
- Filtered : 0
- TxBroad : 0
- TxPause : 0
- TxMulti : 0
- TxUnderRun : 0
- Tx64Byte : 0
- Tx128Byte : 0
- Tx256Byte : 0
- Tx512Byte : 0
- Tx1024Byte : 0
- Tx1518Byte : 0
- TxMaxByte : 0
- TxOverSize : 0
- TxByte : 0
- TxCollision : 0
- TxAbortCol : 0
- TxMultiCol : 0
- TxSingleCol : 0
- TxExcDefer : 0
- TxDefer : 0
- TxLateCol : 0
-
- pvid: 0
- link: port:3 link:down
- Port 4:
- mib: Port 4 MIB counters
- RxBroad : 0
- RxPause : 0
- RxMulti : 0
- RxFcsErr : 0
- RxAlignErr : 0
- RxRunt : 0
- RxFragment : 0
- Rx64Byte : 0
- Rx128Byte : 0
- Rx256Byte : 0
- Rx512Byte : 0
- Rx1024Byte : 0
- Rx1518Byte : 0
- RxMaxByte : 0
- RxTooLong : 0
- RxGoodByte : 0
- RxBadByte : 0
- RxOverFlow : 0
- Filtered : 0
- TxBroad : 0
- TxPause : 0
- TxMulti : 0
- TxUnderRun : 0
- Tx64Byte : 0
- Tx128Byte : 0
- Tx256Byte : 0
- Tx512Byte : 0
- Tx1024Byte : 0
- Tx1518Byte : 0
- TxMaxByte : 0
- TxOverSize : 0
- TxByte : 0
- TxCollision : 0
- TxAbortCol : 0
- TxMultiCol : 0
- TxSingleCol : 0
- TxExcDefer : 0
- TxDefer : 0
- TxLateCol : 0
-
- pvid: 0
- link: port:4 link:down
- Port 5:
- mib: Port 5 MIB counters
- RxBroad : 0
- RxPause : 0
- RxMulti : 0
- RxFcsErr : 0
- RxAlignErr : 0
- RxRunt : 0
- RxFragment : 0
- Rx64Byte : 0
- Rx128Byte : 0
- Rx256Byte : 0
- Rx512Byte : 0
- Rx1024Byte : 0
- Rx1518Byte : 0
- RxMaxByte : 0
- RxTooLong : 0
- RxGoodByte : 0
- RxBadByte : 0
- RxOverFlow : 0
- Filtered : 0
- TxBroad : 0
- TxPause : 0
- TxMulti : 0
- TxUnderRun : 0
- Tx64Byte : 0
- Tx128Byte : 0
- Tx256Byte : 0
- Tx512Byte : 0
- Tx1024Byte : 0
- Tx1518Byte : 0
- TxMaxByte : 0
- TxOverSize : 0
- TxByte : 0
- TxCollision : 0
- TxAbortCol : 0
- TxMultiCol : 0
- TxSingleCol : 0
- TxExcDefer : 0
- TxDefer : 0
- TxLateCol : 0
-
- pvid: 0
- link: port:5 link:down
- Port 6:
- mib: Port 6 MIB counters
- RxBroad : 0
- RxPause : 0
- RxMulti : 0
- RxFcsErr : 0
- RxAlignErr : 0
- RxRunt : 0
- RxFragment : 0
- Rx64Byte : 0
- Rx128Byte : 0
- Rx256Byte : 0
- Rx512Byte : 0
- Rx1024Byte : 0
- Rx1518Byte : 0
- RxMaxByte : 0
- RxTooLong : 0
- RxGoodByte : 0
- RxBadByte : 0
- RxOverFlow : 0
- Filtered : 0
- TxBroad : 0
- TxPause : 0
- TxMulti : 0
- TxUnderRun : 0
- Tx64Byte : 0
- Tx128Byte : 0
- Tx256Byte : 0
- Tx512Byte : 0
- Tx1024Byte : 0
- Tx1518Byte : 0
- TxMaxByte : 0
- TxOverSize : 0
- TxByte : 0
- TxCollision : 0
- TxAbortCol : 0
- TxMultiCol : 0
- TxSingleCol : 0
- TxExcDefer : 0
- TxDefer : 0
- TxLateCol : 0
-
- pvid: 0
- link: port:6 link:up speed:1000baseT full-duplex
- VLAN 1:
- vid: 1
- ports: 0t 1
- VLAN 2:
- vid: 2
- ports: 0t 2
Analysis
AR8327 driver locates kernel/drivers/net/phy/ar8216.c
in order to compatible to old AR8X16 device, max vlan id defined to 128.
give the patch here, in order to support VLANID > 128
- diff --git a/drivers/net/phy/ar8216.c b/drivers/net/phy/ar8216.c
- index 864b778..3e8ceed 100755
-
--- a/drivers/net/phy/ar8216.c
-
+++ b/drivers/net/phy/ar8216.c
-
@@ -41,7 +41,12 @@
- #endif
-
- /* size of the vlan table */
-
+#if OK_PATCH
-
+/* for AR8327 */
-
+#define AR8X16_MAX_VLANS 4096
-
+#else /* !OK_PATCH */
- #define AR8X16_MAX_VLANS 128
-
+#endif /* OK_PATCH */
- #define AR8X16_PROBE_RETRIES 10
- #define AR8X16_MAX_PORTS 8
tagged and untagged on the same port not working
analysis
- diff --git a/drivers/net/phy/ar8216.c b/drivers/net/phy/ar8216.c
- index 3e8ceed..33c873c 100755
-
--- a/drivers/net/phy/ar8216.c
-
+++ b/drivers/net/phy/ar8216.c
- @@ -84,7 +84,11 @@ struct ar8xxx_chip {
- u32 (*read_port_status)(struct ar8216_priv *priv, int port);
- int (*atu_flush)(struct ar8216_priv *priv);
- void (*vtu_flush)(struct ar8216_priv *priv);
-
+#if OK_PATCH
-
+ void (*vtu_load_vlan)(struct ar8216_priv *priv, u32 vlan);
-
+#else
- void (*vtu_load_vlan)(struct ar8216_priv *priv, u32 vid, u32 port_mask);
-
+#endif
- int (*atu_dump)(struct ar8216_priv *priv);
- int (*igmp_snooping)(struct ar8216_priv *priv, u32 enable);
-
- @@ -124,7 +128,12 @@ struct ar8216_priv {
- bool vlan;
- u16 vlan_id[AR8X16_MAX_VLANS];
- u8 vlan_table[AR8X16_MAX_VLANS];
-
- u8 vlan_tagged;
-
+#if OK_PATCH
-
+ u8 vlan_tagged_8216;
-
+ u8 vlan_tagged_8327[AR8X16_MAX_VLANS];
-
+#else
-
+ u8 vlan_tagged;
-
+#endif
- u16 pvid[AR8X16_MAX_PORTS];
- /* if set, the vlan interface is UP */
- u8 vlan_status[AR8X16_MAX_VLANS];
- @@ -631,7 +640,11 @@ ar8216_mangle_rx(struct net_device *dev, struct sk_buff *skb)
- port = buf[0] & 0xf;
-
- /* no need to fix up packets coming from a tagged source */
-
+#if OK_PATCH
-
+ if (priv->vlan_tagged_8216 & (1 << port))
-
+#else
- if (priv->vlan_tagged & (1 << port))
-
+#endif
- return;
-
- /* lookup port vid from local table, the switch passes an invalid vlan id */
- @@ -685,9 +698,17 @@ ar8216_vtu_flush(struct ar8216_priv *priv)
- }
-
- static void
-
+#if OK_PATCH
-
+ar8216_vtu_load_vlan(struct ar8216_priv *priv, u32 vlan)
-
+#else
- ar8216_vtu_load_vlan(struct ar8216_priv *priv, u32 vid, u32 port_mask)
-
+#endif
- {
-
- u32 op;
-
+ u32 op;
-
+#if OK_PATCH
-
+ u32 vid = priv->vlan_id[vlan];
-
+ u32 port_mask = priv->vlan_table[vlan];
-
+#endif
-
- op = AR8216_VTU_OP_LOAD | (vid << AR8216_VTU_VID_S);
- ar8216_vtu_op(priv, op, port_mask);
- @@ -1609,11 +1630,20 @@ ar8327_vtu_flush(struct ar8216_priv *priv)
- }
-
- static void
-
+#if OK_PATCH
-
+ar8327_vtu_load_vlan(struct ar8216_priv *priv, u32 vlan)
-
+#else
- ar8327_vtu_load_vlan(struct ar8216_priv *priv, u32 vid, u32 port_mask)
-
+#endif
- {
- u32 op;
- u32 val;
-
- int i;
-
+ int i;
-
+#if OK_PATCH
-
+ u32 vid = priv->vlan_id[vlan];
-
+ u32 port_mask = priv->vlan_table[vlan];
-
+ u32 tagged = priv->vlan_tagged_8327[vlan];
-
+#endif
-
- op = AR8327_VTU_FUNC1_OP_LOAD | (vid << AR8327_VTU_FUNC1_VID_S);
- val = AR8327_VTU_FUNC0_VALID | AR8327_VTU_FUNC0_IVL;
- @@ -1622,9 +1652,13 @@ ar8327_vtu_load_vlan(struct ar8216_priv *priv, u32 vid, u32 port_mask)
-
- if ((port_mask & BIT(i)) == 0)
- mode = AR8327_VTU_FUNC0_EG_MODE_NOT;
-
- else if (priv->vlan == 0)
-
- mode = AR8327_VTU_FUNC0_EG_MODE_KEEP;
-
- else if (priv->vlan_tagged & BIT(i))
-
+ else if (priv->vlan == 0)
-
+ mode = AR8327_VTU_FUNC0_EG_MODE_KEEP;
-
+#if OK_PATCH
-
+ else if (tagged& BIT(i))
-
+#else
-
+ else if (priv->vlan_tagged & BIT(i))
-
+#endif
- mode = AR8327_VTU_FUNC0_EG_MODE_TAG;
- else
- mode = AR8327_VTU_FUNC0_EG_MODE_UNTAG;
- @@ -1638,13 +1672,26 @@ static void
- ar8327_setup_port(struct ar8216_priv *priv, int port, u32 egress, u32 ingress,
- u32 members, u32 pvid)
- {
-
- u32 t;
-
- u32 mode;
-
+ u32 t;
-
+ u32 mode;
-
+
-
+#if OK_PATCH
-
+ if (priv->vlan) {
-
+ pvid = priv->vlan_id[priv->pvid[port]];
-
+ mode = AR8327_PORT_VLAN1_OUT_MODE_UNMOD;
-
+ ingress = AR8216_IN_SECURE;
-
+ } else {
-
+ pvid = port;
-
+ mode = AR8327_PORT_VLAN1_OUT_MODE_UNTOUCH;
-
+ ingress = AR8216_IN_PORT_ONLY;
-
+ }
-
+#endif
-
- t = pvid << AR8327_PORT_VLAN0_DEF_SVID_S;
- t |= pvid << AR8327_PORT_VLAN0_DEF_CVID_S;
- priv->write(priv, AR8327_REG_PORT_VLAN0(port), t);
-
-
+#if !OK_PATCH
- mode = AR8327_PORT_VLAN1_OUT_MODE_UNMOD;
- switch (egress) {
- case AR8216_OUT_KEEP:
- @@ -1657,6 +1704,7 @@ ar8327_setup_port(struct ar8216_priv *priv, int port, u32 egress, u32 ingress,
- mode = AR8327_PORT_VLAN1_OUT_MODE_TAG;
- break;
- }
-
+#endif
-
- t = AR8327_PORT_VLAN1_PORT_VLAN_PROP;
- t |= mode << AR8327_PORT_VLAN1_OUT_MODE_S;
- @@ -1813,22 +1861,40 @@ ar8216_sw_get_port_link(struct switch_dev *dev, int port,
- }
-
- static int
-
+#if OK_PATCH
-
+ar8xxx_sw_get_ports(struct switch_val *val, int ports, u8 port_mask, u8 tagged)
-
+#else
- ar8216_sw_get_ports(struct switch_dev *dev, struct switch_val *val)
-
+#endif
- {
-
+#if !OK_PATCH
- struct ar8216_priv *priv = to_ar8216(dev);
- u8 ports = priv->vlan_table[val->port_vlan];
-
+#endif
- int i;
-
- val->len = 0;
-
+#if OK_PATCH
-
+ for (i = 0; i < ports; i++) {
-
+#else
- for (i = 0; i < dev->ports; i++) {
-
+#endif
- struct switch_port *p;
-
-
- if (!(ports & (1 << i)))
-
- continue;
-
+#if OK_PATCH
-
+ if (!(port_mask & (1 << i)))
-
+#else
-
+ if (!(ports & (1 << i)))
-
+#endif
-
+ continue;
-
- p = &val->value.ports[val->len++];
- p->id = i;
-
- if (priv->vlan_tagged & (1 << i))
-
+#if OK_PATCH
-
+ if (tagged & BIT(i))
-
+#else
-
+ if (priv->vlan_tagged & (1 << i))
-
+#endif
- p->flags = (1 << SWITCH_PORT_FLAG_TAGGED);
- else
- p->flags = 0;
- @@ -1840,17 +1906,42 @@ static int
- ar8216_sw_set_ports(struct switch_dev *dev, struct switch_val *val)
- {
- struct ar8216_priv *priv = to_ar8216(dev);
-
- u8 *vt = &priv->vlan_table[val->port_vlan];
-
+ u8 *vt = &priv->vlan_table[val->port_vlan];
-
+#if OK_PATCH
-
+ u8 *tagged = &priv->vlan_tagged_8216;
-
+#endif
- int i, j;
-
- *vt = 0;
- for (i = 0; i < val->len; i++) {
- struct switch_port *p = &val->value.ports[i];
-
-
+#if OK_PATCH
-
+ if (p->flags & BIT(SWITCH_PORT_FLAG_TAGGED)) {
-
+
-
+ /* if port was untagged before then
-
+ * remove him from other vlans */
-
+ if(*tagged & BIT(p->id)){
-
+ for (j = 0; j < AR8X16_MAX_VLANS; j++) {
-
+ if (j == val->port_vlan)
-
+ continue;
-
+
-
+ priv->vlan_table[j] &= ~(BIT(p->id));
-
+ }
-
+ }
-
+
-
+ *tagged |= BIT(p->id);
-
+
-
+#else
- if (p->flags & (1 << SWITCH_PORT_FLAG_TAGGED)) {
- priv->vlan_tagged |= (1 << p->id);
-
+#endif
- } else {
-
- priv->vlan_tagged &= ~(1 << p->id);
-
+#if OK_PATCH
-
+ *tagged &= ~(BIT(p->id));
-
+#else
-
+ priv->vlan_tagged &= ~(1 << p->id);
-
+#endif
- priv->pvid[p->id] = val->port_vlan;
-
- /* make sure that an untagged port does not
- @@ -1867,6 +1958,54 @@ ar8216_sw_set_ports(struct switch_dev *dev, struct switch_val *val)
- return 0;
- }
-
-
+#if OK_PATCH
-
+ static int
-
+ar8327_sw_set_ports(struct switch_dev *dev, struct switch_val *val)
-
+{
-
+ struct ar8216_priv *priv = to_ar8216(dev);
-
+ u8 *vt = &priv->vlan_table[val->port_vlan];
-
+ u8 *vlan_tagged = priv->vlan_tagged_8327;
-
+ u8 *tagged = &vlan_tagged[val->port_vlan];
-
+
-
+ int i;
-
+
-
+ *vt = 0;
-
+ *tagged = 0;
-
+ for (i = 0; i < val->len; i++) {
-
+ struct switch_port *p = &val->value.ports[i];
-
+
-
+ if (p->flags & BIT(SWITCH_PORT_FLAG_TAGGED)) {
-
+ *tagged |= BIT(p->id);
-
+ } else {
-
+ priv->pvid[p->id] = val->port_vlan;
-
+ }
-
+
-
+ *vt |= BIT(p->id);
-
+ }
-
+ return 0;
-
+}
-
+ static int
-
+ar8216_sw_get_ports(struct switch_dev *dev, struct switch_val *val)
-
+{
-
+ int ports = dev->ports;
-
+ struct ar8216_priv *priv = to_ar8216(dev);
-
+ u8 port_mask = priv->vlan_table[val->port_vlan];
-
+ u8 tagged = priv->vlan_tagged_8216;
-
+
-
+ return ar8xxx_sw_get_ports(val, ports, port_mask, tagged);
-
+}
-
+ static int
-
+ar8327_sw_get_ports(struct switch_dev *dev, struct switch_val *val)
-
+{
-
+ int ports = dev->ports;
-
+ struct ar8216_priv *priv = to_ar8216(dev);
-
+ u8 port_mask = priv->vlan_table[val->port_vlan];
-
+ u8 tagged = priv->vlan_tagged_8327[val->port_vlan];
-
+
-
+ return ar8xxx_sw_get_ports(val, ports, port_mask, tagged);
-
+}
-
+#endif
-
+
- static int
- ar8216_sw_hw_apply(struct switch_dev *dev)
- {
- @@ -1894,8 +2033,12 @@ ar8216_sw_hw_apply(struct switch_dev *dev)
- portmask[i] |= vp & ~mask;
- }
-
-
- priv->chip->vtu_load_vlan(priv, priv->vlan_id[j],
-
- priv->vlan_table[j]);
-
+#if OK_PATCH
-
+ priv->chip->vtu_load_vlan(priv, j);
-
+#else
-
+ priv->chip->vtu_load_vlan(priv, priv->vlan_id[j],
-
+ priv->vlan_table[j]);
-
+#endif
- }
- } else {
- /* vlan disabled:
- @@ -1916,7 +2059,11 @@ ar8216_sw_hw_apply(struct switch_dev *dev)
-
- if (priv->vlan) {
- pvid = priv->vlan_id[priv->pvid[i]];
-
+#if OK_PATCH
-
+ if (priv->vlan_tagged_8216 & (1 << i))
-
+#else
- if (priv->vlan_tagged & (1 << i))
-
+#endif
- egress = AR8216_OUT_ADD_VLAN;
- else
- egress = AR8216_OUT_STRIP_VLAN;
- @@ -2267,6 +2414,30 @@ static const struct switch_dev_ops ar8216_sw_ops = {
- .set_reg_val = ar8216_sw_set_reg_val,
- };
-
-
+#if OK_PATCH
-
+static const struct switch_dev_ops ar8327_sw_ops = {
-
+ .attr_global = {
-
+ .attr = ar8216_globals,
-
+ .n_attr = ARRAY_SIZE(ar8216_globals),
-
+ },
-
+ .attr_port = {
-
+ .attr = ar8216_port,
-
+ .n_attr = ARRAY_SIZE(ar8216_port),
-
+ },
-
+ .attr_vlan = {
-
+ .attr = ar8216_vlan,
-
+ .n_attr = ARRAY_SIZE(ar8216_vlan),
-
+ },
-
+ .get_port_pvid = ar8216_sw_get_pvid,
-
+ .set_port_pvid = ar8216_sw_set_pvid,
-
+ .get_vlan_ports = ar8327_sw_get_ports,
-
+ .set_vlan_ports = ar8327_sw_set_ports,
-
+ .apply_config = ar8216_sw_hw_apply,
-
+ .reset_switch = ar8216_sw_reset_switch,
-
+ .get_port_link = ar8216_sw_get_port_link,
-
+};
-
+#endif
-
+
- static int
- ar8216_id_chip(struct ar8216_priv *priv)
- {
- @@ -2757,8 +2928,15 @@ ar8216_config_init(struct phy_device *pdev)
- pdev->priv = priv;
-
- swdev = &priv->dev;
-
- swdev->cpu_port = AR8216_PORT_CPU;
-
+ swdev->cpu_port = AR8216_PORT_CPU;
-
+#if OK_PATCH
-
+ if(chip_is_ar8327(priv) || chip_is_ar8337(priv))
-
+ swdev->ops = &ar8327_sw_ops;
-
+ else
-
+ swdev->ops = &ar8216_sw_ops;
-
+#else
- swdev->ops = &ar8216_sw_ops;
-
+#endif
- swdev->ports = AR8216_NUM_PORTS;
-
- if (chip_is_ar8316(priv)) {
nicephil@gmail.com 2017-3-23