Lines Matching refs:trigger_entry

60 	int (*bind)(struct mlxsw_sp_span_trigger_entry *trigger_entry);
61 void (*unbind)(struct mlxsw_sp_span_trigger_entry *trigger_entry);
62 bool (*matches)(struct mlxsw_sp_span_trigger_entry *trigger_entry,
65 int (*enable)(struct mlxsw_sp_span_trigger_entry *trigger_entry,
67 void (*disable)(struct mlxsw_sp_span_trigger_entry *trigger_entry,
1219 trigger_entry, bool enable) in __mlxsw_sp_span_trigger_port_bind()
1224 switch (trigger_entry->trigger) { in __mlxsw_sp_span_trigger_port_bind()
1236 if (trigger_entry->parms.probability_rate > MLXSW_REG_MPAR_RATE_MAX) in __mlxsw_sp_span_trigger_port_bind()
1239 mlxsw_reg_mpar_pack(mpar_pl, trigger_entry->local_port, i_e, enable, in __mlxsw_sp_span_trigger_port_bind()
1240 trigger_entry->parms.span_id, in __mlxsw_sp_span_trigger_port_bind()
1241 trigger_entry->parms.probability_rate); in __mlxsw_sp_span_trigger_port_bind()
1247 trigger_entry) in mlxsw_sp_span_trigger_port_bind()
1249 return __mlxsw_sp_span_trigger_port_bind(trigger_entry->span, in mlxsw_sp_span_trigger_port_bind()
1250 trigger_entry, true); in mlxsw_sp_span_trigger_port_bind()
1255 trigger_entry) in mlxsw_sp_span_trigger_port_unbind()
1257 __mlxsw_sp_span_trigger_port_bind(trigger_entry->span, trigger_entry, in mlxsw_sp_span_trigger_port_unbind()
1263 trigger_entry, in mlxsw_sp_span_trigger_port_matches()
1267 return trigger_entry->trigger == trigger && in mlxsw_sp_span_trigger_port_matches()
1268 trigger_entry->local_port == mlxsw_sp_port->local_port; in mlxsw_sp_span_trigger_port_matches()
1273 trigger_entry, in mlxsw_sp_span_trigger_port_enable()
1282 trigger_entry, in mlxsw_sp_span_trigger_port_disable()
1298 trigger_entry) in mlxsw_sp1_span_trigger_global_bind()
1305 trigger_entry) in mlxsw_sp1_span_trigger_global_unbind()
1311 trigger_entry, in mlxsw_sp1_span_trigger_global_matches()
1321 trigger_entry, in mlxsw_sp1_span_trigger_global_enable()
1330 trigger_entry, in mlxsw_sp1_span_trigger_global_disable()
1354 trigger_entry) in mlxsw_sp2_span_trigger_global_bind()
1356 struct mlxsw_sp *mlxsw_sp = trigger_entry->span->mlxsw_sp; in mlxsw_sp2_span_trigger_global_bind()
1360 switch (trigger_entry->trigger) { in mlxsw_sp2_span_trigger_global_bind()
1375 if (trigger_entry->parms.probability_rate > MLXSW_REG_MPAGR_RATE_MAX) in mlxsw_sp2_span_trigger_global_bind()
1378 mlxsw_reg_mpagr_pack(mpagr_pl, trigger, trigger_entry->parms.span_id, in mlxsw_sp2_span_trigger_global_bind()
1379 trigger_entry->parms.probability_rate); in mlxsw_sp2_span_trigger_global_bind()
1385 trigger_entry) in mlxsw_sp2_span_trigger_global_unbind()
1394 trigger_entry, in mlxsw_sp2_span_trigger_global_matches()
1398 return trigger_entry->trigger == trigger; in mlxsw_sp2_span_trigger_global_matches()
1403 trigger_entry, in __mlxsw_sp2_span_trigger_global_enable()
1407 struct mlxsw_sp *mlxsw_sp = trigger_entry->span->mlxsw_sp; in __mlxsw_sp2_span_trigger_global_enable()
1412 switch (trigger_entry->trigger) { in __mlxsw_sp2_span_trigger_global_enable()
1441 trigger_entry, in mlxsw_sp2_span_trigger_global_enable()
1445 return __mlxsw_sp2_span_trigger_global_enable(trigger_entry, in mlxsw_sp2_span_trigger_global_enable()
1451 trigger_entry, in mlxsw_sp2_span_trigger_global_disable()
1455 __mlxsw_sp2_span_trigger_global_enable(trigger_entry, mlxsw_sp_port, tc, in mlxsw_sp2_span_trigger_global_disable()
1476 mlxsw_sp_span_trigger_ops_set(struct mlxsw_sp_span_trigger_entry *trigger_entry) in mlxsw_sp_span_trigger_ops_set() argument
1478 struct mlxsw_sp_span *span = trigger_entry->span; in mlxsw_sp_span_trigger_ops_set()
1481 switch (trigger_entry->trigger) { in mlxsw_sp_span_trigger_ops_set()
1496 trigger_entry->ops = span->span_trigger_ops_arr[type]; in mlxsw_sp_span_trigger_ops_set()
1506 struct mlxsw_sp_span_trigger_entry *trigger_entry; in mlxsw_sp_span_trigger_entry_create() local
1509 trigger_entry = kzalloc(sizeof(*trigger_entry), GFP_KERNEL); in mlxsw_sp_span_trigger_entry_create()
1510 if (!trigger_entry) in mlxsw_sp_span_trigger_entry_create()
1513 refcount_set(&trigger_entry->ref_count, 1); in mlxsw_sp_span_trigger_entry_create()
1514 trigger_entry->local_port = mlxsw_sp_port ? mlxsw_sp_port->local_port : in mlxsw_sp_span_trigger_entry_create()
1516 trigger_entry->trigger = trigger; in mlxsw_sp_span_trigger_entry_create()
1517 memcpy(&trigger_entry->parms, parms, sizeof(trigger_entry->parms)); in mlxsw_sp_span_trigger_entry_create()
1518 trigger_entry->span = span; in mlxsw_sp_span_trigger_entry_create()
1519 mlxsw_sp_span_trigger_ops_set(trigger_entry); in mlxsw_sp_span_trigger_entry_create()
1520 list_add_tail(&trigger_entry->list, &span->trigger_entries_list); in mlxsw_sp_span_trigger_entry_create()
1522 err = trigger_entry->ops->bind(trigger_entry); in mlxsw_sp_span_trigger_entry_create()
1526 return trigger_entry; in mlxsw_sp_span_trigger_entry_create()
1529 list_del(&trigger_entry->list); in mlxsw_sp_span_trigger_entry_create()
1530 kfree(trigger_entry); in mlxsw_sp_span_trigger_entry_create()
1537 trigger_entry) in mlxsw_sp_span_trigger_entry_destroy()
1539 trigger_entry->ops->unbind(trigger_entry); in mlxsw_sp_span_trigger_entry_destroy()
1540 list_del(&trigger_entry->list); in mlxsw_sp_span_trigger_entry_destroy()
1541 kfree(trigger_entry); in mlxsw_sp_span_trigger_entry_destroy()
1549 struct mlxsw_sp_span_trigger_entry *trigger_entry; in mlxsw_sp_span_trigger_entry_find() local
1551 list_for_each_entry(trigger_entry, &span->trigger_entries_list, list) { in mlxsw_sp_span_trigger_entry_find()
1552 if (trigger_entry->ops->matches(trigger_entry, trigger, in mlxsw_sp_span_trigger_entry_find()
1554 return trigger_entry; in mlxsw_sp_span_trigger_entry_find()
1565 struct mlxsw_sp_span_trigger_entry *trigger_entry; in mlxsw_sp_span_agent_bind() local
1573 trigger_entry = mlxsw_sp_span_trigger_entry_find(mlxsw_sp->span, in mlxsw_sp_span_agent_bind()
1576 if (trigger_entry) { in mlxsw_sp_span_agent_bind()
1577 if (trigger_entry->parms.span_id != parms->span_id || in mlxsw_sp_span_agent_bind()
1578 trigger_entry->parms.probability_rate != in mlxsw_sp_span_agent_bind()
1581 refcount_inc(&trigger_entry->ref_count); in mlxsw_sp_span_agent_bind()
1585 trigger_entry = mlxsw_sp_span_trigger_entry_create(mlxsw_sp->span, in mlxsw_sp_span_agent_bind()
1589 if (IS_ERR(trigger_entry)) in mlxsw_sp_span_agent_bind()
1590 err = PTR_ERR(trigger_entry); in mlxsw_sp_span_agent_bind()
1601 struct mlxsw_sp_span_trigger_entry *trigger_entry; in mlxsw_sp_span_agent_unbind() local
1609 trigger_entry = mlxsw_sp_span_trigger_entry_find(mlxsw_sp->span, in mlxsw_sp_span_agent_unbind()
1612 if (WARN_ON_ONCE(!trigger_entry)) in mlxsw_sp_span_agent_unbind()
1615 if (!refcount_dec_and_test(&trigger_entry->ref_count)) in mlxsw_sp_span_agent_unbind()
1618 mlxsw_sp_span_trigger_entry_destroy(mlxsw_sp->span, trigger_entry); in mlxsw_sp_span_agent_unbind()
1625 struct mlxsw_sp_span_trigger_entry *trigger_entry; in mlxsw_sp_span_trigger_enable() local
1629 trigger_entry = mlxsw_sp_span_trigger_entry_find(mlxsw_sp->span, in mlxsw_sp_span_trigger_enable()
1632 if (WARN_ON_ONCE(!trigger_entry)) in mlxsw_sp_span_trigger_enable()
1635 return trigger_entry->ops->enable(trigger_entry, mlxsw_sp_port, tc); in mlxsw_sp_span_trigger_enable()
1642 struct mlxsw_sp_span_trigger_entry *trigger_entry; in mlxsw_sp_span_trigger_disable() local
1646 trigger_entry = mlxsw_sp_span_trigger_entry_find(mlxsw_sp->span, in mlxsw_sp_span_trigger_disable()
1649 if (WARN_ON_ONCE(!trigger_entry)) in mlxsw_sp_span_trigger_disable()
1652 return trigger_entry->ops->disable(trigger_entry, mlxsw_sp_port, tc); in mlxsw_sp_span_trigger_disable()