18c2ecf20Sopenharmony_ci/* Broadcom NetXtreme-C/E network driver. 28c2ecf20Sopenharmony_ci * 38c2ecf20Sopenharmony_ci * Copyright (c) 2017-2018 Broadcom Limited 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 68c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License as published by 78c2ecf20Sopenharmony_ci * the Free Software Foundation. 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/dim.h> 118c2ecf20Sopenharmony_ci#include "bnxt_hsi.h" 128c2ecf20Sopenharmony_ci#include "bnxt.h" 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_civoid bnxt_dim_work(struct work_struct *work) 158c2ecf20Sopenharmony_ci{ 168c2ecf20Sopenharmony_ci struct dim *dim = container_of(work, struct dim, work); 178c2ecf20Sopenharmony_ci struct bnxt_cp_ring_info *cpr = container_of(dim, 188c2ecf20Sopenharmony_ci struct bnxt_cp_ring_info, 198c2ecf20Sopenharmony_ci dim); 208c2ecf20Sopenharmony_ci struct bnxt_napi *bnapi = container_of(cpr, 218c2ecf20Sopenharmony_ci struct bnxt_napi, 228c2ecf20Sopenharmony_ci cp_ring); 238c2ecf20Sopenharmony_ci struct dim_cq_moder cur_moder = 248c2ecf20Sopenharmony_ci net_dim_get_rx_moderation(dim->mode, dim->profile_ix); 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci cpr->rx_ring_coal.coal_ticks = cur_moder.usec; 278c2ecf20Sopenharmony_ci cpr->rx_ring_coal.coal_bufs = cur_moder.pkts; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci bnxt_hwrm_set_ring_coal(bnapi->bp, bnapi); 308c2ecf20Sopenharmony_ci dim->state = DIM_START_MEASURE; 318c2ecf20Sopenharmony_ci} 32