Commit 03f7a986 authored by Anirudh Venkataramanan's avatar Anirudh Venkataramanan Committed by Jeff Kirsher

ice: Rework queue management code for reuse

This patch reworks the queue management code to allow for reuse with the
XDP feature (to be added in a future patch).
Signed-off-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
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 ab4ab73f
...@@ -129,6 +129,17 @@ struct ice_res_tracker { ...@@ -129,6 +129,17 @@ struct ice_res_tracker {
u16 list[1]; u16 list[1];
}; };
struct ice_qs_cfg {
struct mutex *qs_mutex; /* will be assgined to &pf->avail_q_mutex */
unsigned long *pf_map;
unsigned long pf_map_size;
unsigned int q_count;
unsigned int scatter_count;
u16 *vsi_map;
u16 vsi_map_offset;
u8 mapping_mode;
};
struct ice_sw { struct ice_sw {
struct ice_pf *pf; struct ice_pf *pf;
u16 sw_id; /* switch ID for this switch */ u16 sw_id; /* switch ID for this switch */
......
This diff is collapsed.
...@@ -15,7 +15,7 @@ void ice_update_eth_stats(struct ice_vsi *vsi); ...@@ -15,7 +15,7 @@ void ice_update_eth_stats(struct ice_vsi *vsi);
int ice_vsi_cfg_rxqs(struct ice_vsi *vsi); int ice_vsi_cfg_rxqs(struct ice_vsi *vsi);
int ice_vsi_cfg_txqs(struct ice_vsi *vsi); int ice_vsi_cfg_lan_txqs(struct ice_vsi *vsi);
void ice_vsi_cfg_msix(struct ice_vsi *vsi); void ice_vsi_cfg_msix(struct ice_vsi *vsi);
...@@ -31,7 +31,8 @@ int ice_vsi_start_rx_rings(struct ice_vsi *vsi); ...@@ -31,7 +31,8 @@ int ice_vsi_start_rx_rings(struct ice_vsi *vsi);
int ice_vsi_stop_rx_rings(struct ice_vsi *vsi); int ice_vsi_stop_rx_rings(struct ice_vsi *vsi);
int ice_vsi_stop_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, int
ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
u16 rel_vmvf_num); u16 rel_vmvf_num);
int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena); int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena);
......
...@@ -2546,7 +2546,8 @@ static int ice_vsi_cfg(struct ice_vsi *vsi) ...@@ -2546,7 +2546,8 @@ static int ice_vsi_cfg(struct ice_vsi *vsi)
if (err) if (err)
return err; return err;
} }
err = ice_vsi_cfg_txqs(vsi);
err = ice_vsi_cfg_lan_txqs(vsi);
if (!err) if (!err)
err = ice_vsi_cfg_rxqs(vsi); err = ice_vsi_cfg_rxqs(vsi);
...@@ -3040,7 +3041,8 @@ int ice_down(struct ice_vsi *vsi) ...@@ -3040,7 +3041,8 @@ int ice_down(struct ice_vsi *vsi)
} }
ice_vsi_dis_irq(vsi); ice_vsi_dis_irq(vsi);
tx_err = ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, 0);
tx_err = ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, 0);
if (tx_err) if (tx_err)
netdev_err(vsi->netdev, netdev_err(vsi->netdev,
"Failed stop Tx rings, VSI %d error %d\n", "Failed stop Tx rings, VSI %d error %d\n",
......
...@@ -224,13 +224,15 @@ void ice_free_vfs(struct ice_pf *pf) ...@@ -224,13 +224,15 @@ void ice_free_vfs(struct ice_pf *pf)
/* Avoid wait time by stopping all VFs at the same time */ /* Avoid wait time by stopping all VFs at the same time */
for (i = 0; i < pf->num_alloc_vfs; i++) { for (i = 0; i < pf->num_alloc_vfs; i++) {
struct ice_vsi *vsi;
if (!test_bit(ICE_VF_STATE_ENA, pf->vf[i].vf_states)) if (!test_bit(ICE_VF_STATE_ENA, pf->vf[i].vf_states))
continue; continue;
vsi = pf->vsi[pf->vf[i].lan_vsi_idx];
/* stop rings without wait time */ /* stop rings without wait time */
ice_vsi_stop_tx_rings(pf->vsi[pf->vf[i].lan_vsi_idx], ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, i);
ICE_NO_RESET, i); ice_vsi_stop_rx_rings(vsi);
ice_vsi_stop_rx_rings(pf->vsi[pf->vf[i].lan_vsi_idx]);
clear_bit(ICE_VF_STATE_ENA, pf->vf[i].vf_states); clear_bit(ICE_VF_STATE_ENA, pf->vf[i].vf_states);
} }
...@@ -831,6 +833,7 @@ static bool ice_reset_vf(struct ice_vf *vf, bool is_vflr) ...@@ -831,6 +833,7 @@ static bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)
{ {
struct ice_pf *pf = vf->pf; struct ice_pf *pf = vf->pf;
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
struct ice_vsi *vsi;
bool rsd = false; bool rsd = false;
u32 reg; u32 reg;
int i; int i;
...@@ -843,17 +846,18 @@ static bool ice_reset_vf(struct ice_vf *vf, bool is_vflr) ...@@ -843,17 +846,18 @@ static bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)
ice_trigger_vf_reset(vf, is_vflr); ice_trigger_vf_reset(vf, is_vflr);
vsi = pf->vsi[vf->lan_vsi_idx];
if (test_bit(ICE_VF_STATE_ENA, vf->vf_states)) { if (test_bit(ICE_VF_STATE_ENA, vf->vf_states)) {
ice_vsi_stop_tx_rings(pf->vsi[vf->lan_vsi_idx], ICE_VF_RESET, ice_vsi_stop_lan_tx_rings(vsi, ICE_VF_RESET, vf->vf_id);
vf->vf_id); ice_vsi_stop_rx_rings(vsi);
ice_vsi_stop_rx_rings(pf->vsi[vf->lan_vsi_idx]);
clear_bit(ICE_VF_STATE_ENA, vf->vf_states); clear_bit(ICE_VF_STATE_ENA, vf->vf_states);
} else { } else {
/* Call Disable LAN Tx queue AQ call even when queues are not /* Call Disable LAN Tx queue AQ call even when queues are not
* enabled. This is needed for successful completiom of VFR * enabled. This is needed for successful completiom of VFR
*/ */
ice_dis_vsi_txq(pf->vsi[vf->lan_vsi_idx]->port_info, 0, ice_dis_vsi_txq(vsi->port_info, 0, NULL, NULL, ICE_VF_RESET,
NULL, NULL, ICE_VF_RESET, vf->vf_id, NULL); vf->vf_id, NULL);
} }
/* poll VPGEN_VFRSTAT reg to make sure /* poll VPGEN_VFRSTAT reg to make sure
...@@ -1614,7 +1618,7 @@ static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg) ...@@ -1614,7 +1618,7 @@ static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg)
goto error_param; goto error_param;
} }
if (ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, vf->vf_id)) { if (ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, vf->vf_id)) {
dev_err(&vsi->back->pdev->dev, dev_err(&vsi->back->pdev->dev,
"Failed to stop tx rings on VSI %d\n", "Failed to stop tx rings on VSI %d\n",
vsi->vsi_num); vsi->vsi_num);
...@@ -1784,7 +1788,7 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) ...@@ -1784,7 +1788,7 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
vsi->num_txq = qci->num_queue_pairs; vsi->num_txq = qci->num_queue_pairs;
vsi->num_rxq = qci->num_queue_pairs; vsi->num_rxq = qci->num_queue_pairs;
if (!ice_vsi_cfg_txqs(vsi) && !ice_vsi_cfg_rxqs(vsi)) if (!ice_vsi_cfg_lan_txqs(vsi) && !ice_vsi_cfg_rxqs(vsi))
aq_ret = 0; aq_ret = 0;
else else
aq_ret = ICE_ERR_PARAM; aq_ret = ICE_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