Subject: Re: [PATCH RFC v2 1/2] net/802: Implement Multiple Registration Protocol (MRP)

From: Patrick McHardy <[email-masked]>
Date: Fri, 8 Feb 2013 09:37:56 +0100

On Thu, Feb 07, 2013 at 10:50:55PM -0500, David Ward wrote:
> Initial implementation of the Multiple Registration Protocol (MRP)
> from IEEE 802.1Q-2011, based on the existing implementation of the
> Generic Attribute Registration Protocol (GARP).
> 
> Signed-off-by: David Ward <[email-masked]>

> +enum mrp_vecattr_event {
> +	MRP_NEW,
> +	MRP_JOIN_IN,
> +	MRP_IN,
> +	MRP_JOIN_MT,
> +	MRP_MT,
> +	MRP_LV,
> +};

> +static int mrp_pdu_append_event(struct mrp_applicant *app,
> +				const struct mrp_attr *attr,
> +				enum mrp_vecattr_event event)
> +{
...
> +	switch (pos) {
> +	case 0:
> +		*events = event * 36;
> +		break;
> +	case 1:
> +		*events += event * 6;
> +		break;
> +	case 2:
> +		*events += event;
> +		break;
> +	default:
> +		WARN_ON(1);
> +	}

Could you define a MRT_VAEVENT_MAX or something and use that instead of the
magic values? Took me a bit to figure out their meaning.

> +static int mrp_pdu_parse_vecattr(struct mrp_applicant *app,
> +				 struct sk_buff *skb, int *offset)
> +{
...
> +	while (valen > 0) {
> +		if (skb_copy_bits(skb, *offset, &vaevents,
> +				  sizeof(vaevents)) < 0)
> +			return -1;
> +		*offset += sizeof(vaevents);
> +
> +		/* Extract and process the first event. */
> +		vaevent = vaevents / 36;
> +		if (vaevent >= 6) {

Same here.

Other than that:

Acked-by: Patrick McHardy <[email-masked]>

for all patches.