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,
1217 trigger_entry, bool enable) in __mlxsw_sp_span_trigger_port_bind()
1222 switch (trigger_entry->trigger) { in __mlxsw_sp_span_trigger_port_bind()
1234 if (trigger_entry->parms.probability_rate > MLXSW_REG_MPAR_RATE_MAX) in __mlxsw_sp_span_trigger_port_bind()
1237 mlxsw_reg_mpar_pack(mpar_pl, trigger_entry->local_port, i_e, enable, in __mlxsw_sp_span_trigger_port_bind()
1238 trigger_entry->parms.span_id, in __mlxsw_sp_span_trigger_port_bind()
1239 trigger_entry->parms.probability_rate); in __mlxsw_sp_span_trigger_port_bind()
1245 trigger_entry) in mlxsw_sp_span_trigger_port_bind()
1247 return __mlxsw_sp_span_trigger_port_bind(trigger_entry->span, in mlxsw_sp_span_trigger_port_bind()
1248 trigger_entry, true); in mlxsw_sp_span_trigger_port_bind()
1253 trigger_entry) in mlxsw_sp_span_trigger_port_unbind()
1255 __mlxsw_sp_span_trigger_port_bind(trigger_entry->span, trigger_entry, in mlxsw_sp_span_trigger_port_unbind()
1261 trigger_entry, in mlxsw_sp_span_trigger_port_matches()
1265 return trigger_entry->trigger == trigger && in mlxsw_sp_span_trigger_port_matches()
1266 trigger_entry->local_port == mlxsw_sp_port->local_port; in mlxsw_sp_span_trigger_port_matches()
1271 trigger_entry, in mlxsw_sp_span_trigger_port_enable()
1280 trigger_entry, in mlxsw_sp_span_trigger_port_disable()
1296 trigger_entry) in mlxsw_sp1_span_trigger_global_bind()
1303 trigger_entry) in mlxsw_sp1_span_trigger_global_unbind()
1309 trigger_entry, in mlxsw_sp1_span_trigger_global_matches()
1319 trigger_entry, in mlxsw_sp1_span_trigger_global_enable()
1328 trigger_entry, in mlxsw_sp1_span_trigger_global_disable()
1352 trigger_entry) in mlxsw_sp2_span_trigger_global_bind()
1354 struct mlxsw_sp *mlxsw_sp = trigger_entry->span->mlxsw_sp; in mlxsw_sp2_span_trigger_global_bind()
1358 switch (trigger_entry->trigger) { in mlxsw_sp2_span_trigger_global_bind()
1373 if (trigger_entry->parms.probability_rate > MLXSW_REG_MPAGR_RATE_MAX) in mlxsw_sp2_span_trigger_global_bind()
1376 mlxsw_reg_mpagr_pack(mpagr_pl, trigger, trigger_entry->parms.span_id, in mlxsw_sp2_span_trigger_global_bind()
1377 trigger_entry->parms.probability_rate); in mlxsw_sp2_span_trigger_global_bind()
1383 trigger_entry) in mlxsw_sp2_span_trigger_global_unbind()
1392 trigger_entry, in mlxsw_sp2_span_trigger_global_matches()
1396 return trigger_entry->trigger == trigger; in mlxsw_sp2_span_trigger_global_matches()
1401 trigger_entry, in __mlxsw_sp2_span_trigger_global_enable()
1405 struct mlxsw_sp *mlxsw_sp = trigger_entry->span->mlxsw_sp; in __mlxsw_sp2_span_trigger_global_enable()
1410 switch (trigger_entry->trigger) { in __mlxsw_sp2_span_trigger_global_enable()
1439 trigger_entry, in mlxsw_sp2_span_trigger_global_enable()
1443 return __mlxsw_sp2_span_trigger_global_enable(trigger_entry, in mlxsw_sp2_span_trigger_global_enable()
1449 trigger_entry, in mlxsw_sp2_span_trigger_global_disable()
1453 __mlxsw_sp2_span_trigger_global_enable(trigger_entry, mlxsw_sp_port, tc, in mlxsw_sp2_span_trigger_global_disable()
1474 mlxsw_sp_span_trigger_ops_set(struct mlxsw_sp_span_trigger_entry *trigger_entry) in mlxsw_sp_span_trigger_ops_set() argument
1476 struct mlxsw_sp_span *span = trigger_entry->span; in mlxsw_sp_span_trigger_ops_set()
1479 switch (trigger_entry->trigger) { in mlxsw_sp_span_trigger_ops_set()
1494 trigger_entry->ops = span->span_trigger_ops_arr[type]; in mlxsw_sp_span_trigger_ops_set()
1504 struct mlxsw_sp_span_trigger_entry *trigger_entry; in mlxsw_sp_span_trigger_entry_create() local
1507 trigger_entry = kzalloc(sizeof(*trigger_entry), GFP_KERNEL); in mlxsw_sp_span_trigger_entry_create()
1508 if (!trigger_entry) in mlxsw_sp_span_trigger_entry_create()
1511 refcount_set(&trigger_entry->ref_count, 1); in mlxsw_sp_span_trigger_entry_create()
1512 trigger_entry->local_port = mlxsw_sp_port ? mlxsw_sp_port->local_port : in mlxsw_sp_span_trigger_entry_create()
1514 trigger_entry->trigger = trigger; in mlxsw_sp_span_trigger_entry_create()
1515 memcpy(&trigger_entry->parms, parms, sizeof(trigger_entry->parms)); in mlxsw_sp_span_trigger_entry_create()
1516 trigger_entry->span = span; in mlxsw_sp_span_trigger_entry_create()
1517 mlxsw_sp_span_trigger_ops_set(trigger_entry); in mlxsw_sp_span_trigger_entry_create()
1518 list_add_tail(&trigger_entry->list, &span->trigger_entries_list); in mlxsw_sp_span_trigger_entry_create()
1520 err = trigger_entry->ops->bind(trigger_entry); in mlxsw_sp_span_trigger_entry_create()
1524 return trigger_entry; in mlxsw_sp_span_trigger_entry_create()
1527 list_del(&trigger_entry->list); in mlxsw_sp_span_trigger_entry_create()
1528 kfree(trigger_entry); in mlxsw_sp_span_trigger_entry_create()
1535 trigger_entry) in mlxsw_sp_span_trigger_entry_destroy()
1537 trigger_entry->ops->unbind(trigger_entry); in mlxsw_sp_span_trigger_entry_destroy()
1538 list_del(&trigger_entry->list); in mlxsw_sp_span_trigger_entry_destroy()
1539 kfree(trigger_entry); in mlxsw_sp_span_trigger_entry_destroy()
1547 struct mlxsw_sp_span_trigger_entry *trigger_entry; in mlxsw_sp_span_trigger_entry_find() local
1549 list_for_each_entry(trigger_entry, &span->trigger_entries_list, list) { in mlxsw_sp_span_trigger_entry_find()
1550 if (trigger_entry->ops->matches(trigger_entry, trigger, in mlxsw_sp_span_trigger_entry_find()
1552 return trigger_entry; in mlxsw_sp_span_trigger_entry_find()
1563 struct mlxsw_sp_span_trigger_entry *trigger_entry; in mlxsw_sp_span_agent_bind() local
1571 trigger_entry = mlxsw_sp_span_trigger_entry_find(mlxsw_sp->span, in mlxsw_sp_span_agent_bind()
1574 if (trigger_entry) { in mlxsw_sp_span_agent_bind()
1575 if (trigger_entry->parms.span_id != parms->span_id || in mlxsw_sp_span_agent_bind()
1576 trigger_entry->parms.probability_rate != in mlxsw_sp_span_agent_bind()
1579 refcount_inc(&trigger_entry->ref_count); in mlxsw_sp_span_agent_bind()
1583 trigger_entry = mlxsw_sp_span_trigger_entry_create(mlxsw_sp->span, in mlxsw_sp_span_agent_bind()
1587 if (IS_ERR(trigger_entry)) in mlxsw_sp_span_agent_bind()
1588 err = PTR_ERR(trigger_entry); in mlxsw_sp_span_agent_bind()
1599 struct mlxsw_sp_span_trigger_entry *trigger_entry; in mlxsw_sp_span_agent_unbind() local
1607 trigger_entry = mlxsw_sp_span_trigger_entry_find(mlxsw_sp->span, in mlxsw_sp_span_agent_unbind()
1610 if (WARN_ON_ONCE(!trigger_entry)) in mlxsw_sp_span_agent_unbind()
1613 if (!refcount_dec_and_test(&trigger_entry->ref_count)) in mlxsw_sp_span_agent_unbind()
1616 mlxsw_sp_span_trigger_entry_destroy(mlxsw_sp->span, trigger_entry); in mlxsw_sp_span_agent_unbind()
1623 struct mlxsw_sp_span_trigger_entry *trigger_entry; in mlxsw_sp_span_trigger_enable() local
1627 trigger_entry = mlxsw_sp_span_trigger_entry_find(mlxsw_sp->span, in mlxsw_sp_span_trigger_enable()
1630 if (WARN_ON_ONCE(!trigger_entry)) in mlxsw_sp_span_trigger_enable()
1633 return trigger_entry->ops->enable(trigger_entry, mlxsw_sp_port, tc); in mlxsw_sp_span_trigger_enable()
1640 struct mlxsw_sp_span_trigger_entry *trigger_entry; in mlxsw_sp_span_trigger_disable() local
1644 trigger_entry = mlxsw_sp_span_trigger_entry_find(mlxsw_sp->span, in mlxsw_sp_span_trigger_disable()
1647 if (WARN_ON_ONCE(!trigger_entry)) in mlxsw_sp_span_trigger_disable()
1650 return trigger_entry->ops->disable(trigger_entry, mlxsw_sp_port, tc); in mlxsw_sp_span_trigger_disable()