get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 120276,
    "url": "http://patches.dpdk.org/api/patches/120276/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20221129144832.2750-2-lucp.at.work@gmail.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20221129144832.2750-2-lucp.at.work@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20221129144832.2750-2-lucp.at.work@gmail.com",
    "date": "2022-11-29T14:48:29",
    "name": "[v3,1/5] failsafe: fix segfault on hotplug event",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "526408f605b57ae27cd2fbe01287a5f387c7d54f",
    "submitter": {
        "id": 2151,
        "url": "http://patches.dpdk.org/api/people/2151/?format=api",
        "name": "Luc Pelletier",
        "email": "lucp.at.work@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20221129144832.2750-2-lucp.at.work@gmail.com/mbox/",
    "series": [
        {
            "id": 25923,
            "url": "http://patches.dpdk.org/api/series/25923/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=25923",
            "date": "2022-11-29T14:48:29",
            "name": "[v3,1/5] failsafe: fix segfault on hotplug event",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/25923/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/120276/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/120276/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 22EE4A00C3;\n\tTue, 29 Nov 2022 15:50:32 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id CDD2242BD9;\n\tTue, 29 Nov 2022 15:50:31 +0100 (CET)",
            "from mail-qt1-f173.google.com (mail-qt1-f173.google.com\n [209.85.160.173])\n by mails.dpdk.org (Postfix) with ESMTP id 2E65642B8C;\n Tue, 29 Nov 2022 15:50:30 +0100 (CET)",
            "by mail-qt1-f173.google.com with SMTP id l15so9051453qtv.4;\n Tue, 29 Nov 2022 06:50:30 -0800 (PST)",
            "from ubuntu.home\n (bras-base-hullpq2034w-grc-26-74-12-221-152.dsl.bell.ca. [74.12.221.152])\n by smtp.gmail.com with ESMTPSA id\n y14-20020a05620a44ce00b006fb7c42e73asm11068836qkp.21.2022.11.29.06.50.28\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 29 Nov 2022 06:50:28 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=x65RBFLYFeugknTlnHkP1QebxJ/q7Kwtp/HyVMorJTQ=;\n b=XbqX1SuQmVK1FDdPD3zPuDPNlfI4uldOawRLdGB1+zkvUxWv3gbt7ZMup9wTI+9pbx\n Kx5CsNBxjdvPYYADGNURIFqTvawa/7Pux5vEDlMYKJiXfXqacq/P6PtYACtVTxJm4jvb\n Y4aEBkOntV9xQhizfrSjMqRUaLAIzAr8WjTSwGwP0N0japZOm1Fr97XRjxkN+89hMrX/\n OtgI/B/KNWQsO3Gc1GmWFkEzSMr6z6VaKB6r9ktHSylXILw2FLRlx5g0T7nybankCPt/\n WT7VGvG7B+SRXOp5Jho+aWMlYkmGFg41FIqyYzQzxG0za1ivd4QpsmN2wyP2oAgHMj2F\n QSkA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20210112;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=x65RBFLYFeugknTlnHkP1QebxJ/q7Kwtp/HyVMorJTQ=;\n b=QsgM+DlwLcGdo/Y23g4q9EGrIDrPnFVVf9CRxObR73koUb0P5szqjgHMaMNJOBKu3Q\n cOM45z4CXvT1fWUrOMg4r8Q+oojbGD9wtSuK8e9q5OV1e6lzwZEluKO/XM6VhShkuDGh\n +hoA0P+PW+ZoHgEs4a+857fXs6kbNj6qLZzQmsxoh9t283mswqe/UulunLNDy6m3rpiw\n v83CXI5HTOqtFDsEHBXT6juQR3y9jyZP2Z3KlhIiTrnns3YXWCryel1+vqd8bJRTd4vH\n cRJrKuWUOKF7QogcEiFLGFCCWNzKGlB9cSuWVd3gAl3c+tCcBNfv2yrCfviG8PxAsD3G\n kJmw==",
        "X-Gm-Message-State": "ANoB5pnDoMMgnDWjHaHOGRHRKg3U5lHZgKkQAsaDoOrWGF/AzgPZBsyt\n CgzQNkZB/mBVXdXHr0AqIUg=",
        "X-Google-Smtp-Source": "\n AA0mqf6cTlt/QLARgpIwZHqYU4yDHdzdZiOg5+7mlnyIm3W20GyAwwioGjMZq7fdiDXwxhsYvkOZVw==",
        "X-Received": "by 2002:ac8:4d46:0:b0:3a5:278d:d95e with SMTP id\n x6-20020ac84d46000000b003a5278dd95emr52268972qtv.125.1669733429542;\n Tue, 29 Nov 2022 06:50:29 -0800 (PST)",
        "From": "Luc Pelletier <lucp.at.work@gmail.com>",
        "To": "grive@u256.net",
        "Cc": "dev@dpdk.org, stephen@networkplumber.org, konstantin.ananyev@huawei.com,\n Luc Pelletier <lucp.at.work@gmail.com>, stable@dpdk.org",
        "Subject": "[PATCH v3 1/5] failsafe: fix segfault on hotplug event",
        "Date": "Tue, 29 Nov 2022 09:48:29 -0500",
        "Message-Id": "<20221129144832.2750-2-lucp.at.work@gmail.com>",
        "X-Mailer": "git-send-email 2.38.1",
        "In-Reply-To": "<20221110163410.12734-1-lucp.at.work@gmail.com>",
        "References": "<20221110163410.12734-1-lucp.at.work@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "When the failsafe PMD encounters a hotplug event, it switches its rx/tx\nfunctions to \"safe\" ones that validate the sub-device's rx/tx functions\nbefore calling them. It switches the rx/tx functions by changing the\nfunction pointers in the rte_eth_dev structure.\n\nFollowing commit 7a0935239b9e, the rx/tx functions of PMDs are no longer\ncalled through the function pointers in the rte_eth_dev structure. They\nare rather called through a flat array named rte_eth_fp_ops. The\nfunction pointers in that array are initialized when the devices start\nand are initialized.\n\nWhen a hotplug event occurs, the function pointers in rte_eth_fp_ops\nstill point to the \"unsafe\" rx/tx functions in the failsafe PMD since\nthey haven't been updated. This results in a segmentation fault because\nit ends up using the \"unsafe\" functions, when the \"safe\" functions\nshould have been used.\n\nTo fix the problem, the \"unsafe\" rx/tx functions were completely\nremoved. The \"safe\" functions are now always used. Modifying the rx/tx\nfunctions on-the-fly is not supported by DPDK, so this is the correct\napproach and should have very minimal impact on performance.\n\nFixes: 7a0935239b9e (\"ethdev: make fast-path functions to use new flat array\")\nCc: Konstantin Ananyev <konstantin.ananyev@huawei.com>\nCc: stable@dpdk.org\n\nSigned-off-by: Luc Pelletier <lucp.at.work@gmail.com>\n---\n drivers/net/failsafe/failsafe_ether.c   |  2 -\n drivers/net/failsafe/failsafe_private.h |  8 ---\n drivers/net/failsafe/failsafe_rxtx.c    | 83 +------------------------\n 3 files changed, 1 insertion(+), 92 deletions(-)",
    "diff": "diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c\nindex 10b90fd837..517126565f 100644\n--- a/drivers/net/failsafe/failsafe_ether.c\n+++ b/drivers/net/failsafe/failsafe_ether.c\n@@ -595,8 +595,6 @@ failsafe_eth_rmv_event_callback(uint16_t port_id __rte_unused,\n \tfs_lock(fs_dev(sdev), 0);\n \t/* Switch as soon as possible tx_dev. */\n \tfs_switch_dev(fs_dev(sdev), sdev);\n-\t/* Use safe bursts in any case. */\n-\tfailsafe_set_burst_fn(fs_dev(sdev), 1);\n \t/*\n \t * Async removal, the sub-PMD will try to unregister\n \t * the callback at the source of the current thread context.\ndiff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h\nindex 53a451c1b1..3865f2fc34 100644\n--- a/drivers/net/failsafe/failsafe_private.h\n+++ b/drivers/net/failsafe/failsafe_private.h\n@@ -208,18 +208,11 @@ int failsafe_hotplug_alarm_cancel(struct rte_eth_dev *dev);\n \n /* RX / TX */\n \n-void failsafe_set_burst_fn(struct rte_eth_dev *dev, int force_safe);\n-\n uint16_t failsafe_rx_burst(void *rxq,\n \t\tstruct rte_mbuf **rx_pkts, uint16_t nb_pkts);\n uint16_t failsafe_tx_burst(void *txq,\n \t\tstruct rte_mbuf **tx_pkts, uint16_t nb_pkts);\n \n-uint16_t failsafe_rx_burst_fast(void *rxq,\n-\t\tstruct rte_mbuf **rx_pkts, uint16_t nb_pkts);\n-uint16_t failsafe_tx_burst_fast(void *txq,\n-\t\tstruct rte_mbuf **tx_pkts, uint16_t nb_pkts);\n-\n /* ARGS */\n \n int failsafe_args_parse(struct rte_eth_dev *dev, const char *params);\n@@ -487,7 +480,6 @@ fs_switch_dev(struct rte_eth_dev *dev,\n \t} else {\n \t\treturn;\n \t}\n-\tfailsafe_set_burst_fn(dev, 0);\n \trte_wmb();\n }\n \ndiff --git a/drivers/net/failsafe/failsafe_rxtx.c b/drivers/net/failsafe/failsafe_rxtx.c\nindex fe67293299..707fe60a36 100644\n--- a/drivers/net/failsafe/failsafe_rxtx.c\n+++ b/drivers/net/failsafe/failsafe_rxtx.c\n@@ -28,39 +28,6 @@ fs_tx_unsafe(struct sub_device *sdev)\n \t\t(sdev->state != DEV_STARTED);\n }\n \n-void\n-failsafe_set_burst_fn(struct rte_eth_dev *dev, int force_safe)\n-{\n-\tstruct sub_device *sdev;\n-\tuint8_t i;\n-\tint need_safe;\n-\tint safe_set;\n-\n-\tneed_safe = force_safe;\n-\tFOREACH_SUBDEV(sdev, i, dev)\n-\t\tneed_safe |= fs_rx_unsafe(sdev);\n-\tsafe_set = (dev->rx_pkt_burst == &failsafe_rx_burst);\n-\tif (need_safe && !safe_set) {\n-\t\tDEBUG(\"Using safe RX bursts%s\",\n-\t\t      (force_safe ? \" (forced)\" : \"\"));\n-\t\tdev->rx_pkt_burst = &failsafe_rx_burst;\n-\t} else if (!need_safe && safe_set) {\n-\t\tDEBUG(\"Using fast RX bursts\");\n-\t\tdev->rx_pkt_burst = &failsafe_rx_burst_fast;\n-\t}\n-\tneed_safe = force_safe || fs_tx_unsafe(TX_SUBDEV(dev));\n-\tsafe_set = (dev->tx_pkt_burst == &failsafe_tx_burst);\n-\tif (need_safe && !safe_set) {\n-\t\tDEBUG(\"Using safe TX bursts%s\",\n-\t\t      (force_safe ? \" (forced)\" : \"\"));\n-\t\tdev->tx_pkt_burst = &failsafe_tx_burst;\n-\t} else if (!need_safe && safe_set) {\n-\t\tDEBUG(\"Using fast TX bursts\");\n-\t\tdev->tx_pkt_burst = &failsafe_tx_burst_fast;\n-\t}\n-\trte_wmb();\n-}\n-\n /*\n  * Override source port in Rx packets.\n  *\n@@ -89,7 +56,7 @@ failsafe_rx_burst(void *queue,\n \trxq = queue;\n \tsdev = rxq->sdev;\n \tdo {\n-\t\tif (fs_rx_unsafe(sdev)) {\n+\t\tif (unlikely(fs_rx_unsafe(sdev))) {\n \t\t\tnb_rx = 0;\n \t\t\tsdev = sdev->next;\n \t\t\tcontinue;\n@@ -108,34 +75,6 @@ failsafe_rx_burst(void *queue,\n \treturn nb_rx;\n }\n \n-uint16_t\n-failsafe_rx_burst_fast(void *queue,\n-\t\t\t struct rte_mbuf **rx_pkts,\n-\t\t\t uint16_t nb_pkts)\n-{\n-\tstruct sub_device *sdev;\n-\tstruct rxq *rxq;\n-\tvoid *sub_rxq;\n-\tuint16_t nb_rx;\n-\n-\trxq = queue;\n-\tsdev = rxq->sdev;\n-\tdo {\n-\t\tRTE_ASSERT(!fs_rx_unsafe(sdev));\n-\t\tsub_rxq = ETH(sdev)->data->rx_queues[rxq->qid];\n-\t\tFS_ATOMIC_P(rxq->refcnt[sdev->sid]);\n-\t\tnb_rx = ETH(sdev)->\n-\t\t\trx_pkt_burst(sub_rxq, rx_pkts, nb_pkts);\n-\t\tFS_ATOMIC_V(rxq->refcnt[sdev->sid]);\n-\t\tsdev = sdev->next;\n-\t} while (nb_rx == 0 && sdev != rxq->sdev);\n-\trxq->sdev = sdev;\n-\tif (nb_rx)\n-\t\tfailsafe_rx_set_port(rx_pkts, nb_rx,\n-\t\t\t\t     rxq->priv->data->port_id);\n-\treturn nb_rx;\n-}\n-\n uint16_t\n failsafe_tx_burst(void *queue,\n \t\t  struct rte_mbuf **tx_pkts,\n@@ -156,23 +95,3 @@ failsafe_tx_burst(void *queue,\n \tFS_ATOMIC_V(txq->refcnt[sdev->sid]);\n \treturn nb_tx;\n }\n-\n-uint16_t\n-failsafe_tx_burst_fast(void *queue,\n-\t\t\t struct rte_mbuf **tx_pkts,\n-\t\t\t uint16_t nb_pkts)\n-{\n-\tstruct sub_device *sdev;\n-\tstruct txq *txq;\n-\tvoid *sub_txq;\n-\tuint16_t nb_tx;\n-\n-\ttxq = queue;\n-\tsdev = TX_SUBDEV(&rte_eth_devices[txq->priv->data->port_id]);\n-\tRTE_ASSERT(!fs_tx_unsafe(sdev));\n-\tsub_txq = ETH(sdev)->data->tx_queues[txq->qid];\n-\tFS_ATOMIC_P(txq->refcnt[sdev->sid]);\n-\tnb_tx = ETH(sdev)->tx_pkt_burst(sub_txq, tx_pkts, nb_pkts);\n-\tFS_ATOMIC_V(txq->refcnt[sdev->sid]);\n-\treturn nb_tx;\n-}\n",
    "prefixes": [
        "v3",
        "1/5"
    ]
}