netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: ram.vepa@neterion.com
Cc: netdev@vger.kernel.org, support@neterion.com
Subject: Re: [PATCH 2.6.24 1/5]S2io: Enable all the error and alarm indications
Date: Fri, 31 Aug 2007 09:01:13 -0400	[thread overview]
Message-ID: <46D81119.6080700@garzik.org> (raw)
In-Reply-To: <1187223130.23940.331.camel@flash>

Ramkrishna Vepa wrote:
> - Added support to unmask entire set of device errors and alarms.
> 
> Signed-off-by: Sivakumar Subramani <sivakumar.subramani@neterion.com>
> Signed-off-by: Santosh Rastapur <santosh.rastapur@neterion.com>
> Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
> ---
> diff -Nurp orig/drivers/net/s2io.c patch1/drivers/net/s2io.c
> --- orig/drivers/net/s2io.c	2007-08-15 08:04:06.000000000 -0700
> +++ patch1/drivers/net/s2io.c	2007-08-15 08:55:53.000000000 -0700
> @@ -892,8 +892,9 @@ static void free_shared_mem(struct s2io_
>  					k++;
>  				}
>  				kfree(mac_control->rings[i].ba[j]);
> -				nic->mac_control.stats_info->sw_stat.mem_freed 				+= (sizeof(struct buffAdd) * 
> -				(rxd_count[nic->rxd_mode] + 1));
> +				nic->mac_control.stats_info->sw_stat.mem_freed += 
> +					(sizeof(struct buffAdd) * 
> +					(rxd_count[nic->rxd_mode] + 1));
>  			}
>  			kfree(mac_control->rings[i].ba);
>  			nic->mac_control.stats_info->sw_stat.mem_freed += 
> @@ -1732,6 +1733,365 @@ static int s2io_link_fault_indication(st
>  		return MAC_RMAC_ERR_TIMER;
>  }
>  
> +void en_dis_err_alarms(struct s2io_nic *nic, u16 mask, int flag)
> +{
> +	struct XENA_dev_config __iomem *bar0 = nic->bar0;
> +	register u64 val64 = 0, temp64 = 0, gen_int_mask = 0;
> +
> +	if (mask & TX_DMA_INTR) {
> +		gen_int_mask |= TXDMA_INT_M;
> +
> +		if (flag == ENABLE_INTRS) {
> +
> +			val64 = TXDMA_TDA_INT|TXDMA_PFC_INT|TXDMA_PCC_INT
> +				|TXDMA_TTI_INT|TXDMA_LSO_INT|TXDMA_TPA_INT
> +				|TXDMA_SM_INT;
> +			temp64 = readq(&bar0->txdma_int_mask);
> +			temp64 &= ~((u64) val64);
> +			writeq(temp64, &bar0->txdma_int_mask);


reduce the size of this huge functions by creating a helper function 
whose use would look something like

	writebits(TXDMA_TDA_INT|TXDMA_PFC_INT|TXDMA_PCC_INT|
		  TXDMA_TTI_INT|TXDMA_LSO_INT|TXDMA_TPA_INT|
		  TXDMA_SM_INT,
		  flag,
		  &bar0->txdma_int_mask);

That eliminates the wholesale duplication of code based on the 
'flags==ENABLE_INTRS' test, and overall increases readability and 
decreases code size


  reply	other threads:[~2007-08-31 13:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-16  0:12 [PATCH 2.6.24 1/5]S2io: Enable all the error and alarm indications Ramkrishna Vepa
2007-08-31 13:01 ` Jeff Garzik [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-09-06 10:21 Sivakumar Subramani
2007-09-13  4:04 ` Jeff Garzik

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=46D81119.6080700@garzik.org \
    --to=jeff@garzik.org \
    --cc=netdev@vger.kernel.org \
    --cc=ram.vepa@neterion.com \
    --cc=support@neterion.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;
as well as URLs for NNTP newsgroup(s).