Subject: Re: [patch net-next RFC 1/4] openvswitch: split flow structures into ovs specific and generic ones

From: Thomas Graf <[email-masked]>
Date: Thu, 20 Mar 2014 13:04:26 +0000

On 03/19/14 at 04:33pm, Jiri Pirko wrote:
> After this, flow related structures can be used in other code.

LGTM. Definitely makes sense to share flow definition
between OVS and a possible HW switch API.

> Signed-off-by: Jiri Pirko <[email-masked]>
> +	/* Ethernet+IPv4 specific members. */
> +	unsigned char       ar_sha[ETH_ALEN];	/* sender hardware address  */
> +	unsigned char       ar_sip[4];		/* sender IP address        */
> +	unsigned char       ar_tha[ETH_ALEN];	/* target hardware address  */
> +	unsigned char       ar_tip[4];		/* target IP address        */
> +} __packed;
>  
> -struct sw_flow_mask {
> +struct ovs_flow_mask {
>  	int ref_count;
>  	struct rcu_head rcu;

Perhaps move rcu_head to the end if you are touching it anyway.

>  	struct list_head list;
> -	struct sw_flow_key_range range;
> -	struct sw_flow_key key;
> +	struct sw_flow_mask mask;
>  };
>  
> -struct sw_flow_match {
> +struct ovs_flow_match {
>  	struct sw_flow_key *key;
>  	struct sw_flow_key_range range;
>  	struct sw_flow_mask *mask;
> @@ -163,36 +106,20 @@ struct sw_flow_stats {
>  	};
>  };
>  
> -struct sw_flow {
> +struct ovs_flow {
>  	struct rcu_head rcu;

Same here.

>  	struct hlist_node hash_node[2];
>  	u32 hash;
>  
> -	struct sw_flow_key key;
> -	struct sw_flow_key unmasked_key;
> -	struct sw_flow_mask *mask;
> +	struct sw_flow flow;
>  	struct sw_flow_actions __rcu *sf_acts;
>  	struct sw_flow_stats stats;
>  };