16a8788f2SAndy Gospodarek /* Broadcom NetXtreme-C/E network driver.
26a8788f2SAndy Gospodarek  *
36a8788f2SAndy Gospodarek  * Copyright (c) 2017-2018 Broadcom Limited
46a8788f2SAndy Gospodarek  *
56a8788f2SAndy Gospodarek  * This program is free software; you can redistribute it and/or modify
66a8788f2SAndy Gospodarek  * it under the terms of the GNU General Public License as published by
76a8788f2SAndy Gospodarek  * the Free Software Foundation.
86a8788f2SAndy Gospodarek  */
96a8788f2SAndy Gospodarek 
104f75da36STal Gilboa #include <linux/dim.h>
116a8788f2SAndy Gospodarek #include "bnxt_hsi.h"
126a8788f2SAndy Gospodarek #include "bnxt.h"
136a8788f2SAndy Gospodarek 
bnxt_dim_work(struct work_struct * work)146a8788f2SAndy Gospodarek void bnxt_dim_work(struct work_struct *work)
156a8788f2SAndy Gospodarek {
168960b389STal Gilboa 	struct dim *dim = container_of(work, struct dim, work);
176a8788f2SAndy Gospodarek 	struct bnxt_cp_ring_info *cpr = container_of(dim,
186a8788f2SAndy Gospodarek 						     struct bnxt_cp_ring_info,
196a8788f2SAndy Gospodarek 						     dim);
206a8788f2SAndy Gospodarek 	struct bnxt_napi *bnapi = container_of(cpr,
216a8788f2SAndy Gospodarek 					       struct bnxt_napi,
226a8788f2SAndy Gospodarek 					       cp_ring);
238960b389STal Gilboa 	struct dim_cq_moder cur_moder =
24026a807cSTal Gilboa 		net_dim_get_rx_moderation(dim->mode, dim->profile_ix);
256a8788f2SAndy Gospodarek 
26026a807cSTal Gilboa 	cpr->rx_ring_coal.coal_ticks = cur_moder.usec;
27026a807cSTal Gilboa 	cpr->rx_ring_coal.coal_bufs = cur_moder.pkts;
286a8788f2SAndy Gospodarek 
296a8788f2SAndy Gospodarek 	bnxt_hwrm_set_ring_coal(bnapi->bp, bnapi);
30c002bd52STal Gilboa 	dim->state = DIM_START_MEASURE;
316a8788f2SAndy Gospodarek }
32