get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 81109,
    "url": "http://patches.dpdk.org/api/patches/81109/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20201016131243.21672-2-konstantin.ananyev@intel.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": "<20201016131243.21672-2-konstantin.ananyev@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201016131243.21672-2-konstantin.ananyev@intel.com",
    "date": "2020-10-16T13:12:42",
    "name": "[v4,1/2] examples/l3fwd-acl: add source and destination MAC update",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "2707fd5c5cf96b291177863e3124159690218471",
    "submitter": {
        "id": 33,
        "url": "http://patches.dpdk.org/api/people/33/?format=api",
        "name": "Ananyev, Konstantin",
        "email": "konstantin.ananyev@intel.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20201016131243.21672-2-konstantin.ananyev@intel.com/mbox/",
    "series": [
        {
            "id": 13063,
            "url": "http://patches.dpdk.org/api/series/13063/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=13063",
            "date": "2020-10-16T13:12:41",
            "name": "Few enhancements for l3fwd-acl",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/13063/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/81109/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/81109/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 6662EA04DB;\n\tFri, 16 Oct 2020 15:13:14 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 8EB951E93D;\n\tFri, 16 Oct 2020 15:12:59 +0200 (CEST)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n by dpdk.org (Postfix) with ESMTP id 525661D5D3\n for <dev@dpdk.org>; Fri, 16 Oct 2020 15:12:57 +0200 (CEST)",
            "from fmsmga007.fm.intel.com ([10.253.24.52])\n by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 16 Oct 2020 06:12:56 -0700",
            "from sivswdev08.ir.intel.com ([10.237.217.47])\n by fmsmga007.fm.intel.com with ESMTP; 16 Oct 2020 06:12:55 -0700"
        ],
        "IronPort-SDR": [
            "\n 83qQ/dX3hfEg0Hhyxic+spR7JafuvgKwLwEN5c8rOWEKWYfEtBGBzZY8pCz53d/QyyOJPpL0yS\n fnVLC+kyWA/Q==",
            "\n aRBs3d2sZSPvCTlsrL4NbOV3+jhvdKqT3X/pV1oOgOIG18xJGu6s2+paRN5++t2JKEWnhVo0DZ\n AJqk7rmh810A=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9775\"; a=\"230797799\"",
            "E=Sophos;i=\"5.77,383,1596524400\"; d=\"scan'208\";a=\"230797799\"",
            "E=Sophos;i=\"5.77,383,1596524400\"; d=\"scan'208\";a=\"300699256\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Konstantin Ananyev <konstantin.ananyev@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Konstantin Ananyev <konstantin.ananyev@intel.com>",
        "Date": "Fri, 16 Oct 2020 14:12:42 +0100",
        "Message-Id": "<20201016131243.21672-2-konstantin.ananyev@intel.com>",
        "X-Mailer": "git-send-email 2.18.0",
        "In-Reply-To": "<20201016131243.21672-1-konstantin.ananyev@intel.com>",
        "References": "<20201006171618.19374-1-konstantin.ananyev@intel.com>\n <20201016131243.21672-1-konstantin.ananyev@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v4 1/2] examples/l3fwd-acl: add source and\n\tdestination MAC update",
        "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 <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": "Introduces two changes into l3fwd-acl behaviour to make\nit behave in the same way as l3fwd:\n   - Add a command-line parameter to allow the user to specify the\n     destination mac address for each ethernet port used.\n   - While forwarding the packet update source and destination mac\n     addresses.\n\nSigned-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>\n---\n doc/guides/rel_notes/release_20_11.rst        |  5 ++\n .../sample_app_ug/l3_forward_access_ctrl.rst  |  4 +-\n examples/l3fwd-acl/main.c                     | 67 +++++++++++++++++--\n 3 files changed, 70 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst\nindex cda5b2f5b2..3b23a9a206 100644\n--- a/doc/guides/rel_notes/release_20_11.rst\n+++ b/doc/guides/rel_notes/release_20_11.rst\n@@ -276,6 +276,11 @@ New Features\n   * Added scatter gather support.\n   * Added NIST GCMVS complaint GMAC test method support.\n \n+* **Add new command-line parameter for l3wfd-acl sample application.**\n+\n+  Added new optional parameter ``--eth-dest`` for the ``l3fwd-acl`` to allow\n+  the user to specify the destination mac address for each ethernet port used.\n+\n \n Removed Items\n -------------\ndiff --git a/doc/guides/sample_app_ug/l3_forward_access_ctrl.rst b/doc/guides/sample_app_ug/l3_forward_access_ctrl.rst\nindex a44fbcd52c..91004356ed 100644\n--- a/doc/guides/sample_app_ug/l3_forward_access_ctrl.rst\n+++ b/doc/guides/sample_app_ug/l3_forward_access_ctrl.rst\n@@ -236,7 +236,7 @@ The application has a number of command line options:\n \n ..  code-block:: console\n \n-    ./build/l3fwd-acl [EAL options] -- -p PORTMASK [-P] --config(port,queue,lcore)[,(port,queue,lcore)] --rule_ipv4 FILENAME rule_ipv6 FILENAME [--scalar] [--enable-jumbo [--max-pkt-len PKTLEN]] [--no-numa]\n+    ./build/l3fwd-acl [EAL options] -- -p PORTMASK [-P] --config(port,queue,lcore)[,(port,queue,lcore)] --rule_ipv4 FILENAME rule_ipv6 FILENAME [--scalar] [--enable-jumbo [--max-pkt-len PKTLEN]] [--no-numa] [--eth-dest=X,MM:MM:MM:MM:MM:MM]\n \n \n where,\n@@ -260,6 +260,8 @@ where,\n \n *   --no-numa: optional, disables numa awareness\n \n+*   --eth-dest=X,MM:MM:MM:MM:MM:MM: optional, ethernet destination for port X\n+\n For example, consider a dual processor socket platform with 8 physical cores, where cores 0-7 and 16-23 appear on socket 0,\n while cores 8-15 and 24-31 appear on socket 1.\n \ndiff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c\nindex 4386584667..16e9530b3b 100644\n--- a/examples/l3fwd-acl/main.c\n+++ b/examples/l3fwd-acl/main.c\n@@ -39,6 +39,9 @@\n #include <rte_string_fns.h>\n #include <rte_acl.h>\n \n+#include <cmdline_parse.h>\n+#include <cmdline_parse_etheraddr.h>\n+\n #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG\n #define L3FWDACL_DEBUG\n #endif\n@@ -81,9 +84,6 @@\n static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;\n static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;\n \n-/* ethernet addresses of ports */\n-static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];\n-\n /* mask of enabled ports */\n static uint32_t enabled_port_mask;\n static int promiscuous_on; /**< Ports set in promiscuous mode off by default. */\n@@ -143,6 +143,9 @@ static struct rte_eth_conf port_conf = {\n \n static struct rte_mempool *pktmbuf_pool[NB_SOCKETS];\n \n+/* ethernet addresses of ports */\n+static struct rte_ether_hdr port_l2hdr[RTE_MAX_ETHPORTS];\n+\n /***********************start of ACL part******************************/\n #ifdef DO_RFC_1812_CHECKS\n static inline int\n@@ -164,6 +167,7 @@ send_single_packet(struct rte_mbuf *m, uint16_t port);\n #define OPTION_RULE_IPV4\t\"rule_ipv4\"\n #define OPTION_RULE_IPV6\t\"rule_ipv6\"\n #define OPTION_SCALAR\t\t\"scalar\"\n+#define OPTION_ETH_DEST\t\t\"eth-dest\"\n #define ACL_DENY_SIGNATURE\t0xf0000000\n #define RTE_LOGTYPE_L3FWDACL\tRTE_LOGTYPE_USER3\n #define acl_log(format, ...)\tRTE_LOG(ERR, L3FWDACL, format, ##__VA_ARGS__)\n@@ -1275,9 +1279,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port)\n {\n \tuint32_t lcore_id;\n \tstruct lcore_conf *qconf;\n+\tstruct rte_ether_hdr *eh;\n \n \tlcore_id = rte_lcore_id();\n \n+\t/* update src and dst mac*/\n+\teh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);\n+\tmemcpy(eh, &port_l2hdr[port], sizeof(eh->d_addr) + sizeof(eh->s_addr));\n+\n \tqconf = &lcore_conf[lcore_id];\n \trte_eth_tx_buffer(port, qconf->tx_queue_id[port],\n \t\t\tqconf->tx_buffer[port], m);\n@@ -1627,6 +1636,26 @@ parse_config(const char *q_arg)\n \treturn 0;\n }\n \n+static const char *\n+parse_eth_dest(const char *optarg)\n+{\n+\tunsigned long portid;\n+\tchar *port_end;\n+\n+\terrno = 0;\n+\tportid = strtoul(optarg, &port_end, 0);\n+\tif (errno != 0 || port_end == optarg || *port_end++ != ',')\n+\t\treturn \"Invalid format\";\n+\telse if (portid >= RTE_MAX_ETHPORTS)\n+\t\treturn \"port value exceeds RTE_MAX_ETHPORTS(\"\n+\t\t\tRTE_STR(RTE_MAX_ETHPORTS) \")\";\n+\n+\tif (cmdline_parse_etheraddr(NULL, port_end, &port_l2hdr[portid].d_addr,\n+\t\t\tsizeof(port_l2hdr[portid].d_addr)) < 0)\n+\t\treturn \"Invalid ethernet address\";\n+\treturn NULL;\n+}\n+\n /* Parse the argument given in the command line of the application */\n static int\n parse_args(int argc, char **argv)\n@@ -1642,6 +1671,7 @@ parse_args(int argc, char **argv)\n \t\t{OPTION_RULE_IPV4, 1, 0, 0},\n \t\t{OPTION_RULE_IPV6, 1, 0, 0},\n \t\t{OPTION_SCALAR, 0, 0, 0},\n+\t\t{OPTION_ETH_DEST, 1, 0, 0},\n \t\t{NULL, 0, 0, 0}\n \t};\n \n@@ -1737,6 +1767,16 @@ parse_args(int argc, char **argv)\n \t\t\t\t\tOPTION_SCALAR, sizeof(OPTION_SCALAR)))\n \t\t\t\tparm_config.scalar = 1;\n \n+\t\t\tif (!strncmp(lgopts[option_index].name, OPTION_ETH_DEST,\n+\t\t\t\t\tsizeof(OPTION_ETH_DEST))) {\n+\t\t\t\tconst char *serr = parse_eth_dest(optarg);\n+\t\t\t\tif (serr != NULL) {\n+\t\t\t\t\tprintf(\"invalid %s value:\\\"%s\\\": %s\\n\",\n+\t\t\t\t\t\tOPTION_ETH_DEST, optarg, serr);\n+\t\t\t\t\tprint_usage(prgname);\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\t\t\t}\n \n \t\t\tbreak;\n \n@@ -1862,6 +1902,20 @@ check_all_ports_link_status(uint32_t port_mask)\n \t}\n }\n \n+/*\n+ * build-up default vaues for dest MACs.\n+ */\n+static void\n+set_default_dest_mac(void)\n+{\n+\tuint32_t i;\n+\n+\tfor (i = 0; i != RTE_DIM(port_l2hdr); i++) {\n+\t\tport_l2hdr[i].d_addr.addr_bytes[0] = RTE_ETHER_LOCAL_ADMIN_ADDR;\n+\t\tport_l2hdr[i].d_addr.addr_bytes[5] = i;\n+\t}\n+}\n+\n int\n main(int argc, char **argv)\n {\n@@ -1883,6 +1937,8 @@ main(int argc, char **argv)\n \targc -= ret;\n \targv += ret;\n \n+\tset_default_dest_mac();\n+\n \t/* parse application arguments (after the EAL ones) */\n \tret = parse_args(argc, argv);\n \tif (ret < 0)\n@@ -1962,13 +2018,14 @@ main(int argc, char **argv)\n \t\t\t\t\"rte_eth_dev_adjust_nb_rx_tx_desc: err=%d, port=%d\\n\",\n \t\t\t\tret, portid);\n \n-\t\tret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);\n+\t\tret = rte_eth_macaddr_get(portid, &port_l2hdr[portid].s_addr);\n \t\tif (ret < 0)\n \t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\"rte_eth_macaddr_get: err=%d, port=%d\\n\",\n \t\t\t\tret, portid);\n \n-\t\tprint_ethaddr(\" Address:\", &ports_eth_addr[portid]);\n+\t\tprint_ethaddr(\"Dst MAC:\", &port_l2hdr[portid].d_addr);\n+\t\tprint_ethaddr(\", Src MAC:\", &port_l2hdr[portid].s_addr);\n \t\tprintf(\", \");\n \n \t\t/* init memory */\n",
    "prefixes": [
        "v4",
        "1/2"
    ]
}