iPXE
tg3.c File Reference
#include <mii.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <byteswap.h>
#include <ipxe/pci.h>
#include <ipxe/iobuf.h>
#include <ipxe/timer.h>
#include <ipxe/malloc.h>
#include <ipxe/if_ether.h>
#include <ipxe/ethernet.h>
#include <ipxe/netdevice.h>
#include "tg3.h"

Go to the source code of this file.

Macros

#define TG3_DEF_RX_MODE   0
#define TG3_DEF_TX_MODE   0
#define TG3_TX_RING_BYTES
#define TG3_RX_RCB_RING_BYTES(tp)
#define TG3_RX_STD_RING_BYTES(tp)
#define TG3_RX_STD_BUFF_RING_BYTES(tp)
#define TG3_RX_STD_RING_BYTES(tp)
#define NEXT_TX(N)
#define TG3_RX_STD_BUFF_RING_BYTES(tp)
#define TG3_RX_STD_RING_BYTES(tp)
#define TEST_BUFFER_SIZE   0x2000

Functions

 FILE_LICENCE (GPL2_ONLY)
static void tg3_refill_prod_ring (struct tg3 *tp)
void tg3_rx_prodring_fini (struct tg3 __unused *tp, struct tg3_rx_prodring_set *tpr)
static void tg3_free_consistent (struct tg3 *tp)
int tg3_alloc_consistent (struct tg3 *tp)
static int tg3_rx_prodring_alloc (struct tg3 __unused *tp, struct tg3_rx_prodring_set *tpr)
static void tg3_rx_iob_free (struct io_buffer *iobs[], int i)
static void tg3_rx_prodring_free (struct tg3_rx_prodring_set *tpr)
int tg3_init_rings (struct tg3 *tp)
static int tg3_open (struct net_device *dev)
static u32 tg3_tx_avail (struct tg3 *tp)
static int tg3_transmit (struct net_device *dev, struct io_buffer *iob)
static void tg3_tx_complete (struct net_device *dev)
static int tg3_alloc_rx_iob (struct tg3 *tp, struct tg3_rx_prodring_set *tpr, u32 dest_idx_unmasked)
static void tg3_rx_complete (struct net_device *dev)
static void tg3_poll (struct net_device *dev)
static void tg3_close (struct net_device *dev)
static void tg3_irq (struct net_device *dev, int enable)
int tg3_do_test_dma (struct tg3 *tp, u32 __unused *buf, physaddr_t buf_dma, int size, int to_device)
void tg3_read_mem (struct tg3 *tp, u32 off, u32 *val)
static int tg3_test_dma (struct tg3 *tp)
static int tg3_init_one (struct pci_device *pdev)
static void tg3_remove_one (struct pci_device *pci)

Variables

static struct net_device_operations tg3_netdev_ops
static struct pci_device_id tg3_nics []
struct pci_driver tg3_pci_driver __pci_driver

Macro Definition Documentation

◆ TG3_DEF_RX_MODE

#define TG3_DEF_RX_MODE   0

Definition at line 20 of file tg3.c.

Referenced by tg3_init_one().

◆ TG3_DEF_TX_MODE

#define TG3_DEF_TX_MODE   0

Definition at line 21 of file tg3.c.

Referenced by tg3_init_one().

◆ TG3_TX_RING_BYTES

#define TG3_TX_RING_BYTES
Value:
(sizeof(struct tg3_tx_buffer_desc) * \
#define TG3_TX_RING_SIZE
Definition tg3.h:3309

Definition at line 32 of file tg3.c.

32#define TG3_TX_RING_BYTES (sizeof(struct tg3_tx_buffer_desc) * \
33 TG3_TX_RING_SIZE)

Referenced by tg3_alloc_consistent(), tg3_free_consistent(), and tg3_init_rings().

◆ TG3_RX_RCB_RING_BYTES

#define TG3_RX_RCB_RING_BYTES ( tp)
Value:
#define TG3_RX_RET_MAX_SIZE_5705
Definition tg3.h:178

Definition at line 36 of file tg3.c.

36#define TG3_RX_RCB_RING_BYTES(tp) \
37 (sizeof(struct tg3_rx_buffer_desc) * (TG3_RX_RET_MAX_SIZE_5705))

Referenced by tg3_alloc_consistent(), tg3_free_consistent(), and tg3_init_rings().

◆ TG3_RX_STD_RING_BYTES [1/3]

#define TG3_RX_STD_RING_BYTES ( tp)
Value:
#define TG3_RX_STD_MAX_SIZE_5700
Definition tg3.h:173

Definition at line 39 of file tg3.c.

39#define TG3_RX_STD_RING_BYTES(tp) \
40 (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_STD_MAX_SIZE_5700)

Referenced by tg3_alloc_consistent(), and tg3_rx_prodring_fini().

◆ TG3_RX_STD_BUFF_RING_BYTES [1/2]

#define TG3_RX_STD_BUFF_RING_BYTES ( tp)
Value:

Definition at line 142 of file tg3.c.

142#define TG3_RX_STD_BUFF_RING_BYTES(tp) \
143 (sizeof(struct ring_info) * TG3_RX_STD_MAX_SIZE_5700)

◆ TG3_RX_STD_RING_BYTES [2/3]

#define TG3_RX_STD_RING_BYTES ( tp)
Value:

Definition at line 39 of file tg3.c.

39#define TG3_RX_STD_RING_BYTES(tp) \
40 (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_STD_MAX_SIZE_5700)

◆ NEXT_TX

#define NEXT_TX ( N)
Value:
(((N) + 1) & (TG3_TX_RING_SIZE - 1))

Definition at line 300 of file tg3.c.

Referenced by tg3_transmit(), and tg3_tx_complete().

◆ TG3_RX_STD_BUFF_RING_BYTES [2/2]

#define TG3_RX_STD_BUFF_RING_BYTES ( tp)
Value:

Definition at line 142 of file tg3.c.

142#define TG3_RX_STD_BUFF_RING_BYTES(tp) \
143 (sizeof(struct ring_info) * TG3_RX_STD_MAX_SIZE_5700)

◆ TG3_RX_STD_RING_BYTES [3/3]

#define TG3_RX_STD_RING_BYTES ( tp)
Value:

Definition at line 39 of file tg3.c.

39#define TG3_RX_STD_RING_BYTES(tp) \
40 (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_STD_MAX_SIZE_5700)

◆ TEST_BUFFER_SIZE

#define TEST_BUFFER_SIZE   0x2000

Definition at line 547 of file tg3.c.

Referenced by tg3_test_dma().

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_ONLY )

◆ tg3_refill_prod_ring()

void tg3_refill_prod_ring ( struct tg3 * tp)
static

Definition at line 415 of file tg3.c.

416{ DBGP("%s\n", __func__);
417
418 struct tg3_rx_prodring_set *tpr = &tp->prodring;
419 int idx = tpr->rx_std_prod_idx;
420
421 DBGCP(tp->dev, "%s\n", __func__);
422
424 if (tpr->rx_iobufs[idx % TG3_DEF_RX_RING_PENDING] == NULL) {
425 if (tg3_alloc_rx_iob(tp, tpr, idx) < 0) {
426 DBGC(tp->dev, "alloc_iob() failed for descriptor %d\n", idx);
427 break;
428 }
429 DBGC2(tp->dev, "allocated iob_buffer for descriptor %d\n", idx);
430 }
431
432 idx = (idx + 1) % TG3_RX_STD_MAX_SIZE_5700;
433 tpr->rx_std_iob_cnt++;
434 }
435
436 if ((u32)idx != tpr->rx_std_prod_idx) {
437 tpr->rx_std_prod_idx = idx;
439 }
440}
#define NULL
NULL pointer (VOID *).
Definition Base.h:321
#define DBGP(...)
Definition compiler.h:557
#define DBGC2(...)
Definition compiler.h:547
#define DBGCP(...)
Definition compiler.h:564
#define DBGC(...)
Definition compiler.h:530
struct io_buffer * rx_iobufs[TG3_DEF_RX_RING_PENDING]
Definition tg3.h:2954
static int tg3_alloc_rx_iob(struct tg3 *tp, struct tg3_rx_prodring_set *tpr, u32 dest_idx_unmasked)
Definition tg3.c:378
#define TG3_RX_STD_PROD_IDX_REG
Definition tg3.h:445
#define TG3_DEF_RX_RING_PENDING
Definition tg3.h:2947
#define tw32_rx_mbox(reg, val)
Definition tg3.h:3336
static struct tulip_private * tp
Definition tulip.c:442
#define u32
Definition vga.h:21

References DBGC, DBGC2, DBGCP, DBGP, NULL, tg3_rx_prodring_set::rx_iobufs, tg3_rx_prodring_set::rx_std_iob_cnt, tg3_rx_prodring_set::rx_std_prod_idx, tg3_alloc_rx_iob(), TG3_DEF_RX_RING_PENDING, TG3_RX_STD_MAX_SIZE_5700, TG3_RX_STD_PROD_IDX_REG, tp, tw32_rx_mbox, and u32.

