[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1349807912.2800.33.camel@bwh-desktop.uk.solarflarecom.com>
Date: Tue, 9 Oct 2012 19:38:32 +0100
From: Ben Hutchings <bhutchings@...arflare.com>
To: Stephen Hemminger <shemminger@...tta.com>
CC: David Miller <davem@...emloft.net>, <netdev@...r.kernel.org>
Subject: Re: [PATCH 4/6] VXLAN bases source UDP port based on flow to help
the receiver to be able to load balance based on outer header flow.
On Tue, 2012-10-09 at 10:56 -0700, Stephen Hemminger wrote:
> This patch restricts the port range to the normal UDP local
> ports, and allows overriding via configruation.
>
> It also uses jhash of Ethernet header when looking at flows
> with out know L3 header.
[...]
> +/* 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;
> +}
[...]
> @@ -1021,6 +1046,18 @@ static int vxlan_validate(struct nlattr
> return -EADDRNOTAVAIL;
> }
> }
> +
> + if (data[IFLA_VXLAN_PORT_RANGE]) {
> + const struct ifla_vxlan_port_range *p
> + = nla_data(data[IFLA_VXLAN_PORT_RANGE]);
> +
> + if ((int)(ntohs(p->high) - ntohs(p->low)) < 1) {
[...]
This seems to be off-by-one - both bounds are inclusive so they can be
equal.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
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