Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1049864/?format=api
{ "id": 1049864, "url": "http://patchwork.ozlabs.org/api/patches/1049864/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190228232603.32156-3-anirudh.venkataramanan@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20190228232603.32156-3-anirudh.venkataramanan@intel.com>", "list_archive_url": null, "date": "2019-02-28T23:25:48", "name": "[S17,02/17] ice: Create framework for VSI queue context", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "2a8b1e88909c69f4ec0345685aa83509b984156c", "submitter": { "id": 73601, "url": "http://patchwork.ozlabs.org/api/people/73601/?format=api", "name": "Anirudh Venkataramanan", "email": "anirudh.venkataramanan@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190228232603.32156-3-anirudh.venkataramanan@intel.com/mbox/", "series": [ { "id": 94829, "url": "http://patchwork.ozlabs.org/api/series/94829/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=94829", "date": "2019-02-28T23:25:46", "name": "Implementation updates for ice", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/94829/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1049864/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1049864/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.133; helo=hemlock.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com" ], "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 449TFm5d73z9sMQ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 1 Mar 2019 10:26:20 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 3DDDB87A1D;\n\tThu, 28 Feb 2019 23:26:19 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id CKKjeattDGaY; Thu, 28 Feb 2019 23:26:14 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id AFA44879B8;\n\tThu, 28 Feb 2019 23:26:11 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 29EA81BF3EA\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 28 Feb 2019 23:26:08 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 26FE98126A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 28 Feb 2019 23:26:08 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id runKrkG7ZNXJ for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 28 Feb 2019 23:26:04 +0000 (UTC)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id BDC2981422\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 28 Feb 2019 23:26:04 +0000 (UTC)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t28 Feb 2019 15:26:04 -0800", "from shasta.jf.intel.com ([10.166.241.11])\n\tby FMSMGA003.fm.intel.com with ESMTP; 28 Feb 2019 15:26:03 -0800" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.58,425,1544515200\"; d=\"scan'208\";a=\"137127987\"", "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Thu, 28 Feb 2019 15:25:48 -0800", "Message-Id": "<20190228232603.32156-3-anirudh.venkataramanan@intel.com>", "X-Mailer": "git-send-email 2.14.5", "In-Reply-To": "<20190228232603.32156-1-anirudh.venkataramanan@intel.com>", "References": "<20190228232603.32156-1-anirudh.venkataramanan@intel.com>", "Subject": "[Intel-wired-lan] [PATCH S17 02/17] ice: Create framework for VSI\n\tqueue context", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>", "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>", "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>" }, "content": "This patch introduces a framework to store queue specific information\nin VSI queue contexts. Currently VSI queue context (represented by\nstruct ice_q_ctx) only has q_handle as a member. In future patches,\nthis structure will be updated to hold queue specific information.\n\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_common.c | 62 +++++++++++++--\n drivers/net/ethernet/intel/ice/ice_common.h | 11 +--\n drivers/net/ethernet/intel/ice/ice_lib.c | 99 ++++++++++++++----------\n drivers/net/ethernet/intel/ice/ice_sched.c | 54 +++++++++++--\n drivers/net/ethernet/intel/ice/ice_switch.c | 22 ++++++\n drivers/net/ethernet/intel/ice/ice_switch.h | 9 +++\n drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 4 +-\n 7 files changed, 205 insertions(+), 56 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c\nindex 2937c6be1aee..0a57b726b1f0 100644\n--- a/drivers/net/ethernet/intel/ice/ice_common.c\n+++ b/drivers/net/ethernet/intel/ice/ice_common.c\n@@ -2790,11 +2790,36 @@ ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)\n \treturn 0;\n }\n \n+/**\n+ * ice_get_lan_q_ctx - get the lan queue context for the given VSI and TC\n+ * @hw: pointer to the hw struct\n+ * @vsi_handle: software VSI handle\n+ * @tc: tc number\n+ * @q_handle: software queue handle\n+ */\n+static struct ice_q_ctx *\n+ice_get_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 q_handle)\n+{\n+\tstruct ice_vsi_ctx *vsi;\n+\tstruct ice_q_ctx *q_ctx;\n+\n+\tvsi = ice_get_vsi_ctx(hw, vsi_handle);\n+\tif (!vsi)\n+\t\treturn NULL;\n+\tif (q_handle >= vsi->num_lan_q_entries[tc])\n+\t\treturn NULL;\n+\tif (!vsi->lan_q_ctx[tc])\n+\t\treturn NULL;\n+\tq_ctx = vsi->lan_q_ctx[tc];\n+\treturn &q_ctx[q_handle];\n+}\n+\n /**\n * ice_ena_vsi_txq\n * @pi: port information structure\n * @vsi_handle: software VSI handle\n * @tc: TC number\n+ * @q_handle: software queue handle\n * @num_qgrps: Number of added queue groups\n * @buf: list of queue groups to be added\n * @buf_size: size of buffer for indirect command\n@@ -2803,12 +2828,13 @@ ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)\n * This function adds one LAN queue\n */\n enum ice_status\n-ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_qgrps,\n-\t\tstruct ice_aqc_add_tx_qgrp *buf, u16 buf_size,\n+ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle,\n+\t\tu8 num_qgrps, struct ice_aqc_add_tx_qgrp *buf, u16 buf_size,\n \t\tstruct ice_sq_cd *cd)\n {\n \tstruct ice_aqc_txsched_elem_data node = { 0 };\n \tstruct ice_sched_node *parent;\n+\tstruct ice_q_ctx *q_ctx;\n \tenum ice_status status;\n \tstruct ice_hw *hw;\n \n@@ -2825,6 +2851,14 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_qgrps,\n \n \tmutex_lock(&pi->sched_lock);\n \n+\tq_ctx = ice_get_lan_q_ctx(hw, vsi_handle, tc, q_handle);\n+\tif (!q_ctx) {\n+\t\tice_debug(hw, ICE_DBG_SCHED, \"Enaq: invalid queue handle %d\\n\",\n+\t\t\t q_handle);\n+\t\tstatus = ICE_ERR_PARAM;\n+\t\tgoto ena_txq_exit;\n+\t}\n+\n \t/* find a parent node */\n \tparent = ice_sched_get_free_qparent(pi, vsi_handle, tc,\n \t\t\t\t\t ICE_SCHED_NODE_OWNER_LAN);\n@@ -2851,7 +2885,7 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_qgrps,\n \t/* add the LAN queue */\n \tstatus = ice_aq_add_lan_txq(hw, num_qgrps, buf, buf_size, cd);\n \tif (status) {\n-\t\tice_debug(hw, ICE_DBG_SCHED, \"enable Q %d failed %d\\n\",\n+\t\tice_debug(hw, ICE_DBG_SCHED, \"enable queue %d failed %d\\n\",\n \t\t\t le16_to_cpu(buf->txqs[0].txq_id),\n \t\t\t hw->adminq.sq_last_status);\n \t\tgoto ena_txq_exit;\n@@ -2859,6 +2893,7 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_qgrps,\n \n \tnode.node_teid = buf->txqs[0].q_teid;\n \tnode.data.elem_type = ICE_AQC_ELEM_TYPE_LEAF;\n+\tq_ctx->q_handle = q_handle;\n \n \t/* add a leaf node into schduler tree queue layer */\n \tstatus = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1, &node);\n@@ -2871,7 +2906,10 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_qgrps,\n /**\n * ice_dis_vsi_txq\n * @pi: port information structure\n+ * @vsi_handle: software VSI handle\n+ * @tc: TC number\n * @num_queues: number of queues\n+ * @q_handles: pointer to software queue handle array\n * @q_ids: pointer to the q_id array\n * @q_teids: pointer to queue node teids\n * @rst_src: if called due to reset, specifies the reset source\n@@ -2881,12 +2919,14 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_qgrps,\n * This function removes queues and their corresponding nodes in SW DB\n */\n enum ice_status\n-ice_dis_vsi_txq(struct ice_port_info *pi, u8 num_queues, u16 *q_ids,\n-\t\tu32 *q_teids, enum ice_disq_rst_src rst_src, u16 vmvf_num,\n+ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,\n+\t\tu16 *q_handles, u16 *q_ids, u32 *q_teids,\n+\t\tenum ice_disq_rst_src rst_src, u16 vmvf_num,\n \t\tstruct ice_sq_cd *cd)\n {\n \tenum ice_status status = ICE_ERR_DOES_NOT_EXIST;\n \tstruct ice_aqc_dis_txq_item qg_list;\n+\tstruct ice_q_ctx *q_ctx;\n \tu16 i;\n \n \tif (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY)\n@@ -2909,6 +2949,17 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u8 num_queues, u16 *q_ids,\n \t\tnode = ice_sched_find_node_by_teid(pi->root, q_teids[i]);\n \t\tif (!node)\n \t\t\tcontinue;\n+\t\tq_ctx = ice_get_lan_q_ctx(pi->hw, vsi_handle, tc, q_handles[i]);\n+\t\tif (!q_ctx) {\n+\t\t\tice_debug(pi->hw, ICE_DBG_SCHED, \"invalid queue handle%d\\n\",\n+\t\t\t\t q_handles[i]);\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (q_ctx->q_handle != q_handles[i]) {\n+\t\t\tice_debug(pi->hw, ICE_DBG_SCHED, \"Err:handles %d %d\\n\",\n+\t\t\t\t q_ctx->q_handle, q_handles[i]);\n+\t\t\tcontinue;\n+\t\t}\n \t\tqg_list.parent_teid = node->info.parent_teid;\n \t\tqg_list.num_qs = 1;\n \t\tqg_list.q_id[0] = cpu_to_le16(q_ids[i]);\n@@ -2919,6 +2970,7 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u8 num_queues, u16 *q_ids,\n \t\tif (status)\n \t\t\tbreak;\n \t\tice_free_sched_node(pi, node);\n+\t\tq_ctx->q_handle = ICE_INVAL_Q_HANDLE;\n \t}\n \tmutex_unlock(&pi->sched_lock);\n \treturn status;\ndiff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h\nindex faefc45e4a1e..f1ddebf45231 100644\n--- a/drivers/net/ethernet/intel/ice/ice_common.h\n+++ b/drivers/net/ethernet/intel/ice/ice_common.h\n@@ -99,15 +99,16 @@ ice_aq_set_port_id_led(struct ice_port_info *pi, bool is_orig_mode,\n \t\t struct ice_sq_cd *cd);\n \n enum ice_status\n-ice_dis_vsi_txq(struct ice_port_info *pi, u8 num_queues, u16 *q_ids,\n-\t\tu32 *q_teids, enum ice_disq_rst_src rst_src, u16 vmvf_num,\n-\t\tstruct ice_sq_cd *cmd_details);\n+ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,\n+\t\tu16 *q_handle, u16 *q_ids, u32 *q_teids,\n+\t\tenum ice_disq_rst_src rst_src, u16 vmvf_num,\n+\t\tstruct ice_sq_cd *cd);\n enum ice_status\n ice_cfg_vsi_lan(struct ice_port_info *pi, u16 vsi_handle, u8 tc_bitmap,\n \t\tu16 *max_lanqs);\n enum ice_status\n-ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_qgrps,\n-\t\tstruct ice_aqc_add_tx_qgrp *buf, u16 buf_size,\n+ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle,\n+\t\tu8 num_qgrps, struct ice_aqc_add_tx_qgrp *buf, u16 buf_size,\n \t\tstruct ice_sq_cd *cd);\n enum ice_status ice_replay_vsi(struct ice_hw *hw, u16 vsi_handle);\n void ice_replay_post(struct ice_hw *hw);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex f31129e4e9cf..fa8ebd8a10ce 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -1715,8 +1715,8 @@ ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings, int offset)\n \t\t\trings[q_idx]->tail =\n \t\t\t\tpf->hw.hw_addr + QTX_COMM_DBELL(pf_q);\n \t\t\tstatus = ice_ena_vsi_txq(vsi->port_info, vsi->idx, tc,\n-\t\t\t\t\t\t num_q_grps, qg_buf, buf_len,\n-\t\t\t\t\t\t NULL);\n+\t\t\t\t\t\t i, num_q_grps, qg_buf,\n+\t\t\t\t\t\t buf_len, NULL);\n \t\t\tif (status) {\n \t\t\t\tdev_err(&vsi->back->pdev->dev,\n \t\t\t\t\t\"Failed to set LAN Tx queue context, error: %d\\n\",\n@@ -2033,10 +2033,10 @@ ice_vsi_stop_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,\n {\n \tstruct ice_pf *pf = vsi->back;\n \tstruct ice_hw *hw = &pf->hw;\n+\tint tc, q_idx = 0, err = 0;\n+\tu16 *q_ids, *q_handles, i;\n \tenum ice_status status;\n \tu32 *q_teids, val;\n-\tu16 *q_ids, i;\n-\tint err = 0;\n \n \tif (vsi->num_txq > ICE_LAN_TXQ_MAX_QDIS)\n \t\treturn -EINVAL;\n@@ -2053,50 +2053,71 @@ ice_vsi_stop_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,\n \t\tgoto err_alloc_q_ids;\n \t}\n \n-\t/* set up the Tx queue list to be disabled */\n-\tice_for_each_txq(vsi, i) {\n-\t\tu16 v_idx;\n+\tq_handles = devm_kcalloc(&pf->pdev->dev, vsi->num_txq,\n+\t\t\t\t sizeof(*q_handles), GFP_KERNEL);\n+\tif (!q_handles) {\n+\t\terr = -ENOMEM;\n+\t\tgoto err_alloc_q_handles;\n+\t}\n \n-\t\tif (!rings || !rings[i] || !rings[i]->q_vector) {\n-\t\t\terr = -EINVAL;\n-\t\t\tgoto err_out;\n-\t\t}\n+\t/* set up the Tx queue list to be disabled for each enabled TC */\n+\tice_for_each_traffic_class(tc) {\n+\t\tif (!(vsi->tc_cfg.ena_tc & BIT(tc)))\n+\t\t\tbreak;\n+\n+\t\tfor (i = 0; i < vsi->tc_cfg.tc_info[tc].qcount_tx; i++) {\n+\t\t\tu16 v_idx;\n+\n+\t\t\tif (!rings || !rings[i] || !rings[i]->q_vector) {\n+\t\t\t\terr = -EINVAL;\n+\t\t\t\tgoto err_out;\n+\t\t\t}\n \n-\t\tq_ids[i] = vsi->txq_map[i + offset];\n-\t\tq_teids[i] = rings[i]->txq_teid;\n+\t\t\tq_ids[i] = vsi->txq_map[q_idx + offset];\n+\t\t\tq_teids[i] = rings[q_idx]->txq_teid;\n+\t\t\tq_handles[i] = i;\n \n-\t\t/* clear cause_ena bit for disabled queues */\n-\t\tval = rd32(hw, QINT_TQCTL(rings[i]->reg_idx));\n-\t\tval &= ~QINT_TQCTL_CAUSE_ENA_M;\n-\t\twr32(hw, QINT_TQCTL(rings[i]->reg_idx), val);\n+\t\t\t/* clear cause_ena bit for disabled queues */\n+\t\t\tval = rd32(hw, QINT_TQCTL(rings[i]->reg_idx));\n+\t\t\tval &= ~QINT_TQCTL_CAUSE_ENA_M;\n+\t\t\twr32(hw, QINT_TQCTL(rings[i]->reg_idx), val);\n \n-\t\t/* software is expected to wait for 100 ns */\n-\t\tndelay(100);\n+\t\t\t/* software is expected to wait for 100 ns */\n+\t\t\tndelay(100);\n \n-\t\t/* trigger a software interrupt for the vector associated to\n-\t\t * the queue to schedule NAPI handler\n+\t\t\t/* trigger a software interrupt for the vector\n+\t\t\t * associated to the queue to schedule NAPI handler\n+\t\t\t */\n+\t\t\tv_idx = rings[i]->q_vector->v_idx;\n+\t\t\twr32(hw, GLINT_DYN_CTL(vsi->hw_base_vector + v_idx),\n+\t\t\t GLINT_DYN_CTL_SWINT_TRIG_M |\n+\t\t\t GLINT_DYN_CTL_INTENA_MSK_M);\n+\t\t\tq_idx++;\n+\t\t}\n+\t\tstatus = ice_dis_vsi_txq(vsi->port_info, vsi->idx, tc,\n+\t\t\t\t\t vsi->num_txq, q_handles, q_ids,\n+\t\t\t\t\t q_teids, rst_src, rel_vmvf_num, NULL);\n+\n+\t\t/* if the disable queue command was exercised during an active\n+\t\t * reset flow, ICE_ERR_RESET_ONGOING is returned. This is not\n+\t\t * an error as the reset operation disables queues at the\n+\t\t * hardware level anyway.\n \t\t */\n-\t\tv_idx = rings[i]->q_vector->v_idx;\n-\t\twr32(hw, GLINT_DYN_CTL(vsi->hw_base_vector + v_idx),\n-\t\t GLINT_DYN_CTL_SWINT_TRIG_M | GLINT_DYN_CTL_INTENA_MSK_M);\n-\t}\n-\tstatus = ice_dis_vsi_txq(vsi->port_info, vsi->num_txq, q_ids, q_teids,\n-\t\t\t\t rst_src, rel_vmvf_num, NULL);\n-\t/* if the disable queue command was exercised during an active reset\n-\t * flow, ICE_ERR_RESET_ONGOING is returned. This is not an error as\n-\t * the reset operation disables queues at the hardware level anyway.\n-\t */\n-\tif (status == ICE_ERR_RESET_ONGOING) {\n-\t\tdev_info(&pf->pdev->dev,\n-\t\t\t \"Reset in progress. LAN Tx queues already disabled\\n\");\n-\t} else if (status) {\n-\t\tdev_err(&pf->pdev->dev,\n-\t\t\t\"Failed to disable LAN Tx queues, error: %d\\n\",\n-\t\t\tstatus);\n-\t\terr = -ENODEV;\n+\t\tif (status == ICE_ERR_RESET_ONGOING) {\n+\t\t\tdev_dbg(&pf->pdev->dev,\n+\t\t\t\t\"Reset in progress. LAN Tx queues already disabled\\n\");\n+\t\t} else if (status) {\n+\t\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\t\"Failed to disable LAN Tx queues, error: %d\\n\",\n+\t\t\t\tstatus);\n+\t\t\terr = -ENODEV;\n+\t\t}\n \t}\n \n err_out:\n+\tdevm_kfree(&pf->pdev->dev, q_handles);\n+\n+err_alloc_q_handles:\n \tdevm_kfree(&pf->pdev->dev, q_ids);\n \n err_alloc_q_ids:\ndiff --git a/drivers/net/ethernet/intel/ice/ice_sched.c b/drivers/net/ethernet/intel/ice/ice_sched.c\nindex 124feaf0e730..8d49f83be7a5 100644\n--- a/drivers/net/ethernet/intel/ice/ice_sched.c\n+++ b/drivers/net/ethernet/intel/ice/ice_sched.c\n@@ -532,6 +532,50 @@ ice_sched_suspend_resume_elems(struct ice_hw *hw, u8 num_nodes, u32 *node_teids,\n \treturn status;\n }\n \n+/**\n+ * ice_alloc_lan_q_ctx - allocate LAN queue contexts for the given VSI and TC\n+ * @hw: pointer to the HW struct\n+ * @vsi_handle: VSI handle\n+ * @tc: TC number\n+ * @new_numqs: number of queues\n+ */\n+static enum ice_status\n+ice_alloc_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs)\n+{\n+\tstruct ice_vsi_ctx *vsi_ctx;\n+\tstruct ice_q_ctx *q_ctx;\n+\n+\tvsi_ctx = ice_get_vsi_ctx(hw, vsi_handle);\n+\tif (!vsi_ctx)\n+\t\treturn ICE_ERR_PARAM;\n+\t/* allocate LAN queue contexts */\n+\tif (!vsi_ctx->lan_q_ctx[tc]) {\n+\t\tvsi_ctx->lan_q_ctx[tc] = devm_kcalloc(ice_hw_to_dev(hw),\n+\t\t\t\t\t\t new_numqs,\n+\t\t\t\t\t\t sizeof(*q_ctx),\n+\t\t\t\t\t\t GFP_KERNEL);\n+\t\tif (!vsi_ctx->lan_q_ctx[tc])\n+\t\t\treturn ICE_ERR_NO_MEMORY;\n+\t\tvsi_ctx->num_lan_q_entries[tc] = new_numqs;\n+\t\treturn 0;\n+\t}\n+\t/* num queues are increased, update the queue contexts */\n+\tif (new_numqs > vsi_ctx->num_lan_q_entries[tc]) {\n+\t\tu16 prev_num = vsi_ctx->num_lan_q_entries[tc];\n+\n+\t\tq_ctx = devm_kcalloc(ice_hw_to_dev(hw), new_numqs,\n+\t\t\t\t sizeof(*q_ctx), GFP_KERNEL);\n+\t\tif (!q_ctx)\n+\t\t\treturn ICE_ERR_NO_MEMORY;\n+\t\tmemcpy(q_ctx, vsi_ctx->lan_q_ctx[tc],\n+\t\t prev_num * sizeof(*q_ctx));\n+\t\tdevm_kfree(ice_hw_to_dev(hw), vsi_ctx->lan_q_ctx[tc]);\n+\t\tvsi_ctx->lan_q_ctx[tc] = q_ctx;\n+\t\tvsi_ctx->num_lan_q_entries[tc] = new_numqs;\n+\t}\n+\treturn 0;\n+}\n+\n /**\n * ice_sched_clear_agg - clears the aggregator related information\n * @hw: pointer to the hardware structure\n@@ -1403,14 +1447,14 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,\n \tif (!vsi_ctx)\n \t\treturn ICE_ERR_PARAM;\n \n-\tif (owner == ICE_SCHED_NODE_OWNER_LAN)\n-\t\tprev_numqs = vsi_ctx->sched.max_lanq[tc];\n-\telse\n-\t\treturn ICE_ERR_PARAM;\n-\n+\tprev_numqs = vsi_ctx->sched.max_lanq[tc];\n \t/* num queues are not changed or less than the previous number */\n \tif (new_numqs <= prev_numqs)\n \t\treturn status;\n+\tstatus = ice_alloc_lan_q_ctx(hw, vsi_handle, tc, new_numqs);\n+\tif (status)\n+\t\treturn status;\n+\n \tif (new_numqs)\n \t\tice_sched_calc_vsi_child_nodes(hw, new_numqs, new_num_nodes);\n \t/* Keep the max number of queue configuration all the time. Update the\ndiff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c\nindex 87d87ae3f551..b7975971403d 100644\n--- a/drivers/net/ethernet/intel/ice/ice_switch.c\n+++ b/drivers/net/ethernet/intel/ice/ice_switch.c\n@@ -328,6 +328,27 @@ ice_save_vsi_ctx(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi)\n \thw->vsi_ctx[vsi_handle] = vsi;\n }\n \n+/**\n+ * ice_clear_vsi_q_ctx - clear VSI queue contexts for all TCs\n+ * @hw: pointer to the hw struct\n+ * @vsi_handle: VSI handle\n+ */\n+static void ice_clear_vsi_q_ctx(struct ice_hw *hw, u16 vsi_handle)\n+{\n+\tstruct ice_vsi_ctx *vsi;\n+\tu8 i;\n+\n+\tvsi = ice_get_vsi_ctx(hw, vsi_handle);\n+\tif (!vsi)\n+\t\treturn;\n+\tice_for_each_traffic_class(i) {\n+\t\tif (vsi->lan_q_ctx[i]) {\n+\t\t\tdevm_kfree(ice_hw_to_dev(hw), vsi->lan_q_ctx[i]);\n+\t\t\tvsi->lan_q_ctx[i] = NULL;\n+\t\t}\n+\t}\n+}\n+\n /**\n * ice_clear_vsi_ctx - clear the VSI context entry\n * @hw: pointer to the HW struct\n@@ -341,6 +362,7 @@ static void ice_clear_vsi_ctx(struct ice_hw *hw, u16 vsi_handle)\n \n \tvsi = ice_get_vsi_ctx(hw, vsi_handle);\n \tif (vsi) {\n+\t\tice_clear_vsi_q_ctx(hw, vsi_handle);\n \t\tdevm_kfree(ice_hw_to_dev(hw), vsi);\n \t\thw->vsi_ctx[vsi_handle] = NULL;\n \t}\ndiff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h\nindex 64a2fecfce20..88eb4be4d5a4 100644\n--- a/drivers/net/ethernet/intel/ice/ice_switch.h\n+++ b/drivers/net/ethernet/intel/ice/ice_switch.h\n@@ -9,6 +9,13 @@\n #define ICE_SW_CFG_MAX_BUF_LEN 2048\n #define ICE_DFLT_VSI_INVAL 0xff\n #define ICE_VSI_INVAL_ID 0xffff\n+#define ICE_INVAL_Q_HANDLE 0xFFFF\n+#define ICE_INVAL_Q_HANDLE 0xFFFF\n+\n+/* VSI queue context structure */\n+struct ice_q_ctx {\n+\tu16 q_handle;\n+};\n \n /* VSI context structure for add/get/update/free operations */\n struct ice_vsi_ctx {\n@@ -20,6 +27,8 @@ struct ice_vsi_ctx {\n \tstruct ice_sched_vsi_info sched;\n \tu8 alloc_from_pool;\n \tu8 vf_num;\n+\tu16 num_lan_q_entries[ICE_MAX_TRAFFIC_CLASS];\n+\tstruct ice_q_ctx *lan_q_ctx[ICE_MAX_TRAFFIC_CLASS];\n };\n \n enum ice_sw_fwd_act_type {\ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\nindex e562ea15b79b..789b6f10b381 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n@@ -996,8 +996,8 @@ static bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)\n \t\t/* Call Disable LAN Tx queue AQ call even when queues are not\n \t\t * enabled. This is needed for successful completiom of VFR\n \t\t */\n-\t\tice_dis_vsi_txq(vsi->port_info, 0, NULL, NULL, ICE_VF_RESET,\n-\t\t\t\tvf->vf_id, NULL);\n+\t\tice_dis_vsi_txq(vsi->port_info, vsi->idx, 0, 0, NULL, NULL,\n+\t\t\t\tNULL, ICE_VF_RESET, vf->vf_id, NULL);\n \t}\n \n \thw = &pf->hw;\n", "prefixes": [ "S17", "02/17" ] }