Lines Matching +full:disabled +full:- +full:ports

1 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
3 * Hardware library for MAC Merge Layer and Frame Preemption on TSN-capable
6 * Copyright 2022-2023 NXP
28 return "DISABLED"; in mm_verify_state_to_string()
54 struct ocelot_port *ocelot_port = ocelot->ports[port]; in ocelot_port_update_active_preemptible_tcs()
55 struct ocelot_mm_state *mm = &ocelot->mm[port]; in ocelot_port_update_active_preemptible_tcs()
58 lockdep_assert_held(&ocelot->fwd_domain_lock); in ocelot_port_update_active_preemptible_tcs()
65 if ((ocelot_port->phy_mode != PHY_INTERFACE_MODE_QSGMII || in ocelot_port_update_active_preemptible_tcs()
66 ocelot_port->speed == SPEED_1000) && mm->tx_active) in ocelot_port_update_active_preemptible_tcs()
67 val = mm->preemptible_tcs; in ocelot_port_update_active_preemptible_tcs()
70 * so first make sure it is disabled. Also, changing the preemptible in ocelot_port_update_active_preemptible_tcs()
72 * re-triggered. And since tas_guard_bands_update() also implicitly in ocelot_port_update_active_preemptible_tcs()
75 mm->active_preemptible_tcs = val; in ocelot_port_update_active_preemptible_tcs()
76 ocelot->ops->tas_guard_bands_update(ocelot, port); in ocelot_port_update_active_preemptible_tcs()
78 dev_dbg(ocelot->dev, in ocelot_port_update_active_preemptible_tcs()
80 port, phy_modes(ocelot_port->phy_mode), in ocelot_port_update_active_preemptible_tcs()
81 phy_speed_to_str(ocelot_port->speed), in ocelot_port_update_active_preemptible_tcs()
82 mm->tx_active ? "active" : "inactive", mm->preemptible_tcs, in ocelot_port_update_active_preemptible_tcs()
83 mm->active_preemptible_tcs); in ocelot_port_update_active_preemptible_tcs()
93 struct ocelot_mm_state *mm = &ocelot->mm[port]; in ocelot_port_change_fp()
95 lockdep_assert_held(&ocelot->fwd_domain_lock); in ocelot_port_change_fp()
97 if (mm->preemptible_tcs == preemptible_tcs) in ocelot_port_change_fp()
100 mm->preemptible_tcs = preemptible_tcs; in ocelot_port_change_fp()
107 struct ocelot_port *ocelot_port = ocelot->ports[port]; in ocelot_mm_update_port_status()
108 struct ocelot_mm_state *mm = &ocelot->mm[port]; in ocelot_mm_update_port_status()
112 if (!mm->tx_enabled) in ocelot_mm_update_port_status()
118 if (mm->verify_status != verify_status) { in ocelot_mm_update_port_status()
119 dev_dbg(ocelot->dev, in ocelot_mm_update_port_status()
122 mm->verify_status = verify_status; in ocelot_mm_update_port_status()
126 mm->tx_active = !!(val & DEV_MM_STAT_MM_STATUS_PRMPT_ACTIVE_STATUS); in ocelot_mm_update_port_status()
128 dev_dbg(ocelot->dev, "Port %d TX preemption %s\n", in ocelot_mm_update_port_status()
129 port, mm->tx_active ? "active" : "inactive"); in ocelot_mm_update_port_status()
136 dev_err(ocelot->dev, in ocelot_mm_update_port_status()
137 …"Unexpected P-frame received on port %d while verification was unsuccessful or not yet verified\n", in ocelot_mm_update_port_status()
144 dev_err(ocelot->dev, in ocelot_mm_update_port_status()
145 …"Unexpected P-frame requested to be transmitted on port %d while verification was unsuccessful or … in ocelot_mm_update_port_status()
159 mutex_lock(&ocelot->fwd_domain_lock); in ocelot_mm_irq()
161 for (port = 0; port < ocelot->num_phys_ports; port++) in ocelot_mm_irq()
164 mutex_unlock(&ocelot->fwd_domain_lock); in ocelot_mm_irq()
172 struct ocelot_port *ocelot_port = ocelot->ports[port]; in ocelot_port_set_mm()
177 if (!ocelot->mm_supported) in ocelot_port_set_mm()
178 return -EOPNOTSUPP; in ocelot_port_set_mm()
180 mm = &ocelot->mm[port]; in ocelot_port_set_mm()
182 err = ethtool_mm_frag_size_min_to_add(cfg->tx_min_frag_size, in ocelot_port_set_mm()
187 if (cfg->pmac_enabled) in ocelot_port_set_mm()
190 if (cfg->tx_enabled) in ocelot_port_set_mm()
193 if (!cfg->verify_enabled) in ocelot_port_set_mm()
196 mutex_lock(&ocelot->fwd_domain_lock); in ocelot_port_set_mm()
204 DEV_MM_CONFIG_VERIF_CONFIG_PRM_VERIFY_TIME(cfg->verify_time), in ocelot_port_set_mm()
215 /* The switch will emit an IRQ when TX is disabled, to notify that it in ocelot_port_set_mm()
217 * not bother processing MM IRQs at all for ports with TX disabled, in ocelot_port_set_mm()
218 * but we need to ACK this IRQ now, while mm->tx_enabled is still set, in ocelot_port_set_mm()
221 if (mm->tx_enabled && !cfg->tx_enabled) { in ocelot_port_set_mm()
223 WARN_ON(mm->tx_active); in ocelot_port_set_mm()
226 mm->tx_enabled = cfg->tx_enabled; in ocelot_port_set_mm()
228 mutex_unlock(&ocelot->fwd_domain_lock); in ocelot_port_set_mm()
237 struct ocelot_port *ocelot_port = ocelot->ports[port]; in ocelot_port_get_mm()
241 if (!ocelot->mm_supported) in ocelot_port_get_mm()
242 return -EOPNOTSUPP; in ocelot_port_get_mm()
244 mm = &ocelot->mm[port]; in ocelot_port_get_mm()
246 mutex_lock(&ocelot->fwd_domain_lock); in ocelot_port_get_mm()
249 state->pmac_enabled = !!(val & DEV_MM_CONFIG_ENABLE_CONFIG_MM_RX_ENA); in ocelot_port_get_mm()
250 state->tx_enabled = !!(val & DEV_MM_CONFIG_ENABLE_CONFIG_MM_TX_ENA); in ocelot_port_get_mm()
253 state->verify_enabled = !(val & DEV_MM_CONFIG_VERIF_CONFIG_PRM_VERIFY_DIS); in ocelot_port_get_mm()
254 state->verify_time = DEV_MM_CONFIG_VERIF_CONFIG_PRM_VERIFY_TIME_X(val); in ocelot_port_get_mm()
255 state->max_verify_time = 128; in ocelot_port_get_mm()
259 state->tx_min_frag_size = ethtool_mm_frag_size_add_to_min(add_frag_size); in ocelot_port_get_mm()
260 state->rx_min_frag_size = ETH_ZLEN; in ocelot_port_get_mm()
263 state->verify_status = mm->verify_status; in ocelot_port_get_mm()
264 state->tx_active = mm->tx_active; in ocelot_port_get_mm()
266 mutex_unlock(&ocelot->fwd_domain_lock); in ocelot_port_get_mm()
278 if (!ocelot->mm_supported) in ocelot_mm_init()
281 ocelot->mm = devm_kcalloc(ocelot->dev, ocelot->num_phys_ports, in ocelot_mm_init()
282 sizeof(*ocelot->mm), GFP_KERNEL); in ocelot_mm_init()
283 if (!ocelot->mm) in ocelot_mm_init()
284 return -ENOMEM; in ocelot_mm_init()
286 for (port = 0; port < ocelot->num_phys_ports; port++) { in ocelot_mm_init()
289 mm = &ocelot->mm[port]; in ocelot_mm_init()
290 ocelot_port = ocelot->ports[port]; in ocelot_mm_init()
296 mm->verify_status = ocelot_mm_verify_status(val); in ocelot_mm_init()