Netdev List
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "Sebastian Pöhn" <sebastian.belden@googlemail.com>
Cc: "Linux Netdev" <netdev@vger.kernel.org>,
	"Sebastian Pöhn" <sebastian.poehn@belden.com>
Subject: Re: [PATCH] gianfar v5: implement nfc
Date: Tue, 21 Jun 2011 10:44:13 -0700	[thread overview]
Message-ID: <1308678253.3338.13.camel@Joe-Laptop> (raw)
In-Reply-To: <1308562782.12794.6.camel@DENEC1DT0191>

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@belden.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?



  parent reply	other threads:[~2011-06-21 17:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-20  9:39 [PATCH] gianfar v5: implement nfc Sebastian Pöhn
2011-06-20 20:58 ` David Miller
2011-06-21 17:44 ` Joe Perches [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-06-22  9:29 Sebastian Pöhn
2011-06-22 16:48 ` Joe Perches
2011-06-27 14:43   ` Sebastian.Poehn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1308678253.3338.13.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=netdev@vger.kernel.org \
    --cc=sebastian.belden@googlemail.com \
    --cc=sebastian.poehn@belden.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox