Commit 7e708760 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski

net: mscc: ocelot: move ocelot_port_private :: chip_port to ocelot_port :: index

Currently the ocelot switch lib is unaware of the index of a struct
ocelot_port, since that is kept in the encapsulating structures of outer
drivers (struct dsa_port :: index, struct ocelot_port_private :: chip_port).

With the upcoming increase in complexity associated with assigning DSA
tag_8021q CPU ports to certain user ports, it becomes necessary for the
switch lib to be able to retrieve the index of a certain ocelot_port.

Therefore, introduce a new u8 to ocelot_port (same size as the chip_port
used by the ocelot switchdev driver) and rework the existing code to
populate and use it.
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 6d0be600
...@@ -1249,6 +1249,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) ...@@ -1249,6 +1249,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)
ocelot_port->phy_mode = port_phy_modes[port]; ocelot_port->phy_mode = port_phy_modes[port];
ocelot_port->ocelot = ocelot; ocelot_port->ocelot = ocelot;
ocelot_port->target = target; ocelot_port->target = target;
ocelot_port->index = port;
ocelot->ports[port] = ocelot_port; ocelot->ports[port] = ocelot_port;
} }
......
...@@ -48,7 +48,6 @@ struct ocelot_port_private { ...@@ -48,7 +48,6 @@ struct ocelot_port_private {
struct net_device *dev; struct net_device *dev;
struct phylink *phylink; struct phylink *phylink;
struct phylink_config phylink_config; struct phylink_config phylink_config;
u8 chip_port;
struct ocelot_port_tc tc; struct ocelot_port_tc tc;
}; };
......
This diff is collapsed.
...@@ -675,6 +675,8 @@ struct ocelot_port { ...@@ -675,6 +675,8 @@ struct ocelot_port {
u8 ptp_cmd; u8 ptp_cmd;
u8 ts_id; u8 ts_id;
u8 index;
u8 stp_state; u8 stp_state;
bool vlan_aware; bool vlan_aware;
bool is_dsa_8021q_cpu; bool is_dsa_8021q_cpu;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment