Skip to content

Commit 650d77c

Browse files
danielj-mellanoxPaolo Abeni
authored and
Paolo Abeni
committed
virtio_net: Do DIM update for specified queue only
Since we no longer have to hold the RTNL lock here just do updates for the specified queue. Signed-off-by: Daniel Jurgens <[email protected]> Reviewed-by: Heng Qi <[email protected]> Tested-by: Heng Qi <[email protected]> Acked-by: Jason Wang <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 6f45ab3 commit 650d77c

File tree

1 file changed

+15
-25
lines changed

1 file changed

+15
-25
lines changed

drivers/net/virtio_net.c

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4383,38 +4383,28 @@ static void virtnet_rx_dim_work(struct work_struct *work)
43834383
struct virtnet_info *vi = rq->vq->vdev->priv;
43844384
struct net_device *dev = vi->dev;
43854385
struct dim_cq_moder update_moder;
4386-
int i, qnum, err;
4386+
int qnum, err;
43874387

43884388
if (!rtnl_trylock())
43894389
return;
43904390

4391-
/* Each rxq's work is queued by "net_dim()->schedule_work()"
4392-
* in response to NAPI traffic changes. Note that dim->profile_ix
4393-
* for each rxq is updated prior to the queuing action.
4394-
* So we only need to traverse and update profiles for all rxqs
4395-
* in the work which is holding rtnl_lock.
4396-
*/
4397-
for (i = 0; i < vi->curr_queue_pairs; i++) {
4398-
rq = &vi->rq[i];
4399-
dim = &rq->dim;
4400-
qnum = rq - vi->rq;
4391+
qnum = rq - vi->rq;
44014392

4402-
if (!rq->dim_enabled)
4403-
continue;
4393+
if (!rq->dim_enabled)
4394+
goto out;
44044395

4405-
update_moder = net_dim_get_rx_moderation(dim->mode, dim->profile_ix);
4406-
if (update_moder.usec != rq->intr_coal.max_usecs ||
4407-
update_moder.pkts != rq->intr_coal.max_packets) {
4408-
err = virtnet_send_rx_ctrl_coal_vq_cmd(vi, qnum,
4409-
update_moder.usec,
4410-
update_moder.pkts);
4411-
if (err)
4412-
pr_debug("%s: Failed to send dim parameters on rxq%d\n",
4413-
dev->name, qnum);
4414-
dim->state = DIM_START_MEASURE;
4415-
}
4396+
update_moder = net_dim_get_rx_moderation(dim->mode, dim->profile_ix);
4397+
if (update_moder.usec != rq->intr_coal.max_usecs ||
4398+
update_moder.pkts != rq->intr_coal.max_packets) {
4399+
err = virtnet_send_rx_ctrl_coal_vq_cmd(vi, qnum,
4400+
update_moder.usec,
4401+
update_moder.pkts);
4402+
if (err)
4403+
pr_debug("%s: Failed to send dim parameters on rxq%d\n",
4404+
dev->name, qnum);
4405+
dim->state = DIM_START_MEASURE;
44164406
}
4417-
4407+
out:
44184408
rtnl_unlock();
44194409
}
44204410

0 commit comments

Comments
 (0)