aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_lib.c
diff options
context:
space:
mode:
authorBrett Creeley <brett.creeley@intel.com>2019-02-08 15:50:59 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2019-03-19 20:24:03 -0400
commitad71b256ba4e6e469d60e3f7b9973fd195b04bee (patch)
treedbf7f86e7058939ad11fb9caa1c9a13551ead638 /drivers/net/ethernet/intel/ice/ice_lib.c
parent544f63d307b103d0b1e2bc25f1830d48df177031 (diff)
ice: Determine descriptor count and ring size based on PAGE_SIZE
Currently we set the default number of Tx and Rx descriptors to 128 by default. For Rx this amounts to a full page (assuming 4K pages) because each Rx descriptor is 32 Bytes, but for Tx it only amounts to a half page because each Tx descriptor is 16 Bytes (assuming 4K pages). Instead of assuming 4K pages, determine the ring size and the number of descriptors for Tx and Rx based on a calculation using the PAGE_SIZE, ICE_MAX_NUM_DESC, and ICE_REQ_DESC_MULTIPLE. This change is being made to improve the performance of the driver when using the default settings. Signed-off-by: Brett Creeley <brett.creeley@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.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index c6572f6fb488..d3061f243877 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -276,7 +276,26 @@ err_txrings:
276} 276}
277 277
278/** 278/**
279 * ice_vsi_set_num_qs - Set num queues, descriptors and vectors for a VSI 279 * ice_vsi_set_num_desc - Set number of descriptors for queues on this VSI
280 * @vsi: the VSI being configured
281 */
282static void ice_vsi_set_num_desc(struct ice_vsi *vsi)
283{
284 switch (vsi->type) {
285 case ICE_VSI_PF:
286 vsi->num_rx_desc = ICE_DFLT_NUM_RX_DESC;
287 vsi->num_tx_desc = ICE_DFLT_NUM_TX_DESC;
288 break;
289 default:
290 dev_dbg(&vsi->back->pdev->dev,
291 "Not setting number of Tx/Rx descriptors for VSI type %d\n",
292 vsi->type);
293 break;
294 }
295}
296
297/**
298 * ice_vsi_set_num_qs - Set number of queues, descriptors and vectors for a VSI
280 * @vsi: the VSI being configured 299 * @vsi: the VSI being configured
281 * 300 *
282 * Return 0 on success and a negative value on error 301 * Return 0 on success and a negative value on error
@@ -289,7 +308,6 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi)
289 case ICE_VSI_PF: 308 case ICE_VSI_PF:
290 vsi->alloc_txq = pf->num_lan_tx; 309 vsi->alloc_txq = pf->num_lan_tx;
291 vsi->alloc_rxq = pf->num_lan_rx; 310 vsi->alloc_rxq = pf->num_lan_rx;
292 vsi->num_desc = ALIGN(ICE_DFLT_NUM_DESC, ICE_REQ_DESC_MULTIPLE);
293 vsi->num_q_vectors = max_t(int, pf->num_lan_rx, pf->num_lan_tx); 311 vsi->num_q_vectors = max_t(int, pf->num_lan_rx, pf->num_lan_tx);
294 break; 312 break;
295 case ICE_VSI_VF: 313 case ICE_VSI_VF:
@@ -307,6 +325,8 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi)
307 vsi->type); 325 vsi->type);
308 break; 326 break;
309 } 327 }
328
329 ice_vsi_set_num_desc(vsi);
310} 330}
311 331
312/** 332/**
@@ -1212,7 +1232,7 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi)
1212 ring->ring_active = false; 1232 ring->ring_active = false;
1213 ring->vsi = vsi; 1233 ring->vsi = vsi;
1214 ring->dev = &pf->pdev->dev; 1234 ring->dev = &pf->pdev->dev;
1215 ring->count = vsi->num_desc; 1235 ring->count = vsi->num_tx_desc;
1216 vsi->tx_rings[i] = ring; 1236 vsi->tx_rings[i] = ring;
1217 } 1237 }
1218 1238
@@ -1231,7 +1251,7 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi)
1231 ring->vsi = vsi; 1251 ring->vsi = vsi;
1232 ring->netdev = vsi->netdev; 1252 ring->netdev = vsi->netdev;
1233 ring->dev = &pf->pdev->dev; 1253 ring->dev = &pf->pdev->dev;
1234 ring->count = vsi->num_desc; 1254 ring->count = vsi->num_rx_desc;
1235 vsi->rx_rings[i] = ring; 1255 vsi->rx_rings[i] = ring;
1236 } 1256 }
1237 1257