diff options
author | Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> | 2019-02-28 18:25:48 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2019-05-02 03:57:44 -0400 |
commit | bb87ee0efb7396d79ba5f37ff8e8721d01c87d4a (patch) | |
tree | f4cbd3f588e0409d949f865d44d5cc990bf535d1 /drivers/net/ethernet/intel/ice/ice_sched.c | |
parent | f76c4b571feea8eb03184d8ba0ee45f98fff47ff (diff) |
ice: Create framework for VSI queue context
This patch introduces a framework to store queue specific information
in VSI queue contexts. Currently VSI queue context (represented by
struct ice_q_ctx) only has q_handle as a member. In future patches,
this structure will be updated to hold queue specific information.
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_sched.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_sched.c | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_sched.c b/drivers/net/ethernet/intel/ice/ice_sched.c index 124feaf0e730..8d49f83be7a5 100644 --- a/drivers/net/ethernet/intel/ice/ice_sched.c +++ b/drivers/net/ethernet/intel/ice/ice_sched.c | |||
@@ -533,6 +533,50 @@ ice_sched_suspend_resume_elems(struct ice_hw *hw, u8 num_nodes, u32 *node_teids, | |||
533 | } | 533 | } |
534 | 534 | ||
535 | /** | 535 | /** |
536 | * ice_alloc_lan_q_ctx - allocate LAN queue contexts for the given VSI and TC | ||
537 | * @hw: pointer to the HW struct | ||
538 | * @vsi_handle: VSI handle | ||
539 | * @tc: TC number | ||
540 | * @new_numqs: number of queues | ||
541 | */ | ||
542 | static enum ice_status | ||
543 | ice_alloc_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs) | ||
544 | { | ||
545 | struct ice_vsi_ctx *vsi_ctx; | ||
546 | struct ice_q_ctx *q_ctx; | ||
547 | |||
548 | vsi_ctx = ice_get_vsi_ctx(hw, vsi_handle); | ||
549 | if (!vsi_ctx) | ||
550 | return ICE_ERR_PARAM; | ||
551 | /* allocate LAN queue contexts */ | ||
552 | if (!vsi_ctx->lan_q_ctx[tc]) { | ||
553 | vsi_ctx->lan_q_ctx[tc] = devm_kcalloc(ice_hw_to_dev(hw), | ||
554 | new_numqs, | ||
555 | sizeof(*q_ctx), | ||
556 | GFP_KERNEL); | ||
557 | if (!vsi_ctx->lan_q_ctx[tc]) | ||
558 | return ICE_ERR_NO_MEMORY; | ||
559 | vsi_ctx->num_lan_q_entries[tc] = new_numqs; | ||
560 | return 0; | ||
561 | } | ||
562 | /* num queues are increased, update the queue contexts */ | ||
563 | if (new_numqs > vsi_ctx->num_lan_q_entries[tc]) { | ||
564 | u16 prev_num = vsi_ctx->num_lan_q_entries[tc]; | ||
565 | |||
566 | q_ctx = devm_kcalloc(ice_hw_to_dev(hw), new_numqs, | ||
567 | sizeof(*q_ctx), GFP_KERNEL); | ||
568 | if (!q_ctx) | ||
569 | return ICE_ERR_NO_MEMORY; | ||
570 | memcpy(q_ctx, vsi_ctx->lan_q_ctx[tc], | ||
571 | prev_num * sizeof(*q_ctx)); | ||
572 | devm_kfree(ice_hw_to_dev(hw), vsi_ctx->lan_q_ctx[tc]); | ||
573 | vsi_ctx->lan_q_ctx[tc] = q_ctx; | ||
574 | vsi_ctx->num_lan_q_entries[tc] = new_numqs; | ||
575 | } | ||
576 | return 0; | ||
577 | } | ||
578 | |||
579 | /** | ||
536 | * ice_sched_clear_agg - clears the aggregator related information | 580 | * ice_sched_clear_agg - clears the aggregator related information |
537 | * @hw: pointer to the hardware structure | 581 | * @hw: pointer to the hardware structure |
538 | * | 582 | * |
@@ -1403,14 +1447,14 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle, | |||
1403 | if (!vsi_ctx) | 1447 | if (!vsi_ctx) |
1404 | return ICE_ERR_PARAM; | 1448 | return ICE_ERR_PARAM; |
1405 | 1449 | ||
1406 | if (owner == ICE_SCHED_NODE_OWNER_LAN) | 1450 | prev_numqs = vsi_ctx->sched.max_lanq[tc]; |
1407 | prev_numqs = vsi_ctx->sched.max_lanq[tc]; | ||
1408 | else | ||
1409 | return ICE_ERR_PARAM; | ||
1410 | |||
1411 | /* num queues are not changed or less than the previous number */ | 1451 | /* num queues are not changed or less than the previous number */ |
1412 | if (new_numqs <= prev_numqs) | 1452 | if (new_numqs <= prev_numqs) |
1413 | return status; | 1453 | return status; |
1454 | status = ice_alloc_lan_q_ctx(hw, vsi_handle, tc, new_numqs); | ||
1455 | if (status) | ||
1456 | return status; | ||
1457 | |||
1414 | if (new_numqs) | 1458 | if (new_numqs) |
1415 | ice_sched_calc_vsi_child_nodes(hw, new_numqs, new_num_nodes); | 1459 | ice_sched_calc_vsi_child_nodes(hw, new_numqs, new_num_nodes); |
1416 | /* Keep the max number of queue configuration all the time. Update the | 1460 | /* Keep the max number of queue configuration all the time. Update the |