@@ -3228,89 +3228,148 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter,
3228
3228
IXGBE_WRITE_REG (hw , IXGBE_SRRCTL (reg_idx ), srrctl );
3229
3229
}
3230
3230
3231
- static void ixgbe_setup_reta (struct ixgbe_adapter * adapter , const u32 * seed )
3231
+ /**
3232
+ * Return a number of entries in the RSS indirection table
3233
+ *
3234
+ * @adapter: device handle
3235
+ *
3236
+ * - 82598/82599/X540: 128
3237
+ * - X550(non-SRIOV mode): 512
3238
+ * - X550(SRIOV mode): 64
3239
+ */
3240
+ u32 ixgbe_rss_indir_tbl_entries (struct ixgbe_adapter * adapter )
3241
+ {
3242
+ if (adapter -> hw .mac .type < ixgbe_mac_X550 )
3243
+ return 128 ;
3244
+ else if (adapter -> flags & IXGBE_FLAG_SRIOV_ENABLED )
3245
+ return 64 ;
3246
+ else
3247
+ return 512 ;
3248
+ }
3249
+
3250
+ /**
3251
+ * Write the RETA table to HW
3252
+ *
3253
+ * @adapter: device handle
3254
+ *
3255
+ * Write the RSS redirection table stored in adapter.rss_indir_tbl[] to HW.
3256
+ */
3257
+ static void ixgbe_store_reta (struct ixgbe_adapter * adapter )
3232
3258
{
3259
+ u32 i , reta_entries = ixgbe_rss_indir_tbl_entries (adapter );
3233
3260
struct ixgbe_hw * hw = & adapter -> hw ;
3234
3261
u32 reta = 0 ;
3235
- int i , j ;
3236
- int reta_entries = 128 ;
3237
- u16 rss_i = adapter -> ring_feature [RING_F_RSS ].indices ;
3238
- int indices_multi ;
3239
-
3240
- /*
3241
- * Program table for at least 2 queues w/ SR-IOV so that VFs can
3242
- * make full use of any rings they may have. We will use the
3243
- * PSRTYPE register to control how many rings we use within the PF.
3244
- */
3245
- if ((adapter -> flags & IXGBE_FLAG_SRIOV_ENABLED ) && (rss_i < 2 ))
3246
- rss_i = 2 ;
3247
-
3248
- /* Fill out hash function seeds */
3249
- for (i = 0 ; i < 10 ; i ++ )
3250
- IXGBE_WRITE_REG (hw , IXGBE_RSSRK (i ), seed [i ]);
3262
+ u32 indices_multi ;
3263
+ u8 * indir_tbl = adapter -> rss_indir_tbl ;
3251
3264
3252
3265
/* Fill out the redirection table as follows:
3253
- * 82598: 128 (8 bit wide) entries containing pair of 4 bit RSS indices
3254
- * 82599/X540: 128 (8 bit wide) entries containing 4 bit RSS index
3255
- * X550: 512 (8 bit wide) entries containing 6 bit RSS index
3266
+ * - 82598: 8 bit wide entries containing pair of 4 bit RSS
3267
+ * indices.
3268
+ * - 82599/X540: 8 bit wide entries containing 4 bit RSS index
3269
+ * - X550: 8 bit wide entries containing 6 bit RSS index
3256
3270
*/
3257
3271
if (adapter -> hw .mac .type == ixgbe_mac_82598EB )
3258
3272
indices_multi = 0x11 ;
3259
3273
else
3260
3274
indices_multi = 0x1 ;
3261
3275
3262
- switch (adapter -> hw .mac .type ) {
3263
- case ixgbe_mac_X550 :
3264
- case ixgbe_mac_X550EM_x :
3265
- if (!(adapter -> flags & IXGBE_FLAG_SRIOV_ENABLED ))
3266
- reta_entries = 512 ;
3267
- default :
3268
- break ;
3269
- }
3270
-
3271
- /* Fill out redirection table */
3272
- for (i = 0 , j = 0 ; i < reta_entries ; i ++ , j ++ ) {
3273
- if (j == rss_i )
3274
- j = 0 ;
3275
- reta = (reta << 8 ) | (j * indices_multi );
3276
+ /* Write redirection table to HW */
3277
+ for (i = 0 ; i < reta_entries ; i ++ ) {
3278
+ reta |= indices_multi * indir_tbl [i ] << (i & 0x3 ) * 8 ;
3276
3279
if ((i & 3 ) == 3 ) {
3277
3280
if (i < 128 )
3278
3281
IXGBE_WRITE_REG (hw , IXGBE_RETA (i >> 2 ), reta );
3279
3282
else
3280
3283
IXGBE_WRITE_REG (hw , IXGBE_ERETA ((i >> 2 ) - 32 ),
3281
3284
reta );
3285
+ reta = 0 ;
3282
3286
}
3283
3287
}
3284
3288
}
3285
3289
3286
- static void ixgbe_setup_vfreta (struct ixgbe_adapter * adapter , const u32 * seed )
3290
+ /**
3291
+ * Write the RETA table to HW (for x550 devices in SRIOV mode)
3292
+ *
3293
+ * @adapter: device handle
3294
+ *
3295
+ * Write the RSS redirection table stored in adapter.rss_indir_tbl[] to HW.
3296
+ */
3297
+ static void ixgbe_store_vfreta (struct ixgbe_adapter * adapter )
3287
3298
{
3299
+ u32 i , reta_entries = ixgbe_rss_indir_tbl_entries (adapter );
3288
3300
struct ixgbe_hw * hw = & adapter -> hw ;
3289
3301
u32 vfreta = 0 ;
3302
+ unsigned int pf_pool = adapter -> num_vfs ;
3303
+
3304
+ /* Write redirection table to HW */
3305
+ for (i = 0 ; i < reta_entries ; i ++ ) {
3306
+ vfreta |= (u32 )adapter -> rss_indir_tbl [i ] << (i & 0x3 ) * 8 ;
3307
+ if ((i & 3 ) == 3 ) {
3308
+ IXGBE_WRITE_REG (hw , IXGBE_PFVFRETA (i >> 2 , pf_pool ),
3309
+ vfreta );
3310
+ vfreta = 0 ;
3311
+ }
3312
+ }
3313
+ }
3314
+
3315
+ static void ixgbe_setup_reta (struct ixgbe_adapter * adapter )
3316
+ {
3317
+ struct ixgbe_hw * hw = & adapter -> hw ;
3318
+ u32 i , j ;
3319
+ u32 reta_entries = ixgbe_rss_indir_tbl_entries (adapter );
3320
+ u16 rss_i = adapter -> ring_feature [RING_F_RSS ].indices ;
3321
+
3322
+ /* Program table for at least 2 queues w/ SR-IOV so that VFs can
3323
+ * make full use of any rings they may have. We will use the
3324
+ * PSRTYPE register to control how many rings we use within the PF.
3325
+ */
3326
+ if ((adapter -> flags & IXGBE_FLAG_SRIOV_ENABLED ) && (rss_i < 2 ))
3327
+ rss_i = 2 ;
3328
+
3329
+ /* Fill out hash function seeds */
3330
+ for (i = 0 ; i < 10 ; i ++ )
3331
+ IXGBE_WRITE_REG (hw , IXGBE_RSSRK (i ), adapter -> rss_key [i ]);
3332
+
3333
+ /* Fill out redirection table */
3334
+ memset (adapter -> rss_indir_tbl , 0 , sizeof (adapter -> rss_indir_tbl ));
3335
+
3336
+ for (i = 0 , j = 0 ; i < reta_entries ; i ++ , j ++ ) {
3337
+ if (j == rss_i )
3338
+ j = 0 ;
3339
+
3340
+ adapter -> rss_indir_tbl [i ] = j ;
3341
+ }
3342
+
3343
+ ixgbe_store_reta (adapter );
3344
+ }
3345
+
3346
+ static void ixgbe_setup_vfreta (struct ixgbe_adapter * adapter )
3347
+ {
3348
+ struct ixgbe_hw * hw = & adapter -> hw ;
3290
3349
u16 rss_i = adapter -> ring_feature [RING_F_RSS ].indices ;
3291
3350
unsigned int pf_pool = adapter -> num_vfs ;
3292
3351
int i , j ;
3293
3352
3294
3353
/* Fill out hash function seeds */
3295
3354
for (i = 0 ; i < 10 ; i ++ )
3296
- IXGBE_WRITE_REG (hw , IXGBE_PFVFRSSRK (i , pf_pool ), seed [i ]);
3355
+ IXGBE_WRITE_REG (hw , IXGBE_PFVFRSSRK (i , pf_pool ),
3356
+ adapter -> rss_key [i ]);
3297
3357
3298
3358
/* Fill out the redirection table */
3299
3359
for (i = 0 , j = 0 ; i < 64 ; i ++ , j ++ ) {
3300
3360
if (j == rss_i )
3301
3361
j = 0 ;
3302
- vfreta = (vfreta << 8 ) | j ;
3303
- if ((i & 3 ) == 3 )
3304
- IXGBE_WRITE_REG (hw , IXGBE_PFVFRETA (i >> 2 , pf_pool ),
3305
- vfreta );
3362
+
3363
+ adapter -> rss_indir_tbl [i ] = j ;
3306
3364
}
3365
+
3366
+ ixgbe_store_vfreta (adapter );
3307
3367
}
3308
3368
3309
3369
static void ixgbe_setup_mrqc (struct ixgbe_adapter * adapter )
3310
3370
{
3311
3371
struct ixgbe_hw * hw = & adapter -> hw ;
3312
3372
u32 mrqc = 0 , rss_field = 0 , vfmrqc = 0 ;
3313
- u32 rss_key [10 ];
3314
3373
u32 rxcsum ;
3315
3374
3316
3375
/* Disable indicating checksum in descriptor, enables RSS hash */
@@ -3354,7 +3413,7 @@ static void ixgbe_setup_mrqc(struct ixgbe_adapter *adapter)
3354
3413
if (adapter -> flags2 & IXGBE_FLAG2_RSS_FIELD_IPV6_UDP )
3355
3414
rss_field |= IXGBE_MRQC_RSS_FIELD_IPV6_UDP ;
3356
3415
3357
- netdev_rss_key_fill (rss_key , sizeof (rss_key ));
3416
+ netdev_rss_key_fill (adapter -> rss_key , sizeof (adapter -> rss_key ));
3358
3417
if ((hw -> mac .type >= ixgbe_mac_X550 ) &&
3359
3418
(adapter -> flags & IXGBE_FLAG_SRIOV_ENABLED )) {
3360
3419
unsigned int pf_pool = adapter -> num_vfs ;
@@ -3364,12 +3423,12 @@ static void ixgbe_setup_mrqc(struct ixgbe_adapter *adapter)
3364
3423
IXGBE_WRITE_REG (hw , IXGBE_MRQC , mrqc );
3365
3424
3366
3425
/* Setup RSS through the VF registers */
3367
- ixgbe_setup_vfreta (adapter , rss_key );
3426
+ ixgbe_setup_vfreta (adapter );
3368
3427
vfmrqc = IXGBE_MRQC_RSSEN ;
3369
3428
vfmrqc |= rss_field ;
3370
3429
IXGBE_WRITE_REG (hw , IXGBE_PFVFMRQC (pf_pool ), vfmrqc );
3371
3430
} else {
3372
- ixgbe_setup_reta (adapter , rss_key );
3431
+ ixgbe_setup_reta (adapter );
3373
3432
mrqc |= rss_field ;
3374
3433
IXGBE_WRITE_REG (hw , IXGBE_MRQC , mrqc );
3375
3434
}
@@ -3599,6 +3658,10 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter)
3599
3658
/* enable ethertype anti spoofing if hw supports it */
3600
3659
if (hw -> mac .ops .set_ethertype_anti_spoofing )
3601
3660
hw -> mac .ops .set_ethertype_anti_spoofing (hw , true, i );
3661
+
3662
+ /* Enable/Disable RSS query feature */
3663
+ ixgbe_ndo_set_vf_rss_query_en (adapter -> netdev , i ,
3664
+ adapter -> vfinfo [i ].rss_query_enabled );
3602
3665
}
3603
3666
}
3604
3667
@@ -8101,6 +8164,7 @@ static const struct net_device_ops ixgbe_netdev_ops = {
8101
8164
.ndo_set_vf_vlan = ixgbe_ndo_set_vf_vlan ,
8102
8165
.ndo_set_vf_rate = ixgbe_ndo_set_vf_bw ,
8103
8166
.ndo_set_vf_spoofchk = ixgbe_ndo_set_vf_spoofchk ,
8167
+ .ndo_set_vf_rss_query_en = ixgbe_ndo_set_vf_rss_query_en ,
8104
8168
.ndo_get_vf_config = ixgbe_ndo_get_vf_config ,
8105
8169
.ndo_get_stats64 = ixgbe_get_stats64 ,
8106
8170
#ifdef CONFIG_IXGBE_DCB
0 commit comments