diff options
author | Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> | 2018-09-19 20:23:13 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2018-10-02 10:13:23 -0400 |
commit | 4fb33f3107e194793bf947183f29ddce5d80a19f (patch) | |
tree | 28180a6f6d72085556a16f950ae60af85149db5d /drivers/net/ethernet/intel/ice/ice_common.c | |
parent | 5726ca0e5eaad0f194979e66c29c1d22029f1041 (diff) |
ice: Expand use of VSI handles part 2/2
This patch is a continuation of the previous patch where VSI
handles are used instead of VSI numbers.
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_common.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_common.c | 71 |
1 files changed, 46 insertions, 25 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index ef9229fa5510..62bc717e4a90 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c | |||
@@ -2055,7 +2055,7 @@ ice_aq_get_set_rss_lut_exit: | |||
2055 | /** | 2055 | /** |
2056 | * ice_aq_get_rss_lut | 2056 | * ice_aq_get_rss_lut |
2057 | * @hw: pointer to the hardware structure | 2057 | * @hw: pointer to the hardware structure |
2058 | * @vsi_id: VSI FW index | 2058 | * @vsi_handle: software VSI handle |
2059 | * @lut_type: LUT table type | 2059 | * @lut_type: LUT table type |
2060 | * @lut: pointer to the LUT buffer provided by the caller | 2060 | * @lut: pointer to the LUT buffer provided by the caller |
2061 | * @lut_size: size of the LUT buffer | 2061 | * @lut_size: size of the LUT buffer |
@@ -2063,17 +2063,20 @@ ice_aq_get_set_rss_lut_exit: | |||
2063 | * get the RSS lookup table, PF or VSI type | 2063 | * get the RSS lookup table, PF or VSI type |
2064 | */ | 2064 | */ |
2065 | enum ice_status | 2065 | enum ice_status |
2066 | ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, | 2066 | ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, |
2067 | u16 lut_size) | 2067 | u8 *lut, u16 lut_size) |
2068 | { | 2068 | { |
2069 | return __ice_aq_get_set_rss_lut(hw, vsi_id, lut_type, lut, lut_size, 0, | 2069 | if (!ice_is_vsi_valid(hw, vsi_handle) || !lut) |
2070 | false); | 2070 | return ICE_ERR_PARAM; |
2071 | |||
2072 | return __ice_aq_get_set_rss_lut(hw, ice_get_hw_vsi_num(hw, vsi_handle), | ||
2073 | lut_type, lut, lut_size, 0, false); | ||
2071 | } | 2074 | } |
2072 | 2075 | ||
2073 | /** | 2076 | /** |
2074 | * ice_aq_set_rss_lut | 2077 | * ice_aq_set_rss_lut |
2075 | * @hw: pointer to the hardware structure | 2078 | * @hw: pointer to the hardware structure |
2076 | * @vsi_id: VSI FW index | 2079 | * @vsi_handle: software VSI handle |
2077 | * @lut_type: LUT table type | 2080 | * @lut_type: LUT table type |
2078 | * @lut: pointer to the LUT buffer provided by the caller | 2081 | * @lut: pointer to the LUT buffer provided by the caller |
2079 | * @lut_size: size of the LUT buffer | 2082 | * @lut_size: size of the LUT buffer |
@@ -2081,11 +2084,14 @@ ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, | |||
2081 | * set the RSS lookup table, PF or VSI type | 2084 | * set the RSS lookup table, PF or VSI type |
2082 | */ | 2085 | */ |
2083 | enum ice_status | 2086 | enum ice_status |
2084 | ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, | 2087 | ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, |
2085 | u16 lut_size) | 2088 | u8 *lut, u16 lut_size) |
2086 | { | 2089 | { |
2087 | return __ice_aq_get_set_rss_lut(hw, vsi_id, lut_type, lut, lut_size, 0, | 2090 | if (!ice_is_vsi_valid(hw, vsi_handle) || !lut) |
2088 | true); | 2091 | return ICE_ERR_PARAM; |
2092 | |||
2093 | return __ice_aq_get_set_rss_lut(hw, ice_get_hw_vsi_num(hw, vsi_handle), | ||
2094 | lut_type, lut, lut_size, 0, true); | ||
2089 | } | 2095 | } |
2090 | 2096 | ||
2091 | /** | 2097 | /** |
@@ -2126,31 +2132,39 @@ ice_status __ice_aq_get_set_rss_key(struct ice_hw *hw, u16 vsi_id, | |||
2126 | /** | 2132 | /** |
2127 | * ice_aq_get_rss_key | 2133 | * ice_aq_get_rss_key |
2128 | * @hw: pointer to the hw struct | 2134 | * @hw: pointer to the hw struct |
2129 | * @vsi_id: VSI FW index | 2135 | * @vsi_handle: software VSI handle |
2130 | * @key: pointer to key info struct | 2136 | * @key: pointer to key info struct |
2131 | * | 2137 | * |
2132 | * get the RSS key per VSI | 2138 | * get the RSS key per VSI |
2133 | */ | 2139 | */ |
2134 | enum ice_status | 2140 | enum ice_status |
2135 | ice_aq_get_rss_key(struct ice_hw *hw, u16 vsi_id, | 2141 | ice_aq_get_rss_key(struct ice_hw *hw, u16 vsi_handle, |
2136 | struct ice_aqc_get_set_rss_keys *key) | 2142 | struct ice_aqc_get_set_rss_keys *key) |
2137 | { | 2143 | { |
2138 | return __ice_aq_get_set_rss_key(hw, vsi_id, key, false); | 2144 | if (!ice_is_vsi_valid(hw, vsi_handle) || !key) |
2145 | return ICE_ERR_PARAM; | ||
2146 | |||
2147 | return __ice_aq_get_set_rss_key(hw, ice_get_hw_vsi_num(hw, vsi_handle), | ||
2148 | key, false); | ||
2139 | } | 2149 | } |
2140 | 2150 | ||
2141 | /** | 2151 | /** |
2142 | * ice_aq_set_rss_key | 2152 | * ice_aq_set_rss_key |
2143 | * @hw: pointer to the hw struct | 2153 | * @hw: pointer to the hw struct |
2144 | * @vsi_id: VSI FW index | 2154 | * @vsi_handle: software VSI handle |
2145 | * @keys: pointer to key info struct | 2155 | * @keys: pointer to key info struct |
2146 | * | 2156 | * |
2147 | * set the RSS key per VSI | 2157 | * set the RSS key per VSI |
2148 | */ | 2158 | */ |
2149 | enum ice_status | 2159 | enum ice_status |
2150 | ice_aq_set_rss_key(struct ice_hw *hw, u16 vsi_id, | 2160 | ice_aq_set_rss_key(struct ice_hw *hw, u16 vsi_handle, |
2151 | struct ice_aqc_get_set_rss_keys *keys) | 2161 | struct ice_aqc_get_set_rss_keys *keys) |
2152 | { | 2162 | { |
2153 | return __ice_aq_get_set_rss_key(hw, vsi_id, keys, true); | 2163 | if (!ice_is_vsi_valid(hw, vsi_handle) || !keys) |
2164 | return ICE_ERR_PARAM; | ||
2165 | |||
2166 | return __ice_aq_get_set_rss_key(hw, ice_get_hw_vsi_num(hw, vsi_handle), | ||
2167 | keys, true); | ||
2154 | } | 2168 | } |
2155 | 2169 | ||
2156 | /** | 2170 | /** |
@@ -2489,7 +2503,7 @@ ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info) | |||
2489 | /** | 2503 | /** |
2490 | * ice_ena_vsi_txq | 2504 | * ice_ena_vsi_txq |
2491 | * @pi: port information structure | 2505 | * @pi: port information structure |
2492 | * @vsi_id: VSI id | 2506 | * @vsi_handle: software VSI handle |
2493 | * @tc: tc number | 2507 | * @tc: tc number |
2494 | * @num_qgrps: Number of added queue groups | 2508 | * @num_qgrps: Number of added queue groups |
2495 | * @buf: list of queue groups to be added | 2509 | * @buf: list of queue groups to be added |
@@ -2499,7 +2513,7 @@ ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info) | |||
2499 | * This function adds one lan q | 2513 | * This function adds one lan q |
2500 | */ | 2514 | */ |
2501 | enum ice_status | 2515 | enum ice_status |
2502 | ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_id, u8 tc, u8 num_qgrps, | 2516 | ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_qgrps, |
2503 | struct ice_aqc_add_tx_qgrp *buf, u16 buf_size, | 2517 | struct ice_aqc_add_tx_qgrp *buf, u16 buf_size, |
2504 | struct ice_sq_cd *cd) | 2518 | struct ice_sq_cd *cd) |
2505 | { | 2519 | { |
@@ -2516,15 +2530,19 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_id, u8 tc, u8 num_qgrps, | |||
2516 | 2530 | ||
2517 | hw = pi->hw; | 2531 | hw = pi->hw; |
2518 | 2532 | ||
2533 | if (!ice_is_vsi_valid(hw, vsi_handle)) | ||
2534 | return ICE_ERR_PARAM; | ||
2535 | |||
2519 | mutex_lock(&pi->sched_lock); | 2536 | mutex_lock(&pi->sched_lock); |
2520 | 2537 | ||
2521 | /* find a parent node */ | 2538 | /* find a parent node */ |
2522 | parent = ice_sched_get_free_qparent(pi, vsi_id, tc, | 2539 | parent = ice_sched_get_free_qparent(pi, vsi_handle, tc, |
2523 | ICE_SCHED_NODE_OWNER_LAN); | 2540 | ICE_SCHED_NODE_OWNER_LAN); |
2524 | if (!parent) { | 2541 | if (!parent) { |
2525 | status = ICE_ERR_PARAM; | 2542 | status = ICE_ERR_PARAM; |
2526 | goto ena_txq_exit; | 2543 | goto ena_txq_exit; |
2527 | } | 2544 | } |
2545 | |||
2528 | buf->parent_teid = parent->info.node_teid; | 2546 | buf->parent_teid = parent->info.node_teid; |
2529 | node.parent_teid = parent->info.node_teid; | 2547 | node.parent_teid = parent->info.node_teid; |
2530 | /* Mark that the values in the "generic" section as valid. The default | 2548 | /* Mark that the values in the "generic" section as valid. The default |
@@ -2602,7 +2620,7 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u8 num_queues, u16 *q_ids, | |||
2602 | /** | 2620 | /** |
2603 | * ice_cfg_vsi_qs - configure the new/exisiting VSI queues | 2621 | * ice_cfg_vsi_qs - configure the new/exisiting VSI queues |
2604 | * @pi: port information structure | 2622 | * @pi: port information structure |
2605 | * @vsi_id: VSI Id | 2623 | * @vsi_handle: software VSI handle |
2606 | * @tc_bitmap: TC bitmap | 2624 | * @tc_bitmap: TC bitmap |
2607 | * @maxqs: max queues array per TC | 2625 | * @maxqs: max queues array per TC |
2608 | * @owner: lan or rdma | 2626 | * @owner: lan or rdma |
@@ -2610,7 +2628,7 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u8 num_queues, u16 *q_ids, | |||
2610 | * This function adds/updates the VSI queues per TC. | 2628 | * This function adds/updates the VSI queues per TC. |
2611 | */ | 2629 | */ |
2612 | static enum ice_status | 2630 | static enum ice_status |
2613 | ice_cfg_vsi_qs(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap, | 2631 | ice_cfg_vsi_qs(struct ice_port_info *pi, u16 vsi_handle, u8 tc_bitmap, |
2614 | u16 *maxqs, u8 owner) | 2632 | u16 *maxqs, u8 owner) |
2615 | { | 2633 | { |
2616 | enum ice_status status = 0; | 2634 | enum ice_status status = 0; |
@@ -2619,6 +2637,9 @@ ice_cfg_vsi_qs(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap, | |||
2619 | if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY) | 2637 | if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY) |
2620 | return ICE_ERR_CFG; | 2638 | return ICE_ERR_CFG; |
2621 | 2639 | ||
2640 | if (!ice_is_vsi_valid(pi->hw, vsi_handle)) | ||
2641 | return ICE_ERR_PARAM; | ||
2642 | |||
2622 | mutex_lock(&pi->sched_lock); | 2643 | mutex_lock(&pi->sched_lock); |
2623 | 2644 | ||
2624 | for (i = 0; i < ICE_MAX_TRAFFIC_CLASS; i++) { | 2645 | for (i = 0; i < ICE_MAX_TRAFFIC_CLASS; i++) { |
@@ -2626,7 +2647,7 @@ ice_cfg_vsi_qs(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap, | |||
2626 | if (!ice_sched_get_tc_node(pi, i)) | 2647 | if (!ice_sched_get_tc_node(pi, i)) |
2627 | continue; | 2648 | continue; |
2628 | 2649 | ||
2629 | status = ice_sched_cfg_vsi(pi, vsi_id, i, maxqs[i], owner, | 2650 | status = ice_sched_cfg_vsi(pi, vsi_handle, i, maxqs[i], owner, |
2630 | ice_is_tc_ena(tc_bitmap, i)); | 2651 | ice_is_tc_ena(tc_bitmap, i)); |
2631 | if (status) | 2652 | if (status) |
2632 | break; | 2653 | break; |
@@ -2639,17 +2660,17 @@ ice_cfg_vsi_qs(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap, | |||
2639 | /** | 2660 | /** |
2640 | * ice_cfg_vsi_lan - configure VSI lan queues | 2661 | * ice_cfg_vsi_lan - configure VSI lan queues |
2641 | * @pi: port information structure | 2662 | * @pi: port information structure |
2642 | * @vsi_id: VSI Id | 2663 | * @vsi_handle: software VSI handle |
2643 | * @tc_bitmap: TC bitmap | 2664 | * @tc_bitmap: TC bitmap |
2644 | * @max_lanqs: max lan queues array per TC | 2665 | * @max_lanqs: max lan queues array per TC |
2645 | * | 2666 | * |
2646 | * This function adds/updates the VSI lan queues per TC. | 2667 | * This function adds/updates the VSI lan queues per TC. |
2647 | */ | 2668 | */ |
2648 | enum ice_status | 2669 | enum ice_status |
2649 | ice_cfg_vsi_lan(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap, | 2670 | ice_cfg_vsi_lan(struct ice_port_info *pi, u16 vsi_handle, u8 tc_bitmap, |
2650 | u16 *max_lanqs) | 2671 | u16 *max_lanqs) |
2651 | { | 2672 | { |
2652 | return ice_cfg_vsi_qs(pi, vsi_id, tc_bitmap, max_lanqs, | 2673 | return ice_cfg_vsi_qs(pi, vsi_handle, tc_bitmap, max_lanqs, |
2653 | ICE_SCHED_NODE_OWNER_LAN); | 2674 | ICE_SCHED_NODE_OWNER_LAN); |
2654 | } | 2675 | } |
2655 | 2676 | ||