get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 94710,
    "url": "https://patches.dpdk.org/api/patches/94710/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210623044702.4240-15-ndabilpuram@marvell.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": "<20210623044702.4240-15-ndabilpuram@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210623044702.4240-15-ndabilpuram@marvell.com",
    "date": "2021-06-23T04:46:14",
    "name": "[v4,14/62] net/cnxk: support link status update",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "b94bdcb2b64d708855fb8368c316733cf41cb295",
    "submitter": {
        "id": 1202,
        "url": "https://patches.dpdk.org/api/people/1202/?format=api",
        "name": "Nithin Dabilpuram",
        "email": "ndabilpuram@marvell.com"
    },
    "delegate": {
        "id": 310,
        "url": "https://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210623044702.4240-15-ndabilpuram@marvell.com/mbox/",
    "series": [
        {
            "id": 17449,
            "url": "https://patches.dpdk.org/api/series/17449/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=17449",
            "date": "2021-06-23T04:46:00",
            "name": "Marvell CNXK Ethdev Driver",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/17449/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/94710/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/94710/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 0E04EA0C41;\n\tWed, 23 Jun 2021 06:49:02 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 40EC9410F4;\n\tWed, 23 Jun 2021 06:48:08 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173])\n by mails.dpdk.org (Postfix) with ESMTP id 05188410E5\n for <dev@dpdk.org>; Wed, 23 Jun 2021 06:48:06 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id\n 15N4k6fO025518 for <dev@dpdk.org>; Tue, 22 Jun 2021 21:48:06 -0700",
            "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0b-0016f401.pphosted.com with ESMTP id 39bptj1gk0-3\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Tue, 22 Jun 2021 21:48:06 -0700",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Tue, 22 Jun 2021 21:48:03 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend\n Transport; Tue, 22 Jun 2021 21:48:03 -0700",
            "from hyd1588t430.marvell.com (unknown [10.29.52.204])\n by maili.marvell.com (Postfix) with ESMTP id 2BC405B6938;\n Tue, 22 Jun 2021 21:47:59 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-type; s=pfpt0220; bh=FP1Rb6nFzmktn6y22itWz/1h9Tw4mhAHBcD99tBGQTg=;\n b=V3dXogACCz01uU7oV8Znoos9BYZQO8/hfvktzMXMSrVJAj2j0lch+qDavoVUCR9EuLxW\n AWtr6IgfvY567ZvecNqM+NF7/j6l8pPcH/+lfOA7BhDBogulvFKbx6H9Z17yli8Ixb/s\n +7Dm+JzwIAi1/ZypSa7o1eDHGtkNb9BDwwZ8e6UXt81c+iaetlpTayaaDztPyl64MiPW\n W/Yq7TBxY3B6MKBHUyWLJ8CJNYhnUy7bW2HHekvkEzeApn7urd4kyzPqlY+Au9EvmoDL\n IwAWlVl9pblep2Fpm9OoFV5mpXHk+YS7+dBv+Os6h87v3P+sLpnXS67TCZYKbISit35S ng==",
        "From": "Nithin Dabilpuram <ndabilpuram@marvell.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<jerinj@marvell.com>, <skori@marvell.com>, <skoteshwar@marvell.com>,\n <pbhagavatula@marvell.com>, <kirankumark@marvell.com>,\n <psatheesh@marvell.com>, <asekhar@marvell.com>, <hkalra@marvell.com>,\n \"Nithin Dabilpuram\" <ndabilpuram@marvell.com>",
        "Date": "Wed, 23 Jun 2021 10:16:14 +0530",
        "Message-ID": "<20210623044702.4240-15-ndabilpuram@marvell.com>",
        "X-Mailer": "git-send-email 2.8.4",
        "In-Reply-To": "<20210623044702.4240-1-ndabilpuram@marvell.com>",
        "References": "<20210306153404.10781-1-ndabilpuram@marvell.com>\n <20210623044702.4240-1-ndabilpuram@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "nt2bkxlmcSURwa4I2AT5bilGB2Hr-UzH",
        "X-Proofpoint-GUID": "nt2bkxlmcSURwa4I2AT5bilGB2Hr-UzH",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790\n definitions=2021-06-23_01:2021-06-22,\n 2021-06-23 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v4 14/62] net/cnxk: support link status update",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add link status update callback to get current\nlink status.\n\nSigned-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>\n---\n doc/guides/nics/cnxk.rst              |   1 +\n doc/guides/nics/features/cnxk.ini     |   2 +\n doc/guides/nics/features/cnxk_vec.ini |   2 +\n doc/guides/nics/features/cnxk_vf.ini  |   2 +\n drivers/net/cnxk/cnxk_ethdev.c        |   7 +++\n drivers/net/cnxk/cnxk_ethdev.h        |   8 +++\n drivers/net/cnxk/cnxk_link.c          | 102 ++++++++++++++++++++++++++++++++++\n drivers/net/cnxk/meson.build          |   3 +-\n 8 files changed, 126 insertions(+), 1 deletion(-)\n create mode 100644 drivers/net/cnxk/cnxk_link.c",
    "diff": "diff --git a/doc/guides/nics/cnxk.rst b/doc/guides/nics/cnxk.rst\nindex 0c2ea89..7bf6cf5 100644\n--- a/doc/guides/nics/cnxk.rst\n+++ b/doc/guides/nics/cnxk.rst\n@@ -20,6 +20,7 @@ Features of the CNXK Ethdev PMD are:\n - Lock-free Tx queue\n - Multiple queues for TX and RX\n - Receiver Side Scaling (RSS)\n+- Link state information\n \n Prerequisites\n -------------\ndiff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini\nindex 96dba2a..affbbd9 100644\n--- a/doc/guides/nics/features/cnxk.ini\n+++ b/doc/guides/nics/features/cnxk.ini\n@@ -8,6 +8,8 @@ Speed capabilities   = Y\n Lock-free Tx queue   = Y\n SR-IOV               = Y\n Multiprocess aware   = Y\n+Link status          = Y\n+Link status event    = Y\n RSS hash             = Y\n Inner RSS            = Y\n Linux                = Y\ndiff --git a/doc/guides/nics/features/cnxk_vec.ini b/doc/guides/nics/features/cnxk_vec.ini\nindex 616991c..836cc9f 100644\n--- a/doc/guides/nics/features/cnxk_vec.ini\n+++ b/doc/guides/nics/features/cnxk_vec.ini\n@@ -8,6 +8,8 @@ Speed capabilities   = Y\n Lock-free Tx queue   = Y\n SR-IOV               = Y\n Multiprocess aware   = Y\n+Link status          = Y\n+Link status event    = Y\n RSS hash             = Y\n Inner RSS            = Y\n Linux                = Y\ndiff --git a/doc/guides/nics/features/cnxk_vf.ini b/doc/guides/nics/features/cnxk_vf.ini\nindex a0bd2f1..29bb24f 100644\n--- a/doc/guides/nics/features/cnxk_vf.ini\n+++ b/doc/guides/nics/features/cnxk_vf.ini\n@@ -7,6 +7,8 @@\n Speed capabilities   = Y\n Lock-free Tx queue   = Y\n Multiprocess aware   = Y\n+Link status          = Y\n+Link status event    = Y\n RSS hash             = Y\n Inner RSS            = Y\n Linux                = Y\ndiff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c\nindex 251d6eb..ea49809 100644\n--- a/drivers/net/cnxk/cnxk_ethdev.c\n+++ b/drivers/net/cnxk/cnxk_ethdev.c\n@@ -601,6 +601,7 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)\n /* CNXK platform independent eth dev ops */\n struct eth_dev_ops cnxk_eth_dev_ops = {\n \t.dev_infos_get = cnxk_nix_info_get,\n+\t.link_update = cnxk_nix_link_update,\n };\n \n static int\n@@ -635,6 +636,9 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)\n \t\tgoto error;\n \t}\n \n+\t/* Register up msg callbacks */\n+\troc_nix_mac_link_cb_register(nix, cnxk_eth_dev_link_status_cb);\n+\n \tdev->eth_dev = eth_dev;\n \tdev->configured = 0;\n \n@@ -723,6 +727,9 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)\n \n \troc_nix_npc_rx_ena_dis(nix, false);\n \n+\t/* Disable link status events */\n+\troc_nix_mac_link_event_start_stop(nix, false);\n+\n \t/* Free up SQs */\n \tfor (i = 0; i < eth_dev->data->nb_tx_queues; i++) {\n \t\tdev_ops->tx_queue_release(eth_dev->data->tx_queues[i]);\ndiff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h\nindex 291f5f9..daa87af 100644\n--- a/drivers/net/cnxk/cnxk_ethdev.h\n+++ b/drivers/net/cnxk/cnxk_ethdev.h\n@@ -15,6 +15,9 @@\n \n #define CNXK_ETH_DEV_PMD_VERSION \"1.0\"\n \n+/* Used for struct cnxk_eth_dev::flags */\n+#define CNXK_LINK_CFG_IN_PROGRESS_F BIT_ULL(0)\n+\n /* VLAN tag inserted by NIX_TX_VTAG_ACTION.\n  * In Tx space is always reserved for this in FRS.\n  */\n@@ -196,6 +199,11 @@ int cnxk_nix_configure(struct rte_eth_dev *eth_dev);\n uint32_t cnxk_rss_ethdev_to_nix(struct cnxk_eth_dev *dev, uint64_t ethdev_rss,\n \t\t\t\tuint8_t rss_level);\n \n+/* Link */\n+void cnxk_eth_dev_link_status_cb(struct roc_nix *nix,\n+\t\t\t\t struct roc_nix_link_info *link);\n+int cnxk_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);\n+\n /* Devargs */\n int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,\n \t\t\t      struct cnxk_eth_dev *dev);\ndiff --git a/drivers/net/cnxk/cnxk_link.c b/drivers/net/cnxk/cnxk_link.c\nnew file mode 100644\nindex 0000000..b0273e7\n--- /dev/null\n+++ b/drivers/net/cnxk/cnxk_link.c\n@@ -0,0 +1,102 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2021 Marvell.\n+ */\n+\n+#include \"cnxk_ethdev.h\"\n+\n+static inline int\n+nix_wait_for_link_cfg(struct cnxk_eth_dev *dev)\n+{\n+\tuint16_t wait = 1000;\n+\n+\tdo {\n+\t\trte_atomic_thread_fence(__ATOMIC_ACQUIRE);\n+\t\tif (!(dev->flags & CNXK_LINK_CFG_IN_PROGRESS_F))\n+\t\t\tbreak;\n+\t\twait--;\n+\t\trte_delay_ms(1);\n+\t} while (wait);\n+\n+\treturn wait ? 0 : -1;\n+}\n+\n+static void\n+nix_link_status_print(struct rte_eth_dev *eth_dev, struct rte_eth_link *link)\n+{\n+\tif (link && link->link_status)\n+\t\tplt_info(\"Port %d: Link Up - speed %u Mbps - %s\",\n+\t\t\t (int)(eth_dev->data->port_id),\n+\t\t\t (uint32_t)link->link_speed,\n+\t\t\t link->link_duplex == ETH_LINK_FULL_DUPLEX\n+\t\t\t\t ? \"full-duplex\"\n+\t\t\t\t : \"half-duplex\");\n+\telse\n+\t\tplt_info(\"Port %d: Link Down\", (int)(eth_dev->data->port_id));\n+}\n+\n+void\n+cnxk_eth_dev_link_status_cb(struct roc_nix *nix, struct roc_nix_link_info *link)\n+{\n+\tstruct cnxk_eth_dev *dev = (struct cnxk_eth_dev *)nix;\n+\tstruct rte_eth_link eth_link;\n+\tstruct rte_eth_dev *eth_dev;\n+\n+\tif (!link || !nix)\n+\t\treturn;\n+\n+\teth_dev = dev->eth_dev;\n+\tif (!eth_dev || !eth_dev->data->dev_conf.intr_conf.lsc)\n+\t\treturn;\n+\n+\tif (nix_wait_for_link_cfg(dev)) {\n+\t\tplt_err(\"Timeout waiting for link_cfg to complete\");\n+\t\treturn;\n+\t}\n+\n+\teth_link.link_status = link->status;\n+\teth_link.link_speed = link->speed;\n+\teth_link.link_autoneg = ETH_LINK_AUTONEG;\n+\teth_link.link_duplex = link->full_duplex;\n+\n+\t/* Print link info */\n+\tnix_link_status_print(eth_dev, &eth_link);\n+\n+\t/* Update link info */\n+\trte_eth_linkstatus_set(eth_dev, &eth_link);\n+\n+\t/* Set the flag and execute application callbacks */\n+\trte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);\n+}\n+\n+int\n+cnxk_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)\n+{\n+\tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n+\tstruct roc_nix_link_info info;\n+\tstruct rte_eth_link link;\n+\tint rc;\n+\n+\tRTE_SET_USED(wait_to_complete);\n+\tmemset(&link, 0, sizeof(struct rte_eth_link));\n+\n+\tif (roc_nix_is_sdp(&dev->nix))\n+\t\treturn 0;\n+\n+\tif (roc_nix_is_lbk(&dev->nix)) {\n+\t\tlink.link_status = ETH_LINK_UP;\n+\t\tlink.link_speed = ETH_SPEED_NUM_100G;\n+\t\tlink.link_autoneg = ETH_LINK_FIXED;\n+\t\tlink.link_duplex = ETH_LINK_FULL_DUPLEX;\n+\t} else {\n+\t\trc = roc_nix_mac_link_info_get(&dev->nix, &info);\n+\t\tif (rc)\n+\t\t\treturn rc;\n+\t\tlink.link_status = info.status;\n+\t\tlink.link_speed = info.speed;\n+\t\tlink.link_autoneg = ETH_LINK_AUTONEG;\n+\t\tif (info.full_duplex)\n+\t\t\tlink.link_duplex = info.full_duplex;\n+\t}\n+\n+\treturn rte_eth_linkstatus_set(eth_dev, &link);\n+}\ndiff --git a/drivers/net/cnxk/meson.build b/drivers/net/cnxk/meson.build\nindex 8495732..1ac3d08 100644\n--- a/drivers/net/cnxk/meson.build\n+++ b/drivers/net/cnxk/meson.build\n@@ -10,7 +10,8 @@ endif\n \n sources = files('cnxk_ethdev.c',\n \t\t'cnxk_ethdev_ops.c',\n-\t\t'cnxk_ethdev_devargs.c')\n+\t\t'cnxk_ethdev_devargs.c',\n+\t\t'cnxk_link.c')\n \n # CN9K\n sources += files('cn9k_ethdev.c')\n",
    "prefixes": [
        "v4",
        "14/62"
    ]
}