get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 76733,
    "url": "http://patches.dpdk.org/api/patches/76733/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200907163926.4878-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": "<20200907163926.4878-2-konstantin.ananyev@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200907163926.4878-2-konstantin.ananyev@intel.com",
    "date": "2020-09-07T16:39:25",
    "name": "[1/2] examples/l3fwd-acl: add source and destination MAC update",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "11e58f6c3e7a17bfeda7157e163b6c321f47d2e9",
    "submitter": {
        "id": 33,
        "url": "http://patches.dpdk.org/api/people/33/?format=api",
        "name": "Ananyev, Konstantin",
        "email": "konstantin.ananyev@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200907163926.4878-2-konstantin.ananyev@intel.com/mbox/",
    "series": [
        {
            "id": 11996,
            "url": "http://patches.dpdk.org/api/series/11996/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11996",
            "date": "2020-09-07T16:39:24",
            "name": "Few enhancements for l3fwd-acl",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/11996/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/76733/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/76733/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 DB7F9A04B1;\n\tMon,  7 Sep 2020 18:39:51 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id B51E31C0CC;\n\tMon,  7 Sep 2020 18:39:51 +0200 (CEST)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n by dpdk.org (Postfix) with ESMTP id 0758A1DB8\n for <dev@dpdk.org>; Mon,  7 Sep 2020 18:39:48 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 07 Sep 2020 09:39:48 -0700",
            "from sivswdev08.ir.intel.com ([10.237.217.47])\n by fmsmga006.fm.intel.com with ESMTP; 07 Sep 2020 09:39:47 -0700"
        ],
        "IronPort-SDR": [
            "\n a2tRhXBRUzhTxaUQ99MmIKh5+WNd9jwX4RXdDR9deg6MmqsRimBgTL+42i6FsOg/cD3HvMhOCq\n V5C+sdYHcWsw==",
            "\n goSChRmWl/cK8NHZpTUgY7mqG2HwWD9vLmJGJ94plfw58EK8zZcs5fSXHmXUpzumgWqz2/6geN\n Vtv+2ewszZwg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9737\"; a=\"138072621\"",
            "E=Sophos;i=\"5.76,402,1592895600\"; d=\"scan'208\";a=\"138072621\"",
            "E=Sophos;i=\"5.76,402,1592895600\"; d=\"scan'208\";a=\"504082011\""
        ],
        "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": "Mon,  7 Sep 2020 17:39:25 +0100",
        "Message-Id": "<20200907163926.4878-2-konstantin.ananyev@intel.com>",
        "X-Mailer": "git-send-email 2.18.0",
        "In-Reply-To": "<20200907163926.4878-1-konstantin.ananyev@intel.com>",
        "References": "<20200907163926.4878-1-konstantin.ananyev@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 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                     | 51 +++++++++++++++++--\n 3 files changed, 54 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 df227a177..e9e1fba1c 100644\n--- a/doc/guides/rel_notes/release_20_11.rst\n+++ b/doc/guides/rel_notes/release_20_11.rst\n@@ -55,6 +55,11 @@ New Features\n      Also, make sure to start the actual text at the margin.\n      =======================================================\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 a44fbcd52..91004356e 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 112ec3d2c..39175398e 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@@ -1965,13 +2005,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": [
        "1/2"
    ]
}