Referenced by tg3_open(), and tg3_rx_complete().

◆ tg3_rx_prodring_fini()

void tg3_rx_prodring_fini ( struct tg3 __unused * tp,
struct tg3_rx_prodring_set * tpr )

Definition at line 42 of file tg3.c.

44{ DBGP("%s\n", __func__);
45
46 if (tpr->rx_std) {
47 dma_free(&tpr->rx_std_map, tpr->rx_std,
49 tpr->rx_std = NULL;
50 }
51}
void dma_free(struct dma_mapping *map, void *addr, size_t len)
Unmap and free DMA-coherent buffer.
struct tg3_rx_buffer_desc * rx_std
Definition tg3.h:2953
struct dma_mapping rx_std_map
Definition tg3.h:2955
#define TG3_RX_STD_RING_BYTES(tp)
Definition tg3.c:39

References __unused, DBGP, dma_free(), NULL, tg3_rx_prodring_set::rx_std, tg3_rx_prodring_set::rx_std_map, TG3_RX_STD_RING_BYTES, and tp.

Referenced by tg3_free_consistent().

◆ tg3_free_consistent()

void tg3_free_consistent ( struct tg3 * tp)
static

Definition at line 57 of file tg3.c.

58{ DBGP("%s\n", __func__);
59
60 if (tp->tx_ring) {
61 dma_free(&tp->tx_desc_map, tp->tx_ring, TG3_TX_RING_BYTES);
62 tp->tx_ring = NULL;
63 }
64
65 free(tp->tx_buffers);
66 tp->tx_buffers = NULL;
67
68 if (tp->rx_rcb) {
69 dma_free(&tp->rx_rcb_map, tp->rx_rcb,
71 tp->rx_rcb = NULL;
72 }
73
74 tg3_rx_prodring_fini(tp, &tp->prodring);
75
76 if (tp->hw_status) {
77 dma_free(&tp->status_map, tp->hw_status, TG3_HW_STATUS_SIZE);
78 tp->hw_status = NULL;
79 }
80}
static void(* free)(struct refcnt *refcnt))
Definition refcnt.h:55
void tg3_rx_prodring_fini(struct tg3 __unused *tp, struct tg3_rx_prodring_set *tpr)
Definition tg3.c:42
#define TG3_TX_RING_BYTES
Definition tg3.c:32
#define TG3_RX_RCB_RING_BYTES(tp)
Definition tg3.c:36
#define TG3_HW_STATUS_SIZE
Definition tg3.h:2669

References DBGP, dma_free(), free, NULL, TG3_HW_STATUS_SIZE, tg3_rx_prodring_fini(), TG3_RX_RCB_RING_BYTES, TG3_TX_RING_BYTES, and tp.

Referenced by tg3_alloc_consistent(), and tg3_close().

◆ tg3_alloc_consistent()

int tg3_alloc_consistent ( struct tg3 * tp)

Definition at line 86 of file tg3.c.

87{ DBGP("%s\n", __func__);
88
89 struct tg3_hw_status *sblk;
90 struct tg3_rx_prodring_set *tpr = &tp->prodring;
91
92 tp->hw_status = dma_alloc(tp->dma, &tp->status_map,
94 if (!tp->hw_status) {
95 DBGC(tp->dev, "hw_status alloc failed\n");
96 goto err_out;
97 }
98
99 memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE);
100 sblk = tp->hw_status;
101
102 tpr->rx_std = dma_alloc(tp->dma, &tpr->rx_std_map,
104 if (!tpr->rx_std) {
105 DBGC(tp->dev, "rx prodring alloc failed\n");
106 goto err_out;
107 }
109
110 tp->tx_buffers = zalloc(sizeof(struct ring_info) * TG3_TX_RING_SIZE);
111 if (!tp->tx_buffers)
112 goto err_out;
113
114 tp->tx_ring = dma_alloc(tp->dma, &tp->tx_desc_map,
116 if (!tp->tx_ring)
117 goto err_out;
118
119 /*
120 * When RSS is enabled, the status block format changes
121 * slightly. The "rx_jumbo_consumer", "reserved",
122 * and "rx_mini_consumer" members get mapped to the
123 * other three rx return ring producer indexes.
124 */
125
126 tp->rx_rcb_prod_idx = &sblk->idx[0].rx_producer;
127
128 tp->rx_rcb = dma_alloc(tp->dma, &tp->rx_rcb_map,
130 if (!tp->rx_rcb)
131 goto err_out;
132
133 memset(tp->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
134
135 return 0;
136
137err_out:
139 return -ENOMEM;
140}
#define ENOMEM
Not enough space.
Definition errno.h:535
void * memset(void *dest, int character, size_t len) __nonnull
void * dma_alloc(struct dma_device *dma, struct dma_mapping *map, size_t len, size_t align)
Allocate and map DMA-coherent buffer.
void * zalloc(size_t size)
Allocate cleared memory.
Definition malloc.c:662
struct tg3_hw_status::@346154016361251030104324040037321237160035164370 idx[16]
u16 rx_producer
Definition tg3.h:2696
static void tg3_free_consistent(struct tg3 *tp)
Definition tg3.c:57
#define TG3_DMA_ALIGNMENT
Definition tg3.h:3312

References DBGC, DBGP, dma_alloc(), ENOMEM, tg3_hw_status::idx, memset(), tg3_hw_status::rx_producer, tg3_rx_prodring_set::rx_std, tg3_rx_prodring_set::rx_std_map, TG3_DMA_ALIGNMENT, tg3_free_consistent(), TG3_HW_STATUS_SIZE, TG3_RX_RCB_RING_BYTES, TG3_RX_STD_RING_BYTES, TG3_TX_RING_BYTES, TG3_TX_RING_SIZE, tp, and zalloc().

Referenced by tg3_open().

◆ tg3_rx_prodring_alloc()

int tg3_rx_prodring_alloc ( struct tg3 __unused * tp,
struct tg3_rx_prodring_set * tpr )
static

Definition at line 153 of file tg3.c.

155{ DBGP("%s\n", __func__);
156
157 u32 i;
158
159 tpr->rx_std_cons_idx = 0;
160 tpr->rx_std_prod_idx = 0;
161
162 /* Initialize invariants of the rings, we only set this
163 * stuff once. This works because the card does not
164 * write into the rx buffer posting rings.
165 */
166 /* FIXME: does TG3_RX_STD_MAX_SIZE_5700 work on all cards? */
167 for (i = 0; i < TG3_RX_STD_MAX_SIZE_5700; i++) {
168 struct tg3_rx_buffer_desc *rxd;
169
170 rxd = &tpr->rx_std[i];
171 rxd->idx_len = (TG3_RX_STD_DMA_SZ - 64 - 2) << RXD_LEN_SHIFT;
172 rxd->type_flags = (RXD_FLAG_END << RXD_FLAGS_SHIFT);
173 rxd->opaque = (RXD_OPAQUE_RING_STD |
175 }
176
177 return 0;
178}
#define rxd
Definition davicom.c:146
#define TG3_RX_STD_DMA_SZ
Definition tg3.h:3314
#define RXD_FLAG_END
Definition tg3.h:2597
#define RXD_FLAGS_SHIFT
Definition tg3.h:2595
#define RXD_LEN_SHIFT
Definition tg3.h:2591
#define RXD_OPAQUE_RING_STD
Definition tg3.h:2631
#define RXD_OPAQUE_INDEX_SHIFT
Definition tg3.h:2630

References __unused, DBGP, tg3_rx_prodring_set::rx_std, tg3_rx_prodring_set::rx_std_cons_idx, tg3_rx_prodring_set::rx_std_prod_idx, rxd, RXD_FLAG_END, RXD_FLAGS_SHIFT, RXD_LEN_SHIFT, RXD_OPAQUE_INDEX_SHIFT, RXD_OPAQUE_RING_STD, TG3_RX_STD_DMA_SZ, TG3_RX_STD_MAX_SIZE_5700, tp, and u32.

Referenced by tg3_init_rings().

◆ tg3_rx_iob_free()

void tg3_rx_iob_free ( struct io_buffer * iobs[],
int i )
static

Definition at line 180 of file tg3.c.

181{ DBGP("%s\n", __func__);
182
183 if (iobs[i] == NULL)
184 return;
185
186 /* RX iobufs were allocated via alloc_rx_iob() and are therefore
187 * DMA-mapped through the platform DMA API; they must be released
188 * via free_rx_iob() so the mapping is torn down.
189 */
190 free_rx_iob(iobs[i]);
191 iobs[i] = NULL;
192}
void free_rx_iob(struct io_buffer *iobuf)
Unmap and free I/O buffer for receive DMA.
Definition iobuf.c:215

References DBGP, free_rx_iob(), and NULL.

Referenced by tg3_rx_prodring_free().

◆ tg3_rx_prodring_free()

void tg3_rx_prodring_free ( struct tg3_rx_prodring_set * tpr)
static

Definition at line 194 of file tg3.c.

195{ DBGP("%s\n", __func__);
196
197 unsigned int i;
198
199 for (i = 0; i < TG3_DEF_RX_RING_PENDING; i++)
200 tg3_rx_iob_free(tpr->rx_iobufs, i);
201}
static void tg3_rx_iob_free(struct io_buffer *iobs[], int i)
Definition tg3.c:180

References DBGP, tg3_rx_prodring_set::rx_iobufs, TG3_DEF_RX_RING_PENDING, and tg3_rx_iob_free().

Referenced by tg3_close(), and tg3_init_rings().

◆ tg3_init_rings()

int tg3_init_rings ( struct tg3 * tp)

tg3_free_rings(tp);

Definition at line 209 of file tg3.c.

210{ DBGP("%s\n", __func__);
211
212 /* Free up all the SKBs. */
213/// tg3_free_rings(tp);
214
215 tp->last_tag = 0;
216 tp->last_irq_tag = 0;
217 tp->hw_status->status = 0;
218 tp->hw_status->status_tag = 0;
219 memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE);
220
221 tp->tx_prod = 0;
222 tp->tx_cons = 0;
223 if (tp->tx_ring)
224 memset(tp->tx_ring, 0, TG3_TX_RING_BYTES);
225
226 tp->rx_rcb_ptr = 0;
227 if (tp->rx_rcb)
228 memset(tp->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
229
230 if (tg3_rx_prodring_alloc(tp, &tp->prodring)) {
231 DBGC(tp->dev, "tg3_rx_prodring_alloc() failed\n");
232 tg3_rx_prodring_free(&tp->prodring);
233 return -ENOMEM;
234 }
235
236 return 0;
237}
static int tg3_rx_prodring_alloc(struct tg3 __unused *tp, struct tg3_rx_prodring_set *tpr)
Definition tg3.c:153
static void tg3_rx_prodring_free(struct tg3_rx_prodring_set *tpr)
Definition tg3.c:194

References DBGC, DBGP, ENOMEM, memset(), TG3_HW_STATUS_SIZE, tg3_rx_prodring_alloc(), tg3_rx_prodring_free(), TG3_RX_RCB_RING_BYTES, TG3_TX_RING_BYTES, and tp.

Referenced by tg3_reset_hw().

◆ tg3_open()

int tg3_open ( struct net_device * dev)
static

Definition at line 239 of file tg3.c.

240{ DBGP("%s\n", __func__);
241
242 struct tg3 *tp = dev->priv;
243 struct tg3_rx_prodring_set *tpr = &tp->prodring;
244 int err = 0;
245
247
248 /* Initialize MAC address and backoff seed. */
250
252 if (err)
253 return err;
254
255 tpr->rx_std_iob_cnt = 0;
256
257 err = tg3_init_hw(tp, 1);
258 if (err != 0)
259 DBGC(tp->dev, "tg3_init_hw failed: %s\n", strerror(err));
260 else
262
263 return err;
264}
char * strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
void * priv
Driver private data.
Definition netdevice.h:432
Definition tg3.h:3045
struct net_device * dev
Definition tg3.h:3089
static void tg3_refill_prod_ring(struct tg3 *tp)
Definition tg3.c:415
int tg3_alloc_consistent(struct tg3 *tp)
Definition tg3.c:86
void tg3_set_power_state_0(struct tg3 *tp)
Definition tg3_hw.c:130
int tg3_init_hw(struct tg3 *tp, int reset_phy)
Definition tg3_hw.c:2585
void __tg3_set_mac_addr(struct tg3 *tp, int skip_mac_1)
Definition tg3_hw.c:1094

References __tg3_set_mac_addr(), DBGC, DBGP, tg3::dev, net_device::priv, tg3_rx_prodring_set::rx_std_iob_cnt, strerror(), tg3_alloc_consistent(), tg3_init_hw(), tg3_refill_prod_ring(), tg3_set_power_state_0(), and tp.

◆ tg3_tx_avail()

u32 tg3_tx_avail ( struct tg3 * tp)
inlinestatic

Definition at line 266 of file tg3.c.

267{ DBGP("%s\n", __func__);
268
269 /* Tell compiler to fetch tx indices from memory. */
270 barrier();
272 ((tp->tx_prod - tp->tx_cons) & (TG3_TX_RING_SIZE - 1));
273}
#define barrier()
Optimisation barrier.
Definition compiler.h:658
#define TG3_DEF_TX_RING_PENDING
Definition tg3.h:3310

References barrier, DBGP, TG3_DEF_TX_RING_PENDING, TG3_TX_RING_SIZE, tp, and u32.

Referenced by tg3_transmit().

◆ tg3_transmit()

int tg3_transmit ( struct net_device * dev,
struct io_buffer * iob )
static

Definition at line 305 of file tg3.c.

306{ DBGP("%s\n", __func__);
307
308 struct tg3 *tp = dev->priv;
309 u32 len, entry;
310 physaddr_t mapping;
311
312 if (tg3_tx_avail(tp) < 1) {
313 DBGC(dev, "Transmit ring full\n");
314 return -ENOBUFS;
315 }
316
317 entry = tp->tx_prod;
318
319 iob_pad(iob, ETH_ZLEN);
320 /* The netdevice core has already called iob_map_tx() for this
321 * iobuf (because netdev->dma is set), so iob_dma() returns the
322 * platform-translated bus address suitable for the device.
323 */
324 mapping = iob_dma(iob);
325 len = iob_len(iob);
326
327 tp->tx_buffers[entry].iob = iob;
328
329 tg3_set_txd(tp, entry, mapping, len, TXD_FLAG_END);
330
331 entry = NEXT_TX(entry);
332
333 /* Packets are ready, update Tx producer idx local and on card. */
334 tw32_tx_mbox(tp->prodmbox, entry);
335
336 tp->tx_prod = entry;
337
338 mb();
339
340 return 0;
341}
unsigned long physaddr_t
Definition stdint.h:20
ring len
Length.
Definition dwmac.h:226
#define ENOBUFS
No buffer space available.
Definition errno.h:499
#define ETH_ZLEN
Definition if_ether.h:11
void mb(void)
Memory barrier.
void iob_pad(struct io_buffer *iobuf, size_t min_len)
Pad I/O buffer.
Definition iobpad.c:50
static __always_inline physaddr_t iob_dma(struct io_buffer *iobuf)
Get I/O buffer DMA address.
Definition iobuf.h:268
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition iobuf.h:160
static u32 tg3_tx_avail(struct tg3 *tp)
Definition tg3.c:266
#define NEXT_TX(N)
Definition tg3.c:300
#define tw32_tx_mbox(reg, val)
Definition tg3.h:3335
void tg3_set_txd(struct tg3 *tp, int entry, physaddr_t mapping, int len, u32 flags)
Definition tg3_hw.c:2595
#define TXD_FLAG_END
Definition tg3.h:2560

References DBGC, DBGP, tg3::dev, ENOBUFS, ETH_ZLEN, iob_dma(), iob_len(), iob_pad(), len, mb(), NEXT_TX, net_device::priv, tg3_set_txd(), tg3_tx_avail(), tp, tw32_tx_mbox, TXD_FLAG_END, and u32.

◆ tg3_tx_complete()

void tg3_tx_complete ( struct net_device * dev)
static

Definition at line 343 of file tg3.c.

344{ DBGP("%s\n", __func__);
345
346 struct tg3 *tp = dev->priv;
347 u32 hw_idx = tp->hw_status->idx[0].tx_consumer;
348 u32 sw_idx = tp->tx_cons;
349
350 while (sw_idx != hw_idx) {
351 struct io_buffer *iob = tp->tx_buffers[sw_idx].iob;
352
353 DBGC2(dev, "Transmitted packet: %zd bytes\n", iob_len(iob));
354
355 netdev_tx_complete(dev, iob);
356 sw_idx = NEXT_TX(sw_idx);
357 }
358
359 tp->tx_cons = sw_idx;
360}
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
Definition netdevice.h:770
A persistent I/O buffer.
Definition iobuf.h:38

References DBGC2, DBGP, tg3::dev, iob_len(), netdev_tx_complete(), NEXT_TX, net_device::priv, tp, and u32.

Referenced by tg3_poll().

◆ tg3_alloc_rx_iob()

int tg3_alloc_rx_iob ( struct tg3 * tp,
struct tg3_rx_prodring_set * tpr,
u32 dest_idx_unmasked )
static

Definition at line 378 of file tg3.c.

380{ DBGP("%s\n", __func__);
381
382 struct tg3_rx_buffer_desc *desc;
383 struct io_buffer *iob;
384 physaddr_t mapping;
385 int dest_idx, iob_idx;
386
387 dest_idx = dest_idx_unmasked & (TG3_RX_STD_MAX_SIZE_5700 - 1);
388 desc = &tpr->rx_std[dest_idx];
389
390 /* Do not overwrite any of the map or rp information
391 * until we are sure we can commit to a new buffer.
392 *
393 * Callers depend upon this behavior and assume that
394 * we leave everything unchanged if we fail.
395 *
396 * Allocate the receive iobuf already DMA-mapped through the
397 * platform DMA API so the device may write into it under
398 * preboot DMA protection (IOMMU).
399 */
400 iob = alloc_rx_iob(TG3_RX_STD_DMA_SZ, tp->dma);
401 if (iob == NULL)
402 return -ENOMEM;
403
404 iob_idx = dest_idx % TG3_DEF_RX_RING_PENDING;
405 tpr->rx_iobufs[iob_idx] = iob;
406
407 mapping = iob_dma(iob);
408
409 desc->addr_hi = ((u64)mapping >> 32);
410 desc->addr_lo = ((u64)mapping & 0xffffffff);
411
412 return 0;
413}
struct ena_llq_option desc
Descriptor counts.
Definition ena.h:9
uint64_t u64
Definition stdint.h:26
struct io_buffer * alloc_rx_iob(size_t len, struct dma_device *dma)
Allocate and map I/O buffer for receive DMA.
Definition iobuf.c:188

References alloc_rx_iob(), DBGP, desc, ENOMEM, iob_dma(), NULL, tg3_rx_prodring_set::rx_iobufs, tg3_rx_prodring_set::rx_std, TG3_DEF_RX_RING_PENDING, TG3_RX_STD_DMA_SZ, TG3_RX_STD_MAX_SIZE_5700, tp, and u32.

Referenced by tg3_refill_prod_ring().

◆ tg3_rx_complete()

void tg3_rx_complete ( struct net_device * dev)
static

Definition at line 442 of file tg3.c.

443{ DBGP("%s\n", __func__);
444
445 struct tg3 *tp = dev->priv;
446
447 u32 sw_idx = tp->rx_rcb_ptr;
448 u16 hw_idx;
449 struct tg3_rx_prodring_set *tpr = &tp->prodring;
450
451 hw_idx = *(tp->rx_rcb_prod_idx);
452
453 while (sw_idx != hw_idx) {
454 struct tg3_rx_buffer_desc *desc = &tp->rx_rcb[sw_idx];
455 u32 desc_idx = desc->opaque & RXD_OPAQUE_INDEX_MASK;
456 int iob_idx = desc_idx % TG3_DEF_RX_RING_PENDING;
457 struct io_buffer *iob = tpr->rx_iobufs[iob_idx];
458 unsigned int len;
459
460 DBGC2(dev, "RX - desc_idx: %d sw_idx: %d hw_idx: %d\n", desc_idx, sw_idx, hw_idx);
461
462 assert(iob != NULL);
463
464 if ((desc->err_vlan & RXD_ERR_MASK) != 0 &&
465 (desc->err_vlan != RXD_ERR_ODD_NIBBLE_RCVD_MII)) {
466 /* drop packet */
467 DBGC(dev, "Corrupted packet received\n");
468 netdev_rx_err(dev, iob, -EINVAL);
469 } else {
470 len = ((desc->idx_len & RXD_LEN_MASK) >> RXD_LEN_SHIFT) -
472 iob_put(iob, len);
473 netdev_rx(dev, iob);
474
475 DBGC2(dev, "Received packet: %d bytes %d %d\n", len, sw_idx, hw_idx);
476 }
477
478 sw_idx++;
479 sw_idx &= TG3_RX_RET_MAX_SIZE_5705 - 1;
480
481 tpr->rx_iobufs[iob_idx] = NULL;
482 tpr->rx_std_iob_cnt--;
483 }
484
485 if (tp->rx_rcb_ptr != sw_idx) {
486 tw32_rx_mbox(tp->consmbox, sw_idx);
487 tp->rx_rcb_ptr = sw_idx;
488 }
489
491}
#define assert(condition)
Assert a condition at run-time.
Definition assert.h:50
#define ETH_FCS_LEN
Definition atl1e.h:45
#define EINVAL
Invalid argument.
Definition errno.h:429
#define iob_put(iobuf, len)
Definition iobuf.h:125
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
Definition netdevice.c:549
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
Definition netdevice.c:587
#define RXD_ERR_MASK
Definition tg3.h:2625
#define RXD_ERR_ODD_NIBBLE_RCVD_MII
Definition tg3.h:2620
#define RXD_LEN_MASK
Definition tg3.h:2590
#define RXD_OPAQUE_INDEX_MASK
Definition tg3.h:2629
#define u16
Definition vga.h:20

References assert, DBGC, DBGC2, DBGP, desc, tg3::dev, EINVAL, ETH_FCS_LEN, iob_put, len, netdev_rx(), netdev_rx_err(), NULL, net_device::priv, tg3_rx_prodring_set::rx_iobufs, tg3_rx_prodring_set::rx_std_iob_cnt, RXD_ERR_MASK, RXD_ERR_ODD_NIBBLE_RCVD_MII, RXD_LEN_MASK, RXD_LEN_SHIFT, RXD_OPAQUE_INDEX_MASK, TG3_DEF_RX_RING_PENDING, tg3_refill_prod_ring(), TG3_RX_RET_MAX_SIZE_5705, tp, tw32_rx_mbox, u16, and u32.

Referenced by tg3_poll().

◆ tg3_poll()

void tg3_poll ( struct net_device * dev)
static

Definition at line 493 of file tg3.c.

494{ DBGP("%s\n", __func__);
495
496 struct tg3 *tp = dev->priv;
497
498 /* ACK interrupts */
499 /*
500 *tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00);
501 */
502 tp->hw_status->status &= ~SD_STATUS_UPDATED;
503
504 mb();
505
509}
static void tg3_rx_complete(struct net_device *dev)
Definition tg3.c:442
static void tg3_tx_complete(struct net_device *dev)
Definition tg3.c:343
#define SD_STATUS_UPDATED
Definition tg3.h:2672
void tg3_poll_link(struct tg3 *tp)
Definition tg3_phy.c:1009

References DBGP, tg3::dev, mb(), net_device::priv, SD_STATUS_UPDATED, tg3_poll_link(), tg3_rx_complete(), tg3_tx_complete(), and tp.

◆ tg3_close()

void tg3_close ( struct net_device * dev)
static

Definition at line 511 of file tg3.c.

512{ DBGP("%s\n", __func__);
513
514 struct tg3 *tp = dev->priv;
515
516 DBGP("%s\n", __func__);
517
518 tg3_halt(tp);
519 tg3_rx_prodring_free(&tp->prodring);
520 tg3_flag_clear(tp, INIT_COMPLETE);
521
523
524}
#define tg3_flag_clear(tp, flag)
Definition tg3.h:3368
int tg3_halt(struct tg3 *tp)
Definition tg3_hw.c:1481

References DBGP, tg3::dev, net_device::priv, tg3_flag_clear, tg3_free_consistent(), tg3_halt(), tg3_rx_prodring_free(), and tp.

◆ tg3_irq()

void tg3_irq ( struct net_device * dev,
int enable )
static

Definition at line 526 of file tg3.c.

527{ DBGP("%s\n", __func__);
528
529 struct tg3 *tp = dev->priv;
530
531 DBGP("%s: %d\n", __func__, enable);
532
533 if (enable)
535 else
537}
void tg3_enable_ints(struct tg3 *tp)
Definition tg3_hw.c:968
void tg3_disable_ints(struct tg3 *tp)
Definition tg3_hw.c:959

References DBGP, tg3::dev, net_device::priv, tg3_disable_ints(), tg3_enable_ints(), and tp.

◆ tg3_do_test_dma()

int tg3_do_test_dma ( struct tg3 * tp,
u32 __unused * buf,
physaddr_t buf_dma,
int size,
int to_device )

Definition at line 2607 of file tg3_hw.c.

2608{ DBGP("%s\n", __func__);
2609
2610 struct tg3_internal_buffer_desc test_desc;
2611 u32 sram_dma_descs;
2612 int ret;
2613 unsigned int i;
2614
2615 sram_dma_descs = NIC_SRAM_DMA_DESC_POOL_BASE;
2616
2619 tw32(RDMAC_STATUS, 0);
2620 tw32(WDMAC_STATUS, 0);
2621
2622 tw32(BUFMGR_MODE, 0);
2623 tw32(FTQ_RESET, 0);
2624
2625 test_desc.addr_hi = ((u64) buf_dma) >> 32;
2626 test_desc.addr_lo = buf_dma & 0xffffffff;
2627 test_desc.nic_mbuf = 0x00002100;
2628 test_desc.len = size;
2629
2630 /*
2631 * HP ZX1 was seeing test failures for 5701 cards running at 33Mhz
2632 * the *second* time the tg3 driver was getting loaded after an
2633 * initial scan.
2634 *
2635 * Broadcom tells me:
2636 * ...the DMA engine is connected to the GRC block and a DMA
2637 * reset may affect the GRC block in some unpredictable way...
2638 * The behavior of resets to individual blocks has not been tested.
2639 *
2640 * Broadcom noted the GRC reset will also reset all sub-components.
2641 */
2642 if (to_device) {
2643 test_desc.cqid_sqid = (13 << 8) | 2;
2644
2646 udelay(40);
2647 } else {
2648 test_desc.cqid_sqid = (16 << 8) | 7;
2649
2651 udelay(40);
2652 }
2653 test_desc.flags = 0x00000005;
2654
2655 for (i = 0; i < (sizeof(test_desc) / sizeof(u32)); i++) {
2656 u32 val;
2657
2658 val = *(((u32 *)&test_desc) + i);
2660 sram_dma_descs + (i * sizeof(u32)));
2662 }
2664
2665 if (to_device)
2666 tw32(FTQ_DMA_HIGH_READ_FIFO_ENQDEQ, sram_dma_descs);
2667 else
2668 tw32(FTQ_DMA_HIGH_WRITE_FIFO_ENQDEQ, sram_dma_descs);
2669
2670 ret = -ENODEV;
2671 for (i = 0; i < 40; i++) {
2672 u32 val;
2673
2674 if (to_device)
2676 else
2678 if ((val & 0xffff) == sram_dma_descs) {
2679 ret = 0;
2680 break;
2681 }
2682
2683 udelay(100);
2684 }
2685
2686 return ret;
2687}
uint16_t size
Buffer size.
Definition dwmac.h:3
#define ENODEV
No such device.
Definition errno.h:510
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
void __asmcall int val
Definition setjmp.h:12
#define RDMAC_MODE_ENABLE
Definition tg3.h:1475
#define RDMAC_MODE
Definition tg3.h:1473
#define RDMAC_STATUS
Definition tg3.h:1495
#define tr32(reg)
Definition tg3.h:3338
#define FTQ_DMA_HIGH_READ_FIFO_ENQDEQ
Definition tg3.h:1700
#define tw32_f(reg, val)
Definition tg3.h:3332
#define FTQ_RESET
Definition tg3.h:1692
#define TG3PCI_MEM_WIN_BASE_ADDR
Definition tg3.h:407
#define WDMAC_STATUS
Definition tg3.h:1536
#define FTQ_RCVBD_COMP_FIFO_ENQDEQ
Definition tg3.h:1744
#define tw32(reg, val)
Definition tg3.h:3328
#define FTQ_RCVDATA_COMP_FIFO_ENQDEQ
Definition tg3.h:1756
#define WDMAC_MODE_ENABLE
Definition tg3.h:1524
#define NIC_SRAM_DMA_DESC_POOL_BASE
Definition tg3.h:2286
#define BUFMGR_MODE
Definition tg3.h:1419
#define FTQ_DMA_HIGH_WRITE_FIFO_ENQDEQ
Definition tg3.h:1720
#define TG3PCI_MEM_WIN_DATA
Definition tg3.h:409
#define WDMAC_MODE
Definition tg3.h:1522
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition timer.c:61

References __unused, tg3_internal_buffer_desc::addr_hi, tg3_internal_buffer_desc::addr_lo, BUFMGR_MODE, tg3_internal_buffer_desc::cqid_sqid, DBGP, ENODEV, tg3_internal_buffer_desc::flags, FTQ_DMA_HIGH_READ_FIFO_ENQDEQ, FTQ_DMA_HIGH_WRITE_FIFO_ENQDEQ, FTQ_RCVBD_COMP_FIFO_ENQDEQ, FTQ_RCVDATA_COMP_FIFO_ENQDEQ, FTQ_RESET, tg3_internal_buffer_desc::len, tg3_internal_buffer_desc::nic_mbuf, NIC_SRAM_DMA_DESC_POOL_BASE, pci_write_config_dword(), RDMAC_MODE, RDMAC_MODE_ENABLE, RDMAC_STATUS, size, TG3PCI_MEM_WIN_BASE_ADDR, TG3PCI_MEM_WIN_DATA, tp, tr32, tw32, tw32_f, u32, udelay(), val, WDMAC_MODE, WDMAC_MODE_ENABLE, and WDMAC_STATUS.

Referenced by tg3_test_dma().

◆ tg3_read_mem()

void tg3_read_mem ( struct tg3 * tp,
u32 off,
u32 * val )

Definition at line 153 of file tg3_hw.c.

154{ DBGP("%s\n", __func__);
155
156 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 &&
157 (off >= NIC_SRAM_STATS_BLK) && (off < NIC_SRAM_TX_BUFFER_DESC)) {
158 *val = 0;
159 return;
160 }
161
164
165 /* Always leave this as zero. */
167}
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
#define ASIC_REV_5906
Definition tg3.h:310
#define GET_ASIC_REV(CHIP_REV_ID)
Definition tg3.h:298
#define NIC_SRAM_STATS_BLK
Definition tg3.h:2200
#define NIC_SRAM_TX_BUFFER_DESC
Definition tg3.h:2288

References ASIC_REV_5906, DBGP, GET_ASIC_REV, NIC_SRAM_STATS_BLK, NIC_SRAM_TX_BUFFER_DESC, pci_read_config_dword(), pci_write_config_dword(), TG3PCI_MEM_WIN_BASE_ADDR, TG3PCI_MEM_WIN_DATA, tp, u32, and val.

Referenced by tg3_get_device_address(), tg3_get_eeprom_hw_cfg(), tg3_poll_fw(), and tg3_test_dma().

◆ tg3_test_dma()

int tg3_test_dma ( struct tg3 * tp)
static

Definition at line 552 of file tg3.c.

553{ DBGP("%s\n", __func__);
554
555 struct dma_mapping buf_map;
556 physaddr_t buf_dma;
557 u32 *buf;
558 int ret = 0;
559
560 memset(&buf_map, 0, sizeof(buf_map));
561 buf = dma_alloc(tp->dma, &buf_map, TEST_BUFFER_SIZE, TG3_DMA_ALIGNMENT);
562 if (!buf) {
563 ret = -ENOMEM;
564 goto out_nofree;
565 }
566 buf_dma = dma(&buf_map, buf);
567 DBGC2(tp->dev, "dma test buffer, virt: %p phys: %#016lx\n", buf, buf_dma);
568
569 if (tg3_flag(tp, 57765_PLUS)) {
571 goto out;
572 }
573
574 tp->dma_rwctrl = ((0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) |
576
577 if (tg3_flag(tp, PCI_EXPRESS)) {
578 /* DMA read watermark not used on PCIE */
579 tp->dma_rwctrl |= 0x00180000;
580 } else if (!tg3_flag(tp, PCIX_MODE)) {
581 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
582 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
583 tp->dma_rwctrl |= 0x003f0000;
584 else
585 tp->dma_rwctrl |= 0x003f000f;
586 } else {
587 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
588 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
589 u32 ccval = (tr32(TG3PCI_CLOCK_CTRL) & 0x1f);
590 u32 read_water = 0x7;
591
592 if (ccval == 0x6 || ccval == 0x7)
593 tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA;
594
595 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703)
596 read_water = 4;
597 /* Set bit 23 to enable PCIX hw bug fix */
598 tp->dma_rwctrl |=
599 (read_water << DMA_RWCTRL_READ_WATER_SHIFT) |
601 (1 << 23);
602 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) {
603 /* 5780 always in PCIX mode */
604 tp->dma_rwctrl |= 0x00144000;
605 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714) {
606 /* 5714 always in PCIX mode */
607 tp->dma_rwctrl |= 0x00148000;
608 } else {
609 tp->dma_rwctrl |= 0x001b000f;
610 }
611 }
612
613 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
614 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
615 tp->dma_rwctrl &= 0xfffffff0;
616
617 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
618 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) {
619 /* Remove this if it causes problems for some boards. */
620 tp->dma_rwctrl |= DMA_RWCTRL_USE_MEM_READ_MULT;
621
622 /* On 5700/5701 chips, we need to set this bit.
623 * Otherwise the chip will issue cacheline transactions
624 * to streamable DMA memory with not all the byte
625 * enables turned on. This is an error on several
626 * RISC PCI controllers, in particular sparc64.
627 *
628 * On 5703/5704 chips, this bit has been reassigned
629 * a different meaning. In particular, it is used
630 * on those chips to enable a PCI-X workaround.
631 */
632 tp->dma_rwctrl |= DMA_RWCTRL_ASSERT_ALL_BE;
633 }
634
635 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
636
637#if 0
638 /* Unneeded, already done by tg3_get_invariants. */
640#endif
641
642 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 &&
643 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701)
644 goto out;
645
646 /* It is best to perform DMA test with maximum write burst size
647 * to expose the 5700/5701 write DMA bug.
648 */
649 tp->dma_rwctrl &= ~DMA_RWCTRL_WRITE_BNDRY_MASK;
650 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
651
652 while (1) {
653 u32 *p = buf, i;
654
655 for (i = 0; i < TEST_BUFFER_SIZE / sizeof(u32); i++)
656 p[i] = i;
657
658 /* Send the buffer to the chip. */
659 ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 1);
660 if (ret) {
661 DBGC(&tp->pdev->dev,
662 "%s: Buffer write failed. err = %d\n",
663 __func__, ret);
664 break;
665 }
666
667 /* validate data reached card RAM correctly. */
668 for (i = 0; i < TEST_BUFFER_SIZE / sizeof(u32); i++) {
669 u32 val;
670 tg3_read_mem(tp, 0x2100 + (i*4), &val);
671 if (le32_to_cpu(val) != p[i]) {
672 DBGC(&tp->pdev->dev,
673 "%s: Buffer corrupted on device! "
674 "(%d != %d)\n", __func__, val, i);
675 /* ret = -ENODEV here? */
676 }
677 p[i] = 0;
678 }
679
680 /* Now read it back. */
681 ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 0);
682 if (ret) {
683 DBGC(&tp->pdev->dev, "%s: Buffer read failed. "
684 "err = %d\n", __func__, ret);
685 break;
686 }
687
688 /* Verify it. */
689 for (i = 0; i < TEST_BUFFER_SIZE / sizeof(u32); i++) {
690 if (p[i] == i)
691 continue;
692
693 if ((tp->dma_rwctrl & DMA_RWCTRL_WRITE_BNDRY_MASK) !=
695 tp->dma_rwctrl &= ~DMA_RWCTRL_WRITE_BNDRY_MASK;
696 tp->dma_rwctrl |= DMA_RWCTRL_WRITE_BNDRY_16;
697 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
698 break;
699 } else {
700 DBGC(&tp->pdev->dev,
701 "%s: Buffer corrupted on read back! "
702 "(%d != %d)\n", __func__, p[i], i);
703 ret = -ENODEV;
704 goto out;
705 }
706 }
707
708 if (i == (TEST_BUFFER_SIZE / sizeof(u32))) {
709 /* Success. */
710 ret = 0;
711 break;
712 }
713 }
714
715 if ((tp->dma_rwctrl & DMA_RWCTRL_WRITE_BNDRY_MASK) !=
717 /* DMA test passed without adjusting DMA boundary,
718 * now look for chipsets that are known to expose the
719 * DMA bug without failing the test.
720 */
721 tp->dma_rwctrl &= ~DMA_RWCTRL_WRITE_BNDRY_MASK;
722 tp->dma_rwctrl |= DMA_RWCTRL_WRITE_BNDRY_16;
723
724 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
725 }
726
727out:
728 dma_free(&buf_map, buf, TEST_BUFFER_SIZE);
729out_nofree:
730 return ret;
731}
__be32 out[4]
Definition CIB_PRM.h:8
#define le32_to_cpu(value)
Definition byteswap.h:114
physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
A DMA mapping.
Definition dma.h:33
#define TEST_BUFFER_SIZE
Definition tg3.c:547
int tg3_do_test_dma(struct tg3 *tp, u32 __unused *buf, physaddr_t buf_dma, int size, int to_device)
Definition tg3_hw.c:2607
void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
Definition tg3_hw.c:153
#define ASIC_REV_5780
Definition tg3.h:306
#define ASIC_REV_5701
Definition tg3.h:300
#define DMA_RWCTRL_PCI_WRITE_CMD_SHIFT
Definition tg3.h:378
#define TG3PCI_DMA_RW_CTRL
Definition tg3.h:340
#define ASIC_REV_5705
Definition tg3.h:303
#define DMA_RWCTRL_WRITE_BNDRY_MASK
Definition tg3.h:356
#define tg3_flag(tp, flag)
Definition tg3.h:3364
#define DMA_RWCTRL_PCI_READ_CMD_SHIFT
Definition tg3.h:376
#define ASIC_REV_5750
Definition tg3.h:304
#define ASIC_REV_5703
Definition tg3.h:301
#define TG3PCI_CLOCK_CTRL
Definition tg3.h:395
#define DMA_RWCTRL_USE_MEM_READ_MULT
Definition tg3.h:373
#define ASIC_REV_5700
Definition tg3.h:299
#define DMA_RWCTRL_ONE_DMA
Definition tg3.h:368
#define ASIC_REV_5704
Definition tg3.h:302
#define DMA_RWCTRL_DIS_CACHE_ALIGNMENT
Definition tg3.h:341
#define DMA_RWCTRL_READ_WATER_SHIFT
Definition tg3.h:370
#define DMA_RWCTRL_WRITE_WATER_SHIFT
Definition tg3.h:372
#define DMA_RWCTRL_ASSERT_ALL_BE
Definition tg3.h:374
#define ASIC_REV_5714
Definition tg3.h:307
#define DMA_RWCTRL_WRITE_BNDRY_16
Definition tg3.h:358
static void tg3_switch_clocks(struct tg3 *tp)
Definition tg3_hw.c:360

