get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 60605,
    "url": "https://patches.dpdk.org/api/patches/60605/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20191007110809.62801-3-bruce.richardson@intel.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": "<20191007110809.62801-3-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191007110809.62801-3-bruce.richardson@intel.com",
    "date": "2019-10-07T11:08:05",
    "name": "[v7,2/6] examples/ioat: add software copy support",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "a05f372253f154695056f6f41a4a9d1dfb43bc90",
    "submitter": {
        "id": 20,
        "url": "https://patches.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20191007110809.62801-3-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 6718,
            "url": "https://patches.dpdk.org/api/series/6718/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=6718",
            "date": "2019-10-07T11:08:03",
            "name": "examples/ioat: sample app for ioat driver",
            "version": 7,
            "mbox": "https://patches.dpdk.org/series/6718/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/60605/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/60605/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 3B9781C216;\n\tMon,  7 Oct 2019 13:08:31 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 2905A1C209\n\tfor <dev@dpdk.org>; Mon,  7 Oct 2019 13:08:29 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t07 Oct 2019 04:08:28 -0700",
            "from silpixa00399126.ir.intel.com (HELO\n\tsilpixa00399126.ger.corp.intel.com) ([10.237.223.2])\n\tby orsmga002.jf.intel.com with ESMTP; 07 Oct 2019 04:08:27 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.67,268,1566889200\"; d=\"scan'208\";a=\"205041024\"",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Marcin Baran <marcinx.baran@intel.com>,\n\tPawel Modrak <pawelx.modrak@intel.com>,\n\tBruce Richardson <bruce.richardson@intel.com>",
        "Date": "Mon,  7 Oct 2019 12:08:05 +0100",
        "Message-Id": "<20191007110809.62801-3-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20191007110809.62801-1-bruce.richardson@intel.com>",
        "References": "<20190920073714.1314-1-marcinx.baran@intel.com>\n\t<20191007110809.62801-1-bruce.richardson@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v7 2/6] examples/ioat: add software copy support",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Marcin Baran <marcinx.baran@intel.com>\n\nAdded support for copying packets using software copy mode and MAC address\nchanging. The copies are processed using one lcore.\n\nSigned-off-by: Marcin Baran <marcinx.baran@intel.com>\nSigned-off-by: Pawel Modrak <pawelx.modrak@intel.com>\nAcked-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n examples/ioat/ioatfwd.c | 177 ++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 177 insertions(+)",
    "diff": "diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c\nindex b33c1eeb4..2a4da948a 100644\n--- a/examples/ioat/ioatfwd.c\n+++ b/examples/ioat/ioatfwd.c\n@@ -89,6 +89,154 @@ static struct rte_ether_addr ioat_ports_eth_addr[RTE_MAX_ETHPORTS];\n static struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS];\n struct rte_mempool *ioat_pktmbuf_pool;\n \n+static void\n+update_mac_addrs(struct rte_mbuf *m, uint32_t dest_portid)\n+{\n+\tstruct rte_ether_hdr *eth;\n+\tvoid *tmp;\n+\n+\teth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);\n+\n+\t/* 02:00:00:00:00:xx - overwriting 2 bytes of source address but\n+\t * it's acceptable cause it gets overwritten by rte_ether_addr_copy\n+\t */\n+\ttmp = &eth->d_addr.addr_bytes[0];\n+\t*((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40);\n+\n+\t/* src addr */\n+\trte_ether_addr_copy(&ioat_ports_eth_addr[dest_portid], &eth->s_addr);\n+}\n+\n+static inline void\n+pktmbuf_sw_copy(struct rte_mbuf *src, struct rte_mbuf *dst)\n+{\n+\t/* Copy packet metadata */\n+\trte_memcpy(&dst->rearm_data,\n+\t\t&src->rearm_data,\n+\t\toffsetof(struct rte_mbuf, cacheline1)\n+\t\t- offsetof(struct rte_mbuf, rearm_data));\n+\n+\t/* Copy packet data */\n+\trte_memcpy(rte_pktmbuf_mtod(dst, char *),\n+\t\trte_pktmbuf_mtod(src, char *), src->data_len);\n+}\n+\n+/* Receive packets on one port and enqueue to IOAT rawdev or rte_ring. */\n+static void\n+ioat_rx_port(struct rxtx_port_config *rx_config)\n+{\n+\tuint32_t nb_rx, nb_enq, i, j;\n+\tstruct rte_mbuf *pkts_burst[MAX_PKT_BURST];\n+\n+\tfor (i = 0; i < rx_config->nb_queues; i++) {\n+\n+\t\tnb_rx = rte_eth_rx_burst(rx_config->rxtx_port, i,\n+\t\t\tpkts_burst, MAX_PKT_BURST);\n+\n+\t\tif (nb_rx == 0)\n+\t\t\tcontinue;\n+\n+\t\tif (copy_mode == COPY_MODE_IOAT_NUM) {\n+\t\t\t/* Perform packet hardware copy */\n+\t\t} else {\n+\t\t\t/* Perform packet software copy, free source packets */\n+\t\t\tint ret;\n+\t\t\tstruct rte_mbuf *pkts_burst_copy[MAX_PKT_BURST];\n+\n+\t\t\tret = rte_mempool_get_bulk(ioat_pktmbuf_pool,\n+\t\t\t\t(void *)pkts_burst_copy, nb_rx);\n+\n+\t\t\tif (unlikely(ret < 0))\n+\t\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\t\"Unable to allocate memory.\\n\");\n+\n+\t\t\tfor (j = 0; j < nb_rx; j++)\n+\t\t\t\tpktmbuf_sw_copy(pkts_burst[j],\n+\t\t\t\t\tpkts_burst_copy[j]);\n+\n+\t\t\trte_mempool_put_bulk(ioat_pktmbuf_pool,\n+\t\t\t\t(void *)pkts_burst, nb_rx);\n+\n+\t\t\tnb_enq = rte_ring_enqueue_burst(\n+\t\t\t\trx_config->rx_to_tx_ring,\n+\t\t\t\t(void *)pkts_burst_copy, nb_rx, NULL);\n+\n+\t\t\t/* Free any not enqueued packets. */\n+\t\t\trte_mempool_put_bulk(ioat_pktmbuf_pool,\n+\t\t\t\t(void *)&pkts_burst_copy[nb_enq],\n+\t\t\t\tnb_rx - nb_enq);\n+\t\t}\n+\t}\n+}\n+\n+/* Transmit packets from IOAT rawdev/rte_ring for one port. */\n+static void\n+ioat_tx_port(struct rxtx_port_config *tx_config)\n+{\n+\tuint32_t i, j, nb_dq = 0;\n+\tstruct rte_mbuf *mbufs_dst[MAX_PKT_BURST];\n+\n+\tfor (i = 0; i < tx_config->nb_queues; i++) {\n+\t\tif (copy_mode == COPY_MODE_IOAT_NUM) {\n+\t\t\t/* Deque the mbufs from IOAT device. */\n+\t\t} else {\n+\t\t\t/* Deque the mbufs from rx_to_tx_ring. */\n+\t\t\tnb_dq = rte_ring_dequeue_burst(\n+\t\t\t\ttx_config->rx_to_tx_ring, (void *)mbufs_dst,\n+\t\t\t\tMAX_PKT_BURST, NULL);\n+\t\t}\n+\n+\t\tif (nb_dq == 0)\n+\t\t\treturn;\n+\n+\t\t/* Update macs if enabled */\n+\t\tif (mac_updating) {\n+\t\t\tfor (j = 0; j < nb_dq; j++)\n+\t\t\t\tupdate_mac_addrs(mbufs_dst[j],\n+\t\t\t\t\ttx_config->rxtx_port);\n+\t\t}\n+\n+\t\tconst uint16_t nb_tx = rte_eth_tx_burst(\n+\t\t\ttx_config->rxtx_port, 0,\n+\t\t\t(void *)mbufs_dst, nb_dq);\n+\n+\t\t/* Free any unsent packets. */\n+\t\tif (unlikely(nb_tx < nb_dq))\n+\t\t\trte_mempool_put_bulk(ioat_pktmbuf_pool,\n+\t\t\t(void *)&mbufs_dst[nb_tx],\n+\t\t\t\tnb_dq - nb_tx);\n+\t}\n+}\n+\n+/* Main rx and tx loop if only one slave lcore available */\n+static void\n+rxtx_main_loop(void)\n+{\n+\tuint16_t i;\n+\tuint16_t nb_ports = cfg.nb_ports;\n+\n+\tRTE_LOG(INFO, IOAT, \"Entering main rx and tx loop for copy on\"\n+\t\t\" lcore %u\\n\", rte_lcore_id());\n+\n+\twhile (!force_quit)\n+\t\tfor (i = 0; i < nb_ports; i++) {\n+\t\t\tioat_rx_port(&cfg.ports[i]);\n+\t\t\tioat_tx_port(&cfg.ports[i]);\n+\t\t}\n+}\n+\n+static void start_forwarding_cores(void)\n+{\n+\tuint32_t lcore_id = rte_lcore_id();\n+\n+\tRTE_LOG(INFO, IOAT, \"Entering %s on lcore %u\\n\",\n+\t\t__func__, rte_lcore_id());\n+\n+\tlcore_id = rte_get_next_lcore(lcore_id, true, true);\n+\trte_eal_remote_launch((lcore_function_t *)rxtx_main_loop,\n+\t\tNULL, lcore_id);\n+}\n+\n /* Display usage */\n static void\n ioat_usage(const char *prgname)\n@@ -253,6 +401,26 @@ check_link_status(uint32_t port_mask)\n \treturn retval;\n }\n \n+static void\n+assign_rings(void)\n+{\n+\tuint32_t i;\n+\n+\tfor (i = 0; i < cfg.nb_ports; i++) {\n+\t\tchar ring_name[RTE_RING_NAMESIZE];\n+\n+\t\tsnprintf(ring_name, sizeof(ring_name), \"rx_to_tx_ring_%u\", i);\n+\t\t/* Create ring for inter core communication */\n+\t\tcfg.ports[i].rx_to_tx_ring = rte_ring_create(\n+\t\t\tring_name, ring_size,\n+\t\t\trte_socket_id(), RING_F_SP_ENQ | RING_F_SC_DEQ);\n+\n+\t\tif (cfg.ports[i].rx_to_tx_ring == NULL)\n+\t\t\trte_exit(EXIT_FAILURE, \"Ring create failed: %s\\n\",\n+\t\t\t\trte_strerror(rte_errno));\n+\t}\n+}\n+\n /*\n  * Initializes a given port using global settings and with the RX buffers\n  * coming from the mbuf_pool passed as a parameter.\n@@ -428,10 +596,19 @@ main(int argc, char **argv)\n \tif (cfg.nb_lcores < 1)\n \t\trte_exit(EXIT_FAILURE,\n \t\t\t\"There should be at least one slave lcore.\\n\");\n+\n+\tassign_rings();\n+\n+\tstart_forwarding_cores();\n+\n+\t/* force_quit is true when we get here */\n+\trte_eal_mp_wait_lcore();\n+\n \tfor (i = 0; i < cfg.nb_ports; i++) {\n \t\tprintf(\"Closing port %d\\n\", cfg.ports[i].rxtx_port);\n \t\trte_eth_dev_stop(cfg.ports[i].rxtx_port);\n \t\trte_eth_dev_close(cfg.ports[i].rxtx_port);\n+\t\trte_ring_free(cfg.ports[i].rx_to_tx_ring);\n \t}\n \n \tprintf(\"Bye...\\n\");\n",
    "prefixes": [
        "v7",
        "2/6"
    ]
}