get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 952122,
    "url": "http://patchwork.ozlabs.org/api/patches/952122/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/20180801121635.14509-5-vkommadi@redhat.com/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/projects/47/?format=api",
        "name": "Open vSwitch",
        "link_name": "openvswitch",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "git@github.com:openvswitch/ovs.git",
        "webscm_url": "https://github.com/openvswitch/ovs",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20180801121635.14509-5-vkommadi@redhat.com>",
    "list_archive_url": null,
    "date": "2018-08-01T12:16:35",
    "name": "[ovs-dev,v7,4/4] Replace router internal MAC with gateway MAC for reply packets",
    "commit_ref": null,
    "pull_url": null,
    "state": "deferred",
    "archived": false,
    "hash": "9132ca2cddee8b24385d650a655778f84c34ad8c",
    "submitter": {
        "id": 67383,
        "url": "http://patchwork.ozlabs.org/api/people/67383/?format=api",
        "name": "Venkata Anil",
        "email": "vkommadi@redhat.com"
    },
    "delegate": {
        "id": 55684,
        "url": "http://patchwork.ozlabs.org/api/users/55684/?format=api",
        "username": "jpettit",
        "first_name": "Justin",
        "last_name": "Pettit",
        "email": "jpettit@nicira.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/20180801121635.14509-5-vkommadi@redhat.com/mbox/",
    "series": [
        {
            "id": 58787,
            "url": "http://patchwork.ozlabs.org/api/series/58787/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/openvswitch/list/?series=58787",
            "date": "2018-08-01T12:16:31",
            "name": "Use VLANs for VLAN packets redirected to a gateway chassis",
            "version": 7,
            "mbox": "http://patchwork.ozlabs.org/series/58787/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/952122/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/952122/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ovs-dev-bounces@openvswitch.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "dev@openvswitch.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "ovs-dev@mail.linuxfoundation.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=redhat.com"
        ],
        "Received": [
            "from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 41gXQs55DRz9s3Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  1 Aug 2018 22:18:45 +1000 (AEST)",
            "from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 951F2E17;\n\tWed,  1 Aug 2018 12:17:01 +0000 (UTC)",
            "from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 91D76E04\n\tfor <dev@openvswitch.org>; Wed,  1 Aug 2018 12:17:00 +0000 (UTC)",
            "from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id BD80ECF\n\tfor <dev@openvswitch.org>; Wed,  1 Aug 2018 12:16:59 +0000 (UTC)",
            "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id D01AD87A76\n\tfor <dev@openvswitch.org>; Wed,  1 Aug 2018 12:16:58 +0000 (UTC)",
            "from vkommadi.lab.eng.blr.redhat.com\n\t(dhcp35-207.lab.eng.blr.redhat.com [10.70.35.207])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id ABB921C5BB;\n\tWed,  1 Aug 2018 12:16:57 +0000 (UTC)"
        ],
        "X-Greylist": [
            "domain auto-whitelisted by SQLgrey-1.7.6",
            "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.11.55.1]);\n\tWed, 01 Aug 2018 12:16:58 +0000 (UTC)",
            "inspected by milter-greylist-4.5.16 (mx1.redhat.com\n\t[10.11.55.1]); \n\tWed, 01 Aug 2018 12:16:58 +0000 (UTC) for IP:'10.11.54.5'\n\tDOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com'\n\tHELO:'smtp.corp.redhat.com' FROM:'vkommadi@redhat.com' RCPT:''"
        ],
        "From": "vkommadi@redhat.com",
        "To": "dev@openvswitch.org",
        "Date": "Wed,  1 Aug 2018 17:46:35 +0530",
        "Message-Id": "<20180801121635.14509-5-vkommadi@redhat.com>",
        "In-Reply-To": "<20180801121635.14509-1-vkommadi@redhat.com>",
        "References": "<20180801121635.14509-1-vkommadi@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.11.54.5",
        "X-Spam-Status": "No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED\n\tautolearn=ham version=3.3.1",
        "X-Spam-Checker-Version": "SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org",
        "Subject": "[ovs-dev] [PATCH v7 4/4] Replace router internal MAC with gateway\n\tMAC for reply packets",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.12",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>",
        "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>",
        "List-Post": "<mailto:ovs-dev@openvswitch.org>",
        "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>",
        "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "ovs-dev-bounces@openvswitch.org",
        "Errors-To": "ovs-dev-bounces@openvswitch.org"
    },
    "content": "From: venkata anil <vkommadi@redhat.com>\n\nPrevious patches in the series doesn't address issue 1 explained in [1]\ni.e\n1) removal of router gateway port MAC address on external switches\n   after expiring of aging time.\n2) then external switches unable to learn the gateway MAC as\n   reply packets carry router internal port MAC address as source\n\nTo fix this, router on gateway node will use router gateway MAC address\ninstead of router internal port MAC address as source for reply packets,\nso that external switches can learn gateway MAC address.\nThis is done only for reply packets from router gateway to tenant VLAN\nswitch ports.\nLater before delivering the packet to the port, ovn-controller will\nreplace the gateway MAC with router internal port MAC in table 33.\n\n[1] //mail.openvswitch.org/pipermail/ovs-dev/2018-July/349803.html\n\nReported-by: Miguel Angel Ajo <majopela@redhat.com>\nReported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2018-July/349803.html\nSigned-off-by: Venkata Anil <vkommadi@redhat.com>\n---\n\nv6->v7:\n* Added this patch\n\n\n ovn/controller/physical.c   | 60 ++++++++++++++++++++++++++++++++++++++++++---\n ovn/northd/ovn-northd.8.xml | 10 ++++++++\n ovn/northd/ovn-northd.c     | 29 ++++++++++++++++++++++\n ovn/ovn-architecture.7.xml  |  4 ++-\n 4 files changed, 99 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c\nindex f269a1d..1f41f59 100644\n--- a/ovn/controller/physical.c\n+++ b/ovn/controller/physical.c\n@@ -190,7 +190,9 @@ get_zone_ids(const struct sbrec_port_binding *binding,\n static void\n put_local_common_flows(uint32_t dp_key, uint32_t port_key,\n                        bool nested_container, const struct zone_ids *zone_ids,\n-                       struct ofpbuf *ofpacts_p, struct hmap *flow_table)\n+                       struct ofpbuf *ofpacts_p, struct hmap *flow_table,\n+                       struct local_datapath *ld,\n+                       const struct hmap *local_datapaths)\n {\n     struct match match;\n \n@@ -221,11 +223,63 @@ put_local_common_flows(uint32_t dp_key, uint32_t port_key,\n         }\n     }\n \n+    struct ofpbuf *clone = NULL;\n+    clone = ofpbuf_clone(ofpacts_p);\n+\n     /* Resubmit to table 34. */\n     put_resubmit(OFTABLE_CHECK_LOOPBACK, ofpacts_p);\n     ofctrl_add_flow(flow_table, OFTABLE_LOCAL_OUTPUT, 100, 0,\n                     &match, ofpacts_p);\n \n+    /* For a reply packet from gateway with VLAN switch port as destination\n+     * (excluding localnet_port and external VLAN networks), gateway router\n+     * will use gateway MAC address as source MAC instead of router internal\n+     * port MAC, so that external switches can learn gateway MAC address.\n+     * Here (before packet is given to the port) we replace router gateway\n+     * MAC address with router internal port MAC. */\n+    if (ld->localnet_port && (port_key != ld->localnet_port->tunnel_key)) {\n+        for (int i = 0; i < ld->n_peer_dps; i++) {\n+            struct local_datapath *peer_ldp = get_local_datapath(\n+                local_datapaths, ld->peer_dps[i]->peer_dp->tunnel_key);\n+            const struct sbrec_port_binding *crp;\n+            crp = peer_ldp->chassisredirect_port;\n+            if (!crp) {\n+                continue;\n+            }\n+\n+            if (strcmp(smap_get(&crp->options, \"distributed-port\"),\n+                       ld->peer_dps[i]->peer->logical_port) &&\n+                (port_key != ld->peer_dps[i]->patch->tunnel_key)) {\n+                for (int j = 0; j < crp->n_mac; j++) {\n+                    struct lport_addresses laddrs;\n+                    if (!extract_lsp_addresses(crp->mac[j], &laddrs)) {\n+                        continue;\n+                    }\n+                    match_set_dl_src(&match, laddrs.ea);\n+                    destroy_lport_addresses(&laddrs);\n+                    break;\n+                }\n+                for (int j = 0; j < ld->peer_dps[i]->peer->n_mac; j++) {\n+                    struct lport_addresses laddrs;\n+                    uint64_t mac64;\n+                    if (!extract_lsp_addresses(\n+                        ld->peer_dps[i]->peer->mac[j], &laddrs)) {\n+                        continue;\n+                    }\n+                    mac64 = eth_addr_to_uint64(laddrs.ea);\n+                    put_load(mac64,\n+                             MFF_ETH_SRC, 0, 48, clone);\n+                    destroy_lport_addresses(&laddrs);\n+                    break;\n+                }\n+                put_resubmit(OFTABLE_CHECK_LOOPBACK, clone);\n+                ofctrl_add_flow(flow_table, OFTABLE_LOCAL_OUTPUT, 150, 0,\n+                    &match, clone);\n+            }\n+        }\n+    }\n+    ofpbuf_delete(clone);\n+\n     /* Table 34, Priority 100.\n      * =======================\n      *\n@@ -330,7 +384,7 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_chassis_by_name,\n \n         struct zone_ids binding_zones = get_zone_ids(binding, ct_zones);\n         put_local_common_flows(dp_key, port_key, false, &binding_zones,\n-                               ofpacts_p, flow_table);\n+                               ofpacts_p, flow_table, ld, local_datapaths);\n \n         match_init_catchall(&match);\n         ofpbuf_clear(ofpacts_p);\n@@ -531,7 +585,7 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_chassis_by_name,\n \n         struct zone_ids zone_ids = get_zone_ids(binding, ct_zones);\n         put_local_common_flows(dp_key, port_key, nested_container, &zone_ids,\n-                               ofpacts_p, flow_table);\n+                               ofpacts_p, flow_table, ld, local_datapaths);\n \n         /* Table 0, Priority 200, 150 and 100.\n          * ==============================\ndiff --git a/ovn/northd/ovn-northd.8.xml b/ovn/northd/ovn-northd.8.xml\nindex 8fa5272..876c121 100644\n--- a/ovn/northd/ovn-northd.8.xml\n+++ b/ovn/northd/ovn-northd.8.xml\n@@ -2013,6 +2013,16 @@ next;\n       </li>\n \n       <li>\n+        A priority-100 logical flow with match\n+        <code>inport == <var>GW</var> &amp;&amp;\n+        flags.rcv_from_vlan == 1</code> has actions\n+        <code>eth.dst = <var>E</var>; next;</code>, where\n+        <var>GW</var> is the logical router distributed gateway\n+        port and <var>E</var> is the MAC address of router\n+        distributed gateway port.\n+      </li>\n+\n+      <li>\n         For each NAT rule in the OVN Northbound database that can\n         be handled in a distributed manner, a priority-100 logical\n         flow with match <code>ip4.src == <var>B</var> &amp;&amp;\ndiff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c\nindex bcf0b66..d012bb8 100644\n--- a/ovn/northd/ovn-northd.c\n+++ b/ovn/northd/ovn-northd.c\n@@ -4419,6 +4419,15 @@ add_route(struct hmap *lflows, const struct ovn_port *op,\n     } else {\n         ds_put_format(&actions, \"ip%s.dst\", is_ipv4 ? \"4\" : \"6\");\n     }\n+\n+    if (op->peer && op->peer->od->localnet_port &&\n+        op->od->l3dgw_port && op->od->l3redirect_port &&\n+        (op != op->od->l3redirect_port) &&\n+        (op != op->od->l3dgw_port)) {\n+        ds_put_format(&match, \" && is_chassis_resident(%s)\",\n+                      op->od->l3redirect_port->json_key);\n+        ds_put_format(&actions, \"; flags.rcv_from_vlan = 1\");\n+    }\n     ds_put_format(&actions, \"; \"\n                   \"%sreg1 = %s; \"\n                   \"eth.src = %s; \"\n@@ -6131,6 +6140,26 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,\n                       op->lrp_networks.ipv6_addrs[i].network_s,\n                       op->lrp_networks.ipv6_addrs[i].plen, NULL, NULL);\n         }\n+\n+        /* For a reply packet from gateway with VLAN switch port as\n+         * destination, replace router internal port MAC with router gateway\n+         * MAC address, so that external switches can learn gateway MAC\n+         * address. Later before delivering the packet to the port,\n+         * controller will replace the gateway MAC with router internal port\n+         * MAC in table 33. */\n+        if (op->od->l3dgw_port && (op == op->od->l3dgw_port) &&\n+            op->od->l3redirect_port) {\n+            ds_clear(&actions);\n+            ds_clear(&match);\n+            ds_put_format(&match, \"inport == %s\", op->json_key);\n+            ds_put_format(&match, \" && flags.rcv_from_vlan == 1\");\n+            ds_put_format(&match, \" && is_chassis_resident(%s)\",\n+                          op->od->l3redirect_port->json_key);\n+            ds_put_format(&actions,\n+                          \"eth.src = %s; next;\", op->lrp_networks.ea_s);\n+            ovn_lflow_add(lflows, op->od, S_ROUTER_IN_GW_REDIRECT, 100,\n+                          ds_cstr(&match), ds_cstr(&actions));\n+        }\n     }\n \n     /* Convert the static routes to flows. */\ndiff --git a/ovn/ovn-architecture.7.xml b/ovn/ovn-architecture.7.xml\nindex ad2101c..0de41d2 100644\n--- a/ovn/ovn-architecture.7.xml\n+++ b/ovn/ovn-architecture.7.xml\n@@ -1067,7 +1067,9 @@\n \n       <p>\n         Flows in table 33 resemble those in table 32 but for logical ports that\n-        reside locally rather than remotely.  For unicast logical output ports\n+        reside locally rather than remotely.  If these are VLAN ports and\n+        packet has router gateway port MAC address as source, replace it with\n+        router internal port MAC address. For unicast logical output ports\n         on the local hypervisor, the actions just resubmit to table 34.  For\n         multicast output ports that include one or more logical ports on the\n         local hypervisor, for each such logical port <var>P</var>, the actions\n",
    "prefixes": [
        "ovs-dev",
        "v7",
        "4/4"
    ]
}