[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALnjE+pXY_pPKiHgiO9hVCo_2rNbZ_pPgx-i1KesjEt8E6Nhug@mail.gmail.com>
Date: Mon, 12 Jan 2015 14:31:00 -0800
From: Pravin Shelar <pshelar@...ira.com>
To: Fan Du <fan.du@...el.com>
Cc: "dev@...nvswitch.org" <dev@...nvswitch.org>,
netdev <netdev@...r.kernel.org>, fengyuleidian0615@...il.com
Subject: Re: [PATCH net-next] openvswitch: Introduce vport_route_lookup
On Mon, Jan 12, 2015 at 1:14 AM, Fan Du <fan.du@...el.com> wrote:
> Introduce vport_route_lookup to consolidate route lookup
> shared by vxlan, gre, and geneve ports.
>
> Signed-off-by: Fan Du <fan.du@...el.com>
> ---
...
> }
> +
> +struct rtable *vport_route_lookup(struct ovs_key_ipv4_tunnel *tun_key,
> + struct sk_buff *skb,
> + struct flowi4 *fl,
> + struct net *net,
> + u8 protocol)
> +{
> + struct rtable *rt;
> +
> + memset(fl, 0, sizeof(*fl));
> + fl->daddr = tun_key->ipv4_dst;
> + fl->saddr = tun_key->ipv4_src;
> + fl->flowi4_tos = RT_TOS(tun_key->ipv4_tos);
> + fl->flowi4_mark = skb->mark;
> + fl->flowi4_proto = protocol;
> +
> + rt = ip_route_output_key(net, fl);
> + return rt;
> +}
> +EXPORT_SYMBOL_GPL(vport_route_lookup);
This is small function and it is in fast path, So can you inline it?
> diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
> index 99c8e71..4487a97 100644
> --- a/net/openvswitch/vport.h
> +++ b/net/openvswitch/vport.h
> @@ -68,6 +68,12 @@ int ovs_tunnel_get_egress_info(struct ovs_tunnel_info *egress_tun_info,
> int ovs_vport_get_egress_tun_info(struct vport *vport, struct sk_buff *skb,
> struct ovs_tunnel_info *info);
>
> +struct rtable *vport_route_lookup(struct ovs_key_ipv4_tunnel *tun_key,
> + struct sk_buff *skb,
> + struct flowi4 *fl,
> + struct net *net,
> + u8 protocol);
> +
> /* The following definitions are for implementers of vport devices: */
>
Generally net is first parameter for networking functions.
Tunnel is better prefix rather than vport for the function name.
You can use new function in ovs_tunnel_get_egress_info().
> struct vport_err_stats {
> --
> 1.7.1
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists