2 * Copyright (c) 2013 Johannes Berg <johannes@sipsolutions.net>
4 * This file is free software: you may copy, redistribute and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation, either version 2 of the License, or (at your
7 * option) any later version.
9 * This file is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 * This file incorporates work covered by the following copyright and
20 * Copyright (c) 2012 Qualcomm Atheros, Inc.
22 * Permission to use, copy, modify, and/or distribute this software for any
23 * purpose with or without fee is hereby granted, provided that the above
24 * copyright notice and this permission notice appear in all copies.
26 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
27 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
28 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
29 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
30 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
31 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
32 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
38 #include <linux/types.h>
39 #include <linux/etherdevice.h>
40 #include <linux/dma-mapping.h>
41 #include <linux/spinlock.h>
44 #define ALX_WATCHDOG_TIME (5 * HZ)
48 DEFINE_DMA_UNMAP_ADDR(dma
);
49 DEFINE_DMA_UNMAP_LEN(size
);
53 struct net_device
*netdev
;
63 struct alx_buffer
*bufs
;
66 u16 write_idx
, read_idx
;
70 #define ALX_RX_ALLOC_THRESH 32
73 struct net_device
*netdev
;
79 struct alx_buffer
*bufs
;
82 u16 write_idx
, read_idx
;
87 #define ALX_DEFAULT_TX_WORK 128
89 enum alx_device_quirks
{
90 ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG
= BIT(0),
94 struct napi_struct napi
;
96 struct alx_rx_queue
*rxq
;
97 struct alx_tx_queue
*txq
;
100 char irq_lbl
[IFNAMSIZ
+ 8];
103 #define ALX_MAX_NAPIS 8
106 struct net_device
*dev
;
113 /* all descriptor memory */
120 struct alx_napi
*qnapi
[ALX_MAX_NAPIS
];
125 /* protect int_mask updates */
129 unsigned int tx_ringsz
;
130 unsigned int rx_ringsz
;
131 unsigned int rxbuf_size
;
133 struct work_struct link_check_wk
;
134 struct work_struct reset_wk
;
138 /* protects hw.stats */
139 spinlock_t stats_lock
;
142 extern const struct ethtool_ops alx_ethtool_ops
;