Skip to content

Commit 1c9017e

Browse files
vladimirolteankuba-moo
authored andcommitted
net: dsa: felix: keep reference on entire tc-taprio config
In a future change we will need to remember the entire tc-taprio config on all ports rather than just the base time, so use the taprio_offload_get() helper function to replace ocelot_port->base_time with ocelot_port->taprio. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent c7e5c42 commit 1c9017e

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

drivers/net/dsa/ocelot/felix_vsc9959.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,9 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port,
12101210
QSYS_TAG_CONFIG_INIT_GATE_STATE_M,
12111211
QSYS_TAG_CONFIG, port);
12121212

1213+
taprio_offload_free(ocelot_port->taprio);
1214+
ocelot_port->taprio = NULL;
1215+
12131216
mutex_unlock(&ocelot->tas_lock);
12141217
return 0;
12151218
}
@@ -1258,8 +1261,6 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port,
12581261
QSYS_TAG_CONFIG_SCH_TRAFFIC_QUEUES_M,
12591262
QSYS_TAG_CONFIG, port);
12601263

1261-
ocelot_port->base_time = taprio->base_time;
1262-
12631264
vsc9959_new_base_time(ocelot, taprio->base_time,
12641265
taprio->cycle_time, &base_ts);
12651266
ocelot_write(ocelot, base_ts.tv_nsec, QSYS_PARAM_CFG_REG_1);
@@ -1282,6 +1283,10 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port,
12821283
ret = readx_poll_timeout(vsc9959_tas_read_cfg_status, ocelot, val,
12831284
!(val & QSYS_TAS_PARAM_CFG_CTRL_CONFIG_CHANGE),
12841285
10, 100000);
1286+
if (ret)
1287+
goto err;
1288+
1289+
ocelot_port->taprio = taprio_offload_get(taprio);
12851290

12861291
err:
12871292
mutex_unlock(&ocelot->tas_lock);
@@ -1291,17 +1296,18 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port,
12911296

12921297
static void vsc9959_tas_clock_adjust(struct ocelot *ocelot)
12931298
{
1299+
struct tc_taprio_qopt_offload *taprio;
12941300
struct ocelot_port *ocelot_port;
12951301
struct timespec64 base_ts;
1296-
u64 cycletime;
12971302
int port;
12981303
u32 val;
12991304

13001305
mutex_lock(&ocelot->tas_lock);
13011306

13021307
for (port = 0; port < ocelot->num_phys_ports; port++) {
1303-
val = ocelot_read_rix(ocelot, QSYS_TAG_CONFIG, port);
1304-
if (!(val & QSYS_TAG_CONFIG_ENABLE))
1308+
ocelot_port = ocelot->ports[port];
1309+
taprio = ocelot_port->taprio;
1310+
if (!taprio)
13051311
continue;
13061312

13071313
ocelot_rmw(ocelot,
@@ -1315,11 +1321,8 @@ static void vsc9959_tas_clock_adjust(struct ocelot *ocelot)
13151321
QSYS_TAG_CONFIG_INIT_GATE_STATE_M,
13161322
QSYS_TAG_CONFIG, port);
13171323

1318-
cycletime = ocelot_read(ocelot, QSYS_PARAM_CFG_REG_4);
1319-
ocelot_port = ocelot->ports[port];
1320-
1321-
vsc9959_new_base_time(ocelot, ocelot_port->base_time,
1322-
cycletime, &base_ts);
1324+
vsc9959_new_base_time(ocelot, taprio->base_time,
1325+
taprio->cycle_time, &base_ts);
13231326

13241327
ocelot_write(ocelot, base_ts.tv_nsec, QSYS_PARAM_CFG_REG_1);
13251328
ocelot_write(ocelot, lower_32_bits(base_ts.tv_sec),

include/soc/mscc/ocelot.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,8 @@ struct ocelot_port {
670670
/* VLAN that untagged frames are classified to, on ingress */
671671
const struct ocelot_bridge_vlan *pvid_vlan;
672672

673+
struct tc_taprio_qopt_offload *taprio;
674+
673675
phy_interface_t phy_mode;
674676

675677
unsigned int ptp_skbs_in_flight;
@@ -692,9 +694,6 @@ struct ocelot_port {
692694
int bridge_num;
693695

694696
int speed;
695-
696-
/* Store the AdminBaseTime of EST fetched from userspace. */
697-
s64 base_time;
698697
};
699698

700699
struct ocelot {

0 commit comments

Comments
 (0)