get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 105256,
    "url": "http://patches.dpdk.org/api/patches/105256/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/9e1e5308ac26be6f0dad1c31073968d704564c5c.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": "<9e1e5308ac26be6f0dad1c31073968d704564c5c.1639636621.git.songyl@ramaxel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/9e1e5308ac26be6f0dad1c31073968d704564c5c.1639636621.git.songyl@ramaxel.com",
    "date": "2021-12-18T02:51:43",
    "name": "[v1,16/25] net/spnic: add device configure/version/info",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "05822b549eddc7117ffbb81acf520d3f4106dc9f",
    "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/9e1e5308ac26be6f0dad1c31073968d704564c5c.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/105256/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/105256/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 057C1A04A4;\n\tSat, 18 Dec 2021 03:54:39 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 399F5426F0;\n\tSat, 18 Dec 2021 03:52:44 +0100 (CET)",
            "from VLXDG1SPAM1.ramaxel.com (email.ramaxel.com [221.4.138.186])\n by mails.dpdk.org (Postfix) with ESMTP id B50E741C25\n for <dev@dpdk.org>; Sat, 18 Dec 2021 03:52:39 +0100 (CET)",
            "from V12DG1MBS01.ramaxel.local (v12dg1mbs01.ramaxel.local\n [172.26.18.31])\n by VLXDG1SPAM1.ramaxel.com with ESMTPS id 1BI2q2nR010345\n (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL);\n Sat, 18 Dec 2021 10:52:02 +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:01 +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 16/25] net/spnic: add device configure/version/info",
        "Date": "Sat, 18 Dec 2021 10:51:43 +0800",
        "Message-ID": "\n <9e1e5308ac26be6f0dad1c31073968d704564c5c.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 1BI2q2nR010345",
        "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 adds the callbacks to configure queue number and mtu\nas well as query configuration information and firmware version.\n\nSigned-off-by: Yanling Song <songyl@ramaxel.com>\n---\n drivers/net/spnic/spnic_ethdev.c | 148 ++++++++++++++++++++++++++++++-\n 1 file changed, 146 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/spnic/spnic_ethdev.c b/drivers/net/spnic/spnic_ethdev.c\nindex b4d20e1a6f..c97f15e871 100644\n--- a/drivers/net/spnic/spnic_ethdev.c\n+++ b/drivers/net/spnic/spnic_ethdev.c\n@@ -71,12 +71,150 @@ enum spnic_rx_mod {\n #define SPNIC_TXD_ALIGN\t\t\t1\n #define SPNIC_RXD_ALIGN\t\t\t1\n \n+static const struct rte_eth_desc_lim spnic_rx_desc_lim = {\n+\t.nb_max = SPNIC_MAX_QUEUE_DEPTH,\n+\t.nb_min = SPNIC_MIN_QUEUE_DEPTH,\n+\t.nb_align = SPNIC_RXD_ALIGN,\n+};\n+\n+static const struct rte_eth_desc_lim spnic_tx_desc_lim = {\n+\t.nb_max = SPNIC_MAX_QUEUE_DEPTH,\n+\t.nb_min = SPNIC_MIN_QUEUE_DEPTH,\n+\t.nb_align = SPNIC_TXD_ALIGN,\n+};\n+\n /**\n- * Deinit mac_vlan table in hardware.\n+ * Ethernet device configuration.\n  *\n- * @param[in] eth_dev\n+ * Prepare the driver for a given number of TX and RX queues, mtu size\n+ * and configure RSS.\n+ *\n+ * @param[in] dev\n+ *   Pointer to ethernet device structure.\n+ *\n+ * @retval zero : Success\n+ * @retval non-zero : Failure.\n+ */\n+static int spnic_dev_configure(struct rte_eth_dev *dev)\n+{\n+\tstruct spnic_nic_dev *nic_dev = SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);\n+\n+\tnic_dev->num_sqs =  dev->data->nb_tx_queues;\n+\tnic_dev->num_rqs = dev->data->nb_rx_queues;\n+\n+\tif (nic_dev->num_sqs > nic_dev->max_sqs ||\n+\t    nic_dev->num_rqs > nic_dev->max_rqs) {\n+\t\tPMD_DRV_LOG(ERR, \"num_sqs: %d or num_rqs: %d larger than max_sqs: %d or max_rqs: %d\",\n+\t\t\t    nic_dev->num_sqs, nic_dev->num_rqs,\n+\t\t\t    nic_dev->max_sqs, nic_dev->max_rqs);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* The range of mtu is 384~9600 */\n+\tif (SPNIC_MTU_TO_PKTLEN(dev->data->dev_conf.rxmode.mtu) <\n+\t    SPNIC_MIN_FRAME_SIZE ||\n+\t    SPNIC_MTU_TO_PKTLEN(dev->data->dev_conf.rxmode.mtu) >\n+\t    SPNIC_MAX_JUMBO_FRAME_SIZE) {\n+\t\tPMD_DRV_LOG(ERR, \"Max rx pkt len out of range, mtu: %d, expect between %d and %d\",\n+\t\t\t    dev->data->dev_conf.rxmode.mtu,\n+\t\t\t    SPNIC_MIN_FRAME_SIZE, SPNIC_MAX_JUMBO_FRAME_SIZE);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tnic_dev->mtu_size =\n+\t\tSPNIC_PKTLEN_TO_MTU(dev->data->dev_conf.rxmode.mtu);\n+\n+\tif (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)\n+\t\tdev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * Get information about the device.\n+ *\n+ * @param[in] dev\n  *   Pointer to ethernet device structure.\n+ * @param[out] info\n+ *   Info structure for ethernet device.\n+ *\n+ * @retval zero : Success\n+ * @retval non-zero : Failure.\n  */\n+static int spnic_dev_infos_get(struct rte_eth_dev *dev,\n+\t\t\t       struct rte_eth_dev_info *info)\n+{\n+\tstruct spnic_nic_dev *nic_dev = SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);\n+\n+\tinfo->max_rx_queues  = nic_dev->max_rqs;\n+\tinfo->max_tx_queues  = nic_dev->max_sqs;\n+\tinfo->min_rx_bufsize = SPNIC_MIN_RX_BUF_SIZE;\n+\tinfo->max_rx_pktlen  = SPNIC_MAX_JUMBO_FRAME_SIZE;\n+\tinfo->max_mac_addrs  = SPNIC_MAX_UC_MAC_ADDRS;\n+\tinfo->min_mtu = SPNIC_MIN_MTU_SIZE;\n+\tinfo->max_mtu = SPNIC_MAX_MTU_SIZE;\n+\tinfo->max_lro_pkt_size = SPNIC_MAX_LRO_SIZE;\n+\n+\tinfo->rx_queue_offload_capa = 0;\n+\tinfo->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |\n+\t\t\t\tDEV_RX_OFFLOAD_IPV4_CKSUM |\n+\t\t\t\tDEV_RX_OFFLOAD_UDP_CKSUM |\n+\t\t\t\tDEV_RX_OFFLOAD_TCP_CKSUM |\n+\t\t\t\tDEV_RX_OFFLOAD_SCTP_CKSUM |\n+\t\t\t\tDEV_RX_OFFLOAD_VLAN_FILTER |\n+\t\t\t\tDEV_RX_OFFLOAD_SCATTER |\n+\t\t\t\tDEV_RX_OFFLOAD_TCP_LRO |\n+\t\t\t\tDEV_RX_OFFLOAD_RSS_HASH;\n+\n+\tinfo->tx_queue_offload_capa = 0;\n+\tinfo->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |\n+\t\t\t\tDEV_TX_OFFLOAD_IPV4_CKSUM |\n+\t\t\t\tDEV_TX_OFFLOAD_UDP_CKSUM |\n+\t\t\t\tDEV_TX_OFFLOAD_TCP_CKSUM |\n+\t\t\t\tDEV_TX_OFFLOAD_SCTP_CKSUM |\n+\t\t\t\tDEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |\n+\t\t\t\tDEV_TX_OFFLOAD_TCP_TSO |\n+\t\t\t\tDEV_TX_OFFLOAD_MULTI_SEGS;\n+\n+\tinfo->hash_key_size = SPNIC_RSS_KEY_SIZE;\n+\tinfo->reta_size = SPNIC_RSS_INDIR_SIZE;\n+\tinfo->flow_type_rss_offloads = SPNIC_RSS_OFFLOAD_ALL;\n+\n+\tinfo->rx_desc_lim = spnic_rx_desc_lim;\n+\tinfo->tx_desc_lim = spnic_tx_desc_lim;\n+\n+\t/* Driver-preferred rx/tx parameters */\n+\tinfo->default_rxportconf.burst_size = SPNIC_DEFAULT_BURST_SIZE;\n+\tinfo->default_txportconf.burst_size = SPNIC_DEFAULT_BURST_SIZE;\n+\tinfo->default_rxportconf.nb_queues = SPNIC_DEFAULT_NB_QUEUES;\n+\tinfo->default_txportconf.nb_queues = SPNIC_DEFAULT_NB_QUEUES;\n+\tinfo->default_rxportconf.ring_size = SPNIC_DEFAULT_RING_SIZE;\n+\tinfo->default_txportconf.ring_size = SPNIC_DEFAULT_RING_SIZE;\n+\n+\treturn 0;\n+}\n+\n+static int spnic_fw_version_get(struct rte_eth_dev *dev, char *fw_version,\n+\t\t\t\tsize_t fw_size)\n+{\n+\tstruct spnic_nic_dev *nic_dev = SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);\n+\tchar mgmt_ver[MGMT_VERSION_MAX_LEN] = { 0 };\n+\tint err;\n+\n+\terr = spnic_get_mgmt_version(nic_dev->hwdev, mgmt_ver,\n+\t\t\t\t     SPNIC_MGMT_VERSION_MAX_LEN);\n+\tif (err) {\n+\t\tPMD_DRV_LOG(ERR, \"Get fw version failed\");\n+\t\treturn -EIO;\n+\t}\n+\n+\tif (fw_size < strlen(mgmt_ver) + 1)\n+\t\treturn (strlen(mgmt_ver) + 1);\n+\n+\tsnprintf(fw_version, fw_size, \"%s\", mgmt_ver);\n+\n+\treturn 0;\n+}\n \n /**\n  * Set ethernet device link state up.\n@@ -1332,6 +1470,9 @@ static int spnic_set_mc_addr_list(struct rte_eth_dev *dev,\n }\n \n static const struct eth_dev_ops spnic_pmd_ops = {\n+\t.dev_configure                 = spnic_dev_configure,\n+\t.dev_infos_get                 = spnic_dev_infos_get,\n+\t.fw_version_get                = spnic_fw_version_get,\n \t.dev_set_link_up               = spnic_dev_set_link_up,\n \t.dev_set_link_down             = spnic_dev_set_link_down,\n \t.link_update                   = spnic_link_update,\n@@ -1350,6 +1491,9 @@ static const struct eth_dev_ops spnic_pmd_ops = {\n };\n \n static const struct eth_dev_ops spnic_pmd_vf_ops = {\n+\t.dev_configure                 = spnic_dev_configure,\n+\t.dev_infos_get                 = spnic_dev_infos_get,\n+\t.fw_version_get                = spnic_fw_version_get,\n \t.rx_queue_setup                = spnic_rx_queue_setup,\n \t.tx_queue_setup                = spnic_tx_queue_setup,\n \t.dev_start                     = spnic_dev_start,\n",
    "prefixes": [
        "v1",
        "16/25"
    ]
}