diff options
Diffstat (limited to 'drivers/net/ethernet/intel')
| -rw-r--r-- | drivers/net/ethernet/intel/ice/ice.h | 1 | ||||
| -rw-r--r-- | drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 1 | ||||
| -rw-r--r-- | drivers/net/ethernet/intel/ice/ice_common.c | 31 | ||||
| -rw-r--r-- | drivers/net/ethernet/intel/ice/ice_main.c | 3 | ||||
| -rw-r--r-- | drivers/net/ethernet/intel/ice/ice_type.h | 4 |
5 files changed, 34 insertions, 6 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h index b8548370f1c7..ba03cbd3638e 100644 --- a/drivers/net/ethernet/intel/ice/ice.h +++ b/drivers/net/ethernet/intel/ice/ice.h | |||
| @@ -52,7 +52,6 @@ extern const char ice_drv_ver[]; | |||
| 52 | #define ICE_MBXQ_LEN 64 | 52 | #define ICE_MBXQ_LEN 64 |
| 53 | #define ICE_MIN_MSIX 2 | 53 | #define ICE_MIN_MSIX 2 |
| 54 | #define ICE_NO_VSI 0xffff | 54 | #define ICE_NO_VSI 0xffff |
| 55 | #define ICE_MAX_VSI_ALLOC 130 | ||
| 56 | #define ICE_MAX_TXQS 2048 | 55 | #define ICE_MAX_TXQS 2048 |
| 57 | #define ICE_MAX_RXQS 2048 | 56 | #define ICE_MAX_RXQS 2048 |
| 58 | #define ICE_VSI_MAP_CONTIG 0 | 57 | #define ICE_VSI_MAP_CONTIG 0 |
diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h index 6653555f55dd..602f02a0a2d1 100644 --- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | |||
| @@ -87,6 +87,7 @@ struct ice_aqc_list_caps { | |||
| 87 | /* Device/Function buffer entry, repeated per reported capability */ | 87 | /* Device/Function buffer entry, repeated per reported capability */ |
| 88 | struct ice_aqc_list_caps_elem { | 88 | struct ice_aqc_list_caps_elem { |
| 89 | __le16 cap; | 89 | __le16 cap; |
| 90 | #define ICE_AQC_CAPS_VALID_FUNCTIONS 0x0005 | ||
| 90 | #define ICE_AQC_CAPS_SRIOV 0x0012 | 91 | #define ICE_AQC_CAPS_SRIOV 0x0012 |
| 91 | #define ICE_AQC_CAPS_VF 0x0013 | 92 | #define ICE_AQC_CAPS_VF 0x0013 |
| 92 | #define ICE_AQC_CAPS_VSI 0x0017 | 93 | #define ICE_AQC_CAPS_VSI 0x0017 |
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index 554fd707a6d6..9de5a3aac77d 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c | |||
| @@ -1387,6 +1387,27 @@ void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res) | |||
| 1387 | } | 1387 | } |
| 1388 | 1388 | ||
| 1389 | /** | 1389 | /** |
| 1390 | * ice_get_guar_num_vsi - determine number of guar VSI for a PF | ||
| 1391 | * @hw: pointer to the hw structure | ||
| 1392 | * | ||
| 1393 | * Determine the number of valid functions by going through the bitmap returned | ||
| 1394 | * from parsing capabilities and use this to calculate the number of VSI per PF. | ||
| 1395 | */ | ||
| 1396 | static u32 ice_get_guar_num_vsi(struct ice_hw *hw) | ||
| 1397 | { | ||
| 1398 | u8 funcs; | ||
| 1399 | |||
| 1400 | #define ICE_CAPS_VALID_FUNCS_M 0xFF | ||
| 1401 | funcs = hweight8(hw->dev_caps.common_cap.valid_functions & | ||
| 1402 | ICE_CAPS_VALID_FUNCS_M); | ||
| 1403 | |||
| 1404 | if (!funcs) | ||
| 1405 | return 0; | ||
| 1406 | |||
| 1407 | return ICE_MAX_VSI / funcs; | ||
| 1408 | } | ||
| 1409 | |||
| 1410 | /** | ||
| 1390 | * ice_parse_caps - parse function/device capabilities | 1411 | * ice_parse_caps - parse function/device capabilities |
| 1391 | * @hw: pointer to the hw struct | 1412 | * @hw: pointer to the hw struct |
| 1392 | * @buf: pointer to a buffer containing function/device capability records | 1413 | * @buf: pointer to a buffer containing function/device capability records |
| @@ -1428,6 +1449,12 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count, | |||
| 1428 | u16 cap = le16_to_cpu(cap_resp->cap); | 1449 | u16 cap = le16_to_cpu(cap_resp->cap); |
| 1429 | 1450 | ||
| 1430 | switch (cap) { | 1451 | switch (cap) { |
| 1452 | case ICE_AQC_CAPS_VALID_FUNCTIONS: | ||
| 1453 | caps->valid_functions = number; | ||
| 1454 | ice_debug(hw, ICE_DBG_INIT, | ||
| 1455 | "HW caps: Valid Functions = %d\n", | ||
| 1456 | caps->valid_functions); | ||
| 1457 | break; | ||
| 1431 | case ICE_AQC_CAPS_SRIOV: | 1458 | case ICE_AQC_CAPS_SRIOV: |
| 1432 | caps->sr_iov_1_1 = (number == 1); | 1459 | caps->sr_iov_1_1 = (number == 1); |
| 1433 | ice_debug(hw, ICE_DBG_INIT, | 1460 | ice_debug(hw, ICE_DBG_INIT, |
| @@ -1457,10 +1484,10 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count, | |||
| 1457 | "HW caps: Dev.VSI cnt = %d\n", | 1484 | "HW caps: Dev.VSI cnt = %d\n", |
| 1458 | dev_p->num_vsi_allocd_to_host); | 1485 | dev_p->num_vsi_allocd_to_host); |
| 1459 | } else if (func_p) { | 1486 | } else if (func_p) { |
| 1460 | func_p->guaranteed_num_vsi = number; | 1487 | func_p->guar_num_vsi = ice_get_guar_num_vsi(hw); |
| 1461 | ice_debug(hw, ICE_DBG_INIT, | 1488 | ice_debug(hw, ICE_DBG_INIT, |
| 1462 | "HW caps: Func.VSI cnt = %d\n", | 1489 | "HW caps: Func.VSI cnt = %d\n", |
| 1463 | func_p->guaranteed_num_vsi); | 1490 | number); |
| 1464 | } | 1491 | } |
| 1465 | break; | 1492 | break; |
| 1466 | case ICE_AQC_CAPS_RSS: | 1493 | case ICE_AQC_CAPS_RSS: |
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 8584061e1bc6..ea79e5e1f589 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c | |||
| @@ -2091,8 +2091,7 @@ static int ice_probe(struct pci_dev *pdev, | |||
| 2091 | 2091 | ||
| 2092 | ice_determine_q_usage(pf); | 2092 | ice_determine_q_usage(pf); |
| 2093 | 2093 | ||
| 2094 | pf->num_alloc_vsi = min_t(u16, ICE_MAX_VSI_ALLOC, | 2094 | pf->num_alloc_vsi = hw->func_caps.guar_num_vsi; |
| 2095 | hw->func_caps.guaranteed_num_vsi); | ||
| 2096 | if (!pf->num_alloc_vsi) { | 2095 | if (!pf->num_alloc_vsi) { |
| 2097 | err = -EIO; | 2096 | err = -EIO; |
| 2098 | goto err_init_pf_unroll; | 2097 | goto err_init_pf_unroll; |
diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h index f4dbc81c1988..0ea428104215 100644 --- a/drivers/net/ethernet/intel/ice/ice_type.h +++ b/drivers/net/ethernet/intel/ice/ice_type.h | |||
| @@ -124,6 +124,8 @@ struct ice_phy_info { | |||
| 124 | 124 | ||
| 125 | /* Common HW capabilities for SW use */ | 125 | /* Common HW capabilities for SW use */ |
| 126 | struct ice_hw_common_caps { | 126 | struct ice_hw_common_caps { |
| 127 | u32 valid_functions; | ||
| 128 | |||
| 127 | /* TX/RX queues */ | 129 | /* TX/RX queues */ |
| 128 | u16 num_rxq; /* Number/Total RX queues */ | 130 | u16 num_rxq; /* Number/Total RX queues */ |
| 129 | u16 rxq_first_id; /* First queue ID for RX queues */ | 131 | u16 rxq_first_id; /* First queue ID for RX queues */ |
| @@ -150,7 +152,7 @@ struct ice_hw_func_caps { | |||
| 150 | struct ice_hw_common_caps common_cap; | 152 | struct ice_hw_common_caps common_cap; |
| 151 | u32 num_allocd_vfs; /* Number of allocated VFs */ | 153 | u32 num_allocd_vfs; /* Number of allocated VFs */ |
| 152 | u32 vf_base_id; /* Logical ID of the first VF */ | 154 | u32 vf_base_id; /* Logical ID of the first VF */ |
| 153 | u32 guaranteed_num_vsi; | 155 | u32 guar_num_vsi; |
| 154 | }; | 156 | }; |
| 155 | 157 | ||
| 156 | /* Device wide capabilities */ | 158 | /* Device wide capabilities */ |
