[ovs-dev] [PATCH 2/8] nsh: userland support for network service headers

Jarno Rajahalme jrajahalme at nicira.com
Tue Oct 1 21:47:06 UTC 2013


On Sep 20, 2013, at 1:04 AM, pritesh <pritesh.kothari at cisco.com> wrote:

> NSH service path (nsp) can be set/unset while creating the port
> as well nsp can be matched on incoming packets.
> 
> Signed-off-by: pritesh <pritesh.kothari at cisco.com>
> 
> 
...
> +++ b/lib/meta-flow.c
> @@ -694,7 +694,24 @@ static const struct mf_field mf_fields[MFF_N_IDS] = {
>         OXM_OF_IPV6_ND_TLL, "OXM_OF_IPV6_ND_TLL",
>         OFPUTIL_P_NXM_OXM_ANY,
>         OFPUTIL_P_NXM_OXM_ANY,
> -    }
> +    },
> +
> +    /* ## ---- ## */
> +    /* ## L"S" ## */
> +    /* ## ---- ## */
> +
> +    {
> +        MFF_NSP, "nsp", NULL,
> +        sizeof(ovs_be32), 24,
> +        MFM_FULLY,
> +        MFS_HEXADECIMAL,
> +        MFP_NONE,
> +        false,
> +        0, NULL,
> +        0, NULL,
> +        OFPUTIL_P_OF10_NXM_ANY,
> +        OFPUTIL_P_OF10_NXM_ANY,

These should be:

        OFPUTIL_P_NONE,
        OFPUTIL_P_NONE,


As matching of nsp is not yet enabled.

> +    },
> };
> 
...
> @@ -418,16 +427,23 @@ tnl_find(const struct flow *flow) OVS_REQ_RDLOCK(rwlock)
>     struct tnl_match_pattern {
>         bool in_key_flow;
>         bool ip_dst_flow;
> +        bool in_nsp_flow;
>         enum ip_src_type ip_src;
>     };
> 
>     static const struct tnl_match_pattern patterns[] = {
> -        { false, false, IP_SRC_EXACT }, /* remote_ip, local_ip, in_key. */
> -        { false, false, IP_SRC_ANY },   /* remote_ip, in_key. */
> -        { true,  false, IP_SRC_EXACT }, /* remote_ip, local_ip. */
> -        { true,  false, IP_SRC_ANY },   /* remote_ip. */
> -        { true,  true,  IP_SRC_ANY },   /* Flow-based remote. */
> -        { true,  true,  IP_SRC_FLOW },  /* Flow-based everything. */
> +        { false, false, false, IP_SRC_EXACT }, /* remote_ip, local_ip, in_key. */
> +        { false, false, false, IP_SRC_ANY },   /* remote_ip, in_key. */
> +        { true,  false, false, IP_SRC_EXACT }, /* remote_ip, local_ip. */
> +        { true,  false, false, IP_SRC_ANY },   /* remote_ip. */
> +        { true,  true,  false, IP_SRC_ANY },   /* Flow-based remote. */
> +        { true,  true,  false, IP_SRC_FLOW },  /* Flow-based everything. */
> +        { false, false, true,  IP_SRC_EXACT }, /* remote_ip, local_ip, in_key. */
> +        { false, false, true,  IP_SRC_ANY },   /* remote_ip, in_key. */
> +        { true,  false, true,  IP_SRC_EXACT }, /* remote_ip, local_ip. */
> +        { true,  false, true,  IP_SRC_ANY },   /* remote_ip. */
> +        { true,  true,  true,  IP_SRC_ANY },   /* Flow-based remote. */
> +        { true,  true,  true,  IP_SRC_FLOW },  /* Flow-based everything. */
>     };
> 

This list gets quite long, and progressively more so with the later patches.
The list is scanned linearly, hashing and matching on each iteration. Are you
sure all the combinations you have added are useful? Do you envision a
separate tunnel being set up for each incoming/outgoing NSP pair, or would
the typical usage set the values as part of the flow match ("in flow")?

>     const struct tnl_match_pattern *p;
> @@ -443,6 +459,9 @@ tnl_find(const struct flow *flow) OVS_REQ_RDLOCK(rwlock)
>         match.in_key_flow = p->in_key_flow;
>         match.in_key = p->in_key_flow ? 0 : flow->tunnel.tun_id;
> 
> +        match.in_nsp_flow = p->in_nsp_flow;
> +        match.in_nsp = p->in_nsp_flow ? 0 : flow->tunnel.nsp;
> +
>         match.ip_dst_flow = p->ip_dst_flow;
>         match.ip_dst = p->ip_dst_flow ? 0 : flow->tunnel.ip_src;
> 
> @@ -477,6 +496,12 @@ tnl_match_fmt(const struct tnl_match *match, struct ds *ds)
>         ds_put_format(ds, ", key=%#"PRIx64, ntohll(match->in_key));
>     }
> 
> +    if (match->in_nsp_flow) {
> +        ds_put_cstr(ds, ", nsp=flow");
> +    } else {
> +        ds_put_format(ds, ", nsp=%#"PRIx32, ntohl(match->in_nsp));
> +    }
> +
>     ds_put_format(ds, ", dp port=%"PRIu32, match->odp_port);
>     ds_put_format(ds, ", pkt mark=%"PRIu32, match->pkt_mark);
> }
> @@ -520,6 +545,19 @@ tnl_port_fmt(const struct tnl_port *tnl_port) OVS_REQ_RDLOCK(rwlock)
>         }
>     }
> 
> +    if (cfg->out_nsp != cfg->in_nsp ||
> +        cfg->out_nsp_present != cfg->in_nsp_present ||
> +        cfg->out_nsp_flow != cfg->in_nsp_flow) {
> +        ds_put_cstr(&ds, ", out_nsp=");
> +        if (!cfg->out_nsp_present) {
> +            ds_put_cstr(&ds, "none");
> +        } else if (cfg->out_nsp_flow) {
> +            ds_put_cstr(&ds, "flow");
> +        } else {
> +            ds_put_format(&ds, "%#"PRIx32, ntohl(cfg->out_nsp));
> +        }
> +    }
> +
>     if (cfg->ttl_inherit) {
>         ds_put_cstr(&ds, ", ttl=inherit");
>     } else {
> -- 
> 1.7.9.5
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev




More information about the dev mailing list