netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dale Farnsworth <dale@farnsworth.org>
To: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 04/39] mv643xx_eth: get rid of individual port config register bit defines
Date: Thu, 5 Jun 2008 04:07:34 -0700	[thread overview]
Message-ID: <20080605110734.GB1059@farnsworth.org> (raw)
In-Reply-To: <1212490974-23719-5-git-send-email-buytenh@wantstofly.org>

On Tue, Jun 03, 2008 at 01:02:19PM +0200, Lennert Buytenhek wrote:
> 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>
> ---
>  drivers/net/mv643xx_eth.c |   44 +++++++-------------------------------------
>  1 files changed, 7 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
> index 9a9218f..38ba365 100644
> --- a/drivers/net/mv643xx_eth.c
> +++ b/drivers/net/mv643xx_eth.c
> @@ -109,39 +109,6 @@ static char mv643xx_driver_version[] = "1.0";
>  #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 +1769,9 @@ static void mv643xx_eth_set_rx_mode(struct net_device *dev)
>  
>  	config_reg = rdl(mp, PORT_CONFIG(mp->port_num));
>  	if (dev->flags & IFF_PROMISC)
> -		config_reg |= (u32) UNICAST_PROMISCUOUS_MODE;
> +		config_reg |= 0x00000001;

Except for the stupid cast, I think the meaning was clearer with the
define.

