get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 105260,
    "url": "http://patches.dpdk.org/api/patches/105260/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/f01949bee8c5294f0ff1db623fbfd1c591f333a5.1639636621.git.songyl@ramaxel.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": "<f01949bee8c5294f0ff1db623fbfd1c591f333a5.1639636621.git.songyl@ramaxel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/f01949bee8c5294f0ff1db623fbfd1c591f333a5.1639636621.git.songyl@ramaxel.com",
    "date": "2021-12-18T02:51:47",
    "name": "[v1,20/25] net/spnic: support flow control",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "80c13abb9b1bc7befe9383dabfecab64027bb53c",
    "submitter": {
        "id": 2455,
        "url": "http://patches.dpdk.org/api/people/2455/?format=api",
        "name": "Yanling Song",
        "email": "songyl@ramaxel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/f01949bee8c5294f0ff1db623fbfd1c591f333a5.1639636621.git.songyl@ramaxel.com/mbox/",
    "series": [
        {
            "id": 20973,
            "url": "http://patches.dpdk.org/api/series/20973/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=20973",
            "date": "2021-12-18T02:51:28",
            "name": "Net/SPNIC: support SPNIC into DPDK 22.03",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/20973/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/105260/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/105260/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 E3BD7A04A4;\n\tSat, 18 Dec 2021 03:55:03 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 04BDE426FC;\n\tSat, 18 Dec 2021 03:52:51 +0100 (CET)",
            "from VLXDG1SPAM1.ramaxel.com (email.ramaxel.com [221.4.138.186])\n by mails.dpdk.org (Postfix) with ESMTP id 438C5426E7\n for <dev@dpdk.org>; Sat, 18 Dec 2021 03:52:48 +0100 (CET)",
            "from V12DG1MBS01.ramaxel.local (v12dg1mbs01.ramaxel.local\n [172.26.18.31])\n by VLXDG1SPAM1.ramaxel.com with ESMTPS id 1BI2q3bL010348\n (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL);\n Sat, 18 Dec 2021 10:52:03 +0800 (GMT-8)\n (envelope-from songyl@ramaxel.com)",
            "from localhost.localdomain (10.64.9.47) by V12DG1MBS01.ramaxel.local\n (172.26.18.31) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Sat, 18\n Dec 2021 10:52:02 +0800"
        ],
        "From": "Yanling Song <songyl@ramaxel.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<songyl@ramaxel.com>, <yanling.song@linux.dev>, <yanggan@ramaxel.com>,\n <ferruh.yigit@intel.com>",
        "Subject": "[PATCH v1 20/25] net/spnic: support flow control",
        "Date": "Sat, 18 Dec 2021 10:51:47 +0800",
        "Message-ID": "\n <f01949bee8c5294f0ff1db623fbfd1c591f333a5.1639636621.git.songyl@ramaxel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<cover.1639636621.git.songyl@ramaxel.com>",
        "References": "<cover.1639636621.git.songyl@ramaxel.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.64.9.47]",
        "X-ClientProxiedBy": "V12DG1MBS01.ramaxel.local (172.26.18.31) To\n V12DG1MBS01.ramaxel.local (172.26.18.31)",
        "X-DNSRBL": "",
        "X-MAIL": "VLXDG1SPAM1.ramaxel.com 1BI2q3bL010348",
        "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": "This commit implements flow control operations\nto support related syscalls.\n\nSigned-off-by: Yanling Song <songyl@ramaxel.com>\n---\n drivers/net/spnic/base/spnic_nic_cfg.c | 53 ++++++++++++++++++\n drivers/net/spnic/base/spnic_nic_cfg.h | 25 +++++++++\n drivers/net/spnic/spnic_ethdev.c       | 77 ++++++++++++++++++++++++++\n drivers/net/spnic/spnic_ethdev.h       |  1 +\n 4 files changed, 156 insertions(+)",
    "diff": "diff --git a/drivers/net/spnic/base/spnic_nic_cfg.c b/drivers/net/spnic/base/spnic_nic_cfg.c\nindex 0b1198eb5f..24336a2096 100644\n--- a/drivers/net/spnic/base/spnic_nic_cfg.c\n+++ b/drivers/net/spnic/base/spnic_nic_cfg.c\n@@ -440,6 +440,59 @@ int spnic_flush_qps_res(void *hwdev)\n \treturn 0;\n }\n \n+static int spnic_cfg_hw_pause(void *hwdev, u8 opcode,\n+\t\t\t       struct nic_pause_config *nic_pause)\n+{\n+\tstruct spnic_cmd_pause_config pause_info;\n+\tu16 out_size = sizeof(pause_info);\n+\tint err;\n+\n+\tmemset(&pause_info, 0, sizeof(pause_info));\n+\n+\tpause_info.port_id = spnic_physical_port_id(hwdev);\n+\tpause_info.opcode = opcode;\n+\tif (opcode == SPNIC_CMD_OP_SET) {\n+\t\tpause_info.auto_neg = nic_pause->auto_neg;\n+\t\tpause_info.rx_pause = nic_pause->rx_pause;\n+\t\tpause_info.tx_pause = nic_pause->tx_pause;\n+\t}\n+\n+\terr = l2nic_msg_to_mgmt_sync(hwdev, SPNIC_CMD_CFG_PAUSE_INFO,\n+\t\t\t\t     &pause_info, sizeof(pause_info),\n+\t\t\t\t     &pause_info, &out_size);\n+\tif (err || !out_size || pause_info.msg_head.status) {\n+\t\tPMD_DRV_LOG(ERR, \"%s pause info failed, err: %d, status: 0x%x, out size: 0x%x\\n\",\n+\t\t\t    opcode == SPNIC_CMD_OP_SET ? \"Set\" : \"Get\",\n+\t\t\t    err, pause_info.msg_head.status, out_size);\n+\t\treturn -EIO;\n+\t}\n+\n+\tif (opcode == SPNIC_CMD_OP_GET) {\n+\t\tnic_pause->auto_neg = pause_info.auto_neg;\n+\t\tnic_pause->rx_pause = pause_info.rx_pause;\n+\t\tnic_pause->tx_pause = pause_info.tx_pause;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int spnic_set_pause_info(void *hwdev, struct nic_pause_config nic_pause)\n+{\n+\tif (!hwdev)\n+\t\treturn -EINVAL;\n+\n+\treturn spnic_cfg_hw_pause(hwdev, SPNIC_CMD_OP_SET, &nic_pause);\n+}\n+\n+int spnic_get_pause_info(void *hwdev, struct nic_pause_config *nic_pause)\n+{\n+\tif (!hwdev || !nic_pause)\n+\t\treturn -EINVAL;\n+\n+\n+\treturn spnic_cfg_hw_pause(hwdev, SPNIC_CMD_OP_GET, nic_pause);\n+}\n+\n static int spnic_set_function_table(void *hwdev, u32 cfg_bitmap,\n \t\t\t\t     struct spnic_func_tbl_cfg *cfg)\n {\ndiff --git a/drivers/net/spnic/base/spnic_nic_cfg.h b/drivers/net/spnic/base/spnic_nic_cfg.h\nindex 3a906b4bc3..2cdaada2ea 100644\n--- a/drivers/net/spnic/base/spnic_nic_cfg.h\n+++ b/drivers/net/spnic/base/spnic_nic_cfg.h\n@@ -560,6 +560,31 @@ int spnic_get_link_state(void *hwdev, u8 *link_state);\n  */\n int spnic_flush_qps_res(void *hwdev);\n \n+/**\n+ * Set pause info\n+ *\n+ * @param[in] hwdev\n+ *   Device pointer to hwdev\n+ * @param[in] nic_pause\n+ *   Pause info\n+ *\n+ * @retval zero : Success\n+ * @retval non-zero : Failure\n+ */\n+int spnic_set_pause_info(void *hwdev, struct nic_pause_config nic_pause);\n+\n+/**\n+ * Get pause info\n+ *\n+ * @param[in] hwdev\n+ *   Device pointer to hwdev\n+ * @param[out] nic_pause\n+ *   Pause info\n+ *\n+ * @retval zero : Success\n+ * @retval non-zero : Failure\n+ */\n+int spnic_get_pause_info(void *hwdev, struct nic_pause_config *nic_pause);\n \n /**\n  * Init nic hwdev\ndiff --git a/drivers/net/spnic/spnic_ethdev.c b/drivers/net/spnic/spnic_ethdev.c\nindex 0b5ef15373..dc7fcae10f 100644\n--- a/drivers/net/spnic/spnic_ethdev.c\n+++ b/drivers/net/spnic/spnic_ethdev.c\n@@ -1544,6 +1544,81 @@ static int spnic_dev_promiscuous_disable(struct rte_eth_dev *dev)\n \treturn 0;\n }\n \n+static int spnic_dev_flow_ctrl_get(struct rte_eth_dev *dev,\n+\t\t\t\t   struct rte_eth_fc_conf *fc_conf)\n+{\n+\tstruct spnic_nic_dev *nic_dev = SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);\n+\tstruct nic_pause_config nic_pause;\n+\tint err;\n+\n+\terr = spnic_mutex_lock(&nic_dev->pause_mutuex);\n+\tif (err)\n+\t\treturn err;\n+\n+\tmemset(&nic_pause, 0, sizeof(nic_pause));\n+\terr = spnic_get_pause_info(nic_dev->hwdev, &nic_pause);\n+\tif (err) {\n+\t\t(void)spnic_mutex_unlock(&nic_dev->pause_mutuex);\n+\t\treturn err;\n+\t}\n+\n+\tif (nic_dev->pause_set || !nic_pause.auto_neg) {\n+\t\tnic_pause.rx_pause = nic_dev->nic_pause.rx_pause;\n+\t\tnic_pause.tx_pause = nic_dev->nic_pause.tx_pause;\n+\t}\n+\n+\tfc_conf->autoneg = nic_pause.auto_neg;\n+\n+\tif (nic_pause.tx_pause && nic_pause.rx_pause)\n+\t\tfc_conf->mode = RTE_FC_FULL;\n+\telse if (nic_pause.tx_pause)\n+\t\tfc_conf->mode = RTE_FC_TX_PAUSE;\n+\telse if (nic_pause.rx_pause)\n+\t\tfc_conf->mode = RTE_FC_RX_PAUSE;\n+\telse\n+\t\tfc_conf->mode = RTE_FC_NONE;\n+\n+\t(void)spnic_mutex_unlock(&nic_dev->pause_mutuex);\n+\treturn 0;\n+}\n+\n+static int spnic_dev_flow_ctrl_set(struct rte_eth_dev *dev,\n+\t\t\t\t   struct rte_eth_fc_conf *fc_conf)\n+{\n+\tstruct spnic_nic_dev *nic_dev = SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);\n+\tstruct nic_pause_config nic_pause;\n+\tint err;\n+\n+\terr = spnic_mutex_lock(&nic_dev->pause_mutuex);\n+\tif (err)\n+\t\treturn err;\n+\n+\tmemset(&nic_pause, 0, sizeof(nic_pause));\n+\tif (((fc_conf->mode & RTE_FC_FULL) == RTE_FC_FULL) ||\n+\t    (fc_conf->mode & RTE_FC_TX_PAUSE))\n+\t\tnic_pause.tx_pause = true;\n+\n+\tif (((fc_conf->mode & RTE_FC_FULL) == RTE_FC_FULL) ||\n+\t    (fc_conf->mode & RTE_FC_RX_PAUSE))\n+\t\tnic_pause.rx_pause = true;\n+\n+\terr = spnic_set_pause_info(nic_dev->hwdev, nic_pause);\n+\tif (err) {\n+\t\t(void)spnic_mutex_unlock(&nic_dev->pause_mutuex);\n+\t\treturn err;\n+\t}\n+\n+\tnic_dev->pause_set = true;\n+\tnic_dev->nic_pause.rx_pause = nic_pause.rx_pause;\n+\tnic_dev->nic_pause.tx_pause = nic_pause.tx_pause;\n+\n+\tPMD_DRV_LOG(INFO, \"Just support set tx or rx pause info, tx: %s, rx: %s\\n\",\n+\t\t    nic_pause.tx_pause ? \"on\" : \"off\",\n+\t\t    nic_pause.rx_pause ? \"on\" : \"off\");\n+\n+\t(void)spnic_mutex_unlock(&nic_dev->pause_mutuex);\n+\treturn 0;\n+}\n \n /**\n  * Update the RSS hash key and RSS hash type.\n@@ -1984,6 +2059,8 @@ static const struct eth_dev_ops spnic_pmd_ops = {\n \t.allmulticast_disable          = spnic_dev_allmulticast_disable,\n \t.promiscuous_enable            = spnic_dev_promiscuous_enable,\n \t.promiscuous_disable           = spnic_dev_promiscuous_disable,\n+\t.flow_ctrl_get                 = spnic_dev_flow_ctrl_get,\n+\t.flow_ctrl_set                 = spnic_dev_flow_ctrl_set,\n \t.rss_hash_update               = spnic_rss_hash_update,\n \t.rss_hash_conf_get             = spnic_rss_conf_get,\n \t.reta_update                   = spnic_rss_reta_update,\ndiff --git a/drivers/net/spnic/spnic_ethdev.h b/drivers/net/spnic/spnic_ethdev.h\nindex 2b59886942..be429945ac 100644\n--- a/drivers/net/spnic/spnic_ethdev.h\n+++ b/drivers/net/spnic/spnic_ethdev.h\n@@ -76,6 +76,7 @@ struct spnic_nic_dev {\n \n \tbool pause_set;\n \tpthread_mutex_t pause_mutuex;\n+\tstruct nic_pause_config nic_pause;\n \n \tstruct rte_ether_addr default_addr;\n \tstruct rte_ether_addr *mc_list;\n",
    "prefixes": [
        "v1",
        "20/25"
    ]
}