[ovs-dev] [PATCH 5/6] datapath: Update IPv6 parsing code for kernel style.

Ben Pfaff blp at nicira.com
Thu Mar 3 18:55:08 UTC 2011


On Wed, Mar 02, 2011 at 07:20:34PM -0800, Jesse Gross wrote:
> Fixes a number of minor elements in the IPv6 extraction and
> parsing code to better conform to kernel style.  Examples include
> using kernel types/functions, adding line breaks, and using
> unlikely() macros.  There is no functional change.
> 
> Signed-off-by: Jesse Gross <jesse at nicira.com>

I see some overparenthesization is still here, e.g.
	if (icmp->icmp6_code == 0 &&
	    ((icmp->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION) ||
	     (icmp->icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT))) {
could be reduced to:
	if (icmp->icmp6_code == 0 &&
	    (icmp->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION ||
	     icmp->icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT)) {
I find the latter easier to read but it's a judgment call of course.

As another example:
			if (unlikely(!opt_len || (opt_len > icmp_len)))
could be:
			if (unlikely(!opt_len || opt_len > icmp_len))

Here, I think that kernel style calls for && to be at end of line:
> +				   && opt_len == 8) {

Ditto here:
> +			    && swkey->tp_src != htons(NDISC_NEIGHBOUR_ADVERTISEMENT))

Acked-by: Ben Pfaff <blp at nicira.com>




More information about the dev mailing list