return 0;
}
-static const struct dsa_8021q_ops felix_tag_8021q_ops = {
- .vlan_add = felix_tag_8021q_vlan_add,
- .vlan_del = felix_tag_8021q_vlan_del,
-};
-
/* Alternatively to using the NPI functionality, that same hardware MAC
* connected internally to the enetc or fman DSA master can be configured to
* use the software-defined tag_8021q frame format. As far as the hardware is
ocelot_rmw_rix(ocelot, 0, cpu_flood, ANA_PGID_PGID, PGID_MC);
ocelot_rmw_rix(ocelot, 0, cpu_flood, ANA_PGID_PGID, PGID_BC);
- err = dsa_tag_8021q_register(ds, &felix_tag_8021q_ops,
- htons(ETH_P_8021AD));
+ err = dsa_tag_8021q_register(ds, htons(ETH_P_8021AD));
if (err)
return err;
.port_mrp_del = felix_mrp_del,
.port_mrp_add_ring_role = felix_mrp_add_ring_role,
.port_mrp_del_ring_role = felix_mrp_del_ring_role,
+ .tag_8021q_vlan_add = felix_tag_8021q_vlan_add,
+ .tag_8021q_vlan_del = felix_tag_8021q_vlan_del,
};
struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port)
return sja1105_build_vlan_table(priv, true);
}
-static const struct dsa_8021q_ops sja1105_dsa_8021q_ops = {
- .vlan_add = sja1105_dsa_8021q_vlan_add,
- .vlan_del = sja1105_dsa_8021q_vlan_del,
-};
-
/* The programming model for the SJA1105 switch is "all-at-once" via static
* configuration tables. Some of these can be dynamically modified at runtime,
* but not the xMII mode parameters table.
.crosschip_bridge_join = sja1105_crosschip_bridge_join,
.crosschip_bridge_leave = sja1105_crosschip_bridge_leave,
.devlink_info_get = sja1105_devlink_info_get,
+ .tag_8021q_vlan_add = sja1105_dsa_8021q_vlan_add,
+ .tag_8021q_vlan_del = sja1105_dsa_8021q_vlan_del,
};
static const struct of_device_id sja1105_dt_ids[];
mutex_init(&priv->ptp_data.lock);
mutex_init(&priv->mgmt_lock);
- rc = dsa_tag_8021q_register(ds, &sja1105_dsa_8021q_ops,
- htons(ETH_P_8021Q));
+ rc = dsa_tag_8021q_register(ds, htons(ETH_P_8021Q));
if (rc)
return rc;
refcount_t refcount;
};
-struct dsa_8021q_ops {
- int (*vlan_add)(struct dsa_switch *ds, int port, u16 vid, u16 flags);
- int (*vlan_del)(struct dsa_switch *ds, int port, u16 vid);
-};
-
struct dsa_8021q_context {
- const struct dsa_8021q_ops *ops;
struct dsa_switch *ds;
struct list_head crosschip_links;
/* EtherType of RX VID, used for filtering on master interface */
__be16 proto;
};
-int dsa_tag_8021q_register(struct dsa_switch *ds,
- const struct dsa_8021q_ops *ops,
- __be16 proto);
+int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto);
void dsa_tag_8021q_unregister(struct dsa_switch *ds);
const struct switchdev_obj_ring_role_mrp *mrp);
int (*port_mrp_del_ring_role)(struct dsa_switch *ds, int port,
const struct switchdev_obj_ring_role_mrp *mrp);
+
+ /*
+ * tag_8021q operations
+ */
+ int (*tag_8021q_vlan_add)(struct dsa_switch *ds, int port, u16 vid,
+ u16 flags);
+ int (*tag_8021q_vlan_del)(struct dsa_switch *ds, int port, u16 vid);
};
#define DSA_DEVLINK_PARAM_DRIVER(_id, _name, _type, _cmodes) \
static int dsa_8021q_vid_apply(struct dsa_switch *ds, int port, u16 vid,
u16 flags, bool enabled)
{
- struct dsa_8021q_context *ctx = ds->tag_8021q_ctx;
struct dsa_port *dp = dsa_to_port(ds, port);
if (enabled)
- return ctx->ops->vlan_add(ctx->ds, dp->index, vid, flags);
+ return ds->ops->tag_8021q_vlan_add(ds, dp->index, vid, flags);
- return ctx->ops->vlan_del(ctx->ds, dp->index, vid);
+ return ds->ops->tag_8021q_vlan_del(ds, dp->index, vid);
}
/* RX VLAN tagging (left) and TX VLAN tagging (right) setup shown for a single
}
EXPORT_SYMBOL_GPL(dsa_8021q_crosschip_bridge_leave);
-int dsa_tag_8021q_register(struct dsa_switch *ds,
- const struct dsa_8021q_ops *ops,
- __be16 proto)
+int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto)
{
struct dsa_8021q_context *ctx;
if (!ctx)
return -ENOMEM;
- ctx->ops = ops;
ctx->proto = proto;
ctx->ds = ds;