@@ -3784,28 +3784,27 @@ static void be_calculate_vf_res(struct be_adapter *adapter, u16 num_vfs,
3784
3784
struct be_resources res_mod = {0 };
3785
3785
u16 num_vf_qs = 1 ;
3786
3786
3787
- /* Distribute the queue resources among the PF and it's VFs
3788
- * Do not distribute queue resources in multi-channel configuration.
3789
- */
3790
- if (num_vfs && !be_is_mc (adapter )) {
3791
- /* Divide the rx queues evenly among the VFs and the PF, capped
3792
- * at VF-EQ-count. Any remainder queues belong to the PF.
3793
- */
3787
+ /* Distribute the queue resources among the PF and it's VFs */
3788
+ if (num_vfs ) {
3789
+ /* Divide the rx queues evenly among the VFs and the PF, capped
3790
+ * at VF-EQ-count. Any remainder queues belong to the PF.
3791
+ */
3794
3792
num_vf_qs = min (SH_VF_MAX_NIC_EQS ,
3795
3793
res .max_rss_qs / (num_vfs + 1 ));
3796
3794
3797
- /* Skyhawk-R chip supports only MAX_RSS_IFACES RSS capable
3798
- * interfaces per port. Provide RSS on VFs, only if number
3799
- * of VFs requested is less than MAX_RSS_IFACES limit.
3795
+ /* Skyhawk-R chip supports only MAX_PORT_RSS_TABLES
3796
+ * RSS Tables per port. Provide RSS on VFs, only if number of
3797
+ * VFs requested is less than it's PF Pool's RSS Tables limit.
3800
3798
*/
3801
- if (num_vfs >= MAX_RSS_IFACES )
3799
+ if (num_vfs >= be_max_pf_pool_rss_tables ( adapter ) )
3802
3800
num_vf_qs = 1 ;
3803
3801
}
3804
3802
3805
3803
/* Resource with fields set to all '1's by GET_PROFILE_CONFIG cmd,
3806
3804
* which are modifiable using SET_PROFILE_CONFIG cmd.
3807
3805
*/
3808
- be_cmd_get_profile_config (adapter , & res_mod , RESOURCE_MODIFIABLE , 0 );
3806
+ be_cmd_get_profile_config (adapter , & res_mod , NULL , ACTIVE_PROFILE_TYPE ,
3807
+ RESOURCE_MODIFIABLE , 0 );
3809
3808
3810
3809
/* If RSS IFACE capability flags are modifiable for a VF, set the
3811
3810
* capability flag as valid and set RSS and DEFQ_RSS IFACE flags if
@@ -3903,7 +3902,8 @@ static int be_vfs_if_create(struct be_adapter *adapter)
3903
3902
3904
3903
for_all_vfs (adapter , vf_cfg , vf ) {
3905
3904
if (!BE3_chip (adapter )) {
3906
- status = be_cmd_get_profile_config (adapter , & res ,
3905
+ status = be_cmd_get_profile_config (adapter , & res , NULL ,
3906
+ ACTIVE_PROFILE_TYPE ,
3907
3907
RESOURCE_LIMITS ,
3908
3908
vf + 1 );
3909
3909
if (!status ) {
@@ -4088,8 +4088,9 @@ static void BEx_get_resources(struct be_adapter *adapter,
4088
4088
/* On a SuperNIC profile, the driver needs to use the
4089
4089
* GET_PROFILE_CONFIG cmd to query the per-function TXQ limits
4090
4090
*/
4091
- be_cmd_get_profile_config (adapter , & super_nic_res ,
4092
- RESOURCE_LIMITS , 0 );
4091
+ be_cmd_get_profile_config (adapter , & super_nic_res , NULL ,
4092
+ ACTIVE_PROFILE_TYPE , RESOURCE_LIMITS ,
4093
+ 0 );
4093
4094
/* Some old versions of BE3 FW don't report max_tx_qs value */
4094
4095
res -> max_tx_qs = super_nic_res .max_tx_qs ? : BE3_MAX_TX_QS ;
4095
4096
} else {
@@ -4128,12 +4129,38 @@ static void be_setup_init(struct be_adapter *adapter)
4128
4129
adapter -> cmd_privileges = MIN_PRIVILEGES ;
4129
4130
}
4130
4131
4132
+ /* HW supports only MAX_PORT_RSS_TABLES RSS Policy Tables per port.
4133
+ * However, this HW limitation is not exposed to the host via any SLI cmd.
4134
+ * As a result, in the case of SRIOV and in particular multi-partition configs
4135
+ * the driver needs to calcuate a proportional share of RSS Tables per PF-pool
4136
+ * for distribution between the VFs. This self-imposed limit will determine the
4137
+ * no: of VFs for which RSS can be enabled.
4138
+ */
4139
+ void be_calculate_pf_pool_rss_tables (struct be_adapter * adapter )
4140
+ {
4141
+ struct be_port_resources port_res = {0 };
4142
+ u8 rss_tables_on_port ;
4143
+ u16 max_vfs = be_max_vfs (adapter );
4144
+
4145
+ be_cmd_get_profile_config (adapter , NULL , & port_res , SAVED_PROFILE_TYPE ,
4146
+ RESOURCE_LIMITS , 0 );
4147
+
4148
+ rss_tables_on_port = MAX_PORT_RSS_TABLES - port_res .nic_pfs ;
4149
+
4150
+ /* Each PF Pool's RSS Tables limit =
4151
+ * PF's Max VFs / Total_Max_VFs on Port * RSS Tables on Port
4152
+ */
4153
+ adapter -> pool_res .max_rss_tables =
4154
+ max_vfs * rss_tables_on_port / port_res .max_vfs ;
4155
+ }
4156
+
4131
4157
static int be_get_sriov_config (struct be_adapter * adapter )
4132
4158
{
4133
4159
struct be_resources res = {0 };
4134
4160
int max_vfs , old_vfs ;
4135
4161
4136
- be_cmd_get_profile_config (adapter , & res , RESOURCE_LIMITS , 0 );
4162
+ be_cmd_get_profile_config (adapter , & res , NULL , ACTIVE_PROFILE_TYPE ,
4163
+ RESOURCE_LIMITS , 0 );
4137
4164
4138
4165
/* Some old versions of BE3 FW don't report max_vfs value */
4139
4166
if (BE3_chip (adapter ) && !res .max_vfs ) {
@@ -4157,6 +4184,12 @@ static int be_get_sriov_config(struct be_adapter *adapter)
4157
4184
adapter -> num_vfs = old_vfs ;
4158
4185
}
4159
4186
4187
+ if (skyhawk_chip (adapter ) && be_max_vfs (adapter ) && !old_vfs ) {
4188
+ be_calculate_pf_pool_rss_tables (adapter );
4189
+ dev_info (& adapter -> pdev -> dev ,
4190
+ "RSS can be enabled for all VFs if num_vfs <= %d\n" ,
4191
+ be_max_pf_pool_rss_tables (adapter ));
4192
+ }
4160
4193
return 0 ;
4161
4194
}
4162
4195
@@ -4272,15 +4305,6 @@ static int be_get_config(struct be_adapter *adapter)
4272
4305
"Using profile 0x%x\n" , profile_id );
4273
4306
}
4274
4307
4275
- status = be_get_resources (adapter );
4276
- if (status )
4277
- return status ;
4278
-
4279
- adapter -> pmac_id = kcalloc (be_max_uc (adapter ),
4280
- sizeof (* adapter -> pmac_id ), GFP_KERNEL );
4281
- if (!adapter -> pmac_id )
4282
- return - ENOMEM ;
4283
-
4284
4308
return 0 ;
4285
4309
}
4286
4310
@@ -4481,13 +4505,22 @@ static int be_setup(struct be_adapter *adapter)
4481
4505
return status ;
4482
4506
}
4483
4507
4508
+ status = be_get_config (adapter );
4509
+ if (status )
4510
+ goto err ;
4511
+
4484
4512
if (!BE2_chip (adapter ) && be_physfn (adapter ))
4485
4513
be_alloc_sriov_res (adapter );
4486
4514
4487
- status = be_get_config (adapter );
4515
+ status = be_get_resources (adapter );
4488
4516
if (status )
4489
4517
goto err ;
4490
4518
4519
+ adapter -> pmac_id = kcalloc (be_max_uc (adapter ),
4520
+ sizeof (* adapter -> pmac_id ), GFP_KERNEL );
4521
+ if (!adapter -> pmac_id )
4522
+ return - ENOMEM ;
4523
+
4491
4524
status = be_msix_enable (adapter );
4492
4525
if (status )
4493
4526
goto err ;
0 commit comments