aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/net_driver.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sfc/net_driver.h')
-rw-r--r--drivers/net/sfc/net_driver.h72
1 files changed, 49 insertions, 23 deletions
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index c505482c2520..5e20e7551dae 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -42,7 +42,7 @@
42#ifndef EFX_DRIVER_NAME 42#ifndef EFX_DRIVER_NAME
43#define EFX_DRIVER_NAME "sfc" 43#define EFX_DRIVER_NAME "sfc"
44#endif 44#endif
45#define EFX_DRIVER_VERSION "2.2.0136" 45#define EFX_DRIVER_VERSION "2.2"
46 46
47#ifdef EFX_ENABLE_DEBUG 47#ifdef EFX_ENABLE_DEBUG
48#define EFX_BUG_ON_PARANOID(x) BUG_ON(x) 48#define EFX_BUG_ON_PARANOID(x) BUG_ON(x)
@@ -52,28 +52,19 @@
52#define EFX_WARN_ON_PARANOID(x) do {} while (0) 52#define EFX_WARN_ON_PARANOID(x) do {} while (0)
53#endif 53#endif
54 54
55#define NET_DEV_REGISTERED(efx) \
56 ((efx)->net_dev->reg_state == NETREG_REGISTERED)
57
58/* Include net device name in log messages if it has been registered.
59 * Use efx->name not efx->net_dev->name so that races with (un)registration
60 * are harmless.
61 */
62#define NET_DEV_NAME(efx) (NET_DEV_REGISTERED(efx) ? (efx)->name : "")
63
64/* Un-rate-limited logging */ 55/* Un-rate-limited logging */
65#define EFX_ERR(efx, fmt, args...) \ 56#define EFX_ERR(efx, fmt, args...) \
66dev_err(&((efx)->pci_dev->dev), "ERR: %s " fmt, NET_DEV_NAME(efx), ##args) 57dev_err(&((efx)->pci_dev->dev), "ERR: %s " fmt, efx_dev_name(efx), ##args)
67 58
68#define EFX_INFO(efx, fmt, args...) \ 59#define EFX_INFO(efx, fmt, args...) \
69dev_info(&((efx)->pci_dev->dev), "INFO: %s " fmt, NET_DEV_NAME(efx), ##args) 60dev_info(&((efx)->pci_dev->dev), "INFO: %s " fmt, efx_dev_name(efx), ##args)
70 61
71#ifdef EFX_ENABLE_DEBUG 62#ifdef EFX_ENABLE_DEBUG
72#define EFX_LOG(efx, fmt, args...) \ 63#define EFX_LOG(efx, fmt, args...) \
73dev_info(&((efx)->pci_dev->dev), "DBG: %s " fmt, NET_DEV_NAME(efx), ##args) 64dev_info(&((efx)->pci_dev->dev), "DBG: %s " fmt, efx_dev_name(efx), ##args)
74#else 65#else
75#define EFX_LOG(efx, fmt, args...) \ 66#define EFX_LOG(efx, fmt, args...) \
76dev_dbg(&((efx)->pci_dev->dev), "DBG: %s " fmt, NET_DEV_NAME(efx), ##args) 67dev_dbg(&((efx)->pci_dev->dev), "DBG: %s " fmt, efx_dev_name(efx), ##args)
77#endif 68#endif
78 69
79#define EFX_TRACE(efx, fmt, args...) do {} while (0) 70#define EFX_TRACE(efx, fmt, args...) do {} while (0)
@@ -90,11 +81,6 @@ do {if (net_ratelimit()) EFX_INFO(efx, fmt, ##args); } while (0)
90#define EFX_LOG_RL(efx, fmt, args...) \ 81#define EFX_LOG_RL(efx, fmt, args...) \
91do {if (net_ratelimit()) EFX_LOG(efx, fmt, ##args); } while (0) 82do {if (net_ratelimit()) EFX_LOG(efx, fmt, ##args); } while (0)
92 83
93/* Kernel headers may redefine inline anyway */
94#ifndef inline
95#define inline inline __attribute__ ((always_inline))
96#endif
97
98/************************************************************************** 84/**************************************************************************
99 * 85 *
100 * Efx data structures 86 * Efx data structures
@@ -134,6 +120,8 @@ struct efx_special_buffer {
134 * Set only on the final fragment of a packet; %NULL for all other 120 * Set only on the final fragment of a packet; %NULL for all other
135 * fragments. When this fragment completes, then we can free this 121 * fragments. When this fragment completes, then we can free this
136 * skb. 122 * skb.
123 * @tsoh: The associated TSO header structure, or %NULL if this
124 * buffer is not a TSO header.
137 * @dma_addr: DMA address of the fragment. 125 * @dma_addr: DMA address of the fragment.
138 * @len: Length of this fragment. 126 * @len: Length of this fragment.
139 * This field is zero when the queue slot is empty. 127 * This field is zero when the queue slot is empty.
@@ -144,6 +132,7 @@ struct efx_special_buffer {
144 */ 132 */
145struct efx_tx_buffer { 133struct efx_tx_buffer {
146 const struct sk_buff *skb; 134 const struct sk_buff *skb;
135 struct efx_tso_header *tsoh;
147 dma_addr_t dma_addr; 136 dma_addr_t dma_addr;
148 unsigned short len; 137 unsigned short len;
149 unsigned char continuation; 138 unsigned char continuation;
@@ -187,6 +176,13 @@ struct efx_tx_buffer {
187 * variable indicates that the queue is full. This is to 176 * variable indicates that the queue is full. This is to
188 * avoid cache-line ping-pong between the xmit path and the 177 * avoid cache-line ping-pong between the xmit path and the
189 * completion path. 178 * completion path.
179 * @tso_headers_free: A list of TSO headers allocated for this TX queue
180 * that are not in use, and so available for new TSO sends. The list
181 * is protected by the TX queue lock.
182 * @tso_bursts: Number of times TSO xmit invoked by kernel
183 * @tso_long_headers: Number of packets with headers too long for standard
184 * blocks
185 * @tso_packets: Number of packets via the TSO xmit path
190 */ 186 */
191struct efx_tx_queue { 187struct efx_tx_queue {
192 /* Members which don't change on the fast path */ 188 /* Members which don't change on the fast path */
@@ -206,6 +202,10 @@ struct efx_tx_queue {
206 unsigned int insert_count ____cacheline_aligned_in_smp; 202 unsigned int insert_count ____cacheline_aligned_in_smp;
207 unsigned int write_count; 203 unsigned int write_count;
208 unsigned int old_read_count; 204 unsigned int old_read_count;
205 struct efx_tso_header *tso_headers_free;
206 unsigned int tso_bursts;
207 unsigned int tso_long_headers;
208 unsigned int tso_packets;
209}; 209};
210 210
211/** 211/**
@@ -434,6 +434,9 @@ struct efx_board {
434 struct efx_blinker blinker; 434 struct efx_blinker blinker;
435}; 435};
436 436
437#define STRING_TABLE_LOOKUP(val, member) \
438 member ## _names[val]
439
437enum efx_int_mode { 440enum efx_int_mode {
438 /* Be careful if altering to correct macro below */ 441 /* Be careful if altering to correct macro below */
439 EFX_INT_MODE_MSIX = 0, 442 EFX_INT_MODE_MSIX = 0,
@@ -506,6 +509,7 @@ enum efx_fc_type {
506 * @check_hw: Check hardware 509 * @check_hw: Check hardware
507 * @reset_xaui: Reset XAUI side of PHY for (software sequenced reset) 510 * @reset_xaui: Reset XAUI side of PHY for (software sequenced reset)
508 * @mmds: MMD presence mask 511 * @mmds: MMD presence mask
512 * @loopbacks: Supported loopback modes mask
509 */ 513 */
510struct efx_phy_operations { 514struct efx_phy_operations {
511 int (*init) (struct efx_nic *efx); 515 int (*init) (struct efx_nic *efx);
@@ -515,6 +519,7 @@ struct efx_phy_operations {
515 int (*check_hw) (struct efx_nic *efx); 519 int (*check_hw) (struct efx_nic *efx);
516 void (*reset_xaui) (struct efx_nic *efx); 520 void (*reset_xaui) (struct efx_nic *efx);
517 int mmds; 521 int mmds;
522 unsigned loopbacks;
518}; 523};
519 524
520/* 525/*
@@ -653,7 +658,6 @@ union efx_multicast_hash {
653 * @phy_op: PHY interface 658 * @phy_op: PHY interface
654 * @phy_data: PHY private data (including PHY-specific stats) 659 * @phy_data: PHY private data (including PHY-specific stats)
655 * @mii: PHY interface 660 * @mii: PHY interface
656 * @phy_powered: PHY power state
657 * @tx_disabled: PHY transmitter turned off 661 * @tx_disabled: PHY transmitter turned off
658 * @link_up: Link status 662 * @link_up: Link status
659 * @link_options: Link options (MII/GMII format) 663 * @link_options: Link options (MII/GMII format)
@@ -662,6 +666,9 @@ union efx_multicast_hash {
662 * @multicast_hash: Multicast hash table 666 * @multicast_hash: Multicast hash table
663 * @flow_control: Flow control flags - separate RX/TX so can't use link_options 667 * @flow_control: Flow control flags - separate RX/TX so can't use link_options
664 * @reconfigure_work: work item for dealing with PHY events 668 * @reconfigure_work: work item for dealing with PHY events
669 * @loopback_mode: Loopback status
670 * @loopback_modes: Supported loopback mode bitmask
671 * @loopback_selftest: Offline self-test private state
665 * 672 *
666 * The @priv field of the corresponding &struct net_device points to 673 * The @priv field of the corresponding &struct net_device points to
667 * this. 674 * this.
@@ -674,7 +681,7 @@ struct efx_nic {
674 struct workqueue_struct *workqueue; 681 struct workqueue_struct *workqueue;
675 struct work_struct reset_work; 682 struct work_struct reset_work;
676 struct delayed_work monitor_work; 683 struct delayed_work monitor_work;
677 unsigned long membase_phys; 684 resource_size_t membase_phys;
678 void __iomem *membase; 685 void __iomem *membase;
679 spinlock_t biu_lock; 686 spinlock_t biu_lock;
680 enum efx_int_mode interrupt_mode; 687 enum efx_int_mode interrupt_mode;
@@ -698,7 +705,7 @@ struct efx_nic {
698 705
699 unsigned n_rx_nodesc_drop_cnt; 706 unsigned n_rx_nodesc_drop_cnt;
700 707
701 void *nic_data; 708 struct falcon_nic_data *nic_data;
702 709
703 struct mutex mac_lock; 710 struct mutex mac_lock;
704 int port_enabled; 711 int port_enabled;
@@ -721,6 +728,7 @@ struct efx_nic {
721 struct efx_phy_operations *phy_op; 728 struct efx_phy_operations *phy_op;
722 void *phy_data; 729 void *phy_data;
723 struct mii_if_info mii; 730 struct mii_if_info mii;
731 unsigned tx_disabled;
724 732
725 int link_up; 733 int link_up;
726 unsigned int link_options; 734 unsigned int link_options;
@@ -732,8 +740,26 @@ struct efx_nic {
732 struct work_struct reconfigure_work; 740 struct work_struct reconfigure_work;
733 741
734 atomic_t rx_reset; 742 atomic_t rx_reset;
743 enum efx_loopback_mode loopback_mode;
744 unsigned int loopback_modes;
745
746 void *loopback_selftest;
735}; 747};
736 748
749static inline int efx_dev_registered(struct efx_nic *efx)
750{
751 return efx->net_dev->reg_state == NETREG_REGISTERED;
752}
753
754/* Net device name, for inclusion in log messages if it has been registered.
755 * Use efx->name not efx->net_dev->name so that races with (un)registration
756 * are harmless.
757 */
758static inline const char *efx_dev_name(struct efx_nic *efx)
759{
760 return efx_dev_registered(efx) ? efx->name : "";
761}
762
737/** 763/**
738 * struct efx_nic_type - Efx device type definition 764 * struct efx_nic_type - Efx device type definition
739 * @mem_bar: Memory BAR number 765 * @mem_bar: Memory BAR number
@@ -769,7 +795,7 @@ struct efx_nic_type {
769 unsigned int txd_ring_mask; 795 unsigned int txd_ring_mask;
770 unsigned int rxd_ring_mask; 796 unsigned int rxd_ring_mask;
771 unsigned int evq_size; 797 unsigned int evq_size;
772 dma_addr_t max_dma_mask; 798 u64 max_dma_mask;
773 unsigned int tx_dma_mask; 799 unsigned int tx_dma_mask;
774 unsigned bug5391_mask; 800 unsigned bug5391_mask;
775 801