get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 747499,
    "url": "http://patchwork.ozlabs.org/api/patches/747499/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170405115103.67374-4-alice.michael@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": "<20170405115103.67374-4-alice.michael@intel.com>",
    "list_archive_url": null,
    "date": "2017-04-05T11:50:56",
    "name": "[next,S66,v2,04/11] i40e: Simplify i40e_detect_recover_hung_queue logic",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "584f9ddf8df120e6fdff761a1db9da4d5f262597",
    "submitter": {
        "id": 71123,
        "url": "http://patchwork.ozlabs.org/api/people/71123/?format=api",
        "name": "Michael, Alice",
        "email": "alice.michael@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/20170405115103.67374-4-alice.michael@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/747499/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/747499/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@lists.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"
        ],
        "Received": [
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3vyxNv62fQz9s8Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  6 Apr 2017 05:53:51 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 527B386212;\n\tWed,  5 Apr 2017 19:53:50 +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 0V6YBD9Nm7Qq; Wed,  5 Apr 2017 19:53:47 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 22D79862F0;\n\tWed,  5 Apr 2017 19:53:45 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 8F0631C0100\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  5 Apr 2017 19:53:44 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 8BC4B885F8\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  5 Apr 2017 19:53:44 +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 wrgK41T9r+e4 for <intel-wired-lan@lists.osuosl.org>;\n\tWed,  5 Apr 2017 19:53:43 +0000 (UTC)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 9FE4C885F2\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  5 Apr 2017 19:53:43 +0000 (UTC)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t05 Apr 2017 12:53:43 -0700",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.16.121])\n\tby orsmga003.jf.intel.com with ESMTP; 05 Apr 2017 12:53:43 -0700"
        ],
        "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"key not found in DNS\" (0-bit key;\n\tunprotected) header.d=intel.com header.i=@intel.com\n\theader.b=\"VT7ptAbd\"; dkim-atps=neutral",
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=simple/simple;\n\td=intel.com; i=@intel.com; q=dns/txt; s=intel;\n\tt=1491422023; x=1522958023;\n\th=from:to:cc:subject:date:message-id:in-reply-to: references;\n\tbh=vK2BNbfRRofoPB5f4khEBTXvQYaVQ9S7YyVC7oFlSWs=;\n\tb=VT7ptAbdtdLp+0pEFZEtUqt3U17bvoxMiEuxZylx5T7EW/RnQgS58V2D\n\thc908Vyy1CP+eKihKbuPzs0vPkWBRA==;",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.37,280,1488873600\"; d=\"scan'208\";a=\"952301570\"",
        "From": "Alice Michael <alice.michael@intel.com>",
        "To": "alice.michael@intel.com,\n\tintel-wired-lan@lists.osuosl.org",
        "Date": "Wed,  5 Apr 2017 07:50:56 -0400",
        "Message-Id": "<20170405115103.67374-4-alice.michael@intel.com>",
        "X-Mailer": "git-send-email 2.9.3",
        "In-Reply-To": "<20170405115103.67374-1-alice.michael@intel.com>",
        "References": "<20170405115103.67374-1-alice.michael@intel.com>",
        "Subject": "[Intel-wired-lan] [next S66 v2 04/11] i40e: Simplify\n\ti40e_detect_recover_hung_queue logic",
        "X-BeenThere": "intel-wired-lan@lists.osuosl.org",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>",
        "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>",
        "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.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@lists.osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>"
    },
    "content": "From: Alan Brady <alan.brady@intel.com>\n\nThis patch greatly reduces the unneeded complexity in the\ni40e_detect_recover_hung_queue code path.  The previous implementation\nset a 'hung bit' which would then get cleared while polling.  If the\ndetection routine was called a second time with the bit already set, we\nwould issue a software interrupt.  This patch makes it such that if\ninterrupts are disabled and we have pending TX descriptors, we trigger a\nsoftware interrupt since in, the worst case, queues are already clean\nand we have an extra interrupt.\n\nAdditionally this patch removes the workaround for lost interrupts as\ncalling napi_reschedule in this context can cause software interrupts to\nfire on the wrong CPU.\n\nSigned-off-by: Alan Brady <alan.brady@intel.com>\nChange-ID: Iae108582a3ceb6229ed1d22e4ed6e69cf97aad8d\n---\n drivers/net/ethernet/intel/i40e/i40e.h         |  4 --\n drivers/net/ethernet/intel/i40e/i40e_ethtool.c |  1 -\n drivers/net/ethernet/intel/i40e/i40e_main.c    | 59 +++++---------------------\n drivers/net/ethernet/intel/i40e/i40e_txrx.c    | 12 ++----\n drivers/net/ethernet/intel/i40e/i40e_txrx.h    |  3 +-\n 5 files changed, 15 insertions(+), 64 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 2c12900..e987503 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -613,7 +613,6 @@ struct i40e_vsi {\n \tu32 tx_busy;\n \tu64 tx_linearize;\n \tu64 tx_force_wb;\n-\tu64 tx_lost_interrupt;\n \tu32 rx_buf_failed;\n \tu32 rx_page_failed;\n \n@@ -699,9 +698,6 @@ struct i40e_q_vector {\n \n \tu8 num_ringpairs;\t/* total number of ring pairs in vector */\n \n-#define I40E_Q_VECTOR_HUNG_DETECT 0 /* Bit Index for hung detection logic */\n-\tunsigned long hung_detected; /* Set/Reset for hung_detection logic */\n-\n \tcpumask_t affinity_mask;\n \tstruct irq_affinity_notify affinity_notify;\n \ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\nindex 68c0f20..10325b5 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n@@ -89,7 +89,6 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = {\n \tI40E_VSI_STAT(\"rx_unknown_protocol\", eth_stats.rx_unknown_protocol),\n \tI40E_VSI_STAT(\"tx_linearize\", tx_linearize),\n \tI40E_VSI_STAT(\"tx_force_wb\", tx_force_wb),\n-\tI40E_VSI_STAT(\"tx_lost_interrupt\", tx_lost_interrupt),\n \tI40E_VSI_STAT(\"rx_alloc_fail\", rx_buf_failed),\n \tI40E_VSI_STAT(\"rx_pg_alloc_fail\", rx_page_failed),\n };\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 33725a5..fcfab36 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -737,7 +737,6 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)\n \tstruct i40e_eth_stats *oes;\n \tstruct i40e_eth_stats *es;     /* device's eth stats */\n \tu32 tx_restart, tx_busy;\n-\tu64 tx_lost_interrupt;\n \tstruct i40e_ring *p;\n \tu32 rx_page, rx_buf;\n \tu64 bytes, packets;\n@@ -763,7 +762,6 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)\n \trx_b = rx_p = 0;\n \ttx_b = tx_p = 0;\n \ttx_restart = tx_busy = tx_linearize = tx_force_wb = 0;\n-\ttx_lost_interrupt = 0;\n \trx_page = 0;\n \trx_buf = 0;\n \trcu_read_lock();\n@@ -782,7 +780,6 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)\n \t\ttx_busy += p->tx_stats.tx_busy;\n \t\ttx_linearize += p->tx_stats.tx_linearize;\n \t\ttx_force_wb += p->tx_stats.tx_force_wb;\n-\t\ttx_lost_interrupt += p->tx_stats.tx_lost_interrupt;\n \n \t\t/* Rx queue is part of the same block as Tx queue */\n \t\tp = &p[1];\n@@ -801,7 +798,6 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)\n \tvsi->tx_busy = tx_busy;\n \tvsi->tx_linearize = tx_linearize;\n \tvsi->tx_force_wb = tx_force_wb;\n-\tvsi->tx_lost_interrupt = tx_lost_interrupt;\n \tvsi->rx_page_failed = rx_page;\n \tvsi->rx_buf_failed = rx_buf;\n \n@@ -4499,16 +4495,15 @@ static int i40e_pf_wait_queues_disabled(struct i40e_pf *pf)\n  * @vsi: Pointer to VSI struct\n  *\n  * This function checks specified queue for given VSI. Detects hung condition.\n- * Sets hung bit since it is two step process. Before next run of service task\n- * if napi_poll runs, it reset 'hung' bit for respective q_vector. If not,\n- * hung condition remain unchanged and during subsequent run, this function\n- * issues SW interrupt to recover from hung condition.\n+ * We proactively detect hung TX queues by checking if interrupts are disabled\n+ * but there are pending descriptors.  If it appears hung, attempt to recover\n+ * by triggering a SW interrupt.\n  **/\n static void i40e_detect_recover_hung_queue(int q_idx, struct i40e_vsi *vsi)\n {\n \tstruct i40e_ring *tx_ring = NULL;\n \tstruct i40e_pf\t*pf;\n-\tu32 head, val, tx_pending_hw;\n+\tu32 val, tx_pending;\n \tint i;\n \n \tpf = vsi->back;\n@@ -4534,47 +4529,15 @@ static void i40e_detect_recover_hung_queue(int q_idx, struct i40e_vsi *vsi)\n \telse\n \t\tval = rd32(&pf->hw, I40E_PFINT_DYN_CTL0);\n \n-\thead = i40e_get_head(tx_ring);\n+\ttx_pending = i40e_get_tx_pending(tx_ring);\n \n-\ttx_pending_hw = i40e_get_tx_pending(tx_ring, false);\n-\n-\t/* HW is done executing descriptors, updated HEAD write back,\n-\t * but SW hasn't processed those descriptors. If interrupt is\n-\t * not generated from this point ON, it could result into\n-\t * dev_watchdog detecting timeout on those netdev_queue,\n-\t * hence proactively trigger SW interrupt.\n+\t/* Interrupts are disabled and TX pending is non-zero,\n+\t * trigger the SW interrupt (don't wait). Worst case\n+\t * there will be one extra interrupt which may result\n+\t * into not cleaning any queues because queues are cleaned.\n \t */\n-\tif (tx_pending_hw && (!(val & I40E_PFINT_DYN_CTLN_INTENA_MASK))) {\n-\t\t/* NAPI Poll didn't run and clear since it was set */\n-\t\tif (test_and_clear_bit(I40E_Q_VECTOR_HUNG_DETECT,\n-\t\t\t\t       &tx_ring->q_vector->hung_detected)) {\n-\t\t\tnetdev_info(vsi->netdev, \"VSI_seid %d, Hung TX queue %d, tx_pending_hw: %d, NTC:0x%x, HWB: 0x%x, NTU: 0x%x, TAIL: 0x%x\\n\",\n-\t\t\t\t    vsi->seid, q_idx, tx_pending_hw,\n-\t\t\t\t    tx_ring->next_to_clean, head,\n-\t\t\t\t    tx_ring->next_to_use,\n-\t\t\t\t    readl(tx_ring->tail));\n-\t\t\tnetdev_info(vsi->netdev, \"VSI_seid %d, Issuing force_wb for TX queue %d, Interrupt Reg: 0x%x\\n\",\n-\t\t\t\t    vsi->seid, q_idx, val);\n-\t\t\ti40e_force_wb(vsi, tx_ring->q_vector);\n-\t\t} else {\n-\t\t\t/* First Chance - detected possible hung */\n-\t\t\tset_bit(I40E_Q_VECTOR_HUNG_DETECT,\n-\t\t\t\t&tx_ring->q_vector->hung_detected);\n-\t\t}\n-\t}\n-\n-\t/* This is the case where we have interrupts missing,\n-\t * so the tx_pending in HW will most likely be 0, but we\n-\t * will have tx_pending in SW since the WB happened but the\n-\t * interrupt got lost.\n-\t */\n-\tif ((!tx_pending_hw) && i40e_get_tx_pending(tx_ring, true) &&\n-\t    (!(val & I40E_PFINT_DYN_CTLN_INTENA_MASK))) {\n-\t\tlocal_bh_disable();\n-\t\tif (napi_reschedule(&tx_ring->q_vector->napi))\n-\t\t\ttx_ring->tx_stats.tx_lost_interrupt++;\n-\t\tlocal_bh_enable();\n-\t}\n+\tif (tx_pending && (!(val & I40E_PFINT_DYN_CTLN_INTENA_MASK)))\n+\t\ti40e_force_wb(vsi, tx_ring->q_vector);\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\nindex 9b92d00..b4a7bfc 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n@@ -711,19 +711,15 @@ void i40e_free_tx_resources(struct i40e_ring *tx_ring)\n /**\n  * i40e_get_tx_pending - how many tx descriptors not processed\n  * @tx_ring: the ring of descriptors\n- * @in_sw: is tx_pending being checked in SW or HW\n  *\n  * Since there is no access to the ring head register\n  * in XL710, we need to use our local copies\n  **/\n-u32 i40e_get_tx_pending(struct i40e_ring *ring, bool in_sw)\n+u32 i40e_get_tx_pending(struct i40e_ring *ring)\n {\n \tu32 head, tail;\n \n-\tif (!in_sw)\n-\t\thead = i40e_get_head(ring);\n-\telse\n-\t\thead = ring->next_to_clean;\n+\thead = i40e_get_head(ring);\n \ttail = readl(ring->tail);\n \n \tif (head != tail)\n@@ -846,7 +842,7 @@ static bool i40e_clean_tx_irq(struct i40e_vsi *vsi,\n \t\t * them to be written back in case we stay in NAPI.\n \t\t * In this mode on X722 we do not enable Interrupt.\n \t\t */\n-\t\tunsigned int j = i40e_get_tx_pending(tx_ring, false);\n+\t\tunsigned int j = i40e_get_tx_pending(tx_ring);\n \n \t\tif (budget &&\n \t\t    ((j / WB_STRIDE) == 0) && (j > 0) &&\n@@ -2185,8 +2181,6 @@ int i40e_napi_poll(struct napi_struct *napi, int budget)\n \t\treturn 0;\n \t}\n \n-\t/* Clear hung_detected bit */\n-\tclear_bit(I40E_Q_VECTOR_HUNG_DETECT, &q_vector->hung_detected);\n \t/* Since the actual Tx work is minimal, we can give the Tx a larger\n \t * budget and be more aggressive about cleaning up the Tx descriptors.\n \t */\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\nindex 2e876ad..f5de511 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n@@ -328,7 +328,6 @@ struct i40e_tx_queue_stats {\n \tu64 tx_done_old;\n \tu64 tx_linearize;\n \tu64 tx_force_wb;\n-\tu64 tx_lost_interrupt;\n };\n \n struct i40e_rx_queue_stats {\n@@ -480,7 +479,7 @@ void i40e_free_tx_resources(struct i40e_ring *tx_ring);\n void i40e_free_rx_resources(struct i40e_ring *rx_ring);\n int i40e_napi_poll(struct napi_struct *napi, int budget);\n void i40e_force_wb(struct i40e_vsi *vsi, struct i40e_q_vector *q_vector);\n-u32 i40e_get_tx_pending(struct i40e_ring *ring, bool in_sw);\n+u32 i40e_get_tx_pending(struct i40e_ring *ring);\n int __i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size);\n bool __i40e_chk_linearize(struct sk_buff *skb);\n \n",
    "prefixes": [
        "next",
        "S66",
        "v2",
        "04/11"
    ]
}