[ovs-dev] [PATCH 2/2] datapath: Hash only the part of struct sw_flow_key populated by flow_extract().

Andrew Evans aevans at nicira.com
Fri May 13 18:33:13 UTC 2011


On Wed, 2011-05-11 at 20:09 -0700, Jesse Gross wrote:
> I think it makes sense to group them, I was just looking for a
> consistent policy.  Right now we are consistent in that we only do it
> with unions but that doesn't mean there isn't something better.  I
> think the right policy is fields that are always assigned together,
> which is that list of header groups that I mentioned before.

Ok, does this look reasonable?

struct sw_flow_key {
	struct {
		__be64 tun_id;			/* Encapsulating tunnel ID. */
		u16    in_port;			/* Input switch port. */
		u8     dl_src[ETH_ALEN];	/* Ethernet source address. */
		u8     dl_dst[ETH_ALEN];	/* Ethernet destination address. */
		__be16 dl_tci;			/* 0 if no VLAN, VLAN_TAG_PRESENT set otherwise. */
		__be16 dl_type;			/* Ethernet frame type. */
	} eth;
	struct {
		u8     nw_proto;		/* IP protocol or lower 8 bits of ARP opcode. */
		u8     nw_tos;			/* IP ToS (DSCP field, 6 bits). */
	} ip;
	union {
		struct {
			struct {
				__be32 src;	/* IP source address. */
				__be32 dst;	/* IP destination address. */
			} addr;
			union {
				struct {
					__be16 src;		/* TCP/UDP source port. */
					__be16 dst;		/* TCP/UDP destination port. */
				} tp;
				struct {
					u8 sha[ETH_ALEN];	/* ARP source hardware address. */
					u8 tha[ETH_ALEN];	/* ARP target hardware address. */
				} arp;
			};
		} ipv4;
		struct {
			struct {
				struct in6_addr src;	   /* IPv6 source address. */
				struct in6_addr dst;	   /* IPv6 destination address. */
			} addr;
			struct {
				__be16 src;		   /* TCP/UDP source port. */
				__be16 dst;		   /* TCP/UDP destination port. */
			} tp;
			struct {
				struct in6_addr nd_target; /* ND target address. */
				u8 nd_sll[ETH_ALEN];	   /* ND source link layer address. */
				u8 nd_tll[ETH_ALEN];	   /* ND target link layer address. */
			} nd;
		} ipv6;
	};
};





More information about the dev mailing list