Commit 9a946843 authored by Anirudh Venkataramanan's avatar Anirudh Venkataramanan Committed by Jeff Kirsher

ice: Use ice_pf_to_dev

Use ice_pf_to_dev(pf) instead of &pf->pdev->dev
Use ice_pf_to_dev(vsi->back) instead of &vsi->back->pdev->dev
When a pointer to the pf instance is available, use ice_pf_to_dev
instead of ice_hw_to_dev
Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 0a6ea04e
...@@ -324,7 +324,7 @@ int ice_setup_rx_ctx(struct ice_ring *ring) ...@@ -324,7 +324,7 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
if (err) if (err)
return err; return err;
dev_info(&vsi->back->pdev->dev, "Registered XDP mem model MEM_TYPE_ZERO_COPY on Rx ring %d\n", dev_info(ice_pf_to_dev(vsi->back), "Registered XDP mem model MEM_TYPE_ZERO_COPY on Rx ring %d\n",
ring->q_index); ring->q_index);
} else { } else {
ring->zca.free = NULL; ring->zca.free = NULL;
...@@ -405,7 +405,7 @@ int ice_setup_rx_ctx(struct ice_ring *ring) ...@@ -405,7 +405,7 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
/* Absolute queue number out of 2K needs to be passed */ /* Absolute queue number out of 2K needs to be passed */
err = ice_write_rxq_ctx(hw, &rlan_ctx, pf_q); err = ice_write_rxq_ctx(hw, &rlan_ctx, pf_q);
if (err) { if (err) {
dev_err(&vsi->back->pdev->dev, dev_err(ice_pf_to_dev(vsi->back),
"Failed to set LAN Rx queue context for absolute Rx queue %d error: %d\n", "Failed to set LAN Rx queue context for absolute Rx queue %d error: %d\n",
pf_q, err); pf_q, err);
return -EIO; return -EIO;
...@@ -428,7 +428,7 @@ int ice_setup_rx_ctx(struct ice_ring *ring) ...@@ -428,7 +428,7 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
ice_alloc_rx_bufs_slow_zc(ring, ICE_DESC_UNUSED(ring)) : ice_alloc_rx_bufs_slow_zc(ring, ICE_DESC_UNUSED(ring)) :
ice_alloc_rx_bufs(ring, ICE_DESC_UNUSED(ring)); ice_alloc_rx_bufs(ring, ICE_DESC_UNUSED(ring));
if (err) if (err)
dev_info(&vsi->back->pdev->dev, dev_info(ice_pf_to_dev(vsi->back),
"Failed allocate some buffers on %sRx ring %d (pf_q %d)\n", "Failed allocate some buffers on %sRx ring %d (pf_q %d)\n",
ring->xsk_umem ? "UMEM enabled " : "", ring->xsk_umem ? "UMEM enabled " : "",
ring->q_index, pf_q); ring->q_index, pf_q);
...@@ -815,13 +815,13 @@ ice_vsi_stop_tx_ring(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, ...@@ -815,13 +815,13 @@ ice_vsi_stop_tx_ring(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
* queues at the hardware level anyway. * queues at the hardware level anyway.
*/ */
if (status == ICE_ERR_RESET_ONGOING) { if (status == ICE_ERR_RESET_ONGOING) {
dev_dbg(&vsi->back->pdev->dev, dev_dbg(ice_pf_to_dev(vsi->back),
"Reset in progress. LAN Tx queues already disabled\n"); "Reset in progress. LAN Tx queues already disabled\n");
} else if (status == ICE_ERR_DOES_NOT_EXIST) { } else if (status == ICE_ERR_DOES_NOT_EXIST) {
dev_dbg(&vsi->back->pdev->dev, dev_dbg(ice_pf_to_dev(vsi->back),
"LAN Tx queues do not exist, nothing to disable\n"); "LAN Tx queues do not exist, nothing to disable\n");
} else if (status) { } else if (status) {
dev_err(&vsi->back->pdev->dev, dev_err(ice_pf_to_dev(vsi->back),
"Failed to disable LAN Tx queues, error: %d\n", status); "Failed to disable LAN Tx queues, error: %d\n", status);
return -ENODEV; return -ENODEV;
} }
......
...@@ -882,7 +882,7 @@ ice_dcbnl_vsi_del_app(struct ice_vsi *vsi, ...@@ -882,7 +882,7 @@ ice_dcbnl_vsi_del_app(struct ice_vsi *vsi,
sapp.protocol = app->prot_id; sapp.protocol = app->prot_id;
sapp.priority = app->priority; sapp.priority = app->priority;
err = ice_dcbnl_delapp(vsi->netdev, &sapp); err = ice_dcbnl_delapp(vsi->netdev, &sapp);
dev_dbg(&vsi->back->pdev->dev, dev_dbg(ice_pf_to_dev(vsi->back),
"Deleting app for VSI idx=%d err=%d sel=%d proto=0x%x, prio=%d\n", "Deleting app for VSI idx=%d err=%d sel=%d proto=0x%x, prio=%d\n",
vsi->idx, err, app->selector, app->prot_id, app->priority); vsi->idx, err, app->selector, app->prot_id, app->priority);
} }
......
...@@ -1058,7 +1058,7 @@ ice_set_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam) ...@@ -1058,7 +1058,7 @@ ice_set_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam)
fec = ICE_FEC_NONE; fec = ICE_FEC_NONE;
break; break;
default: default:
dev_warn(&vsi->back->pdev->dev, "Unsupported FEC mode: %d\n", dev_warn(ice_pf_to_dev(vsi->back), "Unsupported FEC mode: %d\n",
fecparam->fec); fecparam->fec);
return -EINVAL; return -EINVAL;
} }
......
...@@ -117,7 +117,7 @@ static void ice_vsi_set_num_desc(struct ice_vsi *vsi) ...@@ -117,7 +117,7 @@ static void ice_vsi_set_num_desc(struct ice_vsi *vsi)
vsi->num_tx_desc = ICE_DFLT_NUM_TX_DESC; vsi->num_tx_desc = ICE_DFLT_NUM_TX_DESC;
break; break;
default: default:
dev_dbg(&vsi->back->pdev->dev, dev_dbg(ice_pf_to_dev(vsi->back),
"Not setting number of Tx/Rx descriptors for VSI type %d\n", "Not setting number of Tx/Rx descriptors for VSI type %d\n",
vsi->type); vsi->type);
break; break;
...@@ -724,7 +724,7 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) ...@@ -724,7 +724,7 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
vsi->num_txq = tx_count; vsi->num_txq = tx_count;
if (vsi->type == ICE_VSI_VF && vsi->num_txq != vsi->num_rxq) { if (vsi->type == ICE_VSI_VF && vsi->num_txq != vsi->num_rxq) {
dev_dbg(&vsi->back->pdev->dev, "VF VSI should have same number of Tx and Rx queues. Hence making them equal\n"); dev_dbg(ice_pf_to_dev(vsi->back), "VF VSI should have same number of Tx and Rx queues. Hence making them equal\n");
/* since there is a chance that num_rxq could have been changed /* since there is a chance that num_rxq could have been changed
* in the above for loop, make num_txq equal to num_rxq. * in the above for loop, make num_txq equal to num_rxq.
*/ */
...@@ -1453,7 +1453,7 @@ int ice_vsi_cfg_rxqs(struct ice_vsi *vsi) ...@@ -1453,7 +1453,7 @@ int ice_vsi_cfg_rxqs(struct ice_vsi *vsi)
err = ice_setup_rx_ctx(vsi->rx_rings[i]); err = ice_setup_rx_ctx(vsi->rx_rings[i]);
if (err) { if (err) {
dev_err(&vsi->back->pdev->dev, dev_err(ice_pf_to_dev(vsi->back),
"ice_setup_rx_ctx failed for RxQ %d, err %d\n", "ice_setup_rx_ctx failed for RxQ %d, err %d\n",
i, err); i, err);
return err; return err;
...@@ -1623,7 +1623,7 @@ int ice_vsi_manage_vlan_insertion(struct ice_vsi *vsi) ...@@ -1623,7 +1623,7 @@ int ice_vsi_manage_vlan_insertion(struct ice_vsi *vsi)
status = ice_update_vsi(hw, vsi->idx, ctxt, NULL); status = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
if (status) { if (status) {
dev_err(&vsi->back->pdev->dev, "update VSI for VLAN insert failed, err %d aq_err %d\n", dev_err(ice_pf_to_dev(vsi->back), "update VSI for VLAN insert failed, err %d aq_err %d\n",
status, hw->adminq.sq_last_status); status, hw->adminq.sq_last_status);
ret = -EIO; ret = -EIO;
goto out; goto out;
...@@ -1669,7 +1669,7 @@ int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena) ...@@ -1669,7 +1669,7 @@ int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)
status = ice_update_vsi(hw, vsi->idx, ctxt, NULL); status = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
if (status) { if (status) {
dev_err(&vsi->back->pdev->dev, "update VSI for VLAN strip failed, ena = %d err %d aq_err %d\n", dev_err(ice_pf_to_dev(vsi->back), "update VSI for VLAN strip failed, ena = %d err %d aq_err %d\n",
ena, status, hw->adminq.sq_last_status); ena, status, hw->adminq.sq_last_status);
ret = -EIO; ret = -EIO;
goto out; goto out;
...@@ -1834,7 +1834,7 @@ ice_vsi_set_q_vectors_reg_idx(struct ice_vsi *vsi) ...@@ -1834,7 +1834,7 @@ ice_vsi_set_q_vectors_reg_idx(struct ice_vsi *vsi)
struct ice_q_vector *q_vector = vsi->q_vectors[i]; struct ice_q_vector *q_vector = vsi->q_vectors[i];
if (!q_vector) { if (!q_vector) {
dev_err(&vsi->back->pdev->dev, dev_err(ice_pf_to_dev(vsi->back),
"Failed to set reg_idx on q_vector %d VSI %d\n", "Failed to set reg_idx on q_vector %d VSI %d\n",
i, vsi->vsi_num); i, vsi->vsi_num);
goto clear_reg_idx; goto clear_reg_idx;
...@@ -2961,7 +2961,7 @@ ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set) ...@@ -2961,7 +2961,7 @@ ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set)
status = ice_remove_mac(&vsi->back->hw, &tmp_add_list); status = ice_remove_mac(&vsi->back->hw, &tmp_add_list);
cfg_mac_fltr_exit: cfg_mac_fltr_exit:
ice_free_fltr_list(&vsi->back->pdev->dev, &tmp_add_list); ice_free_fltr_list(ice_pf_to_dev(vsi->back), &tmp_add_list);
return status; return status;
} }
......
...@@ -269,7 +269,7 @@ static int ice_cfg_promisc(struct ice_vsi *vsi, u8 promisc_m, bool set_promisc) ...@@ -269,7 +269,7 @@ static int ice_cfg_promisc(struct ice_vsi *vsi, u8 promisc_m, bool set_promisc)
*/ */
static int ice_vsi_sync_fltr(struct ice_vsi *vsi) static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
{ {
struct device *dev = &vsi->back->pdev->dev; struct device *dev = ice_pf_to_dev(vsi->back);
struct net_device *netdev = vsi->netdev; struct net_device *netdev = vsi->netdev;
bool promisc_forced_on = false; bool promisc_forced_on = false;
struct ice_pf *pf = vsi->back; struct ice_pf *pf = vsi->back;
...@@ -1368,7 +1368,7 @@ static int ice_force_phys_link_state(struct ice_vsi *vsi, bool link_up) ...@@ -1368,7 +1368,7 @@ static int ice_force_phys_link_state(struct ice_vsi *vsi, bool link_up)
if (vsi->type != ICE_VSI_PF) if (vsi->type != ICE_VSI_PF)
return 0; return 0;
dev = &vsi->back->pdev->dev; dev = ice_pf_to_dev(vsi->back);
pi = vsi->port_info; pi = vsi->port_info;
...@@ -1686,7 +1686,7 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename) ...@@ -1686,7 +1686,7 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename)
*/ */
static int ice_xdp_alloc_setup_rings(struct ice_vsi *vsi) static int ice_xdp_alloc_setup_rings(struct ice_vsi *vsi)
{ {
struct device *dev = &vsi->back->pdev->dev; struct device *dev = ice_pf_to_dev(vsi->back);
int i; int i;
for (i = 0; i < vsi->num_xdp_txq; i++) { for (i = 0; i < vsi->num_xdp_txq; i++) {
...@@ -3870,14 +3870,14 @@ ice_set_features(struct net_device *netdev, netdev_features_t features) ...@@ -3870,14 +3870,14 @@ ice_set_features(struct net_device *netdev, netdev_features_t features)
/* Don't set any netdev advanced features with device in Safe Mode */ /* Don't set any netdev advanced features with device in Safe Mode */
if (ice_is_safe_mode(vsi->back)) { if (ice_is_safe_mode(vsi->back)) {
dev_err(&vsi->back->pdev->dev, dev_err(ice_pf_to_dev(vsi->back),
"Device is in Safe Mode - not enabling advanced netdev features\n"); "Device is in Safe Mode - not enabling advanced netdev features\n");
return ret; return ret;
} }
/* Do not change setting during reset */ /* Do not change setting during reset */
if (ice_is_reset_in_progress(pf->state)) { if (ice_is_reset_in_progress(pf->state)) {
dev_err(&vsi->back->pdev->dev, dev_err(ice_pf_to_dev(vsi->back),
"Device is resetting, changing advanced netdev features temporarily unavailable.\n"); "Device is resetting, changing advanced netdev features temporarily unavailable.\n");
return -EBUSY; return -EBUSY;
} }
...@@ -4420,7 +4420,7 @@ int ice_vsi_setup_tx_rings(struct ice_vsi *vsi) ...@@ -4420,7 +4420,7 @@ int ice_vsi_setup_tx_rings(struct ice_vsi *vsi)
int i, err = 0; int i, err = 0;
if (!vsi->num_txq) { if (!vsi->num_txq) {
dev_err(&vsi->back->pdev->dev, "VSI %d has 0 Tx queues\n", dev_err(ice_pf_to_dev(vsi->back), "VSI %d has 0 Tx queues\n",
vsi->vsi_num); vsi->vsi_num);
return -EINVAL; return -EINVAL;
} }
...@@ -4451,7 +4451,7 @@ int ice_vsi_setup_rx_rings(struct ice_vsi *vsi) ...@@ -4451,7 +4451,7 @@ int ice_vsi_setup_rx_rings(struct ice_vsi *vsi)
int i, err = 0; int i, err = 0;
if (!vsi->num_rxq) { if (!vsi->num_rxq) {
dev_err(&vsi->back->pdev->dev, "VSI %d has 0 Rx queues\n", dev_err(ice_pf_to_dev(vsi->back), "VSI %d has 0 Rx queues\n",
vsi->vsi_num); vsi->vsi_num);
return -EINVAL; return -EINVAL;
} }
...@@ -4987,7 +4987,7 @@ static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode) ...@@ -4987,7 +4987,7 @@ static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode)
status = ice_update_vsi(hw, vsi->idx, ctxt, NULL); status = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
if (status) { if (status) {
dev_err(&vsi->back->pdev->dev, "update VSI for bridge mode failed, bmode = %d err %d aq_err %d\n", dev_err(ice_pf_to_dev(vsi->back), "update VSI for bridge mode failed, bmode = %d err %d aq_err %d\n",
bmode, status, hw->adminq.sq_last_status); bmode, status, hw->adminq.sq_last_status);
ret = -EIO; ret = -EIO;
goto out; goto out;
......
...@@ -462,7 +462,7 @@ static int ice_vsi_manage_pvid(struct ice_vsi *vsi, u16 vid, bool enable) ...@@ -462,7 +462,7 @@ static int ice_vsi_manage_pvid(struct ice_vsi *vsi, u16 vid, bool enable)
status = ice_update_vsi(hw, vsi->idx, ctxt, NULL); status = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
if (status) { if (status) {
dev_info(&vsi->back->pdev->dev, "update VSI for port VLAN failed, err %d aq_err %d\n", dev_info(ice_pf_to_dev(vsi->back), "update VSI for port VLAN failed, err %d aq_err %d\n",
status, hw->adminq.sq_last_status); status, hw->adminq.sq_last_status);
ret = -EIO; ret = -EIO;
goto out; goto out;
...@@ -2063,7 +2063,7 @@ static int ice_vc_ena_qs_msg(struct ice_vf *vf, u8 *msg) ...@@ -2063,7 +2063,7 @@ static int ice_vc_ena_qs_msg(struct ice_vf *vf, u8 *msg)
continue; continue;
if (ice_vsi_ctrl_rx_ring(vsi, true, vf_q_id)) { if (ice_vsi_ctrl_rx_ring(vsi, true, vf_q_id)) {
dev_err(&vsi->back->pdev->dev, dev_err(ice_pf_to_dev(vsi->back),
"Failed to enable Rx ring %d on VSI %d\n", "Failed to enable Rx ring %d on VSI %d\n",
vf_q_id, vsi->vsi_num); vf_q_id, vsi->vsi_num);
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
...@@ -2166,7 +2166,7 @@ static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg) ...@@ -2166,7 +2166,7 @@ static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg)
if (ice_vsi_stop_tx_ring(vsi, ICE_NO_RESET, vf->vf_id, if (ice_vsi_stop_tx_ring(vsi, ICE_NO_RESET, vf->vf_id,
ring, &txq_meta)) { ring, &txq_meta)) {
dev_err(&vsi->back->pdev->dev, dev_err(ice_pf_to_dev(vsi->back),
"Failed to stop Tx ring %d on VSI %d\n", "Failed to stop Tx ring %d on VSI %d\n",
vf_q_id, vsi->vsi_num); vf_q_id, vsi->vsi_num);
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
...@@ -2193,7 +2193,7 @@ static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg) ...@@ -2193,7 +2193,7 @@ static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg)
continue; continue;
if (ice_vsi_ctrl_rx_ring(vsi, false, vf_q_id)) { if (ice_vsi_ctrl_rx_ring(vsi, false, vf_q_id)) {
dev_err(&vsi->back->pdev->dev, dev_err(ice_pf_to_dev(vsi->back),
"Failed to stop Rx ring %d on VSI %d\n", "Failed to stop Rx ring %d on VSI %d\n",
vf_q_id, vsi->vsi_num); vf_q_id, vsi->vsi_num);
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment