@@ -368,15 +368,15 @@ struct receive_queue {
368368 */
369369#define VIRTIO_NET_RSS_MAX_KEY_SIZE 40
370370struct virtio_net_ctrl_rss {
371- u32 hash_types ;
372- u16 indirection_table_mask ;
373- u16 unclassified_queue ;
374- u16 hash_cfg_reserved ; /* for HASH_CONFIG (see virtio_net_hash_config for details) */
375- u16 max_tx_vq ;
371+ __le32 hash_types ;
372+ __le16 indirection_table_mask ;
373+ __le16 unclassified_queue ;
374+ __le16 hash_cfg_reserved ; /* for HASH_CONFIG (see virtio_net_hash_config for details) */
375+ __le16 max_tx_vq ;
376376 u8 hash_key_length ;
377377 u8 key [VIRTIO_NET_RSS_MAX_KEY_SIZE ];
378378
379- u16 * indirection_table ;
379+ __le16 * indirection_table ;
380380};
381381
382382/* Control VQ buffers: protected by the rtnl lock */
@@ -3638,9 +3638,9 @@ static void virtnet_rss_update_by_qpairs(struct virtnet_info *vi, u16 queue_pair
36383638
36393639 for (; i < vi -> rss_indir_table_size ; ++ i ) {
36403640 indir_val = ethtool_rxfh_indir_default (i , queue_pairs );
3641- vi -> rss .indirection_table [i ] = indir_val ;
3641+ vi -> rss .indirection_table [i ] = cpu_to_le16 ( indir_val ) ;
36423642 }
3643- vi -> rss .max_tx_vq = queue_pairs ;
3643+ vi -> rss .max_tx_vq = cpu_to_le16 ( queue_pairs ) ;
36443644}
36453645
36463646static int virtnet_set_queues (struct virtnet_info * vi , u16 queue_pairs )
@@ -4159,10 +4159,10 @@ static bool virtnet_commit_rss_command(struct virtnet_info *vi)
41594159
41604160static void virtnet_init_default_rss (struct virtnet_info * vi )
41614161{
4162- vi -> rss .hash_types = vi -> rss_hash_types_supported ;
4162+ vi -> rss .hash_types = cpu_to_le32 ( vi -> rss_hash_types_supported ) ;
41634163 vi -> rss_hash_types_saved = vi -> rss_hash_types_supported ;
41644164 vi -> rss .indirection_table_mask = vi -> rss_indir_table_size
4165- ? vi -> rss_indir_table_size - 1 : 0 ;
4165+ ? cpu_to_le16 ( vi -> rss_indir_table_size - 1 ) : 0 ;
41664166 vi -> rss .unclassified_queue = 0 ;
41674167
41684168 virtnet_rss_update_by_qpairs (vi , vi -> curr_queue_pairs );
@@ -4280,7 +4280,7 @@ static bool virtnet_set_hashflow(struct virtnet_info *vi, struct ethtool_rxnfc *
42804280
42814281 if (new_hashtypes != vi -> rss_hash_types_saved ) {
42824282 vi -> rss_hash_types_saved = new_hashtypes ;
4283- vi -> rss .hash_types = vi -> rss_hash_types_saved ;
4283+ vi -> rss .hash_types = cpu_to_le32 ( vi -> rss_hash_types_saved ) ;
42844284 if (vi -> dev -> features & NETIF_F_RXHASH )
42854285 return virtnet_commit_rss_command (vi );
42864286 }
@@ -5460,7 +5460,7 @@ static int virtnet_get_rxfh(struct net_device *dev,
54605460
54615461 if (rxfh -> indir ) {
54625462 for (i = 0 ; i < vi -> rss_indir_table_size ; ++ i )
5463- rxfh -> indir [i ] = vi -> rss .indirection_table [i ];
5463+ rxfh -> indir [i ] = le16_to_cpu ( vi -> rss .indirection_table [i ]) ;
54645464 }
54655465
54665466 if (rxfh -> key )
@@ -5488,7 +5488,7 @@ static int virtnet_set_rxfh(struct net_device *dev,
54885488 return - EOPNOTSUPP ;
54895489
54905490 for (i = 0 ; i < vi -> rss_indir_table_size ; ++ i )
5491- vi -> rss .indirection_table [i ] = rxfh -> indir [i ];
5491+ vi -> rss .indirection_table [i ] = cpu_to_le16 ( rxfh -> indir [i ]) ;
54925492 update = true;
54935493 }
54945494
@@ -6109,9 +6109,9 @@ static int virtnet_set_features(struct net_device *dev,
61096109
61106110 if ((dev -> features ^ features ) & NETIF_F_RXHASH ) {
61116111 if (features & NETIF_F_RXHASH )
6112- vi -> rss .hash_types = vi -> rss_hash_types_saved ;
6112+ vi -> rss .hash_types = cpu_to_le32 ( vi -> rss_hash_types_saved ) ;
61136113 else
6114- vi -> rss .hash_types = VIRTIO_NET_HASH_REPORT_NONE ;
6114+ vi -> rss .hash_types = cpu_to_le32 ( VIRTIO_NET_HASH_REPORT_NONE ) ;
61156115
61166116 if (!virtnet_commit_rss_command (vi ))
61176117 return - EINVAL ;
0 commit comments