|
|
@@ -1435,23 +1435,12 @@ qca8k_port_fdb_dump(struct dsa_switch *ds, int port,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
|
|
|
-static int
|
|
|
-qca8k_port_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
|
|
|
- struct switchdev_trans *trans)
|
|
|
-#else
|
|
|
static int
|
|
|
qca8k_port_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
|
|
|
struct netlink_ext_ack *extack)
|
|
|
-#endif
|
|
|
{
|
|
|
struct qca8k_priv *priv = ds->priv;
|
|
|
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
|
|
|
- if (switchdev_trans_ph_prepare(trans))
|
|
|
- return 0;
|
|
|
-#endif
|
|
|
-
|
|
|
if (vlan_filtering) {
|
|
|
qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
|
|
|
QCA8K_PORT_LOOKUP_VLAN_MODE,
|
|
|
@@ -1465,70 +1454,32 @@ qca8k_port_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
|
|
|
-static int
|
|
|
-qca8k_port_vlan_prepare(struct dsa_switch *ds, int port,
|
|
|
- const struct switchdev_obj_port_vlan *vlan)
|
|
|
-{
|
|
|
- return 0;
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
|
|
|
-static void
|
|
|
-qca8k_port_vlan_add(struct dsa_switch *ds, int port,
|
|
|
- const struct switchdev_obj_port_vlan *vlan)
|
|
|
-#else
|
|
|
static int
|
|
|
qca8k_port_vlan_add(struct dsa_switch *ds, int port,
|
|
|
const struct switchdev_obj_port_vlan *vlan,
|
|
|
struct netlink_ext_ack *extack)
|
|
|
-#endif
|
|
|
{
|
|
|
bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
|
|
|
bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID;
|
|
|
struct qca8k_priv *priv = ds->priv;
|
|
|
int ret = 0;
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
|
|
|
- u16 vid;
|
|
|
|
|
|
- for (vid = vlan->vid_begin; vid <= vlan->vid_end && !ret; ++vid)
|
|
|
- ret = qca8k_vlan_add(priv, port, vid, untagged);
|
|
|
-#else
|
|
|
ret = qca8k_vlan_add(priv, port, vlan->vid, untagged);
|
|
|
-#endif
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
|
|
|
- if (ret)
|
|
|
- dev_err(priv->dev, "Failed to add VLAN to port %d (%d)", port, ret);
|
|
|
-#else
|
|
|
if (ret) {
|
|
|
dev_err(priv->dev, "Failed to add VLAN to port %d (%d)", port, ret);
|
|
|
return ret;
|
|
|
}
|
|
|
-#endif
|
|
|
|
|
|
if (pvid) {
|
|
|
int shift = 16 * (port % 2);
|
|
|
|
|
|
qca8k_rmw(priv, QCA8K_EGRESS_VLAN(port),
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
|
|
|
- 0xfff << shift,
|
|
|
- vlan->vid_end << shift);
|
|
|
-#else
|
|
|
0xfff << shift, vlan->vid << shift);
|
|
|
-#endif
|
|
|
qca8k_write(priv, QCA8K_REG_PORT_VLAN_CTRL0(port),
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
|
|
|
- QCA8K_PORT_VLAN_CVID(vlan->vid_end) |
|
|
|
- QCA8K_PORT_VLAN_SVID(vlan->vid_end));
|
|
|
-#else
|
|
|
QCA8K_PORT_VLAN_CVID(vlan->vid) |
|
|
|
QCA8K_PORT_VLAN_SVID(vlan->vid));
|
|
|
-#endif
|
|
|
}
|
|
|
-#if LINUX_VERSION_CODE > KERNEL_VERSION(5,12,0)
|
|
|
return 0;
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
static int
|
|
|
@@ -1537,14 +1488,8 @@ qca8k_port_vlan_del(struct dsa_switch *ds, int port,
|
|
|
{
|
|
|
struct qca8k_priv *priv = ds->priv;
|
|
|
int ret = 0;
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
|
|
|
- u16 vid;
|
|
|
|
|
|
- for (vid = vlan->vid_begin; vid <= vlan->vid_end && !ret; ++vid)
|
|
|
- ret = qca8k_vlan_del(priv, port, vid);
|
|
|
-#else
|
|
|
ret = qca8k_vlan_del(priv, port, vlan->vid);
|
|
|
-#endif
|
|
|
if (ret)
|
|
|
dev_err(priv->dev, "Failed to delete VLAN from port %d (%d)", port, ret);
|
|
|
|
|
|
@@ -1577,9 +1522,6 @@ static const struct dsa_switch_ops qca8k_switch_ops = {
|
|
|
.port_fdb_del = qca8k_port_fdb_del,
|
|
|
.port_fdb_dump = qca8k_port_fdb_dump,
|
|
|
.port_vlan_filtering = qca8k_port_vlan_filtering,
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
|
|
|
- .port_vlan_prepare = qca8k_port_vlan_prepare,
|
|
|
-#endif
|
|
|
.port_vlan_add = qca8k_port_vlan_add,
|
|
|
.port_vlan_del = qca8k_port_vlan_del,
|
|
|
.phylink_validate = qca8k_phylink_validate,
|