Skip to content

Commit 1b78629

Browse files
danish-tigregkh
authored andcommitted
net: ti: icssg-prueth: Fix HSR and switch offload Enablement during firwmare reload.
[ Upstream commit 01792bc ] To enable HSR / Switch offload, certain configurations are needed. Currently they are done inside icssg_change_mode(). This function only gets called if we move from one mode to another without bringing the links up / down. Once in HSR / Switch mode, if we bring the links down and bring it back up again. The callback sequence is, - emac_ndo_stop() Firmwares are stopped - emac_ndo_open() Firmwares are loaded In this path icssg_change_mode() doesn't get called and as a result the configurations needed for HSR / Switch is not done. To fix this, put all these configurations in a separate function icssg_enable_fw_offload() and call this from both icssg_change_mode() and emac_ndo_open() Fixes: 5637508 ("net: ti: icssg-prueth: Enable HSR Tx duplication, Tx Tag and Rx Tag offload") Signed-off-by: MD Danish Anwar <danishanwar@ti.com> Link: https://patch.msgid.link/20250814105106.1491871-1-danishanwar@ti.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 94731cc commit 1b78629

File tree

1 file changed

+41
-31
lines changed

1 file changed

+41
-31
lines changed

drivers/net/ethernet/ti/icssg/icssg_prueth.c

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,44 @@ static void prueth_emac_stop(struct prueth *prueth)
240240
}
241241
}
242242

243+
static void icssg_enable_fw_offload(struct prueth *prueth)
244+
{
245+
struct prueth_emac *emac;
246+
int mac;
247+
248+
for (mac = PRUETH_MAC0; mac < PRUETH_NUM_MACS; mac++) {
249+
emac = prueth->emac[mac];
250+
if (prueth->is_hsr_offload_mode) {
251+
if (emac->ndev->features & NETIF_F_HW_HSR_TAG_RM)
252+
icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE);
253+
else
254+
icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE);
255+
}
256+
257+
if (prueth->is_switch_mode || prueth->is_hsr_offload_mode) {
258+
if (netif_running(emac->ndev)) {
259+
icssg_fdb_add_del(emac, eth_stp_addr, prueth->default_vlan,
260+
ICSSG_FDB_ENTRY_P0_MEMBERSHIP |
261+
ICSSG_FDB_ENTRY_P1_MEMBERSHIP |
262+
ICSSG_FDB_ENTRY_P2_MEMBERSHIP |
263+
ICSSG_FDB_ENTRY_BLOCK,
264+
true);
265+
icssg_vtbl_modify(emac, emac->port_vlan | DEFAULT_VID,
266+
BIT(emac->port_id) | DEFAULT_PORT_MASK,
267+
BIT(emac->port_id) | DEFAULT_UNTAG_MASK,
268+
true);
269+
if (prueth->is_hsr_offload_mode)
270+
icssg_vtbl_modify(emac, DEFAULT_VID,
271+
DEFAULT_PORT_MASK,
272+
DEFAULT_UNTAG_MASK, true);
273+
icssg_set_pvid(prueth, emac->port_vlan, emac->port_id);
274+
if (prueth->is_switch_mode)
275+
icssg_set_port_state(emac, ICSSG_EMAC_PORT_VLAN_AWARE_ENABLE);
276+
}
277+
}
278+
}
279+
}
280+
243281
static int prueth_emac_common_start(struct prueth *prueth)
244282
{
245283
struct prueth_emac *emac;
@@ -690,6 +728,7 @@ static int emac_ndo_open(struct net_device *ndev)
690728
ret = prueth_emac_common_start(prueth);
691729
if (ret)
692730
goto free_rx_irq;
731+
icssg_enable_fw_offload(prueth);
693732
}
694733

695734
flow_cfg = emac->dram.va + ICSSG_CONFIG_OFFSET + PSI_L_REGULAR_FLOW_ID_BASE_OFFSET;
@@ -1146,44 +1185,15 @@ static int prueth_emac_restart(struct prueth *prueth)
11461185

11471186
static void icssg_change_mode(struct prueth *prueth)
11481187
{
1149-
struct prueth_emac *emac;
1150-
int mac, ret;
1188+
int ret;
11511189

11521190
ret = prueth_emac_restart(prueth);
11531191
if (ret) {
11541192
dev_err(prueth->dev, "Failed to restart the firmwares, aborting the process");
11551193
return;
11561194
}
11571195

1158-
for (mac = PRUETH_MAC0; mac < PRUETH_NUM_MACS; mac++) {
1159-
emac = prueth->emac[mac];
1160-
if (prueth->is_hsr_offload_mode) {
1161-
if (emac->ndev->features & NETIF_F_HW_HSR_TAG_RM)
1162-
icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE);
1163-
else
1164-
icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE);
1165-
}
1166-
1167-
if (netif_running(emac->ndev)) {
1168-
icssg_fdb_add_del(emac, eth_stp_addr, prueth->default_vlan,
1169-
ICSSG_FDB_ENTRY_P0_MEMBERSHIP |
1170-
ICSSG_FDB_ENTRY_P1_MEMBERSHIP |
1171-
ICSSG_FDB_ENTRY_P2_MEMBERSHIP |
1172-
ICSSG_FDB_ENTRY_BLOCK,
1173-
true);
1174-
icssg_vtbl_modify(emac, emac->port_vlan | DEFAULT_VID,
1175-
BIT(emac->port_id) | DEFAULT_PORT_MASK,
1176-
BIT(emac->port_id) | DEFAULT_UNTAG_MASK,
1177-
true);
1178-
if (prueth->is_hsr_offload_mode)
1179-
icssg_vtbl_modify(emac, DEFAULT_VID,
1180-
DEFAULT_PORT_MASK,
1181-
DEFAULT_UNTAG_MASK, true);
1182-
icssg_set_pvid(prueth, emac->port_vlan, emac->port_id);
1183-
if (prueth->is_switch_mode)
1184-
icssg_set_port_state(emac, ICSSG_EMAC_PORT_VLAN_AWARE_ENABLE);
1185-
}
1186-
}
1196+
icssg_enable_fw_offload(prueth);
11871197
}
11881198

11891199
static int prueth_netdevice_port_link(struct net_device *ndev,

0 commit comments

Comments
 (0)