get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1086443,
    "url": "http://patchwork.ozlabs.org/api/patches/1086443/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190416172128.27184-5-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": "<20190416172128.27184-5-anirudh.venkataramanan@intel.com>",
    "list_archive_url": null,
    "date": "2019-04-16T17:21:17",
    "name": "[S18,04/15] ice: Add more validation in ice_vc_cfg_irq_map_msg",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "a03180375e94f9474e0827cd5807ca0e586bf3b6",
    "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/20190416172128.27184-5-anirudh.venkataramanan@intel.com/mbox/",
    "series": [
        {
            "id": 103105,
            "url": "http://patchwork.ozlabs.org/api/series/103105/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=103105",
            "date": "2019-04-16T17:21:13",
            "name": "Fixes and feature updates for ice",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/103105/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1086443/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1086443/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 44kBxv40M7z9s71\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 17 Apr 2019 03:22:11 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id F2E1987A6E;\n\tTue, 16 Apr 2019 17:22:09 +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 DIYUTPjQJBq4; Tue, 16 Apr 2019 17:22:07 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id AEBF687A52;\n\tTue, 16 Apr 2019 17:22:05 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 7E42D1BF28D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 16 Apr 2019 17:22:03 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 7AADF870EA\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 16 Apr 2019 17:22:03 +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 q6+ylckIDyPV for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 16 Apr 2019 17:22:02 +0000 (UTC)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 29A498704C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 16 Apr 2019 17:22:02 +0000 (UTC)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t16 Apr 2019 10:22:02 -0700",
            "from shasta.jf.intel.com ([10.166.244.191])\n\tby fmsmga006.fm.intel.com with ESMTP; 16 Apr 2019 10:22:01 -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.60,358,1549958400\"; d=\"scan'208\";a=\"338040563\"",
        "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Tue, 16 Apr 2019 10:21:17 -0700",
        "Message-Id": "<20190416172128.27184-5-anirudh.venkataramanan@intel.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20190416172128.27184-1-anirudh.venkataramanan@intel.com>",
        "References": "<20190416172128.27184-1-anirudh.venkataramanan@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH S18 04/15] ice: Add more validation in\n\tice_vc_cfg_irq_map_msg",
        "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: Michal Swiatkowski <michal.swiatkowski@intel.com>\n\nAdd few checks to validate msg from iavf driver.\n\nTest if we have got enough q_vectors allocated in VSI connected with VF.\nAdd masks for itr_indx and msix_indx to avoid writing to reserved fieldi\nof QINT. Clear q_vector->num_ring_rx/tx, without it we can increment this\nvalue every time we send irq map msg from VF. So after second call this\nvalue will be incorrect.\n\nDecrement num_vectors from msg, because last vector in iavf msg is misc\nvector (we don't set map for it).\n\nSigned-off-by: Michal Swiatkowski <michal.swiatkowski@intel.com>\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n[Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> cleaned up commit message]\n---\n drivers/net/ethernet/intel/ice/ice.h          |  2 ++\n .../net/ethernet/intel/ice/ice_hw_autogen.h   |  4 +++\n drivers/net/ethernet/intel/ice/ice_lib.c      | 32 +++++++++++--------\n .../net/ethernet/intel/ice/ice_virtchnl_pf.c  | 26 +++++++--------\n 4 files changed, 36 insertions(+), 28 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h\nindex 804d12c2f1df..6f970edf50c7 100644\n--- a/drivers/net/ethernet/intel/ice/ice.h\n+++ b/drivers/net/ethernet/intel/ice/ice.h\n@@ -83,6 +83,8 @@ extern const char ice_drv_ver[];\n #define ICE_MAX_QS_PER_VF\t\t256\n #define ICE_MIN_QS_PER_VF\t\t1\n #define ICE_DFLT_QS_PER_VF\t\t4\n+#define ICE_NONQ_VECS_VF\t\t1\n+#define ICE_MAX_SCATTER_QS_PER_VF\t16\n #define ICE_MAX_BASE_QS_PER_VF\t\t16\n #define ICE_MAX_INTR_PER_VF\t\t65\n #define ICE_MIN_INTR_PER_VF\t\t(ICE_MIN_QS_PER_VF + 1)\ndiff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\nindex e172ca002a0a..ec25f26069b0 100644\n--- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\n+++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\n@@ -163,11 +163,15 @@\n #define PFINT_OICR_ENA\t\t\t\t0x0016C900\n #define QINT_RQCTL(_QRX)\t\t\t(0x00150000 + ((_QRX) * 4))\n #define QINT_RQCTL_MSIX_INDX_S\t\t\t0\n+#define QINT_RQCTL_MSIX_INDX_M\t\t\tICE_M(0x7FF, 0)\n #define QINT_RQCTL_ITR_INDX_S\t\t\t11\n+#define QINT_RQCTL_ITR_INDX_M\t\t\tICE_M(0x3, 11)\n #define QINT_RQCTL_CAUSE_ENA_M\t\t\tBIT(30)\n #define QINT_TQCTL(_DBQM)\t\t\t(0x00140000 + ((_DBQM) * 4))\n #define QINT_TQCTL_MSIX_INDX_S\t\t\t0\n+#define QINT_TQCTL_MSIX_INDX_M\t\t\tICE_M(0x7FF, 0)\n #define QINT_TQCTL_ITR_INDX_S\t\t\t11\n+#define QINT_TQCTL_ITR_INDX_M\t\t\tICE_M(0x3, 11)\n #define QINT_TQCTL_CAUSE_ENA_M\t\t\tBIT(30)\n #define VPINT_ALLOC(_VF)\t\t\t(0x001D1000 + ((_VF) * 4))\n #define VPINT_ALLOC_FIRST_S\t\t\t0\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex 83d0aef7f77e..caa00e8873ec 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -1879,33 +1879,37 @@ void ice_vsi_cfg_msix(struct ice_vsi *vsi)\n \t\t * tracked for this PF.\n \t\t */\n \t\tfor (q = 0; q < q_vector->num_ring_tx; q++) {\n-\t\t\tint itr_idx = q_vector->tx.itr_idx;\n+\t\t\tint itr_idx = (q_vector->tx.itr_idx <<\n+\t\t\t\t       QINT_TQCTL_ITR_INDX_S) &\n+\t\t\t\tQINT_TQCTL_ITR_INDX_M;\n \t\t\tu32 val;\n \n \t\t\tif (vsi->type == ICE_VSI_VF)\n-\t\t\t\tval = QINT_TQCTL_CAUSE_ENA_M |\n-\t\t\t\t      (itr_idx << QINT_TQCTL_ITR_INDX_S)  |\n-\t\t\t\t      ((i + 1) << QINT_TQCTL_MSIX_INDX_S);\n+\t\t\t\tval = QINT_TQCTL_CAUSE_ENA_M | itr_idx |\n+\t\t\t\t      (((i + 1) << QINT_TQCTL_MSIX_INDX_S) &\n+\t\t\t\t       QINT_TQCTL_MSIX_INDX_M);\n \t\t\telse\n-\t\t\t\tval = QINT_TQCTL_CAUSE_ENA_M |\n-\t\t\t\t      (itr_idx << QINT_TQCTL_ITR_INDX_S)  |\n-\t\t\t\t      (reg_idx << QINT_TQCTL_MSIX_INDX_S);\n+\t\t\t\tval = QINT_TQCTL_CAUSE_ENA_M | itr_idx |\n+\t\t\t\t      ((reg_idx << QINT_TQCTL_MSIX_INDX_S) &\n+\t\t\t\t       QINT_TQCTL_MSIX_INDX_M);\n \t\t\twr32(hw, QINT_TQCTL(vsi->txq_map[txq]), val);\n \t\t\ttxq++;\n \t\t}\n \n \t\tfor (q = 0; q < q_vector->num_ring_rx; q++) {\n-\t\t\tint itr_idx = q_vector->rx.itr_idx;\n+\t\t\tint itr_idx = (q_vector->rx.itr_idx <<\n+\t\t\t\t       QINT_RQCTL_ITR_INDX_S) &\n+\t\t\t\tQINT_RQCTL_ITR_INDX_M;\n \t\t\tu32 val;\n \n \t\t\tif (vsi->type == ICE_VSI_VF)\n-\t\t\t\tval = QINT_RQCTL_CAUSE_ENA_M |\n-\t\t\t\t      (itr_idx << QINT_RQCTL_ITR_INDX_S)  |\n-\t\t\t\t      ((i + 1) << QINT_RQCTL_MSIX_INDX_S);\n+\t\t\t\tval = QINT_RQCTL_CAUSE_ENA_M | itr_idx |\n+\t\t\t\t\t(((i + 1) << QINT_RQCTL_MSIX_INDX_S) &\n+\t\t\t\t\t QINT_RQCTL_MSIX_INDX_M);\n \t\t\telse\n-\t\t\t\tval = QINT_RQCTL_CAUSE_ENA_M |\n-\t\t\t\t      (itr_idx << QINT_RQCTL_ITR_INDX_S)  |\n-\t\t\t\t      (reg_idx << QINT_RQCTL_MSIX_INDX_S);\n+\t\t\t\tval = QINT_RQCTL_CAUSE_ENA_M | itr_idx |\n+\t\t\t\t\t((reg_idx << QINT_RQCTL_MSIX_INDX_S) &\n+\t\t\t\t\t QINT_RQCTL_MSIX_INDX_M);\n \t\t\twr32(hw, QINT_RQCTL(vsi->rxq_map[rxq]), val);\n \t\t\trxq++;\n \t\t}\ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\nindex f4b466cd4b7a..a805cbdd69be 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n@@ -1814,14 +1814,22 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg)\n \tstruct ice_vsi *vsi = NULL;\n \tstruct ice_pf *pf = vf->pf;\n \tunsigned long qmap;\n+\tu16 num_q_vectors;\n \tint i;\n \n-\tif (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) {\n+\tnum_q_vectors = irqmap_info->num_vectors - ICE_NONQ_VECS_VF;\n+\tvsi = pf->vsi[vf->lan_vsi_idx];\n+\n+\tif (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states) ||\n+\t    !vsi || vsi->num_q_vectors < num_q_vectors ||\n+\t    irqmap_info->num_vectors == 0) {\n \t\tv_ret = VIRTCHNL_STATUS_ERR_PARAM;\n \t\tgoto error_param;\n \t}\n \n-\tfor (i = 0; i < irqmap_info->num_vectors; i++) {\n+\tfor (i = 0; i < num_q_vectors; i++) {\n+\t\tstruct ice_q_vector *q_vector = vsi->q_vectors[i];\n+\n \t\tmap = &irqmap_info->vecmap[i];\n \n \t\tvector_id = map->vector_id;\n@@ -1833,36 +1841,26 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg)\n \t\t\tgoto error_param;\n \t\t}\n \n-\t\tvsi = pf->vsi[vf->lan_vsi_idx];\n-\t\tif (!vsi) {\n-\t\t\tv_ret = VIRTCHNL_STATUS_ERR_PARAM;\n-\t\t\tgoto error_param;\n-\t\t}\n-\n \t\t/* lookout for the invalid queue index */\n \t\tqmap = map->rxq_map;\n+\t\tq_vector->num_ring_rx = 0;\n \t\tfor_each_set_bit(vsi_q_id, &qmap, ICE_MAX_BASE_QS_PER_VF) {\n-\t\t\tstruct ice_q_vector *q_vector;\n-\n \t\t\tif (!ice_vc_isvalid_q_id(vf, vsi_id, vsi_q_id)) {\n \t\t\t\tv_ret = VIRTCHNL_STATUS_ERR_PARAM;\n \t\t\t\tgoto error_param;\n \t\t\t}\n-\t\t\tq_vector = vsi->q_vectors[i];\n \t\t\tq_vector->num_ring_rx++;\n \t\t\tq_vector->rx.itr_idx = map->rxitr_idx;\n \t\t\tvsi->rx_rings[vsi_q_id]->q_vector = q_vector;\n \t\t}\n \n \t\tqmap = map->txq_map;\n+\t\tq_vector->num_ring_tx = 0;\n \t\tfor_each_set_bit(vsi_q_id, &qmap, ICE_MAX_BASE_QS_PER_VF) {\n-\t\t\tstruct ice_q_vector *q_vector;\n-\n \t\t\tif (!ice_vc_isvalid_q_id(vf, vsi_id, vsi_q_id)) {\n \t\t\t\tv_ret = VIRTCHNL_STATUS_ERR_PARAM;\n \t\t\t\tgoto error_param;\n \t\t\t}\n-\t\t\tq_vector = vsi->q_vectors[i];\n \t\t\tq_vector->num_ring_tx++;\n \t\t\tq_vector->tx.itr_idx = map->txitr_idx;\n \t\t\tvsi->tx_rings[vsi_q_id]->q_vector = q_vector;\n",
    "prefixes": [
        "S18",
        "04/15"
    ]
}