From: Jiri Benc <jbenc@redhat.com>
To: Pravin B Shelar <pshelar@nicira.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net] openvswitch: Fix egress tunnel info.
Date: Mon, 5 Oct 2015 20:40:20 +0200 [thread overview]
Message-ID: <20151005204020.56f50496@griffin> (raw)
In-Reply-To: <1444067897-1951-1-git-send-email-pshelar@nicira.com>
On Mon, 5 Oct 2015 10:58:17 -0700, Pravin B Shelar wrote:
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -2337,6 +2337,51 @@ static int vxlan_change_mtu(struct net_device *dev, int new_mtu)
> return 0;
> }
>
> +static int egress_ipv4_tun_info(struct net_device *dev, struct sk_buff *skb,
> + struct ip_tunnel_info *info,
> + __be16 sport, __be16 dport,
> + struct ip_tunnel_info *egress_tun_info,
> + const void **egress_tun_opts)
> +{
> + struct vxlan_dev *vxlan = netdev_priv(dev);
> + struct rtable *rt;
> + struct flowi4 fl4;
> +
> + memset(&fl4, 0, sizeof(fl4));
> + fl4.flowi4_tos = RT_TOS(info->key.tos);
> + fl4.flowi4_mark = skb->mark;
> + fl4.flowi4_proto = IPPROTO_UDP;
> + fl4.daddr = info->key.u.ipv4.dst;
> +
> + rt = ip_route_output_key(vxlan->net, &fl4);
> + if (IS_ERR(rt))
> + return PTR_ERR(rt);
> + ip_rt_put(rt);
> +
> + ipv4_egress_info_init(egress_tun_info, egress_tun_opts, info,
> + fl4.saddr, sport, dport);
> + return 0;
> +}
> +
> +static int vxlan_egress_tun_info(struct net_device *dev, struct sk_buff *skb,
> + struct ip_tunnel_info *egress_tun_info,
> + const void **egress_tun_opts)
> +{
> + struct ip_tunnel_info *info = skb_tunnel_info(skb);
> + struct vxlan_dev *vxlan = netdev_priv(dev);
> + __be16 sport, dport;
> +
> + sport = udp_flow_src_port(dev_net(dev), skb, vxlan->cfg.port_min,
> + vxlan->cfg.port_max, true);
> + dport = info->key.tp_dst ? : vxlan->cfg.dst_port;
> +
> + if (ip_tunnel_info_af(info) == AF_INET)
> + return egress_ipv4_tun_info(dev, skb, info, sport, dport,
> + egress_tun_info,
> + egress_tun_opts);
> + return -EINVAL;
> +}
This duplicates a lot of code from vxlan_xmit_one. I think we want a
common function (or functions) used by both this and xmit.
Jiri
--
Jiri Benc
next prev parent reply other threads:[~2015-10-05 18:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-05 17:58 [PATCH net] openvswitch: Fix egress tunnel info Pravin B Shelar
2015-10-05 18:40 ` Jiri Benc [this message]
2015-10-05 19:37 ` Pravin Shelar
2015-10-06 15:56 ` Jiri Benc
2015-10-06 18:28 ` Pravin Shelar
2015-10-06 18:45 ` Jiri Benc
2015-10-06 18:55 ` Pravin Shelar
2015-10-06 19:03 ` Jiri Benc
2015-10-06 19:21 ` Pravin Shelar
2015-10-06 19:32 ` Jiri Benc
2015-10-06 21:16 ` Pravin Shelar
2015-10-07 8:09 ` Jiri Benc
2015-10-07 9:34 ` Thomas Graf
2015-10-07 9:53 ` Jiri Benc
2015-10-07 17:19 ` Pravin Shelar
2015-10-06 15:42 ` Jiri Benc
2015-10-06 18:26 ` Pravin Shelar
2015-10-06 18:55 ` Jiri Benc
2015-10-06 19:11 ` Pravin Shelar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151005204020.56f50496@griffin \
--to=jbenc@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pshelar@nicira.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).