get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 756518,
    "url": "http://patchwork.ozlabs.org/api/patches/756518/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170428184421.20216-3-jacob.e.keller@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": "<20170428184421.20216-3-jacob.e.keller@intel.com>",
    "list_archive_url": null,
    "date": "2017-04-28T18:44:18",
    "name": "[v3,2/5] net-intel: avoid permanent lock of *_PTP_TX_IN_PROGRESS",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "b6949cf034eaf86e24dd963a618de2dc8c521162",
    "submitter": {
        "id": 9784,
        "url": "http://patchwork.ozlabs.org/api/people/9784/?format=api",
        "name": "Jacob Keller",
        "email": "jacob.e.keller@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/20170428184421.20216-3-jacob.e.keller@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/756518/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/756518/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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 3wF2mL6c8fz9s84\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 29 Apr 2017 04:44:34 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 678808841D;\n\tFri, 28 Apr 2017 18:44:33 +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 WhVtw7i7kaLC; Fri, 28 Apr 2017 18:44:31 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id A59C388535;\n\tFri, 28 Apr 2017 18:44:29 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id A763E1C26F3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 28 Apr 2017 18:44:27 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id A13268A23D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 28 Apr 2017 18:44:27 +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 IEdc+577ltKy for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 28 Apr 2017 18:44:25 +0000 (UTC)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 137D28A29A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 28 Apr 2017 18:44:25 +0000 (UTC)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby orsmga105.jf.intel.com with ESMTP; 28 Apr 2017 11:44:24 -0700",
            "from jekeller-desk.amr.corp.intel.com (HELO\n\tjekeller-desk.jekeller.internal) ([10.166.35.158])\n\tby fmsmga001.fm.intel.com with ESMTP; 28 Apr 2017 11:44:23 -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-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos; i=\"5.37,389,1488873600\"; d=\"scan'208\";\n\ta=\"1141484701\"",
        "From": "Jacob Keller <jacob.e.keller@intel.com>",
        "To": "Intel Wired LAN <intel-wired-lan@lists.osuosl.org>",
        "Date": "Fri, 28 Apr 2017 11:44:18 -0700",
        "Message-Id": "<20170428184421.20216-3-jacob.e.keller@intel.com>",
        "X-Mailer": "git-send-email 2.13.0.rc0.317.gcc792a6cad5a",
        "In-Reply-To": "<20170428184421.20216-1-jacob.e.keller@intel.com>",
        "References": "<20170428184421.20216-1-jacob.e.keller@intel.com>",
        "Cc": "Richard Cochran <richardcochran@gmail.com>",
        "Subject": "[Intel-wired-lan] [PATCH v3 2/5] net-intel: avoid permanent lock of\n\t*_PTP_TX_IN_PROGRESS",
        "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": "Several drivers share a pattern for Tx timestamping using a bit lock to\nindicate when the timestamp is in progress so that multiple packets\ncannot be timestamped at once. This is required because we only have one\nset of Tx timestamp registers. There exist a few corner cases where we\nwere not properly cleaning up after ourselves on failure to transmit,\nwhich potentially resulted in the state bit being locked forever.\n\nAdd some code at the end of the *_xmit_frame() routines to check and\nmake sure we cleanup in the case of failure. For the *_tx_map()\nfunctions, we also need to add a return code to indicate when DMA\nfailure occurred.\n\nThis resolves a possible permanent lock of the PTP_TX_IN_PROGRESS bit\nfor igb, ixgbe, and i40e. The e1000e driver does not have the same\nproblem due to the ordering of the Tx flow.\n\nReported-by: Reported-by: David Mirabito <davidm@metamako.com>\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 26 ++++++++++++++++++++------\n drivers/net/ethernet/intel/igb/igb_main.c     | 23 ++++++++++++++++++-----\n drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 20 +++++++++++++++-----\n 3 files changed, 53 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\nindex 29321a6167a6..19984be0f70c 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n@@ -2932,10 +2932,12 @@ bool __i40e_chk_linearize(struct sk_buff *skb)\n  * @hdr_len:  size of the packet header\n  * @td_cmd:   the command field in the descriptor\n  * @td_offset: offset for checksum or crc\n+ *\n+ * Returns 0 on success, -1 on failure to DMA\n  **/\n-static inline void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,\n-\t\t\t       struct i40e_tx_buffer *first, u32 tx_flags,\n-\t\t\t       const u8 hdr_len, u32 td_cmd, u32 td_offset)\n+static inline int i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,\n+\t\t\t      struct i40e_tx_buffer *first, u32 tx_flags,\n+\t\t\t      const u8 hdr_len, u32 td_cmd, u32 td_offset)\n {\n \tunsigned int data_len = skb->data_len;\n \tunsigned int size = skb_headlen(skb);\n@@ -3093,7 +3095,7 @@ static inline void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,\n \t\tmmiowb();\n \t}\n \n-\treturn;\n+\treturn 0;\n \n dma_error:\n \tdev_info(tx_ring->dev, \"TX DMA map failed\\n\");\n@@ -3110,6 +3112,8 @@ static inline void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,\n \t}\n \n \ttx_ring->next_to_use = i;\n+\n+\treturn -1;\n }\n \n /**\n@@ -3210,8 +3214,9 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,\n \t */\n \ti40e_atr(tx_ring, skb, tx_flags);\n \n-\ti40e_tx_map(tx_ring, skb, first, tx_flags, hdr_len,\n-\t\t    td_cmd, td_offset);\n+\tif (i40e_tx_map(tx_ring, skb, first, tx_flags, hdr_len,\n+\t\t\ttd_cmd, td_offset))\n+\t\tgoto cleanup_tx_tstamp;\n \n \treturn NETDEV_TX_OK;\n \n@@ -3219,6 +3224,15 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,\n \ti40e_trace(xmit_frame_ring_drop, first->skb, tx_ring);\n \tdev_kfree_skb_any(first->skb);\n \tfirst->skb = NULL;\n+cleanup_tx_tstamp:\n+\tif (unlikely(tx_flags & I40E_TX_FLAGS_TSYN)) {\n+\t\tstruct i40e_pf *pf = i40e_netdev_to_pf(tx_ring->netdev);\n+\n+\t\tdev_kfree_skb_any(pf->ptp_tx_skb);\n+\t\tpf->ptp_tx_skb = NULL;\n+\t\tclear_bit_unlock(__I40E_PTP_TX_IN_PROGRESS, pf->state);\n+\t}\n+\n \treturn NETDEV_TX_OK;\n }\n \ndiff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c\nindex dbb4e3cf7dbf..978908f426a7 100644\n--- a/drivers/net/ethernet/intel/igb/igb_main.c\n+++ b/drivers/net/ethernet/intel/igb/igb_main.c\n@@ -5201,9 +5201,9 @@ static inline int igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size)\n \treturn __igb_maybe_stop_tx(tx_ring, size);\n }\n \n-static void igb_tx_map(struct igb_ring *tx_ring,\n-\t\t       struct igb_tx_buffer *first,\n-\t\t       const u8 hdr_len)\n+static int igb_tx_map(struct igb_ring *tx_ring,\n+\t\t      struct igb_tx_buffer *first,\n+\t\t      const u8 hdr_len)\n {\n \tstruct sk_buff *skb = first->skb;\n \tstruct igb_tx_buffer *tx_buffer;\n@@ -5314,7 +5314,7 @@ static void igb_tx_map(struct igb_ring *tx_ring,\n \t\t */\n \t\tmmiowb();\n \t}\n-\treturn;\n+\treturn 0;\n \n dma_error:\n \tdev_err(tx_ring->dev, \"TX DMA map failed\\n\");\n@@ -5345,6 +5345,8 @@ static void igb_tx_map(struct igb_ring *tx_ring,\n \ttx_buffer->skb = NULL;\n \n \ttx_ring->next_to_use = i;\n+\n+\treturn -1;\n }\n \n netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,\n@@ -5410,13 +5412,24 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,\n \telse if (!tso)\n \t\tigb_tx_csum(tx_ring, first);\n \n-\tigb_tx_map(tx_ring, first, hdr_len);\n+\tif (igb_tx_map(tx_ring, first, hdr_len))\n+\t\tgoto cleanup_tx_tstamp;\n \n \treturn NETDEV_TX_OK;\n \n out_drop:\n \tdev_kfree_skb_any(first->skb);\n \tfirst->skb = NULL;\n+cleanup_tx_tstamp:\n+\tif (unlikely(tx_flags & IGB_TX_FLAGS_TSTAMP)) {\n+\t\tstruct igb_adapter *adapter = netdev_priv(tx_ring->netdev);\n+\n+\t\tdev_kfree_skb_any(adapter->ptp_tx_skb);\n+\t\tadapter->ptp_tx_skb = NULL;\n+\t\tif (adapter->hw.mac.type == e1000_82576)\n+\t\t\tcancel_work_sync(&adapter->ptp_tx_work);\n+\t\tclear_bit_unlock(__IGB_PTP_TX_IN_PROGRESS, &adapter->state);\n+\t}\n \n \treturn NETDEV_TX_OK;\n }\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\nindex 68d849346cdf..54bf0f9f5573 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n@@ -7885,9 +7885,9 @@ static inline int ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, u16 size)\n #define IXGBE_TXD_CMD (IXGBE_TXD_CMD_EOP | \\\n \t\t       IXGBE_TXD_CMD_RS)\n \n-static void ixgbe_tx_map(struct ixgbe_ring *tx_ring,\n-\t\t\t struct ixgbe_tx_buffer *first,\n-\t\t\t const u8 hdr_len)\n+static int ixgbe_tx_map(struct ixgbe_ring *tx_ring,\n+\t\t\tstruct ixgbe_tx_buffer *first,\n+\t\t\tconst u8 hdr_len)\n {\n \tstruct sk_buff *skb = first->skb;\n \tstruct ixgbe_tx_buffer *tx_buffer;\n@@ -8014,7 +8014,7 @@ static void ixgbe_tx_map(struct ixgbe_ring *tx_ring,\n \t\tmmiowb();\n \t}\n \n-\treturn;\n+\treturn 0;\n dma_error:\n \tdev_err(tx_ring->dev, \"TX DMA map failed\\n\");\n \ttx_buffer = &tx_ring->tx_buffer_info[i];\n@@ -8044,6 +8044,8 @@ static void ixgbe_tx_map(struct ixgbe_ring *tx_ring,\n \tfirst->skb = NULL;\n \n \ttx_ring->next_to_use = i;\n+\n+\treturn -1;\n }\n \n static void ixgbe_atr(struct ixgbe_ring *ring,\n@@ -8416,13 +8418,21 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,\n #ifdef IXGBE_FCOE\n xmit_fcoe:\n #endif /* IXGBE_FCOE */\n-\tixgbe_tx_map(tx_ring, first, hdr_len);\n+\tif (ixgbe_tx_map(tx_ring, first, hdr_len))\n+\t\tgoto cleanup_tx_timestamp;\n \n \treturn NETDEV_TX_OK;\n \n out_drop:\n \tdev_kfree_skb_any(first->skb);\n \tfirst->skb = NULL;\n+cleanup_tx_timestamp:\n+\tif (unlikely(tx_flags & IXGBE_TX_FLAGS_TSTAMP)) {\n+\t\tdev_kfree_skb_any(adapter->ptp_tx_skb);\n+\t\tadapter->ptp_tx_skb = NULL;\n+\t\tcancel_work_sync(&adapter->ptp_tx_work);\n+\t\tclear_bit_unlock(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state);\n+\t}\n \n \treturn NETDEV_TX_OK;\n }\n",
    "prefixes": [
        "v3",
        "2/5"
    ]
}