References ASIC_REV_5700, ASIC_REV_5701, ASIC_REV_5703, ASIC_REV_5704, ASIC_REV_5705, ASIC_REV_5714, ASIC_REV_5750, ASIC_REV_5780, DBGC, DBGC2, DBGP, dma(), dma_alloc(), dma_free(), DMA_RWCTRL_ASSERT_ALL_BE, DMA_RWCTRL_DIS_CACHE_ALIGNMENT, DMA_RWCTRL_ONE_DMA, DMA_RWCTRL_PCI_READ_CMD_SHIFT, DMA_RWCTRL_PCI_WRITE_CMD_SHIFT, DMA_RWCTRL_READ_WATER_SHIFT, DMA_RWCTRL_USE_MEM_READ_MULT, DMA_RWCTRL_WRITE_BNDRY_16, DMA_RWCTRL_WRITE_BNDRY_MASK, DMA_RWCTRL_WRITE_WATER_SHIFT, ENODEV, ENOMEM, GET_ASIC_REV, le32_to_cpu, memset(), out, TEST_BUFFER_SIZE, TG3_DMA_ALIGNMENT, tg3_do_test_dma(), tg3_flag, tg3_read_mem(), tg3_switch_clocks(), TG3PCI_CLOCK_CTRL, TG3PCI_DMA_RW_CTRL, tp, tr32, tw32, u32, and val.

