get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 92043,
    "url": "http://patches.dpdk.org/api/patches/92043/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1619137920-13449-8-git-send-email-jizh@linux.microsoft.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": "<1619137920-13449-8-git-send-email-jizh@linux.microsoft.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1619137920-13449-8-git-send-email-jizh@linux.microsoft.com",
    "date": "2021-04-23T00:31:57",
    "name": "[v7,07/10] app/testpmd: replace POSIX specific code",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b1461ca7a2528c489457b49d2eb73f444dcebeba",
    "submitter": {
        "id": 1934,
        "url": "http://patches.dpdk.org/api/people/1934/?format=api",
        "name": "Jie Zhou",
        "email": "jizh@linux.microsoft.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1619137920-13449-8-git-send-email-jizh@linux.microsoft.com/mbox/",
    "series": [
        {
            "id": 16612,
            "url": "http://patches.dpdk.org/api/series/16612/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=16612",
            "date": "2021-04-23T00:31:51",
            "name": "app/testpmd: enable testpmd on Windows",
            "version": 7,
            "mbox": "http://patches.dpdk.org/series/16612/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/92043/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/92043/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 D576EA0A02;\n\tFri, 23 Apr 2021 02:32:57 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4C1D441DE1;\n\tFri, 23 Apr 2021 02:32:24 +0200 (CEST)",
            "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n by mails.dpdk.org (Postfix) with ESMTP id 90C9741CF8\n for <dev@dpdk.org>; Fri, 23 Apr 2021 02:32:07 +0200 (CEST)",
            "from\n linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net\n (linux.microsoft.com [13.77.154.182])\n by linux.microsoft.com (Postfix) with ESMTPSA id 9190620B83E8;\n Thu, 22 Apr 2021 17:32:06 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com 9190620B83E8",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n s=default; t=1619137926;\n bh=PkPR+1/tY9zqEz7CZydi9rcnROL6Zds8sqKBBAzbDC4=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=aSHzxnQx1VWPswKkOj5r0X7N2jngKMcyP2ox4vMmwhSzWoVYKSSgJjjMBQh7IODs0\n r2Xr5FVXDg2jbmE0AHt0PRq49lw3EWgTf+qAnUP9aZiuT/j5RPvEwJa7sfqb8qC9NJ\n ioIF9y4C3+Dsh91I7BvrTZJFS+PdoWfzWU6XJreI=",
        "From": "Jie Zhou <jizh@linux.microsoft.com>",
        "To": "dev@dpdk.org",
        "Cc": "dmitry.kozliuk@gmail.com, xiaoyun.li@intel.com, roretzla@microsoft.com,\n pallavi.kadam@intel.com, thomas@monjalon.net, bruce.richardson@intel.com,\n ferruh.yigit@intel.com, konstantin.ananyev@intel.com",
        "Date": "Thu, 22 Apr 2021 17:31:57 -0700",
        "Message-Id": "<1619137920-13449-8-git-send-email-jizh@linux.microsoft.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1619137920-13449-1-git-send-email-jizh@linux.microsoft.com>",
        "References": "<1618874400-26819-1-git-send-email-jizh@linux.microsoft.com>\n <1619137920-13449-1-git-send-email-jizh@linux.microsoft.com>",
        "Subject": "[dpdk-dev] [PATCH v7 07/10] app/testpmd: replace POSIX specific code",
        "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": "- Make printf format OS independent\n - Replace htons with RTE_BE16\n - Replace POSIX specific inet_aton with OS independent inet_pton\n - Replace sleep with rte_delay_us_sleep\n - Repalce random with rte_rand\n - #ifndef mman related code on Windows for now\n\nSigned-off-by: Jie Zhou <jizh@microsoft.com>\nSigned-off-by: Jie Zhou <jizh@linux.microsoft.com>\n---\n app/test-pmd/cmdline.c     |  3 +--\n app/test-pmd/csumonly.c    |  2 +-\n app/test-pmd/icmpecho.c    |  4 ++--\n app/test-pmd/ieee1588fwd.c |  8 ++++----\n app/test-pmd/parameters.c  | 10 +++++++---\n app/test-pmd/testpmd.c     | 21 ++++++++++++++++++++-\n app/test-pmd/testpmd.h     |  2 +-\n 7 files changed, 36 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex d804ee233..f0636ca9b 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -8,7 +8,6 @@\n #include <stdio.h>\n #include <stdint.h>\n #include <string.h>\n-#include <termios.h>\n #include <unistd.h>\n #include <inttypes.h>\n #include <sys/socket.h>\n@@ -3601,7 +3600,7 @@ cmdline_parse_inst_t cmd_stop = {\n /* *** SET CORELIST and PORTLIST CONFIGURATION *** */\n \n unsigned int\n-parse_item_list(char* str, const char* item_name, unsigned int max_items,\n+parse_item_list(const char *str, const char *item_name, unsigned int max_items,\n \t\tunsigned int *parsed_items, int check_unique_values)\n {\n \tunsigned int nb_item;\ndiff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c\nindex 6b4df335f..089936587 100644\n--- a/app/test-pmd/csumonly.c\n+++ b/app/test-pmd/csumonly.c\n@@ -696,7 +696,7 @@ pkt_copy_split(const struct rte_mbuf *pkt)\n \tmp = current_fwd_lcore()->mbp;\n \n \tif (tx_pkt_split == TX_PKT_SPLIT_RND)\n-\t\tnb_seg = random() % tx_pkt_nb_segs + 1;\n+\t\tnb_seg = rte_rand() % tx_pkt_nb_segs + 1;\n \telse\n \t\tnb_seg = tx_pkt_nb_segs;\n \ndiff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c\nindex af6f7e790..8948f28eb 100644\n--- a/app/test-pmd/icmpecho.c\n+++ b/app/test-pmd/icmpecho.c\n@@ -474,8 +474,8 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)\n \t\t}\n \t\ticmp_h->icmp_type = RTE_IP_ICMP_ECHO_REPLY;\n \t\tcksum = ~icmp_h->icmp_cksum & 0xffff;\n-\t\tcksum += ~htons(RTE_IP_ICMP_ECHO_REQUEST << 8) & 0xffff;\n-\t\tcksum += htons(RTE_IP_ICMP_ECHO_REPLY << 8);\n+\t\tcksum += ~RTE_BE16(RTE_IP_ICMP_ECHO_REQUEST << 8) & 0xffff;\n+\t\tcksum += RTE_BE16(RTE_IP_ICMP_ECHO_REPLY << 8);\n \t\tcksum = (cksum & 0xffff) + (cksum >> 16);\n \t\tcksum = (cksum & 0xffff) + (cksum >> 16);\n \t\ticmp_h->icmp_cksum = ~cksum;\ndiff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c\nindex e3b98e3e0..034f238c3 100644\n--- a/app/test-pmd/ieee1588fwd.c\n+++ b/app/test-pmd/ieee1588fwd.c\n@@ -60,8 +60,8 @@ port_ieee1588_rx_timestamp_check(portid_t pi, uint32_t index)\n \t\tprintf(\"Port %u RX timestamp registers not valid\\n\", pi);\n \t\treturn;\n \t}\n-\tprintf(\"Port %u RX timestamp value %lu s %lu ns\\n\",\n-\t\tpi, timestamp.tv_sec, timestamp.tv_nsec);\n+\tprintf(\"Port %u RX timestamp value %ju s %lu ns\\n\",\n+\t\tpi, (uintmax_t)timestamp.tv_sec, timestamp.tv_nsec);\n }\n \n #define MAX_TX_TMST_WAIT_MICROSECS 1000 /**< 1 milli-second */\n@@ -83,9 +83,9 @@ port_ieee1588_tx_timestamp_check(portid_t pi)\n \t\t       pi, MAX_TX_TMST_WAIT_MICROSECS);\n \t\treturn;\n \t}\n-\tprintf(\"Port %u TX timestamp value %lu s %lu ns validated after \"\n+\tprintf(\"Port %u TX timestamp value %ju s %lu ns validated after \"\n \t       \"%u micro-second%s\\n\",\n-\t       pi, timestamp.tv_sec, timestamp.tv_nsec, wait_us,\n+\t       pi, (uintmax_t)timestamp.tv_sec, timestamp.tv_nsec, wait_us,\n \t       (wait_us == 1) ? \"\" : \"s\");\n }\n \ndiff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c\nindex f3954c1c6..4c3cbbac3 100644\n--- a/app/test-pmd/parameters.c\n+++ b/app/test-pmd/parameters.c\n@@ -185,8 +185,10 @@ usage(char* progname)\n \tprintf(\"  --hot-plug: enable hot plug for device.\\n\");\n \tprintf(\"  --vxlan-gpe-port=N: UPD port of tunnel VXLAN-GPE\\n\");\n \tprintf(\"  --geneve-parsed-port=N: UPD port to parse GENEVE tunnel protocol\\n\");\n+#ifndef RTE_EXEC_ENV_WINDOWS\n \tprintf(\"  --mlockall: lock all memory\\n\");\n \tprintf(\"  --no-mlockall: do not lock all memory\\n\");\n+#endif\n \tprintf(\"  --mp-alloc <native|anon|xmem|xmemhuge>: mempool allocation method.\\n\"\n \t       \"    native: use regular DPDK memory to create and populate mempool\\n\"\n \t       \"    anon: use regular DPDK memory to create and anonymous memory to populate mempool\\n\"\n@@ -211,7 +213,7 @@ usage(char* progname)\n \n #ifdef RTE_LIB_CMDLINE\n static int\n-init_peer_eth_addrs(char *config_filename)\n+init_peer_eth_addrs(const char *config_filename)\n {\n \tFILE *config_file;\n \tportid_t i;\n@@ -610,8 +612,10 @@ launch_args_parse(int argc, char** argv)\n \t\t{ \"hot-plug\",\t\t\t0, 0, 0 },\n \t\t{ \"vxlan-gpe-port\",\t\t1, 0, 0 },\n \t\t{ \"geneve-parsed-port\",\t\t1, 0, 0 },\n+#ifndef RTE_EXEC_ENV_WINDOWS\n \t\t{ \"mlockall\",\t\t\t0, 0, 0 },\n \t\t{ \"no-mlockall\",\t\t0, 0, 0 },\n+#endif\n \t\t{ \"mp-alloc\",\t\t\t1, 0, 0 },\n \t\t{ \"tx-ip\",\t\t\t1, 0, 0 },\n \t\t{ \"tx-udp\",\t\t\t1, 0, 0 },\n@@ -723,13 +727,13 @@ launch_args_parse(int argc, char** argv)\n \t\t\t\t\t\t \"Invalid tx-ip: %s\", optarg);\n \n \t\t\t\t*end++ = 0;\n-\t\t\t\tif (inet_aton(optarg, &in) == 0)\n+\t\t\t\tif (inet_pton(AF_INET, optarg, &in) == 0)\n \t\t\t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\t\t \"Invalid source IP address: %s\\n\",\n \t\t\t\t\t\t optarg);\n \t\t\t\ttx_ip_src_addr = rte_be_to_cpu_32(in.s_addr);\n \n-\t\t\t\tif (inet_aton(end, &in) == 0)\n+\t\t\t\tif (inet_pton(AF_INET, end, &in) == 0)\n \t\t\t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\t\t \"Invalid destination IP address: %s\\n\",\n \t\t\t\t\t\t optarg);\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex d4be23f8f..24a23dbd6 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -9,7 +9,9 @@\n #include <string.h>\n #include <time.h>\n #include <fcntl.h>\n+#ifndef RTE_EXEC_ENV_WINDOWS\n #include <sys/mman.h>\n+#endif\n #include <sys/types.h>\n #include <errno.h>\n #include <stdbool.h>\n@@ -60,6 +62,9 @@\n #ifdef RTE_LIB_LATENCYSTATS\n #include <rte_latencystats.h>\n #endif\n+#ifdef RTE_EXEC_ENV_WINDOWS\n+#include <process.h>\n+#endif\n \n #include \"testpmd.h\"\n \n@@ -632,6 +637,7 @@ set_def_fwd_config(void)\n \tset_default_fwd_ports_config();\n }\n \n+#ifndef RTE_EXEC_ENV_WINDOWS\n /* extremely pessimistic estimation of memory required to create a mempool */\n static int\n calc_mem_size(uint32_t nb_mbufs, uint32_t mbuf_sz, size_t pgsz, size_t *out)\n@@ -902,6 +908,7 @@ dma_map_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused,\n \t\t}\n \t}\n }\n+#endif\n \n static unsigned int\n setup_extbuf(uint32_t nb_mbufs, uint16_t mbuf_sz, unsigned int socket_id,\n@@ -972,9 +979,11 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,\n {\n \tchar pool_name[RTE_MEMPOOL_NAMESIZE];\n \tstruct rte_mempool *rte_mp = NULL;\n+#ifndef RTE_EXEC_ENV_WINDOWS\n \tuint32_t mb_size;\n \n \tmb_size = sizeof(struct rte_mbuf) + mbuf_seg_size;\n+#endif\n \tmbuf_poolname_build(socket_id, pool_name, sizeof(pool_name), size_idx);\n \n \tTESTPMD_LOG(INFO,\n@@ -991,6 +1000,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,\n \t\t\t\tmb_mempool_cache, 0, mbuf_seg_size, socket_id);\n \t\t\tbreak;\n \t\t}\n+#ifndef RTE_EXEC_ENV_WINDOWS\n \tcase MP_ALLOC_ANON:\n \t\t{\n \t\t\trte_mp = rte_mempool_create_empty(pool_name, nb_mbuf,\n@@ -1031,6 +1041,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,\n \t\t\t\t\theap_socket);\n \t\t\tbreak;\n \t\t}\n+#endif\n \tcase MP_ALLOC_XBUF:\n \t\t{\n \t\t\tstruct rte_pktmbuf_extmem *ext_mem;\n@@ -1057,6 +1068,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,\n \t\t}\n \t}\n \n+#ifndef RTE_EXEC_ENV_WINDOWS\n err:\n \tif (rte_mp == NULL) {\n \t\trte_exit(EXIT_FAILURE,\n@@ -1065,6 +1077,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,\n \t} else if (verbose_level > 0) {\n \t\trte_mempool_dump(stdout, rte_mp);\n \t}\n+#endif\n \treturn rte_mp;\n }\n \n@@ -3055,6 +3068,7 @@ pmd_test_exit(void)\n \tif (test_done == 0)\n \t\tstop_packet_forwarding();\n \n+#ifndef RTE_EXEC_ENV_WINDOWS\n \tfor (i = 0 ; i < RTE_DIM(mempools) ; i++) {\n \t\tif (mempools[i]) {\n \t\t\tif (mp_alloc_type == MP_ALLOC_ANON)\n@@ -3062,6 +3076,7 @@ pmd_test_exit(void)\n \t\t\t\t\t\t     NULL);\n \t\t}\n \t}\n+#endif\n \tif (ports != NULL) {\n \t\tno_link_check = 1;\n \t\tRTE_ETH_FOREACH_DEV(pt_id) {\n@@ -3762,7 +3777,9 @@ signal_handler(int signum)\n \t\tf_quit = 1;\n \t\t/* exit with the expected status */\n \t\tsignal(signum, SIG_DFL);\n+#ifndef RTE_EXEC_ENV_WINDOWS\n \t\tkill(getpid(), signum);\n+#endif\n \t}\n }\n \n@@ -3837,10 +3854,12 @@ main(int argc, char** argv)\n \tif (argc > 1)\n \t\tlaunch_args_parse(argc, argv);\n \n+#ifndef RTE_EXEC_ENV_WINDOWS\n \tif (do_mlockall && mlockall(MCL_CURRENT | MCL_FUTURE)) {\n \t\tTESTPMD_LOG(NOTICE, \"mlockall() failed with error \\\"%s\\\"\\n\",\n \t\t\tstrerror(errno));\n \t}\n+#endif\n \n \tif (tx_first && interactive)\n \t\trte_exit(EXIT_FAILURE, \"--tx-first cannot be used on \"\n@@ -3961,7 +3980,7 @@ main(int argc, char** argv)\n \t\t\t\t}\n \t\t\t\t/* Sleep to avoid unnecessary checks */\n \t\t\t\tprev_time = cur_time;\n-\t\t\t\tsleep(1);\n+\t\t\t\trte_delay_us_sleep(1000000);\n \t\t\t}\n \t\t}\n \ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 1d104213b..a4115861b 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -763,7 +763,7 @@ inc_tx_burst_stats(struct fwd_stream *fs, uint16_t nb_tx)\n }\n \n /* Prototypes */\n-unsigned int parse_item_list(char* str, const char* item_name,\n+unsigned int parse_item_list(const char *str, const char *item_name,\n \t\t\tunsigned int max_items,\n \t\t\tunsigned int *parsed_items, int check_unique_values);\n void launch_args_parse(int argc, char** argv);\n",
    "prefixes": [
        "v7",
        "07/10"
    ]
}