[ovs-dev] [PATCH ovn RFC v3 16/29] Pull Table 13 Arp/ND responder to a separate function

Dumitru Ceara dceara at redhat.com
Thu Aug 13 12:21:07 UTC 2020


On 7/16/20 3:19 PM, anton.ivanov at cambridgegreys.com wrote:
> From: Anton Ivanov <anton.ivanov at cambridgegreys.com>
> 
> Signed-off-by: Anton Ivanov <anton.ivanov at cambridgegreys.com>
> ---
>  northd/ovn-northd.c | 36 +++++++++++++++++++++---------------
>  1 file changed, 21 insertions(+), 15 deletions(-)
> 
> diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
> index 878cfb493..13b3793fc 100644
> --- a/northd/ovn-northd.c
> +++ b/northd/ovn-northd.c
> @@ -6509,6 +6509,26 @@ build_lswitch_flows_step_30_od(struct ovn_datapath *od, struct hmap *lflows)
>      build_lswitch_input_port_sec_od(od, lflows);
>  }
>  
> +static void
> +build_lswitch_flows_step_40_op(struct ovn_port *op, struct hmap *lflows)
> +{
> +    struct ds match = DS_EMPTY_INITIALIZER;
> +
> +    /* Ingress table 13: ARP/ND responder, skip requests coming from localnet
> +     * and vtep ports. (priority 100); see ovn-northd.8.xml for the
> +     * rationale. */
> +    if (op->nbsp) {
> +        if ((!strcmp(op->nbsp->type, "localnet")) ||
> +            (!strcmp(op->nbsp->type, "vtep"))) {
> +            ds_put_format(&match, "inport == %s", op->json_key);
> +            ovn_lflow_add_with_hint(lflows, op->od, S_SWITCH_IN_ARP_ND_RSP,
> +                                    100, ds_cstr(&match), "next;",
> +                                    &op->nbsp->header_);
> +        }
> +    }
> +    ds_destroy(&match);

Nit: we could move 'match' directly inside the innermost if.

Thanks,
Dumitru

> +}
> +
>  static void
>  build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
>                      struct hmap *port_groups, struct hmap *lflows,
> @@ -6546,22 +6566,8 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
>          build_lswitch_flows_step_30_od(od, lflows);
>      }
>  
> -    /* Ingress table 13: ARP/ND responder, skip requests coming from localnet
> -     * and vtep ports. (priority 100); see ovn-northd.8.xml for the
> -     * rationale. */
>      HMAP_FOR_EACH (op, key_node, ports) {
> -        if (!op->nbsp) {
> -            continue;
> -        }
> -
> -        if ((!strcmp(op->nbsp->type, "localnet")) ||
> -            (!strcmp(op->nbsp->type, "vtep"))) {
> -            ds_clear(&match);
> -            ds_put_format(&match, "inport == %s", op->json_key);
> -            ovn_lflow_add_with_hint(lflows, op->od, S_SWITCH_IN_ARP_ND_RSP,
> -                                    100, ds_cstr(&match), "next;",
> -                                    &op->nbsp->header_);
> -        }
> +        build_lswitch_flows_step_40_op(op, lflows);
>      }
>  
>      /* Ingress table 13: ARP/ND responder, reply for known IPs.
> 



More information about the dev mailing list