Skip to content

Commit accc1bf

Browse files
brettcreeleykuba-moo
authored andcommitted
virtio_net: use control_buf for coalesce params
Commit 699b045 ("net: virtio_net: notifications coalescing support") added coalescing command support for virtio_net. However, the coalesce commands are using buffers on the stack, which is causing the device to see DMA errors. There should also be a complaint from check_for_stack() in debug_dma_map_xyz(). Fix this by adding and using coalesce params from the control_buf struct, which aligns with other commands. Cc: [email protected] Fixes: 699b045 ("net: virtio_net: notifications coalescing support") Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: Allen Hubbe <[email protected]> Signed-off-by: Brett Creeley <[email protected]> Acked-by: Jason Wang <[email protected]> Reviewed-by: Xuan Zhuo <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4f48c30 commit accc1bf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/net/virtio_net.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ struct control_buf {
205205
__virtio16 vid;
206206
__virtio64 offloads;
207207
struct virtio_net_ctrl_rss rss;
208+
struct virtio_net_ctrl_coal_tx coal_tx;
209+
struct virtio_net_ctrl_coal_rx coal_rx;
208210
};
209211

210212
struct virtnet_info {
@@ -2934,12 +2936,10 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi,
29342936
struct ethtool_coalesce *ec)
29352937
{
29362938
struct scatterlist sgs_tx, sgs_rx;
2937-
struct virtio_net_ctrl_coal_tx coal_tx;
2938-
struct virtio_net_ctrl_coal_rx coal_rx;
29392939

2940-
coal_tx.tx_usecs = cpu_to_le32(ec->tx_coalesce_usecs);
2941-
coal_tx.tx_max_packets = cpu_to_le32(ec->tx_max_coalesced_frames);
2942-
sg_init_one(&sgs_tx, &coal_tx, sizeof(coal_tx));
2940+
vi->ctrl->coal_tx.tx_usecs = cpu_to_le32(ec->tx_coalesce_usecs);
2941+
vi->ctrl->coal_tx.tx_max_packets = cpu_to_le32(ec->tx_max_coalesced_frames);
2942+
sg_init_one(&sgs_tx, &vi->ctrl->coal_tx, sizeof(vi->ctrl->coal_tx));
29432943

29442944
if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_NOTF_COAL,
29452945
VIRTIO_NET_CTRL_NOTF_COAL_TX_SET,
@@ -2950,9 +2950,9 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi,
29502950
vi->tx_usecs = ec->tx_coalesce_usecs;
29512951
vi->tx_max_packets = ec->tx_max_coalesced_frames;
29522952

2953-
coal_rx.rx_usecs = cpu_to_le32(ec->rx_coalesce_usecs);
2954-
coal_rx.rx_max_packets = cpu_to_le32(ec->rx_max_coalesced_frames);
2955-
sg_init_one(&sgs_rx, &coal_rx, sizeof(coal_rx));
2953+
vi->ctrl->coal_rx.rx_usecs = cpu_to_le32(ec->rx_coalesce_usecs);
2954+
vi->ctrl->coal_rx.rx_max_packets = cpu_to_le32(ec->rx_max_coalesced_frames);
2955+
sg_init_one(&sgs_rx, &vi->ctrl->coal_rx, sizeof(vi->ctrl->coal_rx));
29562956

29572957
if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_NOTF_COAL,
29582958
VIRTIO_NET_CTRL_NOTF_COAL_RX_SET,

0 commit comments

Comments
 (0)