Referenced by tg3_init_one().

◆ tg3_init_one()

int tg3_init_one ( struct pci_device * pdev)
static

Definition at line 733 of file tg3.c.

734{ DBGP("%s\n", __func__);
735
736 struct net_device *dev;
737 struct tg3 *tp;
738 int err = 0;
739 unsigned long reg_base, reg_size;
740
742
743 dev = alloc_etherdev(sizeof(*tp));
744 if (!dev) {
745 DBGC(&pdev->dev, "Failed to allocate etherdev\n");
746 err = -ENOMEM;
747 goto err_out_disable_pdev;
748 }
749
752
753 dev->dev = &pdev->dev;
754
755 tp = dev->priv;
756 tp->pdev = pdev;
757 tp->dev = dev;
758 tp->rx_mode = TG3_DEF_RX_MODE;
759 tp->tx_mode = TG3_DEF_TX_MODE;
760
761 /* Configure DMA. This must be done before any DMA allocation
762 * (including the self-test buffer in tg3_test_dma) so that
763 * buffers are mapped through the platform DMA implementation,
764 * which is required when preboot DMA protection (IOMMU) is
765 * active.
766 */
767 tp->dma = &pdev->dma;
768 dev->dma = tp->dma;
769 dma_set_mask_64bit ( tp->dma );
770
771 /* Subsystem IDs are required later */
772 pci_read_config_word(tp->pdev, PCI_SUBSYSTEM_VENDOR_ID, &tp->subsystem_vendor);
773 pci_read_config_word(tp->pdev, PCI_SUBSYSTEM_ID, &tp->subsystem_device);
774
775 /* The word/byte swap controls here control register access byte
776 * swapping. DMA data byte swapping is controlled in the GRC_MODE
777 * setting below.
778 */
779 tp->misc_host_ctrl =
784
785 /* The NONFRM (non-frame) byte/word swap controls take effect
786 * on descriptor entries, anything which isn't packet data.
787 *
788 * The StrongARM chips on the board (one for tx, one for rx)
789 * are running in big-endian mode.
790 */
793#if __BYTE_ORDER == __BIG_ENDIAN
794 tp->grc_mode |= GRC_MODE_BSWAP_NONFRM_DATA;
795#endif
796
797 /* FIXME: how can we detect errors here? */
800
801 tp->regs = pci_ioremap(pdev, reg_base, reg_size);
802 if (!tp->regs) {
803 DBGC(&pdev->dev, "Failed to remap device registers\n");
804 errno = -ENOENT;
805 goto err_out_disable_pdev;
806 }
807
808 err = tg3_get_invariants(tp);
809 if (err) {
810 DBGC(&pdev->dev, "Problem fetching invariants of chip, aborting\n");
811 goto err_out_iounmap;
812 }
813
815
817 if (err) {
818 DBGC(&pdev->dev, "Could not obtain valid ethernet address, aborting\n");
819 goto err_out_iounmap;
820 }
821
822 /*
823 * Reset chip in case UNDI or EFI driver did not shutdown
824 * DMA self test will enable WDMAC and we'll see (spurious)
825 * pending DMA on the PCI bus at that point.
826 */
830 tg3_halt(tp);
831 }
832
833 err = tg3_test_dma(tp);
834 if (err) {
835 DBGC(&pdev->dev, "DMA engine test failed, aborting\n");
836 goto err_out_iounmap;
837 }
838
842
843 tp->coal_now = HOSTCC_MODE_NOW;
844
845 err = register_netdev(dev);
846 if (err) {
847 DBGC(&pdev->dev, "Cannot register net device, aborting\n");
848 goto err_out_iounmap;
849 }
850
851 /* Call tg3_setup_phy() to start autoneg process, which saves time
852 * over starting autoneg in tg3_open();
853 */
854 err = tg3_setup_phy(tp, 0);
855 if (err) {
856 DBGC(tp->dev, "tg3_setup_phy() call failed in %s\n", __func__);
857 goto err_out_iounmap;
858 }
859
860 return 0;
861
862err_out_iounmap:
863 if (tp->regs) {
864 iounmap(tp->regs);
865 tp->regs = NULL;
866 }
867
869
870err_out_disable_pdev:
872 return err;
873}
int errno
Global "last error" number.
Definition errno.c:21
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
Definition ethernet.c:265
#define ENOENT
No such file or directory.
Definition errno.h:515
void iounmap(volatile const void *io_addr)
Unmap I/O address.
int pci_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
static __always_inline void dma_set_mask_64bit(struct dma_device *dma)
Set 64-bit addressable space mask.
Definition dma.h:467
int register_netdev(struct net_device *netdev)
Register network device.
Definition netdevice.c:760
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition netdevice.h:522
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition netdevice.h:579
unsigned long pci_bar_size(struct pci_device *pci, unsigned int reg)
Get the size of a PCI BAR.
Definition pci.c:178
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition pci.c:255
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
Definition pci.c:111
#define PCI_SUBSYSTEM_ID
PCI subsystem ID.
Definition pci.h:79
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
Definition pci.h:370
#define PCI_BASE_ADDRESS_0
Definition pci.h:63
#define PCI_SUBSYSTEM_VENDOR_ID
PCI subsystem vendor ID.
Definition pci.h:76
A network device.
Definition netdevice.h:353
struct dma_device * dma
DMA device.
Definition netdevice.h:367
struct device * dev
Underlying hardware device.
Definition netdevice.h:365
struct device dev
Generic device.
Definition pci.h:216
struct dma_device dma
DMA device.
Definition pci.h:218
struct pci_device * pdev
Definition tg3.h:3090
static int tg3_test_dma(struct tg3 *tp)
Definition tg3.c:552
#define TG3_DEF_TX_MODE
Definition tg3.c:21
#define TG3_DEF_RX_MODE
Definition tg3.c:20
static struct net_device_operations tg3_netdev_ops
Definition tg3.c:539
#define MISC_HOST_CTRL_INDIR_ACCESS
Definition tg3.h:252
#define MAILBOX_INTERRUPT_0
Definition tg3.h:431
#define MAILBOX_SNDHOST_PROD_IDX_0
Definition tg3.h:467
#define GRC_MODE_WSWAP_DATA
Definition tg3.h:1787
#define HOSTCC_MODE_NOW
Definition tg3.h:1303
#define MISC_HOST_CTRL_PCISTATE_RW
Definition tg3.h:249
#define MISC_HOST_CTRL_MASK_PCI_INT
Definition tg3.h:246
#define HOSTCC_MODE
Definition tg3.h:1299
#define GRC_MODE_WSWAP_NONFRM_DATA
Definition tg3.h:1785
#define MAILBOX_RCVRET_CON_IDX_0
Definition tg3.h:451
void tg3_init_bufmgr_config(struct tg3 *tp)
Definition tg3_hw.c:850
int tg3_get_invariants(struct tg3 *tp)
Definition tg3_hw.c:394
#define MEMARB_MODE
Definition tg3.h:1410
#define MISC_HOST_CTRL_WORD_SWAP
Definition tg3.h:248
#define GRC_MODE_BSWAP_DATA
Definition tg3.h:1786
int tg3_setup_phy(struct tg3 *tp, int force_reset)
Definition tg3_phy.c:2521
#define HOSTCC_MODE_ENABLE
Definition tg3.h:1301
#define MEMARB_MODE_ENABLE
Definition tg3.h:1412
#define TG3_64BIT_REG_LOW
Definition tg3.h:160
int tg3_get_device_address(struct tg3 *tp)
Definition tg3_hw.c:1650
#define GRC_MODE_BSWAP_NONFRM_DATA
Definition tg3.h:1784

