get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 79649,
    "url": "https://patches.dpdk.org/api/patches/79649/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20201005120910.189343-31-jiawenwu@trustnetic.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20201005120910.189343-31-jiawenwu@trustnetic.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201005120910.189343-31-jiawenwu@trustnetic.com",
    "date": "2020-10-05T12:08:44",
    "name": "[v2,30/56] net/txgbe: add device stop and close operations",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "dabaa8e1e84ec74dc7f60b66842894275d4c9045",
    "submitter": {
        "id": 1932,
        "url": "https://patches.dpdk.org/api/people/1932/?format=api",
        "name": "Jiawen Wu",
        "email": "jiawenwu@trustnetic.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20201005120910.189343-31-jiawenwu@trustnetic.com/mbox/",
    "series": [
        {
            "id": 12690,
            "url": "https://patches.dpdk.org/api/series/12690/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=12690",
            "date": "2020-10-05T12:08:14",
            "name": "net: txgbe PMD",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/12690/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/79649/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/79649/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 3D236A04B1;\n\tMon,  5 Oct 2020 14:22:15 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 688201BEEE;\n\tMon,  5 Oct 2020 14:09:41 +0200 (CEST)",
            "from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166])\n by dpdk.org (Postfix) with ESMTP id 748F31BCDB\n for <dev@dpdk.org>; Mon,  5 Oct 2020 14:09:22 +0200 (CEST)",
            "from localhost.localdomain.com (unknown [183.129.236.74])\n by esmtp6.qq.com (ESMTP) with\n id ; Mon, 05 Oct 2020 20:09:16 +0800 (CST)"
        ],
        "X-QQ-mid": "bizesmtp9t1601899756tl2dh0p2v",
        "X-QQ-SSF": "01400000002000C0C000B00A0000000",
        "X-QQ-FEAT": "bVkXiLkXizj2oXvAHt8krFKK8wBXtekih6M3T4E6z3Gm5DPSU8hhm/4YUDLZZ\n dJ3tDJ/Gon+cYq9vfFqKXV/cCLlQK+RbD2rTxFaqNmYX+r2qkIcB02ZzPketHl1CKVTDDy1\n twsiTFW8ihQVzLG8d3nkvrI8HsUM3I55+5xiI+4pj6iHCRx0pA6N641YI64OFieqwINMj4U\n fkV7wyj47UMm1ENWjMxJWx9mSb5bHGTvv7fHtbHYWwwsVjDnVeTpynVpRpDWzTbt+Mq8E9M\n LVsBNgKNl19wI8uA9h6grpu81mt1odwM0L6h6wyoHVzgcAhGh4NugKj7S0+3/AthgkIUEuF\n ibeU6urIT6UFHyFKno=",
        "X-QQ-GoodBg": "2",
        "From": "Jiawen Wu <jiawenwu@trustnetic.com>",
        "To": "dev@dpdk.org",
        "Cc": "jiawenwu <jiawenwu@trustnetic.com>",
        "Date": "Mon,  5 Oct 2020 20:08:44 +0800",
        "Message-Id": "<20201005120910.189343-31-jiawenwu@trustnetic.com>",
        "X-Mailer": "git-send-email 2.18.4",
        "In-Reply-To": "<20201005120910.189343-1-jiawenwu@trustnetic.com>",
        "References": "<20201005120910.189343-1-jiawenwu@trustnetic.com>",
        "X-QQ-SENDSIZE": "520",
        "Feedback-ID": "bizesmtp:trustnetic.com:qybgforeign:qybgforeign7",
        "X-QQ-Bgrelay": "1",
        "Subject": "[dpdk-dev] [PATCH v2 30/56] net/txgbe: add device stop and close\n\toperations",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: jiawenwu <jiawenwu@trustnetic.com>\n\nAdd device stop, close and reset operations. And support hardware\nthermal sensor.\n\nSigned-off-by: jiawenwu <jiawenwu@trustnetic.com>\n---\n drivers/net/txgbe/base/txgbe_hw.c   |  70 +++++++++++++++++++\n drivers/net/txgbe/base/txgbe_hw.h   |   3 +\n drivers/net/txgbe/base/txgbe_type.h |  11 +++\n drivers/net/txgbe/txgbe_ethdev.c    | 104 ++++++++++++++++++++++++++++\n 4 files changed, 188 insertions(+)",
    "diff": "diff --git a/drivers/net/txgbe/base/txgbe_hw.c b/drivers/net/txgbe/base/txgbe_hw.c\nindex 36e97eb4f..52b6f9888 100644\n--- a/drivers/net/txgbe/base/txgbe_hw.c\n+++ b/drivers/net/txgbe/base/txgbe_hw.c\n@@ -965,6 +965,72 @@ void txgbe_clear_tx_pending(struct txgbe_hw *hw)\n \twr32(hw, TXGBE_PSRCTL, hlreg0);\n }\n \n+/**\n+ *  txgbe_get_thermal_sensor_data - Gathers thermal sensor data\n+ *  @hw: pointer to hardware structure\n+ *\n+ *  Returns the thermal sensor data structure\n+ **/\n+s32 txgbe_get_thermal_sensor_data(struct txgbe_hw *hw)\n+{\n+\tstruct txgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data;\n+\ts64 tsv;\n+\tu32 ts_stat;\n+\n+\tDEBUGFUNC(\"txgbe_get_thermal_sensor_data\");\n+\n+\t/* Only support thermal sensors attached to physical port 0 */\n+\tif (hw->bus.lan_id != 0) {\n+\t\treturn TXGBE_NOT_IMPLEMENTED;\n+\t}\n+\n+\tts_stat = rd32(hw, TXGBE_TSSTAT);\n+\ttsv = (s64)TXGBE_TSSTAT_DATA(ts_stat);\n+\ttsv = tsv > 1200 ? tsv : 1200;\n+\ttsv = -(48380 << 8) / 1000\n+\t\t+ tsv * (31020 << 8) / 100000\n+\t\t- tsv * tsv * (18201 << 8) / 100000000\n+\t\t+ tsv * tsv * tsv * (81542 << 8) / 1000000000000\n+\t\t- tsv * tsv * tsv * tsv * (16743 << 8) / 1000000000000000;\n+\ttsv >>= 8;\n+\n+\tdata->sensor[0].temp = (s16)tsv;\n+\n+\treturn 0;\n+}\n+\n+/**\n+ *  txgbe_init_thermal_sensor_thresh - Inits thermal sensor thresholds\n+ *  @hw: pointer to hardware structure\n+ *\n+ *  Inits the thermal sensor thresholds according to the NVM map\n+ *  and save off the threshold and location values into mac.thermal_sensor_data\n+ **/\n+s32 txgbe_init_thermal_sensor_thresh(struct txgbe_hw *hw)\n+{\n+\tstruct txgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data;\n+\n+\tDEBUGFUNC(\"txgbe_init_thermal_sensor_thresh\");\n+\n+\tmemset(data, 0, sizeof(struct txgbe_thermal_sensor_data));\n+\n+\tif (hw->bus.lan_id != 0)\n+\t\treturn TXGBE_NOT_IMPLEMENTED;\n+\n+\twr32(hw, TXGBE_TSCTRL, TXGBE_TSCTRL_EVALMD);\n+\twr32(hw, TXGBE_TSINTR,\n+\t\tTXGBE_TSINTR_AEN | TXGBE_TSINTR_DEN);\n+\twr32(hw, TXGBE_TSEN, TXGBE_TSEN_ENA);\n+\n+\n+\tdata->sensor[0].alarm_thresh = 100;\n+\twr32(hw, TXGBE_TSATHRE, 677);\n+\tdata->sensor[0].dalarm_thresh = 90;\n+\twr32(hw, TXGBE_TSDTHRE, 614);\n+\n+\treturn 0;\n+}\n+\n void txgbe_disable_rx(struct txgbe_hw *hw)\n {\n \tu32 pfdtxgswc;\n@@ -1420,6 +1486,10 @@ s32 txgbe_init_ops_pf(struct txgbe_hw *hw)\n \tmac->get_link_capabilities = txgbe_get_link_capabilities_raptor;\n \tmac->check_link = txgbe_check_mac_link;\n \n+\t/* Manageability interface */\n+\tmac->get_thermal_sensor_data = txgbe_get_thermal_sensor_data;\n+\tmac->init_thermal_sensor_thresh = txgbe_init_thermal_sensor_thresh;\n+\n \t/* EEPROM */\n \trom->init_params = txgbe_init_eeprom_params;\n \trom->read16 = txgbe_ee_read16;\ndiff --git a/drivers/net/txgbe/base/txgbe_hw.h b/drivers/net/txgbe/base/txgbe_hw.h\nindex d6fbb0ca4..c75234e85 100644\n--- a/drivers/net/txgbe/base/txgbe_hw.h\n+++ b/drivers/net/txgbe/base/txgbe_hw.h\n@@ -42,6 +42,9 @@ void txgbe_clear_tx_pending(struct txgbe_hw *hw);\n \n extern s32 txgbe_reset_pipeline_raptor(struct txgbe_hw *hw);\n \n+s32 txgbe_get_thermal_sensor_data(struct txgbe_hw *hw);\n+s32 txgbe_init_thermal_sensor_thresh(struct txgbe_hw *hw);\n+\n void txgbe_disable_rx(struct txgbe_hw *hw);\n void txgbe_enable_rx(struct txgbe_hw *hw);\n s32 txgbe_setup_mac_link_multispeed_fiber(struct txgbe_hw *hw,\ndiff --git a/drivers/net/txgbe/base/txgbe_type.h b/drivers/net/txgbe/base/txgbe_type.h\nindex ef5924cf9..559b1206f 100644\n--- a/drivers/net/txgbe/base/txgbe_type.h\n+++ b/drivers/net/txgbe/base/txgbe_type.h\n@@ -18,6 +18,16 @@\n #include \"txgbe_osdep.h\"\n #include \"txgbe_devids.h\"\n \n+struct txgbe_thermal_diode_data {\n+\ts16 temp;\n+\ts16 alarm_thresh;\n+\ts16 dalarm_thresh;\n+};\n+\n+struct txgbe_thermal_sensor_data {\n+\tstruct txgbe_thermal_diode_data sensor[1];\n+};\n+\n /* Physical layer type */\n #define TXGBE_PHYSICAL_LAYER_UNKNOWN\t\t0\n #define TXGBE_PHYSICAL_LAYER_10GBASE_T\t\t0x00001\n@@ -373,6 +383,7 @@ struct txgbe_mac_info {\n \tbool orig_link_settings_stored;\n \tbool autotry_restart;\n \tu8 flags;\n+\tstruct txgbe_thermal_sensor_data  thermal_sensor_data;\n \tbool set_lben;\n \tu32  max_link_up_time;\n };\ndiff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c\nindex d7fc110ac..11948389a 100644\n--- a/drivers/net/txgbe/txgbe_ethdev.c\n+++ b/drivers/net/txgbe/txgbe_ethdev.c\n@@ -757,6 +757,70 @@ txgbe_dev_start(struct rte_eth_dev *dev)\n \treturn -EIO;\n }\n \n+/*\n+ * Stop device: disable rx and tx functions to allow for reconfiguring.\n+ */\n+static void\n+txgbe_dev_stop(struct rte_eth_dev *dev)\n+{\n+\tstruct rte_eth_link link;\n+\tstruct txgbe_hw *hw = TXGBE_DEV_HW(dev);\n+\tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);\n+\tstruct rte_intr_handle *intr_handle = &pci_dev->intr_handle;\n+\n+\tif (hw->adapter_stopped)\n+\t\treturn;\n+\n+\tPMD_INIT_FUNC_TRACE();\n+\n+\trte_eal_alarm_cancel(txgbe_dev_setup_link_alarm_handler, dev);\n+\n+\t/* disable interrupts */\n+\ttxgbe_disable_intr(hw);\n+\n+\t/* reset the NIC */\n+\ttxgbe_pf_reset_hw(hw);\n+\thw->adapter_stopped = 0;\n+\n+\t/* stop adapter */\n+\ttxgbe_stop_hw(hw);\n+\n+\tif (hw->phy.media_type == txgbe_media_type_copper) {\n+\t\t/* Turn off the copper */\n+\t\thw->phy.set_phy_power(hw, false);\n+\t} else {\n+\t\t/* Turn off the laser */\n+\t\thw->mac.disable_tx_laser(hw);\n+\t}\n+\n+\ttxgbe_dev_clear_queues(dev);\n+\n+\t/* Clear stored conf */\n+\tdev->data->scattered_rx = 0;\n+\tdev->data->lro = 0;\n+\n+\t/* Clear recorded link status */\n+\tmemset(&link, 0, sizeof(link));\n+\trte_eth_linkstatus_set(dev, &link);\n+\n+\tif (!rte_intr_allow_others(intr_handle))\n+\t\t/* resume to the default handler */\n+\t\trte_intr_callback_register(intr_handle,\n+\t\t\t\t\t   txgbe_dev_interrupt_handler,\n+\t\t\t\t\t   (void *)dev);\n+\n+\t/* Clean datapath event and queue/vec mapping */\n+\trte_intr_efd_disable(intr_handle);\n+\tif (intr_handle->intr_vec != NULL) {\n+\t\trte_free(intr_handle->intr_vec);\n+\t\tintr_handle->intr_vec = NULL;\n+\t}\n+\n+\twr32m(hw, TXGBE_LEDCTL, 0xFFFFFFFF, TXGBE_LEDCTL_SEL_MASK);\n+\n+\thw->adapter_stopped = true;\n+}\n+\n /*\n  * Set device link up: enable tx.\n  */\n@@ -803,6 +867,7 @@ txgbe_dev_set_link_down(struct rte_eth_dev *dev)\n static void\n txgbe_dev_close(struct rte_eth_dev *dev)\n {\n+\tstruct txgbe_hw *hw = TXGBE_DEV_HW(dev);\n \tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);\n \tstruct rte_intr_handle *intr_handle = &pci_dev->intr_handle;\n \tint retries = 0;\n@@ -810,9 +875,18 @@ txgbe_dev_close(struct rte_eth_dev *dev)\n \n \tPMD_INIT_FUNC_TRACE();\n \n+\ttxgbe_pf_reset_hw(hw);\n+\n+\ttxgbe_dev_stop(dev);\n+\n \ttxgbe_dev_free_queues(dev);\n \n+\t/* reprogram the RAR[0] in case user changed it. */\n+\ttxgbe_set_rar(hw, 0, hw->mac.addr, 0, true);\n+\n \tdev->dev_ops = NULL;\n+\tdev->rx_pkt_burst = NULL;\n+\tdev->tx_pkt_burst = NULL;\n \n \t/* disable uio intr before callback unregister */\n \trte_intr_disable(intr_handle);\n@@ -840,6 +914,32 @@ txgbe_dev_close(struct rte_eth_dev *dev)\n \tdev->data->hash_mac_addrs = NULL;\n }\n \n+/*\n+ * Reset PF device.\n+ */\n+static int\n+txgbe_dev_reset(struct rte_eth_dev *dev)\n+{\n+\tint ret;\n+\n+\t/* When a DPDK PMD PF begin to reset PF port, it should notify all\n+\t * its VF to make them align with it. The detailed notification\n+\t * mechanism is PMD specific. As to txgbe PF, it is rather complex.\n+\t * To avoid unexpected behavior in VF, currently reset of PF with\n+\t * SR-IOV activation is not supported. It might be supported later.\n+\t */\n+\tif (dev->data->sriov.active)\n+\t\treturn -ENOTSUP;\n+\n+\tret = eth_txgbe_dev_uninit(dev);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = eth_txgbe_dev_init(dev, NULL);\n+\n+\treturn ret;\n+}\n+\n static int\n txgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)\n {\n@@ -1576,8 +1676,12 @@ static const struct eth_dev_ops txgbe_eth_dev_ops = {\n \t.dev_configure              = txgbe_dev_configure,\n \t.dev_infos_get              = txgbe_dev_info_get,\n \t.dev_start                  = txgbe_dev_start,\n+\t.dev_stop                   = txgbe_dev_stop,\n \t.dev_set_link_up            = txgbe_dev_set_link_up,\n \t.dev_set_link_down          = txgbe_dev_set_link_down,\n+\t.dev_close                  = txgbe_dev_close,\n+\t.dev_reset                  = txgbe_dev_reset,\n+\t.link_update                = txgbe_dev_link_update,\n \t.dev_supported_ptypes_get   = txgbe_dev_supported_ptypes_get,\n \t.rx_queue_start\t            = txgbe_dev_rx_queue_start,\n \t.rx_queue_stop              = txgbe_dev_rx_queue_stop,\n",
    "prefixes": [
        "v2",
        "30/56"
    ]
}