[ovs-dev] [PATCH] tunnel: Support all combinations of flow-based and specific tunnel matches.

Pritesh Kothari (pritkoth) pritkoth at cisco.com
Tue Feb 11 00:00:46 UTC 2014


Hi Ben,

> -    static const struct tnl_match_pattern patterns[] = {
> -        { false, false, IP_SRC_CFG },  /* remote_ip, local_ip, in_key. */
> -        { false, false, IP_SRC_ANY },  /* remote_ip, in_key. */
> -        { true,  false, IP_SRC_CFG },  /* 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. */

It was lot easier to add specific matches in match pattern here when a tunnel
parameter or two gets added. for example when i added nsp and nsi as [1]
parameters i could add 8 matches here bringing the total to 12+8 = 20 matches.

> +    for (in_key_flow = 0; in_key_flow < 2; in_key_flow++) {
> +        for (ip_dst_flow = 0; ip_dst_flow < 2; ip_dst_flow++) {
> +            for (ip_src = 0; ip_src < 3; ip_src++) {
> +                struct hmap *map = tnl_match_maps[i];

<snip>

> +static struct hmap **
> +tnl_match_map(const struct tnl_match *m)
> +{
> +    enum ip_src_type ip_src;
> +
> +    ip_src = (m->ip_src_flow ? IP_SRC_FLOW
> +              : m->ip_src ? IP_SRC_CFG
> +              : IP_SRC_ANY);
> +
> +    return &tnl_match_maps[6 * m->in_key_flow + 3 * m->ip_dst_flow + ip_src];

but now here i can’t actually select specific matches there by only giving me option to add
(2 * 2 * 3) * 2 * 2 = 48 cases, when i add two new parameters. 

any insight into this would be greatly appreciated, alternatively i was thinking
of adding the code shown below, outside the outer most for loop in tnl_find
to add the 8 matches mentioned above, but then tnl_match_map can’t exactly
differentiate these cases from original 12 above, so not sure about it.

    for (in_key_flow = 0; in_key_flow < 2; in_key_flow++) {
        for (in_nsp_flow = 0; in_nsp_flow < 2; in_nsp_flow++) {
            for (in_nsi_flow = 0; ip_nsi_flow < 2; ip_nsi_flow++) {

Regards,
Pritesh

[1] http://openvswitch.org/pipermail/dev/2013-September/032041.html
(rfc in [1] had 18 extra matches, but i have trimmed them down to 8)


More information about the dev mailing list