Skip to contentSkip to conversation

gianfar v5: implement nfc

PATCH Applied Sebastian Pöhn 3 participants 3 messages Jun 20, 2011 – Jun 21, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gianfar v5: implement nfc

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.

Change-log:
# Some suggestions by Joe Perches applied (thanks!) # Shorted some logs
# Use memcmp() for comparing

---

 drivers/net/gianfar.c         |   10 +-
 drivers/net/gianfar.h         |   53 +++
 drivers/net/gianfar_ethtool.c |  930 ++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 989 insertions(+), 4 deletions(-)
drivers/net/gianfar.c +7 -3
index 0c74832..def7f7e 100644
@@ -657,6 +657,11 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
 	priv->num_rx_queues = num_rx_qs;
 	priv->num_grps = 0x0;
 
+	/* Init Rx queue filer rule set linked list*/
+	INIT_LIST_HEAD(&priv->rx_list.list);
+	priv->rx_list.count = 0;
+	mutex_init(&priv->rx_queue_access);
+
 	model = of_get_property(np, "model", NULL);
 
 	for (i = 0; i < MAXGROUPS; i++)
@@ -1150,9 +1155,8 @@ static int gfar_probe(struct platform_device *ofdev)
 		priv->rx_queue[i]->rxic = DEFAULT_RXIC;
 	}
 
-	/* enable filer if using multiple RX queues*/
-	if(priv->num_rx_queues > 1)
-		priv->rx_filer_enable = 1;
+	/* always enable rx filer*/
+	priv->rx_filer_enable = 1;
 	/* Enable most messages by default */
 	priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1;
 
drivers/net/gianfar.h +53 -0

87 lines not on this page · raw message

drivers/net/gianfar_ethtool.c +929 -1

958 lines not on this page · raw message

maintainer Applied
#1 lore raw

From: "Sebastian Pöhn" <[email protected]>
Date: Mon, 20 Jun 2011 11:39:42 +0200

Quoted 11 lines

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.

Change-log:
# Some suggestions by Joe Perches applied (thanks!) # Shorted some logs
# Use memcmp() for comparing

Applied, thanks.

#2 lore raw
In reply to Sebastian Pöhn
Quoted 5 lines · Sebastian Pöhn

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.

Just a bit more trivia...

[]

Quoted 11 lines
drivers/net/gianfar_ethtool.c +11 -0
+/* 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;
+

drivers/net/gianfar_ethtool.c static int gfar_set_hash_opts(struct gfar_private *priv, struct ethtool_rxnfc *c · line 1283

Quoted 10 lines
drivers/net/gianfar_ethtool.c +10 -0
+	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?