Lines Matching refs:ptp_state

94 	return container_of(mlxsw_sp->ptp_state, struct mlxsw_sp1_ptp_state,  in mlxsw_sp1_ptp_state()
101 return container_of(mlxsw_sp->ptp_state, struct mlxsw_sp2_ptp_state, in mlxsw_sp2_ptp_state()
534 struct mlxsw_sp1_ptp_state *ptp_state = mlxsw_sp1_ptp_state(mlxsw_sp); in mlxsw_sp1_ptp_unmatched_save() local
545 unmatched->gc_cycle = ptp_state->gc_cycle + cycles; in mlxsw_sp1_ptp_unmatched_save()
547 err = rhltable_insert(&ptp_state->unmatched_ht, &unmatched->ht_node, in mlxsw_sp1_ptp_unmatched_save()
559 struct mlxsw_sp1_ptp_state *ptp_state = mlxsw_sp1_ptp_state(mlxsw_sp); in mlxsw_sp1_ptp_unmatched_lookup() local
564 list = rhltable_lookup(&ptp_state->unmatched_ht, &key, in mlxsw_sp1_ptp_unmatched_lookup()
579 struct mlxsw_sp1_ptp_state *ptp_state = mlxsw_sp1_ptp_state(mlxsw_sp); in mlxsw_sp1_ptp_unmatched_remove() local
581 return rhltable_remove(&ptp_state->unmatched_ht, in mlxsw_sp1_ptp_unmatched_remove()
674 struct mlxsw_sp1_ptp_state *ptp_state = mlxsw_sp1_ptp_state(mlxsw_sp); in mlxsw_sp1_ptp_got_piece() local
681 spin_lock(&ptp_state->unmatched_lock); in mlxsw_sp1_ptp_got_piece()
709 spin_unlock(&ptp_state->unmatched_lock); in mlxsw_sp1_ptp_got_piece()
805 mlxsw_sp1_ptp_ht_gc_collect(struct mlxsw_sp1_ptp_state *ptp_state, in mlxsw_sp1_ptp_ht_gc_collect() argument
808 struct mlxsw_sp *mlxsw_sp = ptp_state->common.mlxsw_sp; in mlxsw_sp1_ptp_ht_gc_collect()
822 spin_lock(&ptp_state->unmatched_lock); in mlxsw_sp1_ptp_ht_gc_collect()
823 err = rhltable_remove(&ptp_state->unmatched_ht, &unmatched->ht_node, in mlxsw_sp1_ptp_ht_gc_collect()
825 spin_unlock(&ptp_state->unmatched_lock); in mlxsw_sp1_ptp_ht_gc_collect()
858 struct mlxsw_sp1_ptp_state *ptp_state; in mlxsw_sp1_ptp_ht_gc() local
863 ptp_state = container_of(dwork, struct mlxsw_sp1_ptp_state, ht_gc_dw); in mlxsw_sp1_ptp_ht_gc()
864 gc_cycle = ptp_state->gc_cycle++; in mlxsw_sp1_ptp_ht_gc()
866 rhltable_walk_enter(&ptp_state->unmatched_ht, &iter); in mlxsw_sp1_ptp_ht_gc()
874 mlxsw_sp1_ptp_ht_gc_collect(ptp_state, unmatched); in mlxsw_sp1_ptp_ht_gc()
879 mlxsw_core_schedule_dw(&ptp_state->ht_gc_dw, in mlxsw_sp1_ptp_ht_gc()
1039 struct mlxsw_sp1_ptp_state *ptp_state; in mlxsw_sp1_ptp_init() local
1046 ptp_state = kzalloc(sizeof(*ptp_state), GFP_KERNEL); in mlxsw_sp1_ptp_init()
1047 if (!ptp_state) in mlxsw_sp1_ptp_init()
1049 ptp_state->common.mlxsw_sp = mlxsw_sp; in mlxsw_sp1_ptp_init()
1051 spin_lock_init(&ptp_state->unmatched_lock); in mlxsw_sp1_ptp_init()
1053 err = rhltable_init(&ptp_state->unmatched_ht, in mlxsw_sp1_ptp_init()
1066 INIT_DELAYED_WORK(&ptp_state->ht_gc_dw, mlxsw_sp1_ptp_ht_gc); in mlxsw_sp1_ptp_init()
1067 mlxsw_core_schedule_dw(&ptp_state->ht_gc_dw, in mlxsw_sp1_ptp_init()
1069 return &ptp_state->common; in mlxsw_sp1_ptp_init()
1074 rhltable_destroy(&ptp_state->unmatched_ht); in mlxsw_sp1_ptp_init()
1076 kfree(ptp_state); in mlxsw_sp1_ptp_init()
1083 struct mlxsw_sp1_ptp_state *ptp_state; in mlxsw_sp1_ptp_fini() local
1085 ptp_state = mlxsw_sp1_ptp_state(mlxsw_sp); in mlxsw_sp1_ptp_fini()
1087 cancel_delayed_work_sync(&ptp_state->ht_gc_dw); in mlxsw_sp1_ptp_fini()
1091 rhltable_free_and_destroy(&ptp_state->unmatched_ht, in mlxsw_sp1_ptp_fini()
1093 kfree(ptp_state); in mlxsw_sp1_ptp_fini()
1364 struct mlxsw_sp2_ptp_state *ptp_state; in mlxsw_sp2_ptp_init() local
1367 ptp_state = kzalloc(sizeof(*ptp_state), GFP_KERNEL); in mlxsw_sp2_ptp_init()
1368 if (!ptp_state) in mlxsw_sp2_ptp_init()
1371 ptp_state->common.mlxsw_sp = mlxsw_sp; in mlxsw_sp2_ptp_init()
1377 refcount_set(&ptp_state->ptp_port_enabled_ref, 0); in mlxsw_sp2_ptp_init()
1378 mutex_init(&ptp_state->lock); in mlxsw_sp2_ptp_init()
1379 return &ptp_state->common; in mlxsw_sp2_ptp_init()
1382 kfree(ptp_state); in mlxsw_sp2_ptp_init()
1389 struct mlxsw_sp2_ptp_state *ptp_state; in mlxsw_sp2_ptp_fini() local
1391 ptp_state = mlxsw_sp2_ptp_state(mlxsw_sp); in mlxsw_sp2_ptp_fini()
1393 mutex_destroy(&ptp_state->lock); in mlxsw_sp2_ptp_fini()
1395 kfree(ptp_state); in mlxsw_sp2_ptp_fini()
1463 struct mlxsw_sp2_ptp_state *ptp_state; in mlxsw_sp2_ptp_hwtstamp_get() local
1465 ptp_state = mlxsw_sp2_ptp_state(mlxsw_sp_port->mlxsw_sp); in mlxsw_sp2_ptp_hwtstamp_get()
1467 mutex_lock(&ptp_state->lock); in mlxsw_sp2_ptp_hwtstamp_get()
1468 *config = ptp_state->config; in mlxsw_sp2_ptp_hwtstamp_get()
1469 mutex_unlock(&ptp_state->lock); in mlxsw_sp2_ptp_hwtstamp_get()
1554 struct mlxsw_sp2_ptp_state *ptp_state = mlxsw_sp2_ptp_state(mlxsw_sp); in mlxsw_sp2_ptp_enable() local
1561 ptp_state->config = new_config; in mlxsw_sp2_ptp_enable()
1568 struct mlxsw_sp2_ptp_state *ptp_state = mlxsw_sp2_ptp_state(mlxsw_sp); in mlxsw_sp2_ptp_disable() local
1575 ptp_state->config = new_config; in mlxsw_sp2_ptp_disable()
1583 struct mlxsw_sp2_ptp_state *ptp_state; in mlxsw_sp2_ptp_configure_port() local
1586 ptp_state = mlxsw_sp2_ptp_state(mlxsw_sp_port->mlxsw_sp); in mlxsw_sp2_ptp_configure_port()
1588 if (refcount_inc_not_zero(&ptp_state->ptp_port_enabled_ref)) in mlxsw_sp2_ptp_configure_port()
1596 refcount_set(&ptp_state->ptp_port_enabled_ref, 1); in mlxsw_sp2_ptp_configure_port()
1604 struct mlxsw_sp2_ptp_state *ptp_state; in mlxsw_sp2_ptp_deconfigure_port() local
1607 ptp_state = mlxsw_sp2_ptp_state(mlxsw_sp_port->mlxsw_sp); in mlxsw_sp2_ptp_deconfigure_port()
1609 if (!refcount_dec_and_test(&ptp_state->ptp_port_enabled_ref)) in mlxsw_sp2_ptp_deconfigure_port()
1619 refcount_set(&ptp_state->ptp_port_enabled_ref, 1); in mlxsw_sp2_ptp_deconfigure_port()
1626 struct mlxsw_sp2_ptp_state *ptp_state; in mlxsw_sp2_ptp_hwtstamp_set() local
1633 ptp_state = mlxsw_sp2_ptp_state(mlxsw_sp_port->mlxsw_sp); in mlxsw_sp2_ptp_hwtstamp_set()
1634 mutex_lock(&ptp_state->lock); in mlxsw_sp2_ptp_hwtstamp_set()
1664 mutex_unlock(&ptp_state->lock); in mlxsw_sp2_ptp_hwtstamp_set()
1671 mutex_unlock(&ptp_state->lock); in mlxsw_sp2_ptp_hwtstamp_set()