Lines Matching refs:mlxsw_sp
154 static int mlxsw_sp_erif_entry_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_erif_entry_get() argument
181 err = mlxsw_sp_rif_counter_value_get(mlxsw_sp, rif, in mlxsw_sp_erif_entry_get()
199 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_dpipe_table_erif_entries_dump() local
213 rif_count = MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); in mlxsw_sp_dpipe_table_erif_entries_dump()
214 mutex_lock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_erif_entries_dump()
222 struct mlxsw_sp_rif *rif = mlxsw_sp_rif_by_index(mlxsw_sp, i); in mlxsw_sp_dpipe_table_erif_entries_dump()
226 err = mlxsw_sp_erif_entry_get(mlxsw_sp, &entry, rif, in mlxsw_sp_dpipe_table_erif_entries_dump()
245 mutex_unlock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_erif_entries_dump()
252 mutex_unlock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_erif_entries_dump()
259 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_dpipe_table_erif_counters_update() local
262 mutex_lock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_erif_counters_update()
263 for (i = 0; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); i++) { in mlxsw_sp_dpipe_table_erif_counters_update()
264 struct mlxsw_sp_rif *rif = mlxsw_sp_rif_by_index(mlxsw_sp, i); in mlxsw_sp_dpipe_table_erif_counters_update()
269 mlxsw_sp_rif_counter_alloc(mlxsw_sp, rif, in mlxsw_sp_dpipe_table_erif_counters_update()
272 mlxsw_sp_rif_counter_free(mlxsw_sp, rif, in mlxsw_sp_dpipe_table_erif_counters_update()
275 mutex_unlock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_erif_counters_update()
281 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_dpipe_table_erif_size_get() local
283 return MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); in mlxsw_sp_dpipe_table_erif_size_get()
294 static int mlxsw_sp_dpipe_erif_table_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_dpipe_erif_table_init() argument
296 struct devlink *devlink = priv_to_devlink(mlxsw_sp->core); in mlxsw_sp_dpipe_erif_table_init()
301 mlxsw_sp, false); in mlxsw_sp_dpipe_erif_table_init()
304 static void mlxsw_sp_dpipe_erif_table_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_dpipe_erif_table_fini() argument
306 struct devlink *devlink = priv_to_devlink(mlxsw_sp->core); in mlxsw_sp_dpipe_erif_table_fini()
510 mlxsw_sp_dpipe_table_host_entry_fill(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_dpipe_table_host_entry_fill() argument
530 err = mlxsw_sp_neigh_counter_get(mlxsw_sp, neigh_entry, in mlxsw_sp_dpipe_table_host_entry_fill()
537 mlxsw_sp_dpipe_table_host_entries_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_dpipe_table_host_entries_get() argument
550 mutex_lock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_host_entries_get()
552 rif_count = MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); in mlxsw_sp_dpipe_table_host_entries_get()
559 for (; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); i++) { in mlxsw_sp_dpipe_table_host_entries_get()
560 struct mlxsw_sp_rif *rif = mlxsw_sp_rif_by_index(mlxsw_sp, i); in mlxsw_sp_dpipe_table_host_entries_get()
580 mlxsw_sp_dpipe_table_host_entry_fill(mlxsw_sp, entry, in mlxsw_sp_dpipe_table_host_entries_get()
606 mutex_unlock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_host_entries_get()
611 mutex_unlock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_host_entries_get()
616 mlxsw_sp_dpipe_table_host_entries_dump(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_dpipe_table_host_entries_dump() argument
641 err = mlxsw_sp_dpipe_table_host_entries_get(mlxsw_sp, &entry, in mlxsw_sp_dpipe_table_host_entries_dump()
653 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_dpipe_table_host4_entries_dump() local
655 return mlxsw_sp_dpipe_table_host_entries_dump(mlxsw_sp, in mlxsw_sp_dpipe_table_host4_entries_dump()
661 mlxsw_sp_dpipe_table_host_counters_update(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_dpipe_table_host_counters_update() argument
666 mutex_lock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_host_counters_update()
667 for (i = 0; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); i++) { in mlxsw_sp_dpipe_table_host_counters_update()
668 struct mlxsw_sp_rif *rif = mlxsw_sp_rif_by_index(mlxsw_sp, i); in mlxsw_sp_dpipe_table_host_counters_update()
683 mlxsw_sp_neigh_entry_counter_update(mlxsw_sp, in mlxsw_sp_dpipe_table_host_counters_update()
688 mutex_unlock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_host_counters_update()
693 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_dpipe_table_host4_counters_update() local
695 mlxsw_sp_dpipe_table_host_counters_update(mlxsw_sp, enable, AF_INET); in mlxsw_sp_dpipe_table_host4_counters_update()
700 mlxsw_sp_dpipe_table_host_size_get(struct mlxsw_sp *mlxsw_sp, int type) in mlxsw_sp_dpipe_table_host_size_get() argument
705 mutex_lock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_host_size_get()
706 for (i = 0; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); i++) { in mlxsw_sp_dpipe_table_host_size_get()
707 struct mlxsw_sp_rif *rif = mlxsw_sp_rif_by_index(mlxsw_sp, i); in mlxsw_sp_dpipe_table_host_size_get()
725 mutex_unlock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_host_size_get()
732 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_dpipe_table_host4_size_get() local
734 return mlxsw_sp_dpipe_table_host_size_get(mlxsw_sp, AF_INET); in mlxsw_sp_dpipe_table_host4_size_get()
747 static int mlxsw_sp_dpipe_host4_table_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_dpipe_host4_table_init() argument
749 struct devlink *devlink = priv_to_devlink(mlxsw_sp->core); in mlxsw_sp_dpipe_host4_table_init()
755 mlxsw_sp, false); in mlxsw_sp_dpipe_host4_table_init()
774 static void mlxsw_sp_dpipe_host4_table_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_dpipe_host4_table_fini() argument
776 struct devlink *devlink = priv_to_devlink(mlxsw_sp->core); in mlxsw_sp_dpipe_host4_table_fini()
792 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_dpipe_table_host6_entries_dump() local
794 return mlxsw_sp_dpipe_table_host_entries_dump(mlxsw_sp, in mlxsw_sp_dpipe_table_host6_entries_dump()
801 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_dpipe_table_host6_counters_update() local
803 mlxsw_sp_dpipe_table_host_counters_update(mlxsw_sp, enable, AF_INET6); in mlxsw_sp_dpipe_table_host6_counters_update()
809 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_dpipe_table_host6_size_get() local
811 return mlxsw_sp_dpipe_table_host_size_get(mlxsw_sp, AF_INET6); in mlxsw_sp_dpipe_table_host6_size_get()
824 static int mlxsw_sp_dpipe_host6_table_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_dpipe_host6_table_init() argument
826 struct devlink *devlink = priv_to_devlink(mlxsw_sp->core); in mlxsw_sp_dpipe_host6_table_init()
832 mlxsw_sp, false); in mlxsw_sp_dpipe_host6_table_init()
851 static void mlxsw_sp_dpipe_host6_table_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_dpipe_host6_table_fini() argument
853 struct devlink *devlink = priv_to_devlink(mlxsw_sp->core); in mlxsw_sp_dpipe_host6_table_fini()
909 static u64 mlxsw_sp_dpipe_table_adj_size(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_dpipe_table_adj_size() argument
914 mlxsw_sp_nexthop_for_each(nh, mlxsw_sp->router) in mlxsw_sp_dpipe_table_adj_size()
1064 static void mlxsw_sp_dpipe_table_adj_entry_fill(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_dpipe_table_adj_entry_fill() argument
1078 err = mlxsw_sp_nexthop_counter_get(mlxsw_sp, nh, &entry->counter); in mlxsw_sp_dpipe_table_adj_entry_fill()
1084 mlxsw_sp_dpipe_table_adj_entries_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_dpipe_table_adj_entries_get() argument
1097 mutex_lock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_adj_entries_get()
1098 nh_count_max = mlxsw_sp_dpipe_table_adj_size(mlxsw_sp); in mlxsw_sp_dpipe_table_adj_entries_get()
1106 mlxsw_sp_nexthop_for_each(nh, mlxsw_sp->router) { in mlxsw_sp_dpipe_table_adj_entries_get()
1114 mlxsw_sp_dpipe_table_adj_entry_fill(mlxsw_sp, nh, entry); in mlxsw_sp_dpipe_table_adj_entries_get()
1134 mutex_unlock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_adj_entries_get()
1140 mutex_unlock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_adj_entries_get()
1153 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_dpipe_table_adj_entries_dump() local
1172 err = mlxsw_sp_dpipe_table_adj_entries_get(mlxsw_sp, &entry, in mlxsw_sp_dpipe_table_adj_entries_dump()
1181 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_dpipe_table_adj_counters_update() local
1187 mlxsw_sp_nexthop_for_each(nh, mlxsw_sp->router) { in mlxsw_sp_dpipe_table_adj_counters_update()
1195 mlxsw_sp_nexthop_counter_alloc(mlxsw_sp, nh); in mlxsw_sp_dpipe_table_adj_counters_update()
1197 mlxsw_sp_nexthop_counter_free(mlxsw_sp, nh); in mlxsw_sp_dpipe_table_adj_counters_update()
1198 mlxsw_sp_nexthop_update(mlxsw_sp, in mlxsw_sp_dpipe_table_adj_counters_update()
1207 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_dpipe_table_adj_size_get() local
1210 mutex_lock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_adj_size_get()
1211 size = mlxsw_sp_dpipe_table_adj_size(mlxsw_sp); in mlxsw_sp_dpipe_table_adj_size_get()
1212 mutex_unlock(&mlxsw_sp->router->lock); in mlxsw_sp_dpipe_table_adj_size_get()
1227 static int mlxsw_sp_dpipe_adj_table_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_dpipe_adj_table_init() argument
1229 struct devlink *devlink = priv_to_devlink(mlxsw_sp->core); in mlxsw_sp_dpipe_adj_table_init()
1235 mlxsw_sp, false); in mlxsw_sp_dpipe_adj_table_init()
1254 static void mlxsw_sp_dpipe_adj_table_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_dpipe_adj_table_fini() argument
1256 struct devlink *devlink = priv_to_devlink(mlxsw_sp->core); in mlxsw_sp_dpipe_adj_table_fini()
1262 int mlxsw_sp_dpipe_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_dpipe_init() argument
1264 struct devlink *devlink = priv_to_devlink(mlxsw_sp->core); in mlxsw_sp_dpipe_init()
1271 err = mlxsw_sp_dpipe_erif_table_init(mlxsw_sp); in mlxsw_sp_dpipe_init()
1275 err = mlxsw_sp_dpipe_host4_table_init(mlxsw_sp); in mlxsw_sp_dpipe_init()
1279 err = mlxsw_sp_dpipe_host6_table_init(mlxsw_sp); in mlxsw_sp_dpipe_init()
1283 err = mlxsw_sp_dpipe_adj_table_init(mlxsw_sp); in mlxsw_sp_dpipe_init()
1289 mlxsw_sp_dpipe_host6_table_fini(mlxsw_sp); in mlxsw_sp_dpipe_init()
1291 mlxsw_sp_dpipe_host4_table_fini(mlxsw_sp); in mlxsw_sp_dpipe_init()
1293 mlxsw_sp_dpipe_erif_table_fini(mlxsw_sp); in mlxsw_sp_dpipe_init()
1295 devlink_dpipe_headers_unregister(priv_to_devlink(mlxsw_sp->core)); in mlxsw_sp_dpipe_init()
1299 void mlxsw_sp_dpipe_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_dpipe_fini() argument
1301 struct devlink *devlink = priv_to_devlink(mlxsw_sp->core); in mlxsw_sp_dpipe_fini()
1303 mlxsw_sp_dpipe_adj_table_fini(mlxsw_sp); in mlxsw_sp_dpipe_fini()
1304 mlxsw_sp_dpipe_host6_table_fini(mlxsw_sp); in mlxsw_sp_dpipe_fini()
1305 mlxsw_sp_dpipe_host4_table_fini(mlxsw_sp); in mlxsw_sp_dpipe_fini()
1306 mlxsw_sp_dpipe_erif_table_fini(mlxsw_sp); in mlxsw_sp_dpipe_fini()