References adjust_pci_device(), alloc_etherdev(), DBGC, DBGP, net_device::dev, pci_device::dev, tg3::dev, net_device::dma, pci_device::dma, dma_set_mask_64bit(), ENOENT, ENOMEM, errno, GRC_MODE_BSWAP_DATA, GRC_MODE_BSWAP_NONFRM_DATA, GRC_MODE_WSWAP_DATA, GRC_MODE_WSWAP_NONFRM_DATA, HOSTCC_MODE, HOSTCC_MODE_ENABLE, HOSTCC_MODE_NOW, iounmap(), MAILBOX_INTERRUPT_0, MAILBOX_RCVRET_CON_IDX_0, MAILBOX_SNDHOST_PROD_IDX_0, MEMARB_MODE, MEMARB_MODE_ENABLE, MISC_HOST_CTRL_INDIR_ACCESS, MISC_HOST_CTRL_MASK_PCI_INT, MISC_HOST_CTRL_PCISTATE_RW, MISC_HOST_CTRL_WORD_SWAP, netdev_init(), netdev_put(), NULL, pci_bar_size(), pci_bar_start(), PCI_BASE_ADDRESS_0, pci_ioremap(), pci_read_config_word(), pci_set_drvdata(), PCI_SUBSYSTEM_ID, PCI_SUBSYSTEM_VENDOR_ID, tg3::pdev, net_device::priv, register_netdev(), TG3_64BIT_REG_LOW, TG3_DEF_RX_MODE, TG3_DEF_TX_MODE, tg3_get_device_address(), tg3_get_invariants(), tg3_halt(), tg3_init_bufmgr_config(), tg3_netdev_ops, tg3_setup_phy(), tg3_test_dma(), tp, tr32, tw32, WDMAC_MODE, and WDMAC_MODE_ENABLE.

