Hi Hepeng,

Thanks for your reply. Can you re-send a separate v3 patch email?
I can't apply your patch to master.
Also some comment below


On Thu, Mar 26, 2020 at 7:21 PM 贺鹏 <[email protected]> wrote:
>
> Hi, I rebase the patch on the latest master branch.
>
>
> From 07f10707699a39e3a6de68012dd6c0453120c543 Mon Sep 17 00:00:00 2001
> From: hepeng <[email protected]>
> Date: Wed, 4 Dec 2019 17:38:22 +0800
> Subject: [PATCH] ofproto-dpif-xlate: do not unwildcard source address if not
>  needed
>
> if the tunnel is specified as "remote_ip=flow", we can try to generate
> a megaflow
> which ignores all source address, such as source mac, source IP address
> in the outter header of the packet. This can reduce the number of
> megaflows and avoid expensive upcall and improve the performance.
>
> Signed-off-by: hepeng <[email protected]>
> ---
>  include/openvswitch/flow.h    |  2 ++
>  ofproto/ofproto-dpif-xlate.c  | 16 +++++++++++-
>  ofproto/tunnel.c              | 17 +++++++++++++
>  ofproto/tunnel.h              |  3 ++-
>  tests/packet-type-aware.at    |  2 +-
>  tests/tunnel-push-pop-ipv6.at |  2 +-
>  tests/tunnel-push-pop.at      | 46 ++++++++++++++++++++++++++++++++++-
>  7 files changed, 83 insertions(+), 5 deletions(-)
>
> diff --git a/include/openvswitch/flow.h b/include/openvswitch/flow.h
> index 3054015d9..a4c810e63 100644
> --- a/include/openvswitch/flow.h
> +++ b/include/openvswitch/flow.h
> @@ -204,6 +204,8 @@ struct flow_wildcards {
>      ((WC)->masks.FIELD |= (MASK))
>  #define WC_UNMASK_FIELD(WC, FIELD) \
>      memset(&(WC)->masks.FIELD, 0, sizeof (WC)->masks.FIELD)
> +#define WC_FIELD_MASKED(WC, FIELD) \
> +    ((WC)->masks.FIELD != 0)
>
>  void flow_wildcards_init_catchall(struct flow_wildcards *);
>
> diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
> index 042c50a63..4c0cae30d 100644
> --- a/ofproto/ofproto-dpif-xlate.c
> +++ b/ofproto/ofproto-dpif-xlate.c
> @@ -4088,7 +4088,17 @@ terminate_native_tunnel(struct xlate_ctx *ctx,
> struct flow *flow,
>      /* XXX: Write better Filter for tunnel port. We can use in_port
>       * in tunnel-port flow to avoid these checks completely. */
>      if (ovs_native_tunneling_is_on(ctx->xbridge->ofproto)) {
> -        *tnl_port = tnl_port_map_lookup(flow, wc);
> +        /* Check if the wc contains source info, if not,
> +         * erase all source info including smac and sip.
> +         */
> +        if (!WC_FIELD_MASKED(wc, nw_src)) {
> +            *tnl_port = tnl_port_map_lookup(flow, wc);

Move out the if else statement since both has it?

> +            if (*tnl_port != ODPP_NONE && !WC_FIELD_MASKED(wc, nw_src)) {

why check "!WC_FIELD_MASKED(wc, nw_src)" again?  the outer "if"
already check it.

> +                memset(&wc->masks.dl_src, 0, sizeof wc->masks.dl_src);

use WC_UNMASK_FIELD?

Thank you
William
> +            }
> +        } else {
> +            *tnl_port = tnl_port_map_lookup(flow, wc);
> +        }
>
>          /* If no tunnel port was found and it's about an ARP or ICMPv6 
> packet,
>           * do tunnel neighbor snooping. */
> @@ -7617,6 +7627,10 @@ xlate_actions(struct xlate_in *xin, struct
> xlate_out *xout)
>          ctx.xin->xport_uuid = in_port->uuid;
>      }
>
> +    if (in_port && in_port->is_tunnel) {
> +        tnl_wc_init_by_port(in_port->ofport, ctx.wc);
> +    }
> +
>      if (flow->packet_type != htonl(PT_ETH) && in_port &&
>          in_port->pt_mode == NETDEV_PT_LEGACY_L3 && ctx.table_id == 0) {
>          /* Add dummy Ethernet header to non-L2 packet if it's coming from a
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to