All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-net-drivers@solarflare.com
Subject: [PATCH 17/27] sfc: Move shared members of struct falcon_nic_data into struct efx_nic
Date: Fri, 23 Oct 2009 19:32:04 +0100	[thread overview]
Message-ID: <1256322724.2785.37.camel@achroite> (raw)
In-Reply-To: <1256322441.2785.3.camel@achroite>

These will also be used with Siena NICs.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/falcon.c     |   23 +++++++----------------
 drivers/net/sfc/net_driver.h |    7 +++++++
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 34b475e..1582df7 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -35,19 +35,12 @@
 
 /**
  * struct falcon_nic_data - Falcon NIC state
- * @next_buffer_table: First available buffer table id
  * @pci_dev2: The secondary PCI device if present
  * @i2c_data: Operations and state for I2C bit-bashing algorithm
- * @int_error_count: Number of internal errors seen recently
- * @int_error_expire: Time at which error count will be expired
  */
 struct falcon_nic_data {
-	unsigned next_buffer_table;
 	struct pci_dev *pci_dev2;
 	struct i2c_algo_bit_data i2c_data;
-
-	unsigned int_error_count;
-	unsigned long int_error_expire;
 };
 
 /**************************************************************************
@@ -304,8 +297,6 @@ static int falcon_alloc_special_buffer(struct efx_nic *efx,
 				       struct efx_special_buffer *buffer,
 				       unsigned int len)
 {
-	struct falcon_nic_data *nic_data = efx->nic_data;
-
 	len = ALIGN(len, FALCON_BUF_SIZE);
 
 	buffer->addr = pci_alloc_consistent(efx->pci_dev, len,
@@ -320,8 +311,8 @@ static int falcon_alloc_special_buffer(struct efx_nic *efx,
 	memset(buffer->addr, 0xff, len);
 
 	/* Select new buffer ID */
