virtio-net: Zero max_tx_vq field for VIRTIO_NET_CTRL_MQ_HASH_CONFIG case
Subsystems (3)
PATCH v2 1/1 virtio-net: Zero max_tx_vq field for VIRTIO_NET_CTRL_MQ_HASH_CONFIG case
Kernel uses struct virtio_net_ctrl_rss to save command-specific-data for both the VIRTIO_NET_CTRL_MQ_HASH_CONFIG and VIRTIO_NET_CTRL_MQ_RSS_CONFIG commands.
According to the VirtIO standard, "Field reserved MUST contain zeroes. It is defined to make the structure to match the layout of virtio_net_rss_config structure, defined in 5.1.6.5.7.".
Yet for the VIRTIO_NET_CTRL_MQ_HASH_CONFIG command case, the max_tx_vq field in struct virtio_net_ctrl_rss, which corresponds to the reserved field in struct virtio_net_hash_config, is not zeroed, thereby violating the VirtIO standard.
This patch solves this problem by zeroing this field in virtnet_init_default_rss().
--- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio_net.c +1 -1
@@ -2761,7 +2761,7 @@ static void virtnet_init_default_rss(struct virtnet_info *vi) vi->ctrl->rss.indirection_table[i] = indir_val; } - vi->ctrl->rss.max_tx_vq = vi->curr_queue_pairs; + vi->ctrl->rss.max_tx_vq = vi->has_rss ? vi->curr_queue_pairs :0 ; vi->ctrl->rss.hash_key_length = vi->rss_key_size;netdev_rss_key_fill (vi->ctrl->rss.key, vi->rss_key_size);
Signature · 1 line
2.34.1
Quoted 16 lines · Hawkins Jiawei
Kernel uses
struct virtio_net_ctrl_rssto save command-specific-data for both theVIRTIO_NET_CTRL_MQ_HASH_CONFIGandVIRTIO_NET_CTRL_MQ_RSS_CONFIGcommands.According to the VirtIO standard, "Field reserved MUST contain zeroes. It is defined to make the structure to match the layout of
virtio_net_rss_configstructure, defined in 5.1.6.5.7.".Yet for the
VIRTIO_NET_CTRL_MQ_HASH_CONFIGcommand case, themax_tx_vqfield in structvirtio_net_ctrl_rss, which corresponds to thereservedfield in structvirtio_net_hash_config, is not zeroed, thereby violating the VirtIO standard.This patch solves this problem by zeroing this field in
virtnet_init_default_rss().
Quoted 7 lines
Cc Andrew Melnychenko <[email protected]>Fixes c7114b1249fa ("drivers/net/virtio_net: Added basic RSS support.")Signed-off-by Hawkins Jiawei <[email protected]>Acked-by Jason Wang <[email protected]>Acked-by Eugenio Pérez <[email protected]>
Quoted 20 lines
--- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/virtio_net.c +1
-2@@ -2761,7 +2761,7 @@ static void virtnet_init_default_rss(struct virtnet_info *vi) vi->ctrl->rss.indirection_table[i] = indir_val; } - vi->ctrl->rss.max_tx_vq = vi->curr_queue_pairs; + vi->ctrl->rss.max_tx_vq = vi->has_rss ? vi->curr_queue_pairs :0 ; vi->ctrl->rss.hash_key_length = vi->rss_key_size;netdev_rss_key_fill (vi->ctrl->rss.key, vi->rss_key_size); --2.34.1
Quoted 16 lines · Hawkins Jiawei
Kernel uses
struct virtio_net_ctrl_rssto save command-specific-data for both theVIRTIO_NET_CTRL_MQ_HASH_CONFIGandVIRTIO_NET_CTRL_MQ_RSS_CONFIGcommands.According to the VirtIO standard, "Field reserved MUST contain zeroes. It is defined to make the structure to match the layout of
virtio_net_rss_configstructure, defined in 5.1.6.5.7.".Yet for the
VIRTIO_NET_CTRL_MQ_HASH_CONFIGcommand case, themax_tx_vqfield in structvirtio_net_ctrl_rss, which corresponds to thereservedfield in structvirtio_net_hash_config, is not zeroed, thereby violating the VirtIO standard.This patch solves this problem by zeroing this field in
virtnet_init_default_rss().
Quoted 8 lines
Cc Andrew Melnychenko <[email protected]>Fixes c7114b1249fa ("drivers/net/virtio_net: Added basic RSS support.")Signed-off-by Hawkins Jiawei <[email protected]>Acked-by Jason Wang <[email protected]>Acked-by Eugenio Pérez <[email protected]>---
Sorry for missing the ChangeLog here.
v2:
- Add the missing tags, no code changes.
v1: https://lore.kernel.org/all/[email protected]/
Thanks!
Quoted 16 lines
drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/virtio_net.c +1
-1@@ -2761,7 +2761,7 @@ static void virtnet_init_default_rss(struct virtnet_info *vi) vi->ctrl->rss.indirection_table[i] = indir_val; } - vi->ctrl->rss.max_tx_vq = vi->curr_queue_pairs; + vi->ctrl->rss.max_tx_vq = vi->has_rss ? vi->curr_queue_pairs :0 ; vi->ctrl->rss.hash_key_length = vi->rss_key_size;netdev_rss_key_fill (vi->ctrl->rss.key, vi->rss_key_size);