Skip to content

Commit d718008

Browse files
Heng Qidavem330
authored andcommitted
virtio-net: separate rx/tx coalescing moderation cmds
This patch separates the rx and tx global coalescing moderation commands to support netdim switches in subsequent patches. Signed-off-by: Heng Qi <[email protected]> Acked-by: Jason Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7949c06 commit d718008

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

drivers/net/virtio_net.c

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3266,10 +3266,10 @@ static int virtnet_get_link_ksettings(struct net_device *dev,
32663266
return 0;
32673267
}
32683268

3269-
static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi,
3270-
struct ethtool_coalesce *ec)
3269+
static int virtnet_send_tx_notf_coal_cmds(struct virtnet_info *vi,
3270+
struct ethtool_coalesce *ec)
32713271
{
3272-
struct scatterlist sgs_tx, sgs_rx;
3272+
struct scatterlist sgs_tx;
32733273
int i;
32743274

32753275
vi->ctrl->coal_tx.tx_usecs = cpu_to_le32(ec->tx_coalesce_usecs);
@@ -3289,6 +3289,15 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi,
32893289
vi->sq[i].intr_coal.max_packets = ec->tx_max_coalesced_frames;
32903290
}
32913291

3292+
return 0;
3293+
}
3294+
3295+
static int virtnet_send_rx_notf_coal_cmds(struct virtnet_info *vi,
3296+
struct ethtool_coalesce *ec)
3297+
{
3298+
struct scatterlist sgs_rx;
3299+
int i;
3300+
32923301
vi->ctrl->coal_rx.rx_usecs = cpu_to_le32(ec->rx_coalesce_usecs);
32933302
vi->ctrl->coal_rx.rx_max_packets = cpu_to_le32(ec->rx_max_coalesced_frames);
32943303
sg_init_one(&sgs_rx, &vi->ctrl->coal_rx, sizeof(vi->ctrl->coal_rx));
@@ -3309,6 +3318,22 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi,
33093318
return 0;
33103319
}
33113320

3321+
static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi,
3322+
struct ethtool_coalesce *ec)
3323+
{
3324+
int err;
3325+
3326+
err = virtnet_send_tx_notf_coal_cmds(vi, ec);
3327+
if (err)
3328+
return err;
3329+
3330+
err = virtnet_send_rx_notf_coal_cmds(vi, ec);
3331+
if (err)
3332+
return err;
3333+
3334+
return 0;
3335+
}
3336+
33123337
static int virtnet_send_ctrl_coal_vq_cmd(struct virtnet_info *vi,
33133338
u16 vqn, u32 max_usecs, u32 max_packets)
33143339
{

0 commit comments

Comments
 (0)