◆ tg3_remove_one()

void tg3_remove_one ( struct pci_device * pci)
static

Definition at line 875 of file tg3.c.

876{ DBGP("%s\n", __func__);
877
878 struct net_device *netdev = pci_get_drvdata(pci);
879
883}
static struct net_device * netdev
Definition gdbudp.c:53
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition netdevice.c:946
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition netdevice.h:535
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition pci.h:380

References DBGP, netdev, netdev_nullify(), netdev_put(), pci_get_drvdata(), and unregister_netdev().

Variable Documentation

◆ tg3_netdev_ops

struct net_device_operations tg3_netdev_ops
static
Initial value:
= {
.open = tg3_open,
.close = tg3_close,
.poll = tg3_poll,
.transmit = tg3_transmit,
.irq = tg3_irq,
}
static int tg3_transmit(struct net_device *dev, struct io_buffer *iob)
Definition tg3.c:305
static int tg3_open(struct net_device *dev)
Definition tg3.c:239
static void tg3_irq(struct net_device *dev, int enable)
Definition tg3.c:526
static void tg3_poll(struct net_device *dev)
Definition tg3.c:493
static void tg3_close(struct net_device *dev)
Definition tg3.c:511

Definition at line 539 of file tg3.c.

539 {
540 .open = tg3_open,
541 .close = tg3_close,
542 .poll = tg3_poll,
543 .transmit = tg3_transmit,
544 .irq = tg3_irq,
545};