-	buffer->index = nic_data->next_buffer_table;
-	nic_data->next_buffer_table += buffer->entries;
+	buffer->index = efx->next_buffer_table;
+	efx->next_buffer_table += buffer->entries;
 
 	EFX_LOG(efx, "allocating special buffers %d-%d at %llx+%x "
 		"(virt %p phys %llx)\n", buffer->index,
@@ -1411,13 +1402,13 @@ static irqreturn_t falcon_fatal_interrupt(struct efx_nic *efx)
 	falcon_disable_interrupts(efx);
 
 	/* Count errors and reset or disable the NIC accordingly */
-	if (nic_data->int_error_count == 0 ||
-	    time_after(jiffies, nic_data->int_error_expire)) {
-		nic_data->int_error_count = 0;
-		nic_data->int_error_expire =
+	if (efx->int_error_count == 0 ||
+	    time_after(jiffies, efx->int_error_expire)) {
+		efx->int_error_count = 0;
+		efx->int_error_expire =
 			jiffies + FALCON_INT_ERROR_EXPIRE * HZ;
 	}
-	if (++nic_data->int_error_count < FALCON_MAX_INT_ERRORS) {
+	if (++efx->int_error_count < FALCON_MAX_INT_ERRORS) {
 		EFX_ERR(efx, "SYSTEM ERROR - reset scheduled\n");
 		efx_schedule_reset(efx, RESET_TYPE_INT_ERROR);
 	} else {
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 8e7b854..25b7933 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -688,10 +688,13 @@ union efx_multicast_hash {
  * @tx_queue: TX DMA queues
  * @rx_queue: RX DMA queues
  * @channel: Channels
+ * @next_buffer_table: First available buffer table id
  * @n_rx_queues: Number of RX queues
  * @n_channels: Number of channels in use
  * @rx_buffer_len: RX buffer length
  * @rx_buffer_order: Order (log2) of number of pages for each RX buffer
+ * @int_error_count: Number of internal errors seen recently
+ * @int_error_expire: Time at which error count will be expired
  * @irq_status: Interrupt status buffer
  * @last_irq_cpu: Last CPU to handle interrupt.
  *	This register is written with the SMP processor ID whenever an
@@ -775,11 +778,15 @@ struct efx_nic {
 	struct efx_rx_queue rx_queue[EFX_MAX_RX_QUEUES];
 	struct efx_channel channel[EFX_MAX_CHANNELS];
 
+	unsigned next_buffer_table;
 	int n_rx_queues;
 	int n_channels;
 	unsigned int rx_buffer_len;
 	unsigned int rx_buffer_order;
 
+	unsigned int_error_count;
+	unsigned long int_error_expire;
+
 	struct efx_buffer irq_status;
 	volatile signed int last_irq_cpu;
 

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


  parent reply	other threads:[~2009-10-23 18:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-23 18:27 [PATCH 00/27] sfc: Cleanup and preparation for new hardware Ben Hutchings
2009-10-23 18:28 ` [PATCH 01/27] sfc: Remove redundant header gmii.h Ben Hutchings
2009-10-23 18:28 ` [PATCH 02/27] sfc: Remove redundant hardware initialisation Ben Hutchings
2009-10-23 18:29 ` [PATCH 03/27] sfc: Rename Falcon-specific board code and types Ben Hutchings
2009-10-23 18:29 ` [PATCH 04/27] sfc: Merge sfe4001.c into falcon_boards.c Ben Hutchings
2009-10-23 18:29 ` [PATCH 05/27] sfc: Remove boards.h, moving last remaining declaration to falcon.h Ben Hutchings
2009-10-23 18:30 ` [PATCH 06/27] sfc: Remove versioned bitfield macros Ben Hutchings
2009-10-23 18:30 ` [PATCH 07/27] sfc: Move RX data FIFO thresholds out of struct efx_nic_type Ben Hutchings
2009-10-23 18:30 ` [PATCH 08/27] sfc: Update hardware definitions for Siena Ben Hutchings
2009-10-23 18:30 ` [PATCH 09/27] sfc: Rename register I/O header and functions used by both Falcon and Siena Ben Hutchings
2009-10-23 18:30 ` [PATCH 10/27] sfc: Eliminate indirect lookups of queue size constants Ben Hutchings
2009-10-23 18:31 ` [PATCH 11/27] sfc: Define DMA address mask explicitly in terms of descriptor field width Ben Hutchings
2009-10-23 18:31 ` [PATCH 12/27] sfc: Move all TX DMA length limiting into tx.c Ben Hutchings
2009-10-23 18:31 ` [PATCH 13/27] sfc: Merge struct efx_blinker into struct efx_board Ben Hutchings
2009-10-23 18:31 ` [PATCH 14/27] sfc: Change order of device removal to reverse of probe order Ben Hutchings
2009-10-23 18:31 ` [PATCH 15/27] sfc: Remove declarations of nonexistent functions Ben Hutchings
2009-10-23 18:31 ` [PATCH 16/27] sfc: Move efx_xmit_done() declaration into correct stanza Ben Hutchings
2009-10-23 18:32 ` Ben Hutchings [this message]
2009-10-23 18:32 ` [PATCH 18/27] sfc: Maintain interrupt moderation values in ticks, not microseconds Ben Hutchings
2009-10-23 18:32 ` [PATCH 19/27] sfc: Removed kernel-doc for nonexistent member of efx_phy_operations Ben Hutchings
2009-10-23 18:32 ` [PATCH 20/27] sfc: Remove pointless abstraction of memory BAR number Ben Hutchings
2009-10-23 18:32 ` [PATCH 21/27] sfc: Merge falcon_probe_phy() into falcon_probe_port() Ben Hutchings
2009-10-23 18:32 ` [PATCH 22/27] sfc: Remove incorrect assertion from efx_pci_remove_main() Ben Hutchings
2009-10-23 18:33 ` [PATCH 23/27] sfc: Remove unnecessary tests of efx->membase Ben Hutchings
2009-10-23 18:33 ` [PATCH 24/27] sfc: Move MTD probe after netdev registration and name allocation Ben Hutchings
2009-10-23 18:33 ` [PATCH 25/27] sfc: Merge efx_fc_resolve() into efx_mdio_get_pause() Ben Hutchings
2009-10-23 18:33 ` [PATCH 26/27] sfc: Remove unused code for non-autoneg speed/duplex switching Ben Hutchings
2009-10-23 18:33 ` [PATCH 27/27] sfc: Rename 'xfp' file and functions to reflect reality Ben Hutchings
2009-10-24 11:29 ` [PATCH 00/27] sfc: Cleanup and preparation for new hardware David Miller

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=1256322724.2785.37.camel@achroite \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-net-drivers@solarflare.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.