On Tue, Nov 13, 2012 at 2:19 PM, Kyle Mestery <kmest...@cisco.com> wrote:

> Add support for VXLAN tunnels to Open vSwitch. Add support
> for setting the destination UDP port on a per-port basis.
> This is done by adding a "dst_port" parameter to the port
> configuration. This is only applicable currently to VXLAN
> tunnels.
>
> Specifically, I'd like some comments on the hashing for the source
> port selection. Currently it's using the flow-hash to generate a
> source port. I think what we could replace it with is this:
>
>         return (__force __be16)skb_get_rxhash(skb) | htons(32768);


I haven't looked at the whole thing yet but as far as this specific point,
here's the way that it is done upstream:

/* Compute source port for outgoing packet
 *   first choice to use L4 flow hash since it will spread
 *     better and maybe available from hardware
 *   secondary choice is to use jhash on the Ethernet header
 */
static u16 vxlan_src_port(const struct vxlan_dev *vxlan, struct sk_buff
*skb)
{
        unsigned int range = (vxlan->port_max - vxlan->port_min) + 1;
        u32 hash;

        hash = skb_get_rxhash(skb);
        if (!hash)
                hash = jhash(skb->data, 2 * ETH_ALEN,
                             (__force u32) skb->protocol);

        return (((u64) hash * range) >> 32) + vxlan->port_min;
}

where port_min and max are determined using inet_get_local_port_range().
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to