bnxt_dim.c 910 B

12345678910111213141516171819202122232425262728293031
  1. /* Broadcom NetXtreme-C/E network driver.
  2. *
  3. * Copyright (c) 2017-2018 Broadcom Limited
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation.
  8. */
  9. #include <linux/dim.h>
  10. #include "bnxt_hsi.h"
  11. #include "bnxt.h"
  12. void bnxt_dim_work(struct work_struct *work)
  13. {
  14. struct dim *dim = container_of(work, struct dim, work);
  15. struct bnxt_cp_ring_info *cpr = container_of(dim,
  16. struct bnxt_cp_ring_info,
  17. dim);
  18. struct bnxt_napi *bnapi = container_of(cpr,
  19. struct bnxt_napi,
  20. cp_ring);
  21. struct dim_cq_moder cur_moder =
  22. net_dim_get_rx_moderation(dim->mode, dim->profile_ix);
  23. cpr->rx_ring_coal.coal_ticks = cur_moder.usec;
  24. cpr->rx_ring_coal.coal_bufs = cur_moder.pkts;
  25. bnxt_hwrm_set_ring_coal(bnapi->bp, bnapi);
  26. dim->state = DIM_START_MEASURE;
  27. }