@@ -368,15 +368,15 @@ struct receive_queue {
368
368
*/
369
369
#define VIRTIO_NET_RSS_MAX_KEY_SIZE 40
370
370
struct 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 ;
376
376
u8 hash_key_length ;
377
377
u8 key [VIRTIO_NET_RSS_MAX_KEY_SIZE ];
378
378
379
- u16 * indirection_table ;
379
+ __le16 * indirection_table ;
380
380
};
381
381
382
382
/* 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
3638
3638
3639
3639
for (; i < vi -> rss_indir_table_size ; ++ i ) {
3640
3640
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 ) ;
3642
3642
}
3643
- vi -> rss .max_tx_vq = queue_pairs ;
3643
+ vi -> rss .max_tx_vq = cpu_to_le16 ( queue_pairs ) ;
3644
3644
}
3645
3645
3646
3646
static 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)
4159
4159
4160
4160
static void virtnet_init_default_rss (struct virtnet_info * vi )
4161
4161
{
4162
- vi -> rss .hash_types = vi -> rss_hash_types_supported ;
4162
+ vi -> rss .hash_types = cpu_to_le32 ( vi -> rss_hash_types_supported ) ;
4163
4163
vi -> rss_hash_types_saved = vi -> rss_hash_types_supported ;
4164
4164
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 ;
4166
4166
vi -> rss .unclassified_queue = 0 ;
4167
4167
4168
4168
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 *
4280
4280
4281
4281
if (new_hashtypes != vi -> rss_hash_types_saved ) {
4282
4282
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 ) ;
4284
4284
if (vi -> dev -> features & NETIF_F_RXHASH )
4285
4285
return virtnet_commit_rss_command (vi );
4286
4286
}
@@ -5460,7 +5460,7 @@ static int virtnet_get_rxfh(struct net_device *dev,
5460
5460
5461
5461
if (rxfh -> indir ) {
5462
5462
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 ]) ;
5464
5464
}
5465
5465
5466
5466
if (rxfh -> key )
@@ -5488,7 +5488,7 @@ static int virtnet_set_rxfh(struct net_device *dev,
5488
5488
return - EOPNOTSUPP ;
5489
5489
5490
5490
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 ]) ;
5492
5492
update = true;
5493
5493
}
5494
5494
@@ -6109,9 +6109,9 @@ static int virtnet_set_features(struct net_device *dev,
6109
6109
6110
6110
if ((dev -> features ^ features ) & NETIF_F_RXHASH ) {
6111
6111
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 ) ;
6113
6113
else
6114
- vi -> rss .hash_types = VIRTIO_NET_HASH_REPORT_NONE ;
6114
+ vi -> rss .hash_types = cpu_to_le32 ( VIRTIO_NET_HASH_REPORT_NONE ) ;
6115
6115
6116
6116
if (!virtnet_commit_rss_command (vi ))
6117
6117
return - EINVAL ;
0 commit comments