On 10/16/14 at 11:38am, Pravin B Shelar wrote:
> Rather than using hmap for storing routing entries we can directly use
> classifier which has support for priority and wildcard entries.
> This makes route lookup lockless. This help when we use route lookup
> for native tunneling.
> 
> Signed-off-by: Pravin B Shelar <pshe...@nicira.com>

LGTM. Some minor comments belows. Nothing that should block this.

Acked-by: Thomas Graf <tg...@noironetworks.com>


> +bool
> +ovs_router_lookup(ovs_be32 ip_dst, char output_bridge[], ovs_be32 *gw)
> +{
> +    const struct cls_rule *cr;
> +    struct flow flow;
> +
> +    memset(&flow, 0, sizeof(flow));
> +    flow.nw_dst = ip_dst;

This could use c99 designated initializers at some point to avoid the
explicit memset().

> +static bool
> +rt_entry_delete(uint8_t priority, ovs_be32 ip_dst, uint8_t plen)
> +{
> +    struct cls_rule *cr;
> +    struct cls_rule rule;
> +    struct match match;
> +    ovs_be32 mask = htonl(UINT32_MAX << (32 - plen));
> +
> +    ip_dst &= mask; /* Clear out insignificant bits. */
> +
> +    memset(&match, 0, sizeof match);
> +    match.flow.nw_dst = ip_dst;
> +    match.wc.masks.nw_dst = mask;
> +    cls_rule_init(&rule, &match, priority);

Maybe factor out the match init code of his and the insert() function
into a helper?

> +static void
> +ovs_router_add(struct unixctl_conn *conn, int argc,
> +              const char *argv[], void *aux OVS_UNUSED)
> +{
> +    ovs_be32 ip, gw;
> +    unsigned int plen;
> +
> +    if (scan_ipv4_route(argv[1], &ip, &plen)) {
> +        if (argc > 3) {
> +            inet_aton(argv[3], (struct in_addr *)&gw);

Use inet_pton() here?
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to