@@ -3784,28 +3784,27 @@ static void be_calculate_vf_res(struct be_adapter *adapter, u16 num_vfs,
37843784 struct be_resources res_mod = {0 };
37853785 u16 num_vf_qs = 1 ;
37863786
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+ */
37943792 num_vf_qs = min (SH_VF_MAX_NIC_EQS ,
37953793 res .max_rss_qs / (num_vfs + 1 ));
37963794
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.
38003798 */
3801- if (num_vfs >= MAX_RSS_IFACES )
3799+ if (num_vfs >= be_max_pf_pool_rss_tables ( adapter ) )
38023800 num_vf_qs = 1 ;
38033801 }
38043802
38053803 /* Resource with fields set to all '1's by GET_PROFILE_CONFIG cmd,
38063804 * which are modifiable using SET_PROFILE_CONFIG cmd.
38073805 */
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 );
38093808
38103809 /* If RSS IFACE capability flags are modifiable for a VF, set the
38113810 * 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)
39033902
39043903 for_all_vfs (adapter , vf_cfg , vf ) {
39053904 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 ,
39073907 RESOURCE_LIMITS ,
39083908 vf + 1 );
39093909 if (!status ) {
@@ -4088,8 +4088,9 @@ static void BEx_get_resources(struct be_adapter *adapter,
40884088 /* On a SuperNIC profile, the driver needs to use the
40894089 * GET_PROFILE_CONFIG cmd to query the per-function TXQ limits
40904090 */
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 );
40934094 /* Some old versions of BE3 FW don't report max_tx_qs value */
40944095 res -> max_tx_qs = super_nic_res .max_tx_qs ? : BE3_MAX_TX_QS ;
40954096 } else {
@@ -4128,12 +4129,38 @@ static void be_setup_init(struct be_adapter *adapter)
41284129 adapter -> cmd_privileges = MIN_PRIVILEGES ;
41294130}
41304131
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+
41314157static int be_get_sriov_config (struct be_adapter * adapter )
41324158{
41334159 struct be_resources res = {0 };
41344160 int max_vfs , old_vfs ;
41354161
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 );
41374164
41384165 /* Some old versions of BE3 FW don't report max_vfs value */
41394166 if (BE3_chip (adapter ) && !res .max_vfs ) {
@@ -4157,6 +4184,12 @@ static int be_get_sriov_config(struct be_adapter *adapter)
41574184 adapter -> num_vfs = old_vfs ;
41584185 }
41594186
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+ }
41604193 return 0 ;
41614194}
41624195
@@ -4272,15 +4305,6 @@ static int be_get_config(struct be_adapter *adapter)
42724305 "Using profile 0x%x\n" , profile_id );
42734306 }
42744307
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-
42844308 return 0 ;
42854309}
42864310
@@ -4481,13 +4505,22 @@ static int be_setup(struct be_adapter *adapter)
44814505 return status ;
44824506 }
44834507
4508+ status = be_get_config (adapter );
4509+ if (status )
4510+ goto err ;
4511+
44844512 if (!BE2_chip (adapter ) && be_physfn (adapter ))
44854513 be_alloc_sriov_res (adapter );
44864514
4487- status = be_get_config (adapter );
4515+ status = be_get_resources (adapter );
44884516 if (status )
44894517 goto err ;
44904518
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+
44914524 status = be_msix_enable (adapter );
44924525 if (status )
44934526 goto err ;
0 commit comments