Re: [PATCH 04/39] mv643xx_eth: get rid of individual port config register bit defines

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Dale Farnsworth <dale@...>
Cc: <netdev@...>
Date: Friday, June 6, 2008 - 2:58 am

On Thu, Jun 05, 2008 at 04:07:34AM -0700, Dale Farnsworth wrote:


Right, I got a bit carried away. :-)  How about this instead:



From: Lennert Buytenhek <buytenh@wantstofly.org>
Date: Sun Jun  1 01:22:06 CEST 2008
Subject: mv643xx_eth: get rid of individual port config register bit defines

The mv643xx_eth driver only ever changes bit 0 of the port config
register at run time, the rest of the register bits are fixed (and
always zero).  Document the meaning of the chosen default value,
and get rid of all the defines for each of the individual bits.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>

Index: linux-2.6.26-rc5/drivers/net/mv643xx_eth.c
===================================================================
--- linux-2.6.26-rc5.orig/drivers/net/mv643xx_eth.c
+++ linux-2.6.26-rc5/drivers/net/mv643xx_eth.c
@@ -88,6 +88,7 @@ static char mv643xx_driver_version[] = "
  * Per-port registers.
  */
 #define PORT_CONFIG(p)			(0x0400 + ((p) << 10))
+#define  UNICAST_PROMISCUOUS_MODE	0x00000001
 #define PORT_CONFIG_EXT(p)		(0x0404 + ((p) << 10))
 #define MAC_ADDR_LOW(p)			(0x0414 + ((p) << 10))
 #define MAC_ADDR_HIGH(p)		(0x0418 + ((p) << 10))
@@ -109,39 +110,6 @@ static char mv643xx_driver_version[] = "
 #define OTHER_MCAST_TABLE(p)		(0x1500 + ((p) << 10))
 #define UNICAST_TABLE(p)		(0x1600 + ((p) << 10))
 
-/* These macros describe Ethernet Port configuration reg (Px_cR) bits */
-#define UNICAST_NORMAL_MODE		(0 << 0)
-#define UNICAST_PROMISCUOUS_MODE	(1 << 0)
-#define DEFAULT_RX_QUEUE(queue)		((queue) << 1)
-#define DEFAULT_RX_ARP_QUEUE(queue)	((queue) << 4)
-#define RECEIVE_BC_IF_NOT_IP_OR_ARP	(0 << 7)
-#define REJECT_BC_IF_NOT_IP_OR_ARP	(1 << 7)
-#define RECEIVE_BC_IF_IP		(0 << 8)
-#define REJECT_BC_IF_IP			(1 << 8)
-#define RECEIVE_BC_IF_ARP		(0 << 9)
-#define REJECT_BC_IF_ARP		(1 << 9)
-#define TX_AM_NO_UPDATE_ERROR_SUMMARY	(1 << 12)
-#define CAPTURE_TCP_FRAMES_DIS		(0 << 14)
-#define CAPTURE_TCP_FRAMES_EN		(1 << 14)
-#define CAPTURE_UDP_FRAMES_DIS		(0 << 15)
-#define CAPTURE_UDP_FRAMES_EN		(1 << 15)
-#define DEFAULT_RX_TCP_QUEUE(queue)	((queue) << 16)
-#define DEFAULT_RX_UDP_QUEUE(queue)	((queue) << 19)
-#define DEFAULT_RX_BPDU_QUEUE(queue)	((queue) << 22)
-
-#define PORT_CONFIG_DEFAULT_VALUE			\
-		UNICAST_NORMAL_MODE		|	\
-		DEFAULT_RX_QUEUE(0)		|	\
-		DEFAULT_RX_ARP_QUEUE(0)		|	\
-		RECEIVE_BC_IF_NOT_IP_OR_ARP	|	\
-		RECEIVE_BC_IF_IP		|	\
-		RECEIVE_BC_IF_ARP		|	\
-		CAPTURE_TCP_FRAMES_DIS		|	\
-		CAPTURE_UDP_FRAMES_DIS		|	\
-		DEFAULT_RX_TCP_QUEUE(0)		|	\
-		DEFAULT_RX_UDP_QUEUE(0)		|	\
-		DEFAULT_RX_BPDU_QUEUE(0)
-
 /* These macros describe Ethernet Port configuration extend reg (Px_cXR) bits*/
 #define CLASSIFY_EN				(1 << 0)
 #define SPAN_BPDU_PACKETS_AS_NORMAL		(0 << 1)
