Lines Matching defs:dev

25  * $FreeBSD: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c 358282 2020-02-24 10:42:37Z hselasky $
30 #include <dev/mlx5/cmd.h>
52 #define CONG_LOCK(dev) sx_xlock(&(dev)->congestion.lock)
53 #define CONG_UNLOCK(dev) sx_xunlock(&(dev)->congestion.lock)
54 #define CONG_LOCKED(dev) sx_xlocked(&(dev)->congestion.lock)
255 mlx5_ib_get_all_cc_params(struct mlx5_ib_dev *dev)
273 err = mlx5_cmd_query_cong_params(dev->mdev, node, out, outlen);
278 dev->congestion.arg[x] = mlx5_get_cc_param_val(field, x);
285 mlx5_ib_set_cc_params(struct mlx5_ib_dev *dev, u32 index, u64 var)
311 err = mlx5_cmd_modify_cong_params(dev->mdev, in, inlen);
320 struct mlx5_ib_dev *dev = arg1;
324 CONG_LOCK(dev);
325 value = dev->congestion.arg[arg2];
329 value == dev->congestion.arg[arg2])
333 dev->congestion.arg[arg2] = value;
337 if (!MLX5_CAP_GEN(dev->mdev, cc_modify_allowed))
340 error = -mlx5_ib_set_cc_params(dev, MLX5_IB_INDEX(arg[arg2]),
341 dev->congestion.arg[arg2]);
344 CONG_UNLOCK(dev);
355 struct mlx5_ib_dev *dev =
364 CONG_LOCK(dev);
365 if (mlx5_cmd_query_cong_counter(dev->mdev, 0, out, outlen))
368 dev->congestion.syndrome =
370 dev->congestion.rp_cur_flows =
372 dev->congestion.sum_flows =
374 dev->congestion.rp_cnp_ignored =
376 dev->congestion.rp_cnp_handled =
378 dev->congestion.time_stamp =
380 dev->congestion.accumulators_period =
382 dev->congestion.np_ecn_marked_roce_packets =
384 dev->congestion.np_cnp_sent =
387 CONG_UNLOCK(dev);
391 schedule_delayed_work(&dev->congestion.dwork, hz);
395 mlx5_ib_cleanup_congestion(struct mlx5_ib_dev *dev)
398 while (cancel_delayed_work_sync(&dev->congestion.dwork))
400 sysctl_ctx_free(&dev->congestion.ctx);
401 sx_destroy(&dev->congestion.lock);
405 mlx5_ib_init_congestion(struct mlx5_ib_dev *dev)
413 ctx = &dev->congestion.ctx;
415 sx_init(&dev->congestion.lock, "mlx5ibcong");
416 INIT_DELAYED_WORK(&dev->congestion.dwork, mlx5_ib_read_cong_stats);
418 if (!MLX5_CAP_GEN(dev->mdev, cc_query_allowed))
421 err = mlx5_ib_get_all_cc_params(dev);
425 parent = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(dev->ib_dev.dev.kobj.oidp),
433 sysctl_ctx_free(&dev->congestion.ctx);
442 dev, x, &mlx5_ib_cong_params_handler, "QU",
449 sysctl_ctx_free(&dev->congestion.ctx);
458 &dev->congestion.arg[x + MLX5_IB_CONG_PARAMS_NUM],
461 schedule_delayed_work(&dev->congestion.dwork, hz);