Referenced by tg3_init_one().

◆ tg3_nics

struct pci_device_id tg3_nics[]
static

Definition at line 885 of file tg3.c.

885 {
886 PCI_ROM(0x106b, 0x1645, "106b-1645", "106b-1645", 0),
887 PCI_ROM(0x1148, 0x4400, "1148-4400", "1148-4400", 0),
888 PCI_ROM(0x1148, 0x4500, "1148-4500", "1148-4500", 0),
889 PCI_ROM(0x14e4, 0x1600, "14e4-1600", "14e4-1600", 0),
890 PCI_ROM(0x14e4, 0x1601, "14e4-1601", "14e4-1601", 0),
891 PCI_ROM(0x14e4, 0x1644, "14e4-1644", "14e4-1644", 0),
892 PCI_ROM(0x14e4, 0x1645, "14e4-1645", "14e4-1645", 0),
893 PCI_ROM(0x14e4, 0x1646, "14e4-1646", "14e4-1646", 0),
894 PCI_ROM(0x14e4, 0x1647, "14e4-1647", "14e4-1647", 0),
895 PCI_ROM(0x14e4, 0x1648, "14e4-1648", "14e4-1648", 0),
896 PCI_ROM(0x14e4, 0x1649, "14e4-1649", "14e4-1649", 0),
897 PCI_ROM(0x14e4, 0x164d, "14e4-164d", "14e4-164d", 0),
898 PCI_ROM(0x14e4, 0x1653, "14e4-1653", "14e4-1653", 0),
899 PCI_ROM(0x14e4, 0x1654, "14e4-1654", "14e4-1654", 0),
900 PCI_ROM(0x14e4, 0x1655, "14e4-1655", "14e4-1655", 0),
901 PCI_ROM(0x14e4, 0x1656, "14e4-1656", "14e4-1656", 0),
902 PCI_ROM(0x14e4, 0x1657, "14e4-1657", "14e4-1657", 0),
903 PCI_ROM(0x14e4, 0x1659, "14e4-1659", "14e4-1659", 0),
904 PCI_ROM(0x14e4, 0x165a, "14e4-165a", "14e4-165a", 0),
905 PCI_ROM(0x14e4, 0x165b, "14e4-165b", "14e4-165b", 0),
906 PCI_ROM(0x14e4, 0x165d, "14e4-165d", "14e4-165d", 0),
907 PCI_ROM(0x14e4, 0x165e, "14e4-165e", "14e4-165e", 0),
908 PCI_ROM(0x14e4, 0x165f, "14e4-165f", "14e4-165f", 0),
909 PCI_ROM(0x14e4, 0x1668, "14e4-1668", "14e4-1668", 0),
910 PCI_ROM(0x14e4, 0x1669, "14e4-1669", "14e4-1669", 0),
911 PCI_ROM(0x14e4, 0x166a, "14e4-166a", "14e4-166a", 0),
912 PCI_ROM(0x14e4, 0x166b, "14e4-166b", "14e4-166b", 0),
913 PCI_ROM(0x14e4, 0x166e, "14e4-166e", "14e4-166e", 0),
914 PCI_ROM(0x14e4, 0x1672, "14e4-1672", "14e4-1672", 0),
915 PCI_ROM(0x14e4, 0x1673, "14e4-1673", "14e4-1673", 0),
916 PCI_ROM(0x14e4, 0x1674, "14e4-1674", "14e4-1674", 0),
917 PCI_ROM(0x14e4, 0x1677, "14e4-1677", "14e4-1677", 0),
918 PCI_ROM(0x14e4, 0x1678, "14e4-1678", "14e4-1678", 0),
919 PCI_ROM(0x14e4, 0x1679, "14e4-1679", "14e4-1679", 0),
920 PCI_ROM(0x14e4, 0x167a, "14e4-167a", "14e4-167a", 0),
921 PCI_ROM(0x14e4, 0x167b, "14e4-167b", "14e4-167b", 0),
922 PCI_ROM(0x14e4, 0x167d, "14e4-167d", "14e4-167d", 0),
923 PCI_ROM(0x14e4, 0x167e, "14e4-167e", "14e4-167e", 0),
924 PCI_ROM(0x14e4, 0x167f, "14e4-167f", "14e4-167f", 0),
925 PCI_ROM(0x14e4, 0x1680, "14e4-1680", "14e4-1680", 0),
926 PCI_ROM(0x14e4, 0x1681, "14e4-1681", "14e4-1681", 0),
927 PCI_ROM(0x14e4, 0x1682, "14e4-1682", "14e4-1682", 0),
928 PCI_ROM(0x14e4, 0x1684, "14e4-1684", "14e4-1684", 0),
929 PCI_ROM(0x14e4, 0x1686, "14e4-1686", "14e4-1686", 0),
930 PCI_ROM(0x14e4, 0x1688, "14e4-1688", "14e4-1688", 0),
931 PCI_ROM(0x14e4, 0x1689, "14e4-1689", "14e4-1689", 0),
932 PCI_ROM(0x14e4, 0x1690, "14e4-1690", "14e4-1690", 0),
933 PCI_ROM(0x14e4, 0x1691, "14e4-1691", "14e4-1691", 0),
934 PCI_ROM(0x14e4, 0x1692, "14e4-1692", "14e4-1692", 0),
935 PCI_ROM(0x14e4, 0x1693, "14e4-1693", "14e4-1693", 0),
936 PCI_ROM(0x14e4, 0x1694, "14e4-1694", "14e4-1694", 0),
937 PCI_ROM(0x14e4, 0x1696, "14e4-1696", "14e4-1696", 0),
938 PCI_ROM(0x14e4, 0x1698, "14e4-1698", "14e4-1698", 0),
939 PCI_ROM(0x14e4, 0x1699, "14e4-1699", "14e4-1699", 0),
940 PCI_ROM(0x14e4, 0x169a, "14e4-169a", "14e4-169a", 0),
941 PCI_ROM(0x14e4, 0x169b, "14e4-169b", "14e4-169b", 0),
942 PCI_ROM(0x14e4, 0x169c, "14e4-169c", "14e4-169c", 0),
943 PCI_ROM(0x14e4, 0x169d, "14e4-169d", "14e4-169d", 0),
944 PCI_ROM(0x14e4, 0x16a0, "14e4-16a0", "14e4-16a0", 0),
945 PCI_ROM(0x14e4, 0x16a6, "14e4-16a6", "14e4-16a6", 0),
946 PCI_ROM(0x14e4, 0x16a7, "14e4-16a7", "14e4-16a7", 0),
947 PCI_ROM(0x14e4, 0x16a8, "14e4-16a8", "14e4-16a8", 0),
948 PCI_ROM(0x14e4, 0x16b0, "14e4-16b0", "14e4-16b0", 0),
949 PCI_ROM(0x14e4, 0x16b1, "14e4-16b1", "14e4-16b1", 0),
950 PCI_ROM(0x14e4, 0x16b2, "14e4-16b2", "14e4-16b2", 0),
951 PCI_ROM(0x14e4, 0x16b4, "14e4-16b4", "14e4-16b4", 0),
952 PCI_ROM(0x14e4, 0x16b5, "14e4-16b5", "14e4-16b5", 0),
953 PCI_ROM(0x14e4, 0x16b6, "14e4-16b6", "14e4-16b6", 0),
954 PCI_ROM(0x14e4, 0x16c6, "14e4-16c6", "14e4-16c6", 0),
955 PCI_ROM(0x14e4, 0x16c7, "14e4-16c7", "14e4-16c7", 0),
956 PCI_ROM(0x14e4, 0x16dd, "14e4-16dd", "14e4-16dd", 0),
957 PCI_ROM(0x14e4, 0x16f7, "14e4-16f7", "14e4-16f7", 0),
958 PCI_ROM(0x14e4, 0x16fd, "14e4-16fd", "14e4-16fd", 0),
959 PCI_ROM(0x14e4, 0x16fe, "14e4-16fe", "14e4-16fe", 0),
960 PCI_ROM(0x14e4, 0x170d, "14e4-170d", "14e4-170d", 0),
961 PCI_ROM(0x14e4, 0x170e, "14e4-170e", "14e4-170e", 0),
962 PCI_ROM(0x14e4, 0x1712, "14e4-1712", "14e4-1712", 0),
963 PCI_ROM(0x14e4, 0x1713, "14e4-1713", "14e4-1713", 0),
964 PCI_ROM(0x173b, 0x03e8, "173b-03e8", "173b-03e8", 0),
965 PCI_ROM(0x173b, 0x03e9, "173b-03e9", "173b-03e9", 0),
966 PCI_ROM(0x173b, 0x03ea, "173b-03ea", "173b-03ea", 0),
967 PCI_ROM(0x173b, 0x03eb, "173b-03eb", "173b-03eb", 0),
968};
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition pci.h:311

◆ __pci_driver

struct pci_driver tg3_pci_driver __pci_driver
Initial value:
= {
.ids = tg3_nics,
.id_count = ARRAY_SIZE(tg3_nics),
.probe = tg3_init_one,
.remove = tg3_remove_one,
}
#define ARRAY_SIZE(x)
Definition efx_common.h:43
static struct pci_device_id tg3_nics[]
Definition tg3.c:885
static void tg3_remove_one(struct pci_device *pci)
Definition tg3.c:875
static int tg3_init_one(struct pci_device *pdev)
Definition tg3.c:733

Definition at line 970 of file tg3.c.

970 {
971 .ids = tg3_nics,
972 .id_count = ARRAY_SIZE(tg3_nics),
973 .probe = tg3_init_one,
974 .remove = tg3_remove_one,
975};