[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1308678253.3338.13.camel@Joe-Laptop>
Date: Tue, 21 Jun 2011 10:44:13 -0700
From: Joe Perches <joe@...ches.com>
To: Sebastian Pöhn
<sebastian.belden@...glemail.com>
Cc: Linux Netdev <netdev@...r.kernel.org>,
Sebastian Pöhn <sebastian.poehn@...den.com>
Subject: Re: [PATCH] gianfar v5: implement nfc
On Mon, 2011-06-20 at 11:39 +0200, Sebastian Pöhn wrote:
> This patch adds all missing functionalities for nfc except GRXFH. There is so much code because hardware has not a TCAM.
> Further hardware rule space is very limited. So I had to extensively use
> optimization features. Both reasons lead to the necessity to hold all
> online flows in a linked-list.
> Signed-off-by: Sebastian Poehn <sebastian.poehn@...den.com>
Just a bit more trivia...
[]
> +/* Swaps the 0xFF80 masked bits of a1<>a2 and b1<>b2 */
> +static void gfar_swap_ff80_bits(struct gfar_filer_entry *a1,
> + struct gfar_filer_entry *a2, struct gfar_filer_entry *b1,
> + struct gfar_filer_entry *b2)
> +{
> + u32 temp[4];
> + temp[0] = a1->ctrl & 0xFF80;
> + temp[1] = a2->ctrl & 0xFF80;
> + temp[2] = b1->ctrl & 0xFF80;
> + temp[3] = b2->ctrl & 0xFF80;
> +
> + a1->ctrl &= ~0xFF80;
> + a2->ctrl &= ~0xFF80;
> + b1->ctrl &= ~0xFF80;
> + b2->ctrl &= ~0xFF80;
> +
> + a1->ctrl |= temp[1];
> + a2->ctrl |= temp[0];
> + b1->ctrl |= temp[3];
> + b2->ctrl |= temp[2];
> +}
maybe add a macro similar to swap:
#define swap_bits(a, b, bits) \
do { \
typeof(a) _bits = bits; \
typeof(a) _a_bits = (a) & _bits; \
typeof(a) _b_bits = (b) & _bits; \
\
(a) &= ~_bits; \
(b) &= ~_bits; \
\
(a) |= _b_bits; \
(b) |= _a_bits; \
} while (0)
and use this macro directly in gfar_sort_mask_table?
swap_bits(temp_table->fe[new_first],
temp_table->fe[old_first], 0xff80);
swap_bits(temp_table->fe[new_last],
temp_table->fe[old_last], 0xff80);
And maybe 0xff80 should be a #define?
--
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