get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1141313/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1141313,
    "url": "http://patchwork.ozlabs.org/api/patches/1141313/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190802082533.23083-1-anthony.l.nguyen@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": "<20190802082533.23083-1-anthony.l.nguyen@intel.com>",
    "list_archive_url": null,
    "date": "2019-08-02T08:25:19",
    "name": "[S26,01/15] ice: add support for enabling/disabling single queues",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "3ff13e5d04fae31fec770ebeb22bb179a654ff4d",
    "submitter": {
        "id": 68875,
        "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api",
        "name": "Tony Nguyen",
        "email": "anthony.l.nguyen@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/20190802082533.23083-1-anthony.l.nguyen@intel.com/mbox/",
    "series": [
        {
            "id": 123025,
            "url": "http://patchwork.ozlabs.org/api/series/123025/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=123025",
            "date": "2019-08-02T08:25:29",
            "name": "[S26,01/15] ice: add support for enabling/disabling single queues",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/123025/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1141313/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1141313/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.138; helo=whitealder.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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\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 460YCq6hzkz9sBF\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  3 Aug 2019 02:54:15 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 50201831F5;\n\tFri,  2 Aug 2019 16:54:14 +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 eprKWSWYjvv3; Fri,  2 Aug 2019 16:54:08 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 9C7EA87DF9;\n\tFri,  2 Aug 2019 16:54:05 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 703871BF296\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  2 Aug 2019 16:54:01 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 65FDE86B8C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  2 Aug 2019 16:54:01 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 3RFHRrUNKiCG for <intel-wired-lan@lists.osuosl.org>;\n\tFri,  2 Aug 2019 16:54:00 +0000 (UTC)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 018F586B5E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  2 Aug 2019 16:53:59 +0000 (UTC)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t02 Aug 2019 09:53:58 -0700",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby orsmga003.jf.intel.com with ESMTP; 02 Aug 2019 09:53:58 -0700"
        ],
        "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.64,338,1559545200\"; d=\"scan'208\";a=\"175640938\"",
        "From": "Tony Nguyen <anthony.l.nguyen@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Fri,  2 Aug 2019 01:25:19 -0700",
        "Message-Id": "<20190802082533.23083-1-anthony.l.nguyen@intel.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH S26 01/15] ice: add support for\n\tenabling/disabling single queues",
        "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>",
        "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": "From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>\n\nRefactor the queue handling functions that are going through queue\narrays in a way that the logic done for a single queue is pulled out and\nit will be called for each ring when traversing ring array. This implies\nthat when disabling Tx rings we won't fill up q_ids, q_teids and\nq_handles arrays.  Drop also 'offset' parameter; the value from vsi's\ntxq_map is stored in ring->reg_idx and that drops the need for mentioned\nparameter. Introduce the ice_vsi_cfg_txq, ice_vsi_stop_tx_ring and\nice_vsi_ctrl_rx_ring that are the functions with pulled out logic.\n\nThere's several Tx queue meta data (q_id, q_handle, q_teid and other)\nthat need to be set up during Tx queue disablement, so let's as well add\na helper structure that wraps it up and a function that will be filling\nit up.\n\nSigned-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_lib.c | 340 +++++++++++++----------\n drivers/net/ethernet/intel/ice/ice_lib.h |  18 +-\n 2 files changed, 213 insertions(+), 145 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex 751f9f1f6367..913467e5c1c1 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -191,41 +191,55 @@ static int ice_pf_rxq_wait(struct ice_pf *pf, int pf_q, bool ena)\n }\n \n /**\n- * ice_vsi_ctrl_rx_rings - Start or stop a VSI's Rx rings\n+ * ice_vsi_ctrl_rx_ring - Start or stop a VSI's Rx ring\n  * @vsi: the VSI being configured\n  * @ena: start or stop the Rx rings\n+ * @rxq_idx: Rx queue index\n  */\n-static int ice_vsi_ctrl_rx_rings(struct ice_vsi *vsi, bool ena)\n+static int ice_vsi_ctrl_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx)\n {\n+\tint pf_q = vsi->rxq_map[rxq_idx];\n \tstruct ice_pf *pf = vsi->back;\n \tstruct ice_hw *hw = &pf->hw;\n-\tint i, ret = 0;\n+\tint ret = 0;\n+\tu32 rx_reg;\n \n-\tfor (i = 0; i < vsi->num_rxq; i++) {\n-\t\tint pf_q = vsi->rxq_map[i];\n-\t\tu32 rx_reg;\n+\trx_reg = rd32(hw, QRX_CTRL(pf_q));\n \n-\t\trx_reg = rd32(hw, QRX_CTRL(pf_q));\n+\t/* Skip if the queue is already in the requested state */\n+\tif (ena == !!(rx_reg & QRX_CTRL_QENA_STAT_M))\n+\t\treturn 0;\n \n-\t\t/* Skip if the queue is already in the requested state */\n-\t\tif (ena == !!(rx_reg & QRX_CTRL_QENA_STAT_M))\n-\t\t\tcontinue;\n+\t/* turn on/off the queue */\n+\tif (ena)\n+\t\trx_reg |= QRX_CTRL_QENA_REQ_M;\n+\telse\n+\t\trx_reg &= ~QRX_CTRL_QENA_REQ_M;\n+\twr32(hw, QRX_CTRL(pf_q), rx_reg);\n \n-\t\t/* turn on/off the queue */\n-\t\tif (ena)\n-\t\t\trx_reg |= QRX_CTRL_QENA_REQ_M;\n-\t\telse\n-\t\t\trx_reg &= ~QRX_CTRL_QENA_REQ_M;\n-\t\twr32(hw, QRX_CTRL(pf_q), rx_reg);\n+\t/* wait for the change to finish */\n+\tret = ice_pf_rxq_wait(pf, pf_q, ena);\n+\tif (ret)\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"VSI idx %d Rx ring %d %sable timeout\\n\",\n+\t\t\tvsi->idx, pf_q, (ena ? \"en\" : \"dis\"));\n \n-\t\t/* wait for the change to finish */\n-\t\tret = ice_pf_rxq_wait(pf, pf_q, ena);\n-\t\tif (ret) {\n-\t\t\tdev_err(&pf->pdev->dev,\n-\t\t\t\t\"VSI idx %d Rx ring %d %sable timeout\\n\",\n-\t\t\t\tvsi->idx, pf_q, (ena ? \"en\" : \"dis\"));\n+\treturn ret;\n+}\n+\n+/**\n+ * ice_vsi_ctrl_rx_rings - Start or stop a VSI's Rx rings\n+ * @vsi: the VSI being configured\n+ * @ena: start or stop the Rx rings\n+ */\n+static int ice_vsi_ctrl_rx_rings(struct ice_vsi *vsi, bool ena)\n+{\n+\tint i, ret = 0;\n+\n+\tfor (i = 0; i < vsi->num_rxq; i++) {\n+\t\tret = ice_vsi_ctrl_rx_ring(vsi, ena, i);\n+\t\tif (ret)\n \t\t\tbreak;\n-\t\t}\n \t}\n \n \treturn ret;\n@@ -1668,6 +1682,62 @@ int ice_vsi_cfg_rxqs(struct ice_vsi *vsi)\n \treturn 0;\n }\n \n+/**\n+ * ice_vsi_cfg_txq - Configure single Tx queue\n+ * @vsi: the VSI that queue belongs to\n+ * @ring: Tx ring to be configured\n+ * @tc_q_idx: queue index within given TC\n+ * @qg_buf: queue group buffer\n+ * @tc: TC that Tx ring belongs to\n+ */\n+static int\n+ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring, u16 tc_q_idx,\n+\t\tstruct ice_aqc_add_tx_qgrp *qg_buf, u8 tc)\n+{\n+\tstruct ice_tlan_ctx tlan_ctx = { 0 };\n+\tstruct ice_aqc_add_txqs_perq *txq;\n+\tstruct ice_pf *pf = vsi->back;\n+\tu8 buf_len = sizeof(*qg_buf);\n+\tenum ice_status status;\n+\tu16 pf_q;\n+\n+\tpf_q = ring->reg_idx;\n+\tice_setup_tx_ctx(ring, &tlan_ctx, pf_q);\n+\t/* copy context contents into the qg_buf */\n+\tqg_buf->txqs[0].txq_id = cpu_to_le16(pf_q);\n+\tice_set_ctx((u8 *)&tlan_ctx, qg_buf->txqs[0].txq_ctx,\n+\t\t    ice_tlan_ctx_info);\n+\n+\t/* init queue specific tail reg. It is referred as\n+\t * transmit comm scheduler queue doorbell.\n+\t */\n+\tring->tail = pf->hw.hw_addr + QTX_COMM_DBELL(pf_q);\n+\n+\t/* Add unique software queue handle of the Tx queue per\n+\t * TC into the VSI Tx ring\n+\t */\n+\tring->q_handle = tc_q_idx;\n+\n+\tstatus = ice_ena_vsi_txq(vsi->port_info, vsi->idx, tc, ring->q_handle,\n+\t\t\t\t 1, qg_buf, buf_len, NULL);\n+\tif (status) {\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"Failed to set LAN Tx queue context, error: %d\\n\",\n+\t\t\tstatus);\n+\t\treturn -ENODEV;\n+\t}\n+\n+\t/* Add Tx Queue TEID into the VSI Tx ring from the\n+\t * response. This will complete configuring and\n+\t * enabling the queue.\n+\t */\n+\ttxq = &qg_buf->txqs[0];\n+\tif (pf_q == le16_to_cpu(txq->txq_id))\n+\t\tring->txq_teid = le32_to_cpu(txq->q_teid);\n+\n+\treturn 0;\n+}\n+\n /**\n  * ice_vsi_cfg_txqs - Configure the VSI for Tx\n  * @vsi: the VSI being configured\n@@ -1681,20 +1751,16 @@ static int\n ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings, int offset)\n {\n \tstruct ice_aqc_add_tx_qgrp *qg_buf;\n-\tstruct ice_aqc_add_txqs_perq *txq;\n \tstruct ice_pf *pf = vsi->back;\n-\tu8 num_q_grps, q_idx = 0;\n-\tenum ice_status status;\n-\tu16 buf_len, i, pf_q;\n-\tint err = 0, tc;\n+\tu16 q_idx = 0, i;\n+\tint err = 0;\n+\tu8 tc;\n \n-\tbuf_len = sizeof(*qg_buf);\n-\tqg_buf = devm_kzalloc(&pf->pdev->dev, buf_len, GFP_KERNEL);\n+\tqg_buf = devm_kzalloc(&pf->pdev->dev, sizeof(*qg_buf), GFP_KERNEL);\n \tif (!qg_buf)\n \t\treturn -ENOMEM;\n \n \tqg_buf->num_txqs = 1;\n-\tnum_q_grps = 1;\n \n \t/* set up and configure the Tx queues for each enabled TC */\n \tice_for_each_traffic_class(tc) {\n@@ -1702,39 +1768,10 @@ ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings, int offset)\n \t\t\tbreak;\n \n \t\tfor (i = 0; i < vsi->tc_cfg.tc_info[tc].qcount_tx; i++) {\n-\t\t\tstruct ice_tlan_ctx tlan_ctx = { 0 };\n-\n-\t\t\tpf_q = vsi->txq_map[q_idx + offset];\n-\t\t\tice_setup_tx_ctx(rings[q_idx], &tlan_ctx, pf_q);\n-\t\t\t/* copy context contents into the qg_buf */\n-\t\t\tqg_buf->txqs[0].txq_id = cpu_to_le16(pf_q);\n-\t\t\tice_set_ctx((u8 *)&tlan_ctx, qg_buf->txqs[0].txq_ctx,\n-\t\t\t\t    ice_tlan_ctx_info);\n-\n-\t\t\t/* init queue specific tail reg. It is referred as\n-\t\t\t * transmit comm scheduler queue doorbell.\n-\t\t\t */\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 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(&pf->pdev->dev,\n-\t\t\t\t\t\"Failed to set LAN Tx queue context, error: %d\\n\",\n-\t\t\t\t\tstatus);\n-\t\t\t\terr = -ENODEV;\n+\t\t\terr = ice_vsi_cfg_txq(vsi, rings[q_idx], i + offset,\n+\t\t\t\t\t      qg_buf, tc);\n+\t\t\tif (err)\n \t\t\t\tgoto err_cfg_txqs;\n-\t\t\t}\n-\n-\t\t\t/* Add Tx Queue TEID into the VSI Tx ring from the\n-\t\t\t * response. This will complete configuring and\n-\t\t\t * enabling the queue.\n-\t\t\t */\n-\t\t\ttxq = &qg_buf->txqs[0];\n-\t\t\tif (pf_q == le16_to_cpu(txq->txq_id))\n-\t\t\t\trings[q_idx]->txq_teid =\n-\t\t\t\t\tle32_to_cpu(txq->q_teid);\n \n \t\t\tq_idx++;\n \t\t}\n@@ -2081,45 +2118,106 @@ void ice_trigger_sw_intr(struct ice_hw *hw, struct ice_q_vector *q_vector)\n }\n \n /**\n- * ice_vsi_stop_tx_rings - Disable Tx rings\n+ * ice_vsi_stop_tx_ring - Disable single Tx ring\n  * @vsi: the VSI being configured\n  * @rst_src: reset source\n  * @rel_vmvf_num: Relative ID of VF/VM\n- * @rings: Tx ring array to be stopped\n- * @offset: offset within vsi->txq_map\n+ * @ring: Tx ring to be stopped\n+ * @txq_meta: Meta data of Tx ring to be stopped\n  */\n static int\n-ice_vsi_stop_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,\n-\t\t      u16 rel_vmvf_num, struct ice_ring **rings, int offset)\n+ice_vsi_stop_tx_ring(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,\n+\t\t     u16 rel_vmvf_num, struct ice_ring *ring,\n+\t\t     struct ice_txq_meta *txq_meta)\n {\n \tstruct ice_pf *pf = vsi->back;\n+\tstruct ice_q_vector *q_vector;\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+\tu32 val;\n \n-\tif (vsi->num_txq > ICE_LAN_TXQ_MAX_QDIS)\n-\t\treturn -EINVAL;\n+\t/* clear cause_ena bit for disabled queues */\n+\tval = rd32(hw, QINT_TQCTL(ring->reg_idx));\n+\tval &= ~QINT_TQCTL_CAUSE_ENA_M;\n+\twr32(hw, QINT_TQCTL(ring->reg_idx), val);\n \n-\tq_teids = devm_kcalloc(&pf->pdev->dev, vsi->num_txq, sizeof(*q_teids),\n-\t\t\t       GFP_KERNEL);\n-\tif (!q_teids)\n-\t\treturn -ENOMEM;\n+\t/* software is expected to wait for 100 ns */\n+\tndelay(100);\n \n-\tq_ids = devm_kcalloc(&pf->pdev->dev, vsi->num_txq, sizeof(*q_ids),\n-\t\t\t     GFP_KERNEL);\n-\tif (!q_ids) {\n-\t\terr = -ENOMEM;\n-\t\tgoto err_alloc_q_ids;\n+\t/* trigger a software interrupt for the vector\n+\t * associated to the queue to schedule NAPI handler\n+\t */\n+\tq_vector = ring->q_vector;\n+\tif (q_vector)\n+\t\tice_trigger_sw_intr(hw, q_vector);\n+\n+\tstatus = ice_dis_vsi_txq(vsi->port_info, txq_meta->vsi_idx,\n+\t\t\t\t txq_meta->tc, 1, &txq_meta->q_handle,\n+\t\t\t\t &txq_meta->q_id, &txq_meta->q_teid, rst_src,\n+\t\t\t\t rel_vmvf_num, NULL);\n+\n+\t/* if the disable queue command was exercised during an\n+\t * active reset flow, ICE_ERR_RESET_ONGOING is returned.\n+\t * This is not an error as the reset operation disables\n+\t * queues at the hardware level anyway.\n+\t */\n+\tif (status == ICE_ERR_RESET_ONGOING) {\n+\t\tdev_dbg(&vsi->back->pdev->dev,\n+\t\t\t\"Reset in progress. LAN Tx queues already disabled\\n\");\n+\t} else if (status == ICE_ERR_DOES_NOT_EXIST) {\n+\t\tdev_dbg(&vsi->back->pdev->dev,\n+\t\t\t\"LAN Tx queues do not exist, nothing to disable\\n\");\n+\t} else if (status) {\n+\t\tdev_err(&vsi->back->pdev->dev,\n+\t\t\t\"Failed to disable LAN Tx queues, error: %d\\n\", status);\n+\t\treturn -ENODEV;\n \t}\n \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+\treturn 0;\n+}\n+\n+/**\n+ * ice_fill_txq_meta - Prepare the Tx queue's meta data\n+ * @vsi: VSI that ring belongs to\n+ * @ring: ring that txq_meta will be based on\n+ * @txq_meta: a helper struct that wraps Tx queue's information\n+ *\n+ * Set up a helper struct that will contain all the necessary fields that\n+ * are needed for stopping Tx queue\n+ */\n+static void\n+ice_fill_txq_meta(struct ice_vsi *vsi, struct ice_ring *ring,\n+\t\t  struct ice_txq_meta *txq_meta)\n+{\n+\tu8 tc = 0;\n+\n+#ifdef CONFIG_DCB\n+\ttc = ring->dcb_tc;\n+#endif /* CONFIG_DCB */\n+\ttxq_meta->q_id = ring->reg_idx;\n+\ttxq_meta->q_teid = ring->txq_teid;\n+\ttxq_meta->q_handle = ring->q_handle;\n+\ttxq_meta->vsi_idx = vsi->idx;\n+\ttxq_meta->tc = tc;\n+}\n+\n+/**\n+ * ice_vsi_stop_tx_rings - Disable Tx rings\n+ * @vsi: the VSI being configured\n+ * @rst_src: reset source\n+ * @rel_vmvf_num: Relative ID of VF/VM\n+ * @rings: Tx ring array to be stopped\n+ */\n+static int\n+ice_vsi_stop_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,\n+\t\t      u16 rel_vmvf_num, struct ice_ring **rings)\n+{\n+\tu16 i, q_idx = 0;\n+\tint status;\n+\tu8 tc;\n+\n+\tif (vsi->num_txq > ICE_LAN_TXQ_MAX_QDIS)\n+\t\treturn -EINVAL;\n \n \t/* set up the Tx queue list to be disabled for each enabled TC */\n \tice_for_each_traffic_class(tc) {\n@@ -2127,67 +2225,24 @@ ice_vsi_stop_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,\n \t\t\tbreak;\n \n \t\tfor (i = 0; i < vsi->tc_cfg.tc_info[tc].qcount_tx; i++) {\n-\t\t\tstruct ice_q_vector *q_vector;\n-\n-\t\t\tif (!rings || !rings[q_idx]) {\n-\t\t\t\terr = -EINVAL;\n-\t\t\t\tgoto err_out;\n-\t\t\t}\n+\t\t\tstruct ice_txq_meta txq_meta = { };\n \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+\t\t\tif (!rings || !rings[q_idx])\n+\t\t\t\treturn -EINVAL;\n \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+\t\t\tice_fill_txq_meta(vsi, rings[q_idx], &txq_meta);\n+\t\t\tstatus = ice_vsi_stop_tx_ring(vsi, rst_src,\n+\t\t\t\t\t\t      rel_vmvf_num,\n+\t\t\t\t\t\t      rings[q_idx], &txq_meta);\n \n-\t\t\t/* software is expected to wait for 100 ns */\n-\t\t\tndelay(100);\n-\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\tq_vector = rings[i]->q_vector;\n-\t\t\tif (q_vector)\n-\t\t\t\tice_trigger_sw_intr(hw, q_vector);\n+\t\t\tif (status)\n+\t\t\t\treturn status;\n \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\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 == ICE_ERR_DOES_NOT_EXIST) {\n-\t\t\tdev_dbg(&pf->pdev->dev,\n-\t\t\t\t\"LAN Tx queues does not exist, nothing to 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:\n-\tdevm_kfree(&pf->pdev->dev, q_teids);\n-\n-\treturn err;\n+\treturn 0;\n }\n \n /**\n@@ -2200,8 +2255,7 @@ int\n ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,\n \t\t\t  u16 rel_vmvf_num)\n {\n-\treturn ice_vsi_stop_tx_rings(vsi, rst_src, rel_vmvf_num, vsi->tx_rings,\n-\t\t\t\t     0);\n+\treturn ice_vsi_stop_tx_rings(vsi, rst_src, rel_vmvf_num, vsi->tx_rings);\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h\nindex 0ed111edb7bb..c2d0040afb3a 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.h\n@@ -6,8 +6,22 @@\n \n #include \"ice.h\"\n \n-int ice_add_mac_to_list(struct ice_vsi *vsi, struct list_head *add_list,\n-\t\t\tconst u8 *macaddr);\n+struct ice_txq_meta {\n+\t/* Tx-scheduler element identifier */\n+\tu32 q_teid;\n+\t/* Entry in VSI's txq_map bitmap */\n+\tu16 q_id;\n+\t/* Relative index of Tx queue within TC */\n+\tu16 q_handle;\n+\t/* VSI index that Tx queue belongs to */\n+\tu16 vsi_idx;\n+\t/* TC number that Tx queue belongs to */\n+\tu8 tc;\n+};\n+\n+int\n+ice_add_mac_to_list(struct ice_vsi *vsi, struct list_head *add_list,\n+\t\t    const u8 *macaddr);\n \n void ice_free_fltr_list(struct device *dev, struct list_head *h);\n \n",
    "prefixes": [
        "S26",
        "01/15"
    ]
}