get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 130797,
    "url": "https://patches.dpdk.org/api/patches/130797/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230829075829.208413-14-wanry@3snic.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": "<20230829075829.208413-14-wanry@3snic.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230829075829.208413-14-wanry@3snic.com",
    "date": "2023-08-29T07:58:10",
    "name": "[13/32] net/sssnic: support link status event",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "533be569d19453662ed6c0d8f5fbc9cb462568b8",
    "submitter": {
        "id": 3119,
        "url": "https://patches.dpdk.org/api/people/3119/?format=api",
        "name": "Renyong Wan",
        "email": "wanry@3snic.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20230829075829.208413-14-wanry@3snic.com/mbox/",
    "series": [
        {
            "id": 29358,
            "url": "https://patches.dpdk.org/api/series/29358/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=29358",
            "date": "2023-08-29T07:57:57",
            "name": "Introduce sssnic PMD for 3SNIC's 9x0 serials Ethernet adapters",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/29358/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/130797/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/130797/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 4A88F41F53;\n\tTue, 29 Aug 2023 10:00:32 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 38627402BE;\n\tTue, 29 Aug 2023 09:59:51 +0200 (CEST)",
            "from VLXDG1SPAM1.ramaxel.com (email.unionmem.com [221.4.138.186])\n by mails.dpdk.org (Postfix) with ESMTP id 1B94E402B4\n for <dev@dpdk.org>; Tue, 29 Aug 2023 09:59:48 +0200 (CEST)",
            "from V12DG1MBS03.ramaxel.local ([172.26.18.33])\n by VLXDG1SPAM1.ramaxel.com with ESMTP id 37T7wbm8080463;\n Tue, 29 Aug 2023 15:59:09 +0800 (GMT-8)\n (envelope-from wanry@3snic.com)",
            "from localhost.localdomain (10.64.136.151) by\n V12DG1MBS03.ramaxel.local (172.26.18.33) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id\n 15.1.2375.17; Tue, 29 Aug 2023 15:58:42 +0800"
        ],
        "From": "<wanry@3snic.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<ferruh.yigit@amd.com>, Renyong Wan <wanry@3snic.com>, Steven Song\n <steven.song@3snic.com>",
        "Subject": "[PATCH 13/32] net/sssnic: support link status event",
        "Date": "Tue, 29 Aug 2023 15:58:10 +0800",
        "Message-ID": "<20230829075829.208413-14-wanry@3snic.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230829075829.208413-1-wanry@3snic.com>",
        "References": "<20230829075829.208413-1-wanry@3snic.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "7bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.64.136.151]",
        "X-ClientProxiedBy": "V12DG1MBS03.ramaxel.local (172.26.18.33) To\n V12DG1MBS03.ramaxel.local (172.26.18.33)",
        "X-DNSRBL": "",
        "X-SPAM-SOURCE-CHECK": "pass",
        "X-MAIL": "VLXDG1SPAM1.ramaxel.com 37T7wbm8080463",
        "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": "From: Renyong Wan <wanry@3snic.com>\n\nSigned-off-by: Steven Song <steven.song@3snic.com>\nSigned-off-by: Renyong Wan <wanry@3snic.com>\n---\n doc/guides/nics/features/sssnic.ini        |   1 +\n drivers/net/sssnic/base/meson.build        |   1 +\n drivers/net/sssnic/base/sssnic_exception.c | 115 +++++++++++++++++++++\n drivers/net/sssnic/base/sssnic_exception.h |  10 ++\n drivers/net/sssnic/base/sssnic_hw.c        |  46 +++++++++\n drivers/net/sssnic/base/sssnic_hw.h        |  22 ++++\n drivers/net/sssnic/sssnic_ethdev.c         |   6 +-\n drivers/net/sssnic/sssnic_ethdev_link.c    |  98 ++++++++++++++++++\n drivers/net/sssnic/sssnic_ethdev_link.h    |   2 +\n 9 files changed, 300 insertions(+), 1 deletion(-)\n create mode 100644 drivers/net/sssnic/base/sssnic_exception.c\n create mode 100644 drivers/net/sssnic/base/sssnic_exception.h",
    "diff": "diff --git a/doc/guides/nics/features/sssnic.ini b/doc/guides/nics/features/sssnic.ini\nindex a0688e70ef..82b527ba26 100644\n--- a/doc/guides/nics/features/sssnic.ini\n+++ b/doc/guides/nics/features/sssnic.ini\n@@ -5,6 +5,7 @@\n ;\n [Features]\n Link status          = Y\n+Link status event    = Y\n Unicast MAC filter   = Y\n Multicast MAC filter = Y\n Linux                = Y\ndiff --git a/drivers/net/sssnic/base/meson.build b/drivers/net/sssnic/base/meson.build\nindex e93ca7b24b..cf0c177cab 100644\n--- a/drivers/net/sssnic/base/meson.build\n+++ b/drivers/net/sssnic/base/meson.build\n@@ -9,6 +9,7 @@ sources = [\n         'sssnic_workq.c',\n         'sssnic_ctrlq.c',\n         'sssnic_api.c',\n+\t'sssnic_exception.c',\n ]\n \n c_args = cflags\ndiff --git a/drivers/net/sssnic/base/sssnic_exception.c b/drivers/net/sssnic/base/sssnic_exception.c\nnew file mode 100644\nindex 0000000000..f883814176\n--- /dev/null\n+++ b/drivers/net/sssnic/base/sssnic_exception.c\n@@ -0,0 +1,115 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd.\n+ */\n+\n+#include <rte_byteorder.h>\n+#include <rte_common.h>\n+\n+#include \"../sssnic_log.h\"\n+#include \"sssnic_hw.h\"\n+#include \"sssnic_reg.h\"\n+#include \"sssnic_cmd.h\"\n+#include \"sssnic_msg.h\"\n+#include \"sssnic_eventq.h\"\n+#include \"sssnic_mbox.h\"\n+#include \"sssnic_exception.h\"\n+\n+static void\n+sssnic_link_event_msg_handle(struct sssnic_hw *hw, struct sssnic_msg *msg,\n+\t__rte_unused enum sssnic_msg_chann_id chan_id)\n+{\n+\tstruct sssnic_netif_link_status_get_cmd *cmd;\n+\tsssnic_link_event_cb_t *cb;\n+\tenum sssnic_link_status status;\n+\tvoid *priv;\n+\n+\tcb = hw->link_event_handler.cb;\n+\tpriv = hw->link_event_handler.priv;\n+\n+\tcmd = (struct sssnic_netif_link_status_get_cmd *)msg->data_buf;\n+\tif (cb != NULL) {\n+\t\tif (cmd->status)\n+\t\t\tstatus = SSSNIC_LINK_STATUS_UP;\n+\t\telse\n+\t\t\tstatus = SSSNIC_LINK_STATUS_DOWN;\n+\n+\t\tPMD_DRV_LOG(DEBUG, \"Received sssnic%u link %s event\",\n+\t\t\tSSSNIC_ETH_PORT_ID(hw), status ? \"up\" : \"down\");\n+\n+\t\treturn cb(cmd->port, status, priv);\n+\t}\n+\n+\tPMD_DRV_LOG(WARNING, \"Link event was not processed, port=%u, status=%u\",\n+\t\tcmd->port, cmd->status);\n+}\n+\n+static void\n+sssnic_netif_vf_link_status_msg_handle(struct sssnic_hw *hw,\n+\tstruct sssnic_msg *msg)\n+{\n+\tint ret;\n+\n+\tif (msg->ack != 0) {\n+\t\tmsg->ack = 0;\n+\t\tmsg->type = SSSNIC_MSG_TYPE_RESP;\n+\t\tmsg->data_len = 1; /* indicate no data */\n+\t\tret = sssnic_mbox_send(hw, msg, NULL, 0, 0);\n+\t\tif (ret != 0)\n+\t\t\tPMD_DRV_LOG(ERR,\n+\t\t\t\t\"Failed to send VF link status response, ret=%d\",\n+\t\t\t\tret);\n+\t}\n+}\n+\n+static void\n+sssnic_netif_exception_msg_handle(struct sssnic_hw *hw, struct sssnic_msg *msg,\n+\tenum sssnic_msg_chann_id chan_id)\n+{\n+\tif (msg->command == SSSNIC_GET_NETIF_LINK_STATUS_CMD) {\n+\t\tif (SSSNIC_FUNC_TYPE(hw) == SSSNIC_FUNC_TYPE_VF)\n+\t\t\tsssnic_netif_vf_link_status_msg_handle(hw, msg);\n+\n+\t\tsssnic_link_event_msg_handle(hw, msg, chan_id);\n+\t\treturn;\n+\t}\n+\n+\tPMD_DRV_LOG(WARNING,\n+\t\t\"Netif exception message was not processed, cmd=%u\",\n+\t\tmsg->command);\n+}\n+\n+static int\n+sssnic_exception_msg_process(struct sssnic_msg *msg,\n+\tenum sssnic_msg_chann_id chan_id, void *priv)\n+{\n+\tstruct sssnic_hw *hw = (struct sssnic_hw *)priv;\n+\n+\tSSSNIC_DEBUG(\"command=%u, func=%u module=%u, type=%u, ack=%u, seq=%u, \"\n+\t\t     \"status=%u, id=%u data_buf=%p, data_len=%u\",\n+\t\tmsg->command, msg->func, msg->module, msg->type, msg->ack,\n+\t\tmsg->seg, msg->status, msg->id, msg->data_buf, msg->data_len);\n+\n+\tif (msg->module == SSSNIC_NETIF_MODULE) {\n+\t\tsssnic_netif_exception_msg_handle(hw, msg, chan_id);\n+\t\treturn SSSNIC_MSG_DONE;\n+\t}\n+\n+\tPMD_DRV_LOG(WARNING, \"Exception message was not processed, moule=%u\",\n+\t\tmsg->module);\n+\n+\treturn SSSNIC_MSG_DONE;\n+}\n+\n+int\n+sssnic_exception_process_init(struct sssnic_hw *hw)\n+{\n+\tif (hw == NULL)\n+\t\treturn -EINVAL;\n+\n+\tsssnic_msg_rx_handler_register(hw, SSSNIC_MSG_CHAN_MPU,\n+\t\tSSSNIC_MSG_TYPE_REQ, sssnic_exception_msg_process, hw);\n+\tsssnic_msg_rx_handler_register(hw, SSSNIC_MSG_CHAN_MBOX,\n+\t\tSSSNIC_MSG_TYPE_REQ, sssnic_exception_msg_process, hw);\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/net/sssnic/base/sssnic_exception.h b/drivers/net/sssnic/base/sssnic_exception.h\nnew file mode 100644\nindex 0000000000..46f2f7465b\n--- /dev/null\n+++ b/drivers/net/sssnic/base/sssnic_exception.h\n@@ -0,0 +1,10 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd.\n+ */\n+\n+#ifndef _SSSNIC_EXCEPTION_H_\n+#define _SSSNIC_EXCEPTION_H_\n+\n+int sssnic_exception_process_init(struct sssnic_hw *hw);\n+\n+#endif /* _SSSNIC_EXCEPTION_H_ */\ndiff --git a/drivers/net/sssnic/base/sssnic_hw.c b/drivers/net/sssnic/base/sssnic_hw.c\nindex 8f5f556bde..82eb4ea295 100644\n--- a/drivers/net/sssnic/base/sssnic_hw.c\n+++ b/drivers/net/sssnic/base/sssnic_hw.c\n@@ -15,6 +15,7 @@\n #include \"sssnic_msg.h\"\n #include \"sssnic_mbox.h\"\n #include \"sssnic_ctrlq.h\"\n+#include \"sssnic_exception.h\"\n \n static int\n wait_for_sssnic_hw_ready(struct sssnic_hw *hw)\n@@ -133,6 +134,17 @@ sssnic_msix_all_disable(struct sssnic_hw *hw)\n \t\tsssnic_msix_state_set(hw, i, SSSNIC_MSIX_DISABLE);\n }\n \n+void\n+sssnic_msix_resend_disable(struct sssnic_hw *hw, uint16_t msix_id)\n+{\n+\tstruct sssnic_msix_ctrl_reg reg;\n+\n+\treg.u32 = 0;\n+\treg.resend_timer_clr = SSSNIC_MSIX_DISABLE;\n+\treg.msxi_idx = msix_id;\n+\tsssnic_cfg_reg_write(hw, SSSNIC_MSIX_CTRL_REG, reg.u32);\n+}\n+\n static void\n sssnic_pf_status_set(struct sssnic_hw *hw, enum sssnic_pf_status status)\n {\n@@ -276,6 +288,38 @@ sssnic_capability_init(struct sssnic_hw *hw)\n \treturn 0;\n }\n \n+int\n+sssnic_link_event_callback_register(struct sssnic_hw *hw,\n+\tsssnic_link_event_cb_t *cb, void *priv)\n+{\n+\tif (hw == NULL || cb == NULL)\n+\t\treturn -EINVAL;\n+\n+\thw->link_event_handler.cb = cb;\n+\thw->link_event_handler.priv = priv;\n+\n+\treturn 0;\n+}\n+\n+void\n+sssnic_link_event_callback_unregister(struct sssnic_hw *hw)\n+{\n+\tif (hw != NULL) {\n+\t\thw->link_event_handler.cb = NULL;\n+\t\thw->link_event_handler.priv = NULL;\n+\t}\n+}\n+\n+void\n+sssnic_link_intr_handle(struct sssnic_hw *hw)\n+{\n+\tPMD_DRV_LOG(DEBUG, \"sssnic%u link interrupt triggered!\",\n+\t\tSSSNIC_ETH_PORT_ID(hw));\n+\n+\tsssnic_msix_resend_disable(hw, SSSNIC_LINK_INTR_MSIX_ID);\n+\tsssnic_eventq_flush(hw, SSSNIC_LINK_INTR_EVENTQ, 0);\n+}\n+\n static int\n sssnic_base_init(struct sssnic_hw *hw)\n {\n@@ -389,6 +433,8 @@ sssnic_hw_init(struct sssnic_hw *hw)\n \t\tgoto capbility_init_fail;\n \t}\n \n+\tsssnic_exception_process_init(hw);\n+\n \tsssnic_pf_status_set(hw, SSSNIC_PF_STATUS_ACTIVE);\n \n \treturn 0;\ndiff --git a/drivers/net/sssnic/base/sssnic_hw.h b/drivers/net/sssnic/base/sssnic_hw.h\nindex f8fe2ac7e1..e25f5595e6 100644\n--- a/drivers/net/sssnic/base/sssnic_hw.h\n+++ b/drivers/net/sssnic/base/sssnic_hw.h\n@@ -44,6 +44,22 @@ struct sssnic_hw_attr {\n \tuint16_t num_irq;\n };\n \n+enum sssnic_link_status {\n+\tSSSNIC_LINK_STATUS_DOWN,\n+\tSSSNIC_LINK_STATUS_UP,\n+};\n+\n+#define SSSNIC_LINK_INTR_MSIX_ID 0\n+#define SSSNIC_LINK_INTR_EVENTQ 0\n+\n+typedef void sssnic_link_event_cb_t(uint8_t port,\n+\tenum sssnic_link_status status, void *priv);\n+\n+struct sssnic_link_event_handler {\n+\tsssnic_link_event_cb_t *cb;\n+\tvoid *priv;\n+};\n+\n struct sssnic_hw {\n \tstruct rte_pci_device *pci_dev;\n \tuint8_t *cfg_base_addr;\n@@ -55,6 +71,7 @@ struct sssnic_hw {\n \tstruct sssnic_msg_inbox *msg_inbox;\n \tstruct sssnic_mbox *mbox;\n \tstruct sssnic_ctrlq *ctrlq;\n+\tstruct sssnic_link_event_handler link_event_handler;\n \tuint8_t num_eventqs;\n \tuint8_t phy_port;\n \tuint16_t eth_port_id;\n@@ -82,5 +99,10 @@ enum sssnic_module {\n int sssnic_hw_init(struct sssnic_hw *hw);\n void sssnic_hw_shutdown(struct sssnic_hw *hw);\n void sssnic_msix_state_set(struct sssnic_hw *hw, uint16_t msix_id, int state);\n+void sssnic_msix_resend_disable(struct sssnic_hw *hw, uint16_t msix_id);\n+int sssnic_link_event_callback_register(struct sssnic_hw *hw,\n+\tsssnic_link_event_cb_t *cb, void *priv);\n+void sssnic_link_event_callback_unregister(struct sssnic_hw *hw);\n+void sssnic_link_intr_handle(struct sssnic_hw *hw);\n \n #endif /* _SSSNIC_HW_H_ */\ndiff --git a/drivers/net/sssnic/sssnic_ethdev.c b/drivers/net/sssnic/sssnic_ethdev.c\nindex 6df6f353aa..1f7e7982e5 100644\n--- a/drivers/net/sssnic/sssnic_ethdev.c\n+++ b/drivers/net/sssnic/sssnic_ethdev.c\n@@ -335,6 +335,7 @@ sssnic_ethdev_release(struct rte_eth_dev *ethdev)\n {\n \tstruct sssnic_hw *hw = SSSNIC_ETHDEV_TO_HW(ethdev);\n \n+\tsssnic_ethdev_link_intr_disable(ethdev);\n \tsssnic_ethdev_mac_addrs_clean(ethdev);\n \tsssnic_hw_shutdown(hw);\n \trte_free(hw);\n@@ -392,6 +393,9 @@ sssnic_ethdev_init(struct rte_eth_dev *ethdev)\n \n \tethdev->dev_ops = &sssnic_ethdev_ops;\n \n+\tsssnic_ethdev_link_update(ethdev, 0);\n+\tsssnic_ethdev_link_intr_enable(ethdev);\n+\n \treturn 0;\n \n mac_addrs_init_fail:\n@@ -441,7 +445,7 @@ static const struct rte_pci_id sssnic_pci_id_map[] = {\n \n static struct rte_pci_driver sssnic_pmd = {\n \t.id_table = sssnic_pci_id_map,\n-\t.drv_flags = RTE_PCI_DRV_NEED_MAPPING,\n+\t.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,\n \t.probe = sssnic_pci_probe,\n \t.remove = sssnic_pci_remove,\n };\ndiff --git a/drivers/net/sssnic/sssnic_ethdev_link.c b/drivers/net/sssnic/sssnic_ethdev_link.c\nindex 48f8db93a7..09372f9ca9 100644\n--- a/drivers/net/sssnic/sssnic_ethdev_link.c\n+++ b/drivers/net/sssnic/sssnic_ethdev_link.c\n@@ -110,3 +110,101 @@ sssnic_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete)\n out:\n \treturn rte_eth_linkstatus_set(ethdev, &link);\n }\n+\n+static void\n+sssnic_ethdev_link_status_print(struct rte_eth_dev *ethdev,\n+\tstruct rte_eth_link *link)\n+{\n+\tif (link->link_status) {\n+\t\tPMD_DRV_LOG(INFO, \"Port %u Link Up - speed %s - %s\",\n+\t\t\tethdev->data->port_id,\n+\t\t\trte_eth_link_speed_to_str(link->link_speed),\n+\t\t\tlink->link_duplex == RTE_ETH_LINK_FULL_DUPLEX ?\n+\t\t\t\t      \"full-duplex\" :\n+\t\t\t\t      \"half-duplex\");\n+\t} else {\n+\t\tPMD_DRV_LOG(INFO, \"Port %u Link Down\", ethdev->data->port_id);\n+\t}\n+}\n+\n+static void\n+sssnic_ethdev_link_event_cb(__rte_unused uint8_t port,\n+\t__rte_unused enum sssnic_link_status status, void *arg)\n+{\n+\tstruct rte_eth_dev *ethdev = (struct rte_eth_dev *)arg;\n+\tstruct rte_eth_link link;\n+\tint ret;\n+\n+\tmemset(&link, 0, sizeof(link));\n+\tsssnic_ethdev_link_get(ethdev, &link);\n+\n+\tret = rte_eth_linkstatus_set(ethdev, &link);\n+\tif (ret == 0) {\n+\t\tsssnic_ethdev_link_status_print(ethdev, &link);\n+\t\trte_eth_dev_callback_process(ethdev, RTE_ETH_EVENT_INTR_LSC,\n+\t\t\tNULL);\n+\t}\n+}\n+\n+static void\n+sssnic_ethdev_link_intr_callback(void *arg)\n+{\n+\tstruct rte_eth_dev *ethdev = (struct rte_eth_dev *)arg;\n+\tstruct sssnic_hw *hw;\n+\n+\thw = SSSNIC_ETHDEV_TO_HW(ethdev);\n+\n+\tsssnic_link_intr_handle(hw);\n+}\n+\n+void\n+sssnic_ethdev_link_intr_enable(struct rte_eth_dev *ethdev)\n+{\n+\tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(ethdev);\n+\tstruct sssnic_hw *hw = SSSNIC_ETHDEV_TO_HW(ethdev);\n+\tint ret;\n+\n+\tsssnic_link_event_callback_register(hw, sssnic_ethdev_link_event_cb,\n+\t\tethdev);\n+\n+\tret = rte_intr_callback_register(pci_dev->intr_handle,\n+\t\tsssnic_ethdev_link_intr_callback, ethdev);\n+\tif (ret != 0) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to register port %u intr callback!\",\n+\t\t\tethdev->data->port_id);\n+\n+\t\tsssnic_link_event_callback_unregister(hw);\n+\n+\t\treturn;\n+\t}\n+\n+\tret = rte_intr_enable(pci_dev->intr_handle);\n+\tif (ret != 0) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to enable port %u interrupt!\",\n+\t\t\tethdev->data->port_id);\n+\n+\t\trte_intr_callback_unregister(pci_dev->intr_handle,\n+\t\t\tsssnic_ethdev_link_intr_callback, ethdev);\n+\t\tsssnic_link_event_callback_unregister(hw);\n+\n+\t\treturn;\n+\t}\n+\n+\tsssnic_msix_state_set(hw, SSSNIC_LINK_INTR_MSIX_ID, SSSNIC_MSIX_ENABLE);\n+}\n+\n+void\n+sssnic_ethdev_link_intr_disable(struct rte_eth_dev *ethdev)\n+{\n+\tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(ethdev);\n+\tstruct sssnic_hw *hw = SSSNIC_ETHDEV_TO_HW(ethdev);\n+\n+\tsssnic_msix_state_set(hw, SSSNIC_LINK_INTR_MSIX_ID,\n+\t\tSSSNIC_MSIX_DISABLE);\n+\n+\trte_intr_disable(pci_dev->intr_handle);\n+\trte_intr_callback_unregister(pci_dev->intr_handle,\n+\t\tsssnic_ethdev_link_intr_callback, ethdev);\n+\n+\tsssnic_link_event_callback_unregister(hw);\n+}\ndiff --git a/drivers/net/sssnic/sssnic_ethdev_link.h b/drivers/net/sssnic/sssnic_ethdev_link.h\nindex 00ad13fe9b..52a86b4771 100644\n--- a/drivers/net/sssnic/sssnic_ethdev_link.h\n+++ b/drivers/net/sssnic/sssnic_ethdev_link.h\n@@ -8,5 +8,7 @@\n int sssnic_ethdev_set_link_up(struct rte_eth_dev *ethdev);\n int sssnic_ethdev_set_link_down(struct rte_eth_dev *ethdev);\n int sssnic_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete);\n+void sssnic_ethdev_link_intr_enable(struct rte_eth_dev *ethdev);\n+void sssnic_ethdev_link_intr_disable(struct rte_eth_dev *ethdev);\n \n #endif /* _SSSNIC_ETHDEV_LINK_H_ */\n",
    "prefixes": [
        "13/32"
    ]
}