>  	else
> -		config_reg &= ~(u32) UNICAST_PROMISCUOUS_MODE;
> +		config_reg &= ~0x00000001;
>  	wrl(mp, PORT_CONFIG(mp->port_num), config_reg);
>  
>  	eth_port_set_multicast_list(dev);
> @@ -2226,8 +2193,11 @@ static void eth_port_start(struct net_device *dev)
>  	/* 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);

Same here.

>  	wrl(mp, PORT_CONFIG_EXT(port_num), PORT_CONFIG_EXTEND_DEFAULT_VALUE);

Getting rid of the unused definitions is a good thing though.

-Dale

  reply	other threads:[~2008-06-05 11:41 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-03 11:02 [PATCH 00/39] mv643xx_eth: complete overhaul Lennert Buytenhek
2008-06-03 11:02 ` [PATCH 01/39] mv643xx_eth: reverse topological sort of functions Lennert Buytenhek
2008-06-05 11:23   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 02/39] mv643xx_eth: trim unnecessary includes Lennert Buytenhek
2008-06-05 11:02   ` Dale Farnsworth
2008-06-06  8:18     ` Lennert Buytenhek
2008-06-06 10:55       ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 03/39] mv643xx_eth: shorten reg names Lennert Buytenhek
2008-06-05 11:21   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 04/39] mv643xx_eth: get rid of individual port config register bit defines Lennert Buytenhek
2008-06-05 11:07   ` Dale Farnsworth [this message]
2008-06-06  6:58     ` Lennert Buytenhek
2008-06-06 10:52       ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 05/39] mv643xx_eth: get rid of individual port config extend " Lennert Buytenhek
2008-06-05 11:24   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 06/39] mv643xx_eth: delete unused SDMA config " Lennert Buytenhek
2008-06-05 11:25   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 07/39] mv643xx_eth: delete unused port serial control " Lennert Buytenhek
2008-06-05 11:27   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 08/39] mv643xx_eth: nuke port status " Lennert Buytenhek
2008-06-05 11:26   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 09/39] mv643xx_eth: remove unused DESC_SIZE define Lennert Buytenhek
2008-06-05 11:28   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 10/39] mv643xx_eth: clarify irq masking and unmasking Lennert Buytenhek
2008-06-05 11:35   ` Dale Farnsworth
2008-06-05 11:44   ` Dale Farnsworth
2008-06-05 20:36     ` Lennert Buytenhek
2008-06-05 21:22       ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 11/39] mv643xx_eth: move PHY wait defines into callers Lennert Buytenhek
2008-06-05 11:39   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 12/39] mv643xx_eth: get rid of RX_BUF_OFFSET Lennert Buytenhek
2008-06-05 11:37   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 13/39] mv643xx_eth: move MIB offset defines into their only user Lennert Buytenhek
2008-06-05 11:47   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 14/39] mv643xx_eth: remove port serial status register bit defines Lennert Buytenhek
2008-06-05 11:41   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 15/39] mv643xx_eth: clean up rx/tx descriptor field defines Lennert Buytenhek
2008-06-05 11:37   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 16/39] mv643xx_eth: get rid of ETH_/ethernet_/eth_ prefixes Lennert Buytenhek
2008-06-05 11:50   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 17/39] mv643xx_eth: use 'mv643xx_eth_' prefix consistently Lennert Buytenhek
2008-06-05 11:59   ` Dale Farnsworth
2008-06-06  7:09     ` Lennert Buytenhek
2008-06-03 11:02 ` [PATCH 18/39] mv643xx_eth: kill superfluous comments Lennert Buytenhek
2008-06-05 12:03   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 19/39] mv643xx_eth: kill ->rx_resource_err Lennert Buytenhek
2008-06-05 11:48   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 20/39] mv643xx_eth: get rid of hungarian variable naming Lennert Buytenhek
2008-06-05 12:06   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 21/39] mv643xx_eth: move port_receive() into its only caller Lennert Buytenhek
2008-06-05 11:53   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 22/39] mv643xx_eth: move rx_return_buff() " Lennert Buytenhek
2008-06-05 12:01   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 23/39] mv643xx_eth: kill FUNC_RET_STATUS/pkt_info Lennert Buytenhek
2008-06-05 11:59   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 24/39] mv643xx_eth: kill private unused instance of struct net_device_stats Lennert Buytenhek
2008-06-05 12:08   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 25/39] mv643xx_eth: massively simplify multicast address crc8 computation Lennert Buytenhek
2008-06-05 12:05   ` Dale Farnsworth
2008-06-05 14:08   ` Brent Cook
2008-06-05 20:44     ` Lennert Buytenhek
2008-06-03 11:02 ` [PATCH 26/39] mv643xx_eth: split out rx queue state Lennert Buytenhek
2008-06-05 12:39   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 27/39] mv643xx_eth: split out tx " Lennert Buytenhek
2008-06-05 12:09   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 28/39] mv643xx_eth: remove write-only interrupt coalescing variables Lennert Buytenhek
2008-06-05 12:53   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 29/39] mv643xx_eth: general cleanup Lennert Buytenhek
2008-06-05 12:33   ` Dale Farnsworth
2008-06-06  8:24     ` Lennert Buytenhek
2008-06-06 10:59       ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 30/39] mv643xx_eth: add tx rate control Lennert Buytenhek
2008-06-05 12:51   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 31/39] mv643xx_eth: allow multiple RX queues Lennert Buytenhek
2008-06-05 12:35   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 32/39] mv643xx_eth: allow multiple TX queues Lennert Buytenhek
2008-06-05 12:41   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 33/39] mv643xx_eth: work around TX hang hardware issue Lennert Buytenhek
2008-06-05 12:37   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 34/39] mv643xx_eth: detect extended rx coal register field Lennert Buytenhek
2008-06-05 12:50   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 35/39] mv643xx_eth: detect alternate TX BW control register location Lennert Buytenhek
2008-06-05 12:40   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 36/39] mv643xx_eth: be more agressive about RX refill Lennert Buytenhek
2008-06-05 12:48   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 37/39] mv643xx_eth: don't read from upper parts of 64-bit mib registers Lennert Buytenhek
2008-06-05 12:46   ` Dale Farnsworth
2008-06-06  7:45     ` Lennert Buytenhek
2008-06-03 11:02 ` [PATCH 38/39] mv643xx_eth: add PHY-less mode Lennert Buytenhek
2008-06-05 12:49   ` Dale Farnsworth
2008-06-03 11:02 ` [PATCH 39/39] mv643xx_eth: update driver version and author fields Lennert Buytenhek
2008-06-05 12:48   ` Dale Farnsworth

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=20080605110734.GB1059@farnsworth.org \
    --to=dale@farnsworth.org \
    --cc=buytenh@wantstofly.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).