aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_lib.c
diff options
context:
space:
mode:
authorJesse Brandeburg <jesse.brandeburg@intel.com>2019-02-28 18:26:03 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2019-05-04 16:06:56 -0400
commit819d899863dc019e5e5fff869578b056a93e35db (patch)
tree14c97351f06b47ede013ec0e10bc41cf9b9a9ec0 /drivers/net/ethernet/intel/ice/ice_lib.c
parenta734d1f4c2fc962ef4daa179e216df84a8ec5f84 (diff)
ice: Use pf instead of vsi-back
Many times in our functions we have a local variable pf, which is equivalent to vsi->back. Just use pf consistently instead of vsi->back where available. Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> 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_lib.c')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_lib.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 49c75371af08..bda6ade755c3 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -301,7 +301,6 @@ static void ice_vsi_set_num_desc(struct ice_vsi *vsi)
301static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id) 301static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id)
302{ 302{
303 struct ice_pf *pf = vsi->back; 303 struct ice_pf *pf = vsi->back;
304
305 struct ice_vf *vf = NULL; 304 struct ice_vf *vf = NULL;
306 305
307 if (vsi->type == ICE_VSI_VF) 306 if (vsi->type == ICE_VSI_VF)
@@ -325,8 +324,7 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id)
325 vsi->num_q_vectors = pf->num_vf_msix - 1; 324 vsi->num_q_vectors = pf->num_vf_msix - 1;
326 break; 325 break;
327 default: 326 default:
328 dev_warn(&vsi->back->pdev->dev, "Unknown VSI type %d\n", 327 dev_warn(&pf->pdev->dev, "Unknown VSI type %d\n", vsi->type);
329 vsi->type);
330 break; 328 break;
331 } 329 }
332 330
@@ -573,7 +571,7 @@ static int __ice_vsi_get_qs_contig(struct ice_qs_cfg *qs_cfg)
573 571
574/** 572/**
575 * __ice_vsi_get_qs_sc - Assign a scattered queues from PF to VSI 573 * __ice_vsi_get_qs_sc - Assign a scattered queues from PF to VSI
576 * @qs_cfg: gathered variables needed for PF->VSI queues assignment 574 * @qs_cfg: gathered variables needed for pf->vsi queues assignment
577 * 575 *
578 * Return 0 on success and -ENOMEM in case of no left space in PF queue bitmap 576 * Return 0 on success and -ENOMEM in case of no left space in PF queue bitmap
579 */ 577 */
@@ -917,6 +915,9 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
917static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi) 915static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)
918{ 916{
919 u8 lut_type, hash_type; 917 u8 lut_type, hash_type;
918 struct ice_pf *pf;
919
920 pf = vsi->back;
920 921
921 switch (vsi->type) { 922 switch (vsi->type) {
922 case ICE_VSI_PF: 923 case ICE_VSI_PF:
@@ -930,8 +931,7 @@ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)
930 hash_type = ICE_AQ_VSI_Q_OPT_RSS_TPLZ; 931 hash_type = ICE_AQ_VSI_Q_OPT_RSS_TPLZ;
931 break; 932 break;
932 default: 933 default:
933 dev_warn(&vsi->back->pdev->dev, "Unknown VSI type %d\n", 934 dev_warn(&pf->pdev->dev, "Unknown VSI type %d\n", vsi->type);
934 vsi->type);
935 return; 935 return;
936 } 936 }
937 937
@@ -1018,10 +1018,11 @@ static int ice_vsi_init(struct ice_vsi *vsi)
1018static void ice_free_q_vector(struct ice_vsi *vsi, int v_idx) 1018static void ice_free_q_vector(struct ice_vsi *vsi, int v_idx)
1019{ 1019{
1020 struct ice_q_vector *q_vector; 1020 struct ice_q_vector *q_vector;
1021 struct ice_pf *pf = vsi->back;
1021 struct ice_ring *ring; 1022 struct ice_ring *ring;
1022 1023
1023 if (!vsi->q_vectors[v_idx]) { 1024 if (!vsi->q_vectors[v_idx]) {
1024 dev_dbg(&vsi->back->pdev->dev, "Queue vector at index %d not found\n", 1025 dev_dbg(&pf->pdev->dev, "Queue vector at index %d not found\n",
1025 v_idx); 1026 v_idx);
1026 return; 1027 return;
1027 } 1028 }
@@ -1036,7 +1037,7 @@ static void ice_free_q_vector(struct ice_vsi *vsi, int v_idx)
1036 if (vsi->netdev) 1037 if (vsi->netdev)
1037 netif_napi_del(&q_vector->napi); 1038 netif_napi_del(&q_vector->napi);
1038 1039
1039 devm_kfree(&vsi->back->pdev->dev, q_vector); 1040 devm_kfree(&pf->pdev->dev, q_vector);
1040 vsi->q_vectors[v_idx] = NULL; 1041 vsi->q_vectors[v_idx] = NULL;
1041} 1042}
1042 1043
@@ -1188,8 +1189,7 @@ static int ice_vsi_setup_vector_base(struct ice_vsi *vsi)
1188 num_q_vectors, vsi->idx); 1189 num_q_vectors, vsi->idx);
1189 break; 1190 break;
1190 default: 1191 default:
1191 dev_warn(&vsi->back->pdev->dev, "Unknown VSI type %d\n", 1192 dev_warn(&pf->pdev->dev, "Unknown VSI type %d\n", vsi->type);
1192 vsi->type);
1193 break; 1193 break;
1194 } 1194 }
1195 1195
@@ -1198,7 +1198,7 @@ static int ice_vsi_setup_vector_base(struct ice_vsi *vsi)
1198 "Failed to get tracking for %d HW vectors for VSI %d, err=%d\n", 1198 "Failed to get tracking for %d HW vectors for VSI %d, err=%d\n",
1199 num_q_vectors, vsi->vsi_num, vsi->hw_base_vector); 1199 num_q_vectors, vsi->vsi_num, vsi->hw_base_vector);
1200 if (vsi->type != ICE_VSI_VF) { 1200 if (vsi->type != ICE_VSI_VF) {
1201 ice_free_res(vsi->back->sw_irq_tracker, 1201 ice_free_res(pf->sw_irq_tracker,
1202 vsi->sw_base_vector, vsi->idx); 1202 vsi->sw_base_vector, vsi->idx);
1203 pf->num_avail_sw_msix += num_q_vectors; 1203 pf->num_avail_sw_msix += num_q_vectors;
1204 } 1204 }
@@ -1409,13 +1409,13 @@ static int ice_vsi_cfg_rss_lut_key(struct ice_vsi *vsi)
1409 vsi->rss_table_size); 1409 vsi->rss_table_size);
1410 1410
1411 if (status) { 1411 if (status) {
1412 dev_err(&vsi->back->pdev->dev, 1412 dev_err(&pf->pdev->dev,
1413 "set_rss_lut failed, error %d\n", status); 1413 "set_rss_lut failed, error %d\n", status);
1414 err = -EIO; 1414 err = -EIO;
1415 goto ice_vsi_cfg_rss_exit; 1415 goto ice_vsi_cfg_rss_exit;
1416 } 1416 }
1417 1417
1418 key = devm_kzalloc(&vsi->back->pdev->dev, sizeof(*key), GFP_KERNEL); 1418 key = devm_kzalloc(&pf->pdev->dev, sizeof(*key), GFP_KERNEL);
1419 if (!key) { 1419 if (!key) {
1420 err = -ENOMEM; 1420 err = -ENOMEM;
1421 goto ice_vsi_cfg_rss_exit; 1421 goto ice_vsi_cfg_rss_exit;
@@ -1432,7 +1432,7 @@ static int ice_vsi_cfg_rss_lut_key(struct ice_vsi *vsi)
1432 status = ice_aq_set_rss_key(&pf->hw, vsi->idx, key); 1432 status = ice_aq_set_rss_key(&pf->hw, vsi->idx, key);
1433 1433
1434 if (status) { 1434 if (status) {
1435 dev_err(&vsi->back->pdev->dev, "set_rss_key failed, error %d\n", 1435 dev_err(&pf->pdev->dev, "set_rss_key failed, error %d\n",
1436 status); 1436 status);
1437 err = -EIO; 1437 err = -EIO;
1438 } 1438 }
@@ -1717,7 +1717,7 @@ ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings, int offset)
1717 i, num_q_grps, qg_buf, 1717 i, num_q_grps, qg_buf,
1718 buf_len, NULL); 1718 buf_len, NULL);
1719 if (status) { 1719 if (status) {
1720 dev_err(&vsi->back->pdev->dev, 1720 dev_err(&pf->pdev->dev,
1721 "Failed to set LAN Tx queue context, error: %d\n", 1721 "Failed to set LAN Tx queue context, error: %d\n",
1722 status); 1722 status);
1723 err = -ENODEV; 1723 err = -ENODEV;
@@ -2148,12 +2148,14 @@ int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc)
2148{ 2148{
2149 struct ice_vsi_ctx *ctxt; 2149 struct ice_vsi_ctx *ctxt;
2150 struct device *dev; 2150 struct device *dev;
2151 struct ice_pf *pf;
2151 int status; 2152 int status;
2152 2153
2153 if (!vsi) 2154 if (!vsi)
2154 return -EINVAL; 2155 return -EINVAL;
2155 2156
2156 dev = &vsi->back->pdev->dev; 2157 pf = vsi->back;
2158 dev = &pf->pdev->dev;
2157 ctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL); 2159 ctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);
2158 if (!ctxt) 2160 if (!ctxt)
2159 return -ENOMEM; 2161 return -ENOMEM;
@@ -2177,11 +2179,11 @@ int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc)
2177 cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID | 2179 cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID |
2178 ICE_AQ_VSI_PROP_SW_VALID); 2180 ICE_AQ_VSI_PROP_SW_VALID);
2179 2181
2180 status = ice_update_vsi(&vsi->back->hw, vsi->idx, ctxt, NULL); 2182 status = ice_update_vsi(&pf->hw, vsi->idx, ctxt, NULL);
2181 if (status) { 2183 if (status) {
2182 netdev_err(vsi->netdev, "%sabling VLAN pruning on VSI handle: %d, VSI HW ID: %d failed, err = %d, aq_err = %d\n", 2184 netdev_err(vsi->netdev, "%sabling VLAN pruning on VSI handle: %d, VSI HW ID: %d failed, err = %d, aq_err = %d\n",
2183 ena ? "En" : "Dis", vsi->idx, vsi->vsi_num, status, 2185 ena ? "En" : "Dis", vsi->idx, vsi->vsi_num, status,
2184 vsi->back->hw.adminq.sq_last_status); 2186 pf->hw.adminq.sq_last_status);
2185 goto err_out; 2187 goto err_out;
2186 } 2188 }
2187 2189
@@ -2378,10 +2380,10 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
2378 2380
2379unroll_vector_base: 2381unroll_vector_base:
2380 /* reclaim SW interrupts back to the common pool */ 2382 /* reclaim SW interrupts back to the common pool */
2381 ice_free_res(vsi->back->sw_irq_tracker, vsi->sw_base_vector, vsi->idx); 2383 ice_free_res(pf->sw_irq_tracker, vsi->sw_base_vector, vsi->idx);
2382 pf->num_avail_sw_msix += vsi->num_q_vectors; 2384 pf->num_avail_sw_msix += vsi->num_q_vectors;
2383 /* reclaim HW interrupt back to the common pool */ 2385 /* reclaim HW interrupt back to the common pool */
2384 ice_free_res(vsi->back->hw_irq_tracker, vsi->hw_base_vector, vsi->idx); 2386 ice_free_res(pf->hw_irq_tracker, vsi->hw_base_vector, vsi->idx);
2385 pf->num_avail_hw_msix += vsi->num_q_vectors; 2387 pf->num_avail_hw_msix += vsi->num_q_vectors;
2386unroll_alloc_q_vector: 2388unroll_alloc_q_vector:
2387 ice_vsi_free_q_vectors(vsi); 2389 ice_vsi_free_q_vectors(vsi);
@@ -2718,18 +2720,16 @@ int ice_vsi_release(struct ice_vsi *vsi)
2718 /* reclaim interrupt vectors back to PF */ 2720 /* reclaim interrupt vectors back to PF */
2719 if (vsi->type != ICE_VSI_VF) { 2721 if (vsi->type != ICE_VSI_VF) {
2720 /* reclaim SW interrupts back to the common pool */ 2722 /* reclaim SW interrupts back to the common pool */
2721 ice_free_res(vsi->back->sw_irq_tracker, vsi->sw_base_vector, 2723 ice_free_res(pf->sw_irq_tracker, vsi->sw_base_vector, vsi->idx);
2722 vsi->idx);
2723 pf->num_avail_sw_msix += vsi->num_q_vectors; 2724 pf->num_avail_sw_msix += vsi->num_q_vectors;
2724 /* reclaim HW interrupts back to the common pool */ 2725 /* reclaim HW interrupts back to the common pool */
2725 ice_free_res(vsi->back->hw_irq_tracker, vsi->hw_base_vector, 2726 ice_free_res(pf->hw_irq_tracker, vsi->hw_base_vector, vsi->idx);
2726 vsi->idx);
2727 pf->num_avail_hw_msix += vsi->num_q_vectors; 2727 pf->num_avail_hw_msix += vsi->num_q_vectors;
2728 } else if (test_bit(ICE_VF_STATE_CFG_INTR, vf->vf_states)) { 2728 } else if (test_bit(ICE_VF_STATE_CFG_INTR, vf->vf_states)) {
2729 /* Reclaim VF resources back only while freeing all VFs or 2729 /* Reclaim VF resources back only while freeing all VFs or
2730 * vector reassignment is requested 2730 * vector reassignment is requested
2731 */ 2731 */
2732 ice_free_res(vsi->back->hw_irq_tracker, vf->first_vector_idx, 2732 ice_free_res(pf->hw_irq_tracker, vf->first_vector_idx,
2733 vsi->idx); 2733 vsi->idx);
2734 pf->num_avail_hw_msix += pf->num_vf_msix; 2734 pf->num_avail_hw_msix += pf->num_vf_msix;
2735 } 2735 }
@@ -2798,7 +2798,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi)
2798 2798
2799 ice_vsi_clear_rings(vsi); 2799 ice_vsi_clear_rings(vsi);
2800 ice_vsi_free_arrays(vsi, false); 2800 ice_vsi_free_arrays(vsi, false);
2801 ice_dev_onetime_setup(&vsi->back->hw); 2801 ice_dev_onetime_setup(&pf->hw);
2802 if (vsi->type == ICE_VSI_VF) 2802 if (vsi->type == ICE_VSI_VF)
2803 ice_vsi_set_num_qs(vsi, vf->vf_id); 2803 ice_vsi_set_num_qs(vsi, vf->vf_id);
2804 else 2804 else
@@ -2837,7 +2837,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi)
2837 * receive traffic on first queue. Hence no need to capture 2837 * receive traffic on first queue. Hence no need to capture
2838 * return value 2838 * return value
2839 */ 2839 */
2840 if (test_bit(ICE_FLAG_RSS_ENA, vsi->back->flags)) 2840 if (test_bit(ICE_FLAG_RSS_ENA, pf->flags))
2841 ice_vsi_cfg_rss_lut_key(vsi); 2841 ice_vsi_cfg_rss_lut_key(vsi);
2842 break; 2842 break;
2843 case ICE_VSI_VF: 2843 case ICE_VSI_VF:
@@ -2857,8 +2857,8 @@ int ice_vsi_rebuild(struct ice_vsi *vsi)
2857 if (ret) 2857 if (ret)
2858 goto err_vectors; 2858 goto err_vectors;
2859 2859
2860 vsi->back->q_left_tx -= vsi->alloc_txq; 2860 pf->q_left_tx -= vsi->alloc_txq;
2861 vsi->back->q_left_rx -= vsi->alloc_rxq; 2861 pf->q_left_rx -= vsi->alloc_rxq;
2862 break; 2862 break;
2863 default: 2863 default:
2864 break; 2864 break;
@@ -2889,7 +2889,7 @@ err_rings:
2889 } 2889 }
2890err_vsi: 2890err_vsi:
2891 ice_vsi_clear(vsi); 2891 ice_vsi_clear(vsi);
2892 set_bit(__ICE_RESET_FAILED, vsi->back->state); 2892 set_bit(__ICE_RESET_FAILED, pf->state);
2893 return ret; 2893 return ret;
2894} 2894}
2895 2895