@@ -1802,9 +1770,9 @@ static void mv643xx_eth_set_rx_mode(stru
 
 	config_reg = rdl(mp, PORT_CONFIG(mp->port_num));
 	if (dev->flags & IFF_PROMISC)
-		config_reg |= (u32) UNICAST_PROMISCUOUS_MODE;
+		config_reg |= UNICAST_PROMISCUOUS_MODE;
 	else
-		config_reg &= ~(u32) UNICAST_PROMISCUOUS_MODE;
+		config_reg &= ~UNICAST_PROMISCUOUS_MODE;
 	wrl(mp, PORT_CONFIG(mp->port_num), config_reg);
 
 	eth_port_set_multicast_list(dev);
@@ -2226,8 +2194,11 @@ static void eth_port_start(struct net_de
 	/* Add the assigned Ethernet address to the port's address table */
 	eth_port_uc_addr_set(mp, dev->dev_addr);
 
-	/* Assign port configuration and command. */
-	wrl(mp, PORT_CONFIG(port_num), PORT_CONFIG_DEFAULT_VALUE);
+	/*
+	 * Receive all unmatched unicast, TCP, UDP, BPDU and broadcast
+	 * frames to RX queue #0.
+	 */
+	wrl(mp, PORT_CONFIG(port_num), 0x00000000);
 
 	wrl(mp, PORT_CONFIG_EXT(port_num), PORT_CONFIG_EXTEND_DEFAULT_VALUE);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/39] mv643xx_eth: complete overhaul, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
[PATCH 29/39] mv643xx_eth: general cleanup, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
Re: [PATCH 29/39] mv643xx_eth: general cleanup, Dale Farnsworth, (Thu Jun 5, 8:33 am)
Re: [PATCH 29/39] mv643xx_eth: general cleanup, Lennert Buytenhek, (Fri Jun 6, 4:24 am)
Re: [PATCH 29/39] mv643xx_eth: general cleanup, Dale Farnsworth, (Fri Jun 6, 6:59 am)
[PATCH 19/39] mv643xx_eth: kill -&gt;rx_resource_err, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
Re: [PATCH 19/39] mv643xx_eth: kill -&gt;rx_resource_err, Dale Farnsworth, (Thu Jun 5, 7:48 am)
[PATCH 10/39] mv643xx_eth: clarify irq masking and unmasking, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
[PATCH 02/39] mv643xx_eth: trim unnecessary includes, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
Re: [PATCH 02/39] mv643xx_eth: trim unnecessary includes, Dale Farnsworth, (Thu Jun 5, 7:02 am)
Re: [PATCH 02/39] mv643xx_eth: trim unnecessary includes, Lennert Buytenhek, (Fri Jun 6, 4:18 am)
Re: [PATCH 02/39] mv643xx_eth: trim unnecessary includes, Dale Farnsworth, (Fri Jun 6, 6:55 am)
[PATCH 03/39] mv643xx_eth: shorten reg names, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
[PATCH 18/39] mv643xx_eth: kill superfluous comments, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
Re: [PATCH 18/39] mv643xx_eth: kill superfluous comments, Dale Farnsworth, (Thu Jun 5, 8:03 am)
Re: [PATCH 03/39] mv643xx_eth: shorten reg names, Dale Farnsworth, (Thu Jun 5, 7:21 am)
[PATCH 12/39] mv643xx_eth: get rid of RX_BUF_OFFSET, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
Re: [PATCH 12/39] mv643xx_eth: get rid of RX_BUF_OFFSET, Dale Farnsworth, (Thu Jun 5, 7:37 am)
[PATCH 11/39] mv643xx_eth: move PHY wait defines into callers, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
[PATCH 09/39] mv643xx_eth: remove unused DESC_SIZE define, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
Re: [PATCH 04/39] mv643xx_eth: get rid of individual port co..., Lennert Buytenhek, (Fri Jun 6, 2:58 am)
[PATCH 27/39] mv643xx_eth: split out tx queue state, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
[PATCH 26/39] mv643xx_eth: split out rx queue state, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
Re: [PATCH 26/39] mv643xx_eth: split out rx queue state, Dale Farnsworth, (Thu Jun 5, 8:39 am)
Re: [PATCH 27/39] mv643xx_eth: split out tx queue state, Dale Farnsworth, (Thu Jun 5, 8:09 am)
[PATCH 32/39] mv643xx_eth: allow multiple TX queues, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
Re: [PATCH 32/39] mv643xx_eth: allow multiple TX queues, Dale Farnsworth, (Thu Jun 5, 8:41 am)
[PATCH 31/39] mv643xx_eth: allow multiple RX queues, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
Re: [PATCH 31/39] mv643xx_eth: allow multiple RX queues, Dale Farnsworth, (Thu Jun 5, 8:35 am)
[PATCH 33/39] mv643xx_eth: work around TX hang hardware issue, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
[PATCH 23/39] mv643xx_eth: kill FUNC_RET_STATUS/pkt_info, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
[PATCH 30/39] mv643xx_eth: add tx rate control, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
Re: [PATCH 30/39] mv643xx_eth: add tx rate control, Dale Farnsworth, (Thu Jun 5, 8:51 am)
[PATCH 36/39] mv643xx_eth: be more agressive about RX refill, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
[PATCH 38/39] mv643xx_eth: add PHY-less mode, Lennert Buytenhek, (Tue Jun 3, 7:02 am)
Re: [PATCH 38/39] mv643xx_eth: add PHY-less mode, Dale Farnsworth, (Thu Jun 5, 8:49 am)