iPXE
Functions | Variables
vxge_main.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ipxe/io.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/pci.h>
#include <ipxe/malloc.h>
#include <ipxe/if_ether.h>
#include <ipxe/ethernet.h>
#include <ipxe/iobuf.h>
#include <ipxe/netdevice.h>
#include <ipxe/timer.h>
#include <nic.h>
#include "vxge_main.h"
#include "vxge_reg.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_ONLY)
 
static int is_vxge_card_up (struct vxgedev *vdev)
 
enum vxge_hw_status vxge_xmit_compl (struct __vxge_hw_fifo *fifo_hw, struct vxge_hw_fifo_txd *txdp, enum vxge_hw_fifo_tcode tcode)
 
enum vxge_hw_status vxge_reset_all_vpaths (struct vxgedev *vdev)
 
void vxge_close_vpaths (struct vxgedev *vdev)
 
int vxge_open_vpaths (struct vxgedev *vdev)
 
static int vxge_xmit (struct net_device *dev, struct io_buffer *iobuf)
 Functions that implement the iPXE driver API. More...
 
static void vxge_poll (struct net_device *ndev)
 
static void vxge_irq (struct net_device *netdev __unused, int action)
 
int vxge_open (struct net_device *dev)
 vxge_open @dev: pointer to the device structure. More...
 
static void vxge_close (struct net_device *dev)
 vxge_close @dev: device pointer. More...
 
int vxge_device_register (struct __vxge_hw_device *hldev, struct vxgedev **vdev_out)
 
void vxge_device_unregister (struct __vxge_hw_device *hldev)
 
static int vxge_probe (struct pci_device *pdev)
 vxge_probe @pdev : structure containing the PCI related information of the device. More...
 
static void vxge_remove (struct pci_device *pdev)
 vxge_remove - Free the PCI device @pdev: structure containing the PCI related information of the device. More...
 

Variables

static char * vxge_func_mode_names []
 
static struct net_device_operations vxge_operations
 
static struct pci_device_id vxge_main_nics []
 
struct pci_driver vxge_driver __pci_driver
 

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_ONLY  )

◆ is_vxge_card_up()

static int is_vxge_card_up ( struct vxgedev vdev)
inlinestatic

Definition at line 51 of file vxge_main.c.

52 {
53  return test_bit(__VXGE_STATE_CARD_UP, vdev->state);
54 }
unsigned long state
Definition: vxge_main.h:204
#define test_bit(bit, loc)
Definition: vxge_main.h:165
#define __VXGE_STATE_CARD_UP
Definition: vxge_main.h:163

References __VXGE_STATE_CARD_UP, vxgedev::state, and test_bit.

Referenced by vxge_close(), vxge_poll(), vxge_reset_all_vpaths(), and vxge_xmit().

◆ vxge_xmit_compl()

enum vxge_hw_status vxge_xmit_compl ( struct __vxge_hw_fifo fifo_hw,
struct vxge_hw_fifo_txd txdp,
enum vxge_hw_fifo_tcode  tcode 
)

Definition at line 65 of file vxge_main.c.

67 {
68  struct net_device *netdev;
69  struct io_buffer *tx_iob = NULL;
70 
71  vxge_trace();
72 
73  netdev = fifo_hw->vpathh->hldev->ndev;
74 
75  tx_iob = (struct io_buffer *)(intptr_t)txdp->host_control;
76 
77  if (tcode == VXGE_HW_FIFO_T_CODE_OK) {
78  netdev_tx_complete(netdev, tx_iob);
79  } else {
81  vxge_debug(VXGE_ERR, "%s: transmit failed, tcode %d\n",
82  netdev->name, tcode);
83  }
84 
85  memset(txdp, 0, sizeof(struct vxge_hw_fifo_txd));
86 
87  return VXGE_HW_OK;
88 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
Definition: netdevice.h:752
struct __vxge_hw_virtualpath * vpathh
Definition: vxge_config.h:334
struct vxge_hw_fifo_txd - Transmit Descriptor
Definition: vxge_config.h:212
unsigned long intptr_t
Definition: stdint.h:21
#define vxge_debug(mask, fmt...)
Definition: vxge_config.h:762
static struct net_device * netdev
Definition: gdbudp.c:52
A network device.
Definition: netdevice.h:352
Definition: sis900.h:30
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
Definition: netdevice.c:470
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
#define vxge_trace()
Definition: vxge_config.h:767
struct __vxge_hw_device * hldev
Definition: vxge_config.h:396
struct net_device * ndev
Definition: vxge_config.h:483
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
#define VXGE_ERR
Definition: vxge_config.h:54
void * memset(void *dest, int character, size_t len) __nonnull
A persistent I/O buffer.
Definition: iobuf.h:33

References EINVAL, __vxge_hw_virtualpath::hldev, memset(), net_device::name, __vxge_hw_device::ndev, netdev, netdev_tx_complete(), netdev_tx_complete_err(), NULL, txdp, __vxge_hw_fifo::vpathh, vxge_debug, VXGE_ERR, VXGE_HW_FIFO_T_CODE_OK, VXGE_HW_OK, and vxge_trace.

Referenced by vxge_hw_vpath_poll_tx().

◆ vxge_reset_all_vpaths()

enum vxge_hw_status vxge_reset_all_vpaths ( struct vxgedev vdev)

Definition at line 91 of file vxge_main.c.

92 {
94  struct __vxge_hw_virtualpath *vpath;
95 
96  vxge_trace();
97 
98  vpath = vdev->vpath.vpathh;
99 
100  if (vpath) {
101  if ((status = vxge_hw_vpath_reset(vpath)) == VXGE_HW_OK) {
102  if (is_vxge_card_up(vdev) &&
104  vpath)) != VXGE_HW_OK) {
105  vxge_debug(VXGE_ERR, "vxge_hw_vpath_recover_"
106  "from_reset failed\n");
107  return status;
108  } else {
110  if (status != VXGE_HW_OK) {
112  "__vxge_hw_vpath_reset_check error\n");
113  return status;
114  }
115  }
116  } else {
117  vxge_debug(VXGE_ERR, "vxge_hw_vpath_reset failed\n");
118  return status;
119  }
120  }
121  return status;
122 }
enum vxge_hw_status vxge_hw_vpath_reset(struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1793
static int is_vxge_card_up(struct vxgedev *vdev)
Definition: vxge_main.c:51
#define vxge_debug(mask, fmt...)
Definition: vxge_config.h:762
uint8_t status
Status.
Definition: ena.h:16
struct vxge_vpath vpath
Definition: vxge_main.h:206
enum vxge_hw_status vxge_hw_vpath_recover_from_reset(struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1818
enum vxge_hw_status __vxge_hw_vpath_reset_check(struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1249
#define vxge_trace()
Definition: vxge_config.h:767
vxge_hw_status
Definition: vxge_config.h:70
struct __vxge_hw_virtualpath * vpathh
Definition: vxge_main.h:195
#define VXGE_ERR
Definition: vxge_config.h:54

References __vxge_hw_vpath_reset_check(), is_vxge_card_up(), status, vxgedev::vpath, vxge_vpath::vpathh, vxge_debug, VXGE_ERR, VXGE_HW_OK, vxge_hw_vpath_recover_from_reset(), vxge_hw_vpath_reset(), and vxge_trace.

Referenced by vxge_close().

◆ vxge_close_vpaths()

void vxge_close_vpaths ( struct vxgedev vdev)

Definition at line 125 of file vxge_main.c.

126 {
127 
128  if (vdev->vpath.vpathh && vdev->vpath.is_open)
130 
131  vdev->vpath.is_open = 0;
132  vdev->vpath.vpathh = NULL;
133 }
struct vxge_vpath vpath
Definition: vxge_main.h:206
int is_open
Definition: vxge_main.h:190
enum vxge_hw_status vxge_hw_vpath_close(struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1760
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
struct __vxge_hw_virtualpath * vpathh
Definition: vxge_main.h:195

References vxge_vpath::is_open, NULL, vxgedev::vpath, vxge_vpath::vpathh, and vxge_hw_vpath_close().

Referenced by vxge_close(), vxge_open(), and vxge_open_vpaths().

◆ vxge_open_vpaths()

int vxge_open_vpaths ( struct vxgedev vdev)

Definition at line 136 of file vxge_main.c.

137 {
138  enum vxge_hw_status status;
139  struct __vxge_hw_device *hldev;
140 
141  hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev);
142 
143  vdev->vpath.vpathh = &hldev->virtual_path;
144  vdev->vpath.fifo.ndev = vdev->ndev;
145  vdev->vpath.fifo.pdev = vdev->pdev;
146  vdev->vpath.fifo.fifoh = &hldev->virtual_path.fifoh;
147  vdev->vpath.ring.ndev = vdev->ndev;
148  vdev->vpath.ring.pdev = vdev->pdev;
149  vdev->vpath.ring.ringh = &hldev->virtual_path.ringh;
150 
152  if (status == VXGE_HW_OK) {
153  vdev->vpath.is_open = 1;
154  } else {
156  "%s: vpath: %d failed to open "
157  "with status: %d\n",
159  status);
161  return status;
162  }
163 
165 
166  return VXGE_HW_OK;
167 }
struct net_device * ndev
Definition: vxge_main.h:178
struct vxge_fifo fifo
Definition: vxge_main.h:185
int device_id
Definition: vxge_main.h:189
struct pci_device * pdev
Definition: vxge_main.h:173
struct __vxge_hw_virtualpath virtual_path
Definition: vxge_config.h:507
struct __vxge_hw_fifo * fifoh
Definition: vxge_main.h:174
struct __vxge_hw_device * devh
Definition: vxge_main.h:201
#define vxge_debug(mask, fmt...)
Definition: vxge_config.h:762
struct vxgedev * vdev
Definition: vxge_config.h:484
uint8_t status
Status.
Definition: ena.h:16
struct vxge_vpath vpath
Definition: vxge_main.h:206
struct net_device * ndev
Definition: vxge_main.h:199
struct net_device * ndev
Definition: vxge_main.h:172
struct pci_device * pdev
Definition: vxge_main.h:200
int is_open
Definition: vxge_main.h:190
void vxge_close_vpaths(struct vxgedev *vdev)
Definition: vxge_main.c:125
#define vxge_mBIT(loc)
Definition: vxge_reg.h:24
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition: pci.h:369
struct __vxge_hw_device - Hal device object @magic: Magic Number @bar0: BAR0 virtual address.
Definition: vxge_config.h:477
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
struct __vxge_hw_ring ringh
Definition: vxge_config.h:406
struct vxge_ring ring
Definition: vxge_main.h:186
struct pci_device * pdev
Definition: vxge_main.h:179
vxge_hw_status
Definition: vxge_config.h:70
struct __vxge_hw_ring * ringh
Definition: vxge_main.h:180
struct __vxge_hw_fifo fifoh
Definition: vxge_config.h:407
enum vxge_hw_status vxge_hw_vpath_open(struct __vxge_hw_device *hldev, struct vxge_vpath *vpath)
Definition: vxge_config.c:1690
struct __vxge_hw_virtualpath * vpathh
Definition: vxge_main.h:195
#define VXGE_ERR
Definition: vxge_config.h:54

References vxgedev::devh, vxge_vpath::device_id, vxge_vpath::fifo, vxge_fifo::fifoh, __vxge_hw_virtualpath::fifoh, vxge_vpath::is_open, net_device::name, vxge_fifo::ndev, vxge_ring::ndev, vxgedev::ndev, pci_get_drvdata(), vxge_fifo::pdev, vxge_ring::pdev, vxgedev::pdev, vxge_vpath::ring, vxge_ring::ringh, __vxge_hw_virtualpath::ringh, status, __vxge_hw_device::vdev, __vxge_hw_device::virtual_path, __vxge_hw_virtualpath::vp_id, vxgedev::vpath, vxge_vpath::vpathh, __vxge_hw_device::vpaths_deployed, vxge_close_vpaths(), vxge_debug, VXGE_ERR, VXGE_HW_OK, vxge_hw_vpath_open(), and vxge_mBIT.

Referenced by vxge_open().

◆ vxge_xmit()

static int vxge_xmit ( struct net_device dev,
struct io_buffer iobuf 
)
static

Functions that implement the iPXE driver API.

vxge_xmit @skb : the socket buffer containing the Tx data. @dev : device pointer.

This function is the Tx entry point of the driver. Neterion NIC supports certain protocol assist features on Tx side, namely CSO, S/G, LSO.

Definition at line 180 of file vxge_main.c.

181 {
182  struct vxge_fifo *fifo = NULL;
183  struct vxgedev *vdev = NULL;
184  struct __vxge_hw_fifo *fifoh;
185  struct vxge_hw_fifo_txd *txdp;
186 
187  vxge_trace();
188 
189  vdev = (struct vxgedev *)dev->priv;
190 
191  if (!is_vxge_card_up(vdev)) {
193  "%s: vdev not initialized\n", dev->name);
194  return -EIO;
195  }
196 
197  if (!netdev_link_ok(dev)) {
199  "%s: Link down, transmit failed\n", dev->name);
200  return -ENETDOWN;
201  }
202 
203  fifo = &vdev->vpath.fifo;
204  fifoh = fifo->fifoh;
205 
207  if (!txdp) {
209  "%s: Out of tx descriptors\n", dev->name);
210  return -ENOBUFS;
211  }
212 
213  vxge_debug(VXGE_XMIT, "%s: %s:%d fifoh offset= %d\n",
214  dev->name, __func__, __LINE__, fifoh->sw_offset);
215 
216  vxge_hw_fifo_txdl_buffer_set(fifoh, txdp, iobuf);
217 
219 
220  return 0;
221 }
struct vxge_fifo fifo
Definition: vxge_main.h:185
#define VXGE_XMIT
Definition: vxge_config.h:52
struct vxge_hw_fifo_txd - Transmit Descriptor
Definition: vxge_config.h:212
struct __vxge_hw_fifo * fifoh
Definition: vxge_main.h:174
static int is_vxge_card_up(struct vxgedev *vdev)
Definition: vxge_main.c:51
#define vxge_debug(mask, fmt...)
Definition: vxge_config.h:762
struct vxge_hw_fifo_txd * vxge_hw_fifo_free_txdl_get(struct __vxge_hw_fifo *fifo)
vxge_hw_fifo_free_txdl_get: fetch next available txd in the fifo
Definition: vxge_traffic.c:354
struct vxge_vpath vpath
Definition: vxge_main.h:206
void vxge_hw_fifo_txdl_buffer_set(struct __vxge_hw_fifo *fifo, struct vxge_hw_fifo_txd *txdp, struct io_buffer *iob)
vxge_hw_fifo_txdl_buffer_set - Set transmit buffer pointer in the descriptor.
Definition: vxge_traffic.c:374
void vxge_hw_fifo_txdl_post(struct __vxge_hw_fifo *fifo, struct vxge_hw_fifo_txd *txdp)
vxge_hw_fifo_txdl_post - Post descriptor on the fifo channel.
Definition: vxge_traffic.c:399
void * priv
Driver private data.
Definition: netdevice.h:431
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
Definition: netdevice.h:636
Definition: sis900.h:30
#define ENETDOWN
Network is down.
Definition: errno.h:478
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
#define ENOBUFS
No buffer space available.
Definition: errno.h:498
#define EIO
Input/output error.
Definition: errno.h:433
#define vxge_trace()
Definition: vxge_config.h:767
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
#define VXGE_ERR
Definition: vxge_config.h:54
if(natsemi->flags &NATSEMI_64BIT) return 1

References EIO, ENETDOWN, ENOBUFS, vxge_vpath::fifo, vxge_fifo::fifoh, if(), is_vxge_card_up(), net_device::name, netdev_link_ok(), NULL, net_device::priv, __vxge_hw_fifo::sw_offset, txdp, vxgedev::vpath, vxge_debug, VXGE_ERR, vxge_hw_fifo_free_txdl_get(), vxge_hw_fifo_txdl_buffer_set(), vxge_hw_fifo_txdl_post(), vxge_trace, and VXGE_XMIT.

◆ vxge_poll()

static void vxge_poll ( struct net_device ndev)
static

Definition at line 231 of file vxge_main.c.

232 {
233  struct __vxge_hw_device *hldev;
234  struct vxgedev *vdev;
235 
236  vxge_debug(VXGE_POLL, "%s:%d \n", __func__, __LINE__);
237 
238  vdev = (struct vxgedev *)ndev->priv;
239  hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev);
240 
241  if (!is_vxge_card_up(vdev))
242  return;
243 
244  /* process alarm and acknowledge the interrupts */
246 
248 
250 }
struct __vxge_hw_virtualpath virtual_path
Definition: vxge_config.h:507
static int is_vxge_card_up(struct vxgedev *vdev)
Definition: vxge_main.c:51
#define vxge_debug(mask, fmt...)
Definition: vxge_config.h:762
enum vxge_hw_status vxge_hw_vpath_poll_tx(struct __vxge_hw_fifo *fifo)
vxge_hw_vpath_poll_tx - Poll Tx for completed descriptors and process the same.
Definition: vxge_traffic.c:722
enum vxge_hw_status vxge_hw_vpath_poll_rx(struct __vxge_hw_ring *ring)
Definition: vxge_traffic.c:641
struct net_device * ndev
Definition: vxge_main.h:199
void * priv
Driver private data.
Definition: netdevice.h:431
struct pci_device * pdev
Definition: vxge_main.h:200
#define VXGE_POLL
Definition: vxge_config.h:53
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition: pci.h:369
struct __vxge_hw_device - Hal device object @magic: Magic Number @bar0: BAR0 virtual address.
Definition: vxge_config.h:477
enum vxge_hw_status vxge_hw_device_begin_irq(struct __vxge_hw_device *hldev)
vxge_hw_device_begin_irq - Begin IRQ processing.
Definition: vxge_traffic.c:554
struct __vxge_hw_ring ringh
Definition: vxge_config.h:406
struct __vxge_hw_fifo fifoh
Definition: vxge_config.h:407

References __vxge_hw_virtualpath::fifoh, is_vxge_card_up(), vxgedev::ndev, pci_get_drvdata(), vxgedev::pdev, net_device::priv, __vxge_hw_virtualpath::ringh, __vxge_hw_device::virtual_path, vxge_debug, vxge_hw_device_begin_irq(), vxge_hw_vpath_poll_rx(), vxge_hw_vpath_poll_tx(), and VXGE_POLL.

◆ vxge_irq()

static void vxge_irq ( struct net_device *netdev  __unused,
int  action 
)
static

Definition at line 258 of file vxge_main.c.

259 {
260  struct __vxge_hw_device *hldev;
261  struct vxgedev *vdev;
262 
264  "%s:%d action(%d)\n", __func__, __LINE__, action);
265 
266  vdev = (struct vxgedev *)netdev->priv;
267  hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev);
268 
269  switch (action) {
270  case DISABLE:
272  break;
273  default:
275  break;
276  }
277 }
Definition: nic.h:35
#define VXGE_INFO
Definition: vxge_config.h:50
#define vxge_debug(mask, fmt...)
Definition: vxge_config.h:762
void vxge_hw_device_unmask_all(struct __vxge_hw_device *hldev)
vxge_hw_device_unmask_all - Unmask all device interrupts.
Definition: vxge_traffic.c:231
void * priv
Driver private data.
Definition: netdevice.h:431
static struct net_device * netdev
Definition: gdbudp.c:52
struct pci_device * pdev
Definition: vxge_main.h:200
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition: pci.h:369
struct __vxge_hw_device - Hal device object @magic: Magic Number @bar0: BAR0 virtual address.
Definition: vxge_config.h:477
void vxge_hw_device_mask_all(struct __vxge_hw_device *hldev)
vxge_hw_device_mask_all - Mask all device interrupts.
Definition: vxge_traffic.c:210

References DISABLE, netdev, pci_get_drvdata(), vxgedev::pdev, net_device::priv, vxge_debug, vxge_hw_device_mask_all(), vxge_hw_device_unmask_all(), and VXGE_INFO.

◆ vxge_open()

int vxge_open ( struct net_device dev)

vxge_open @dev: pointer to the device structure.

This function is the open entry point of the driver. It mainly calls a function to allocate Rx buffers and inserts them into the buffer descriptors and then enables the Rx part of the NIC. Return value: '0' on success and an appropriate (-)ve integer as defined in errno.h file on failure.

Definition at line 290 of file vxge_main.c.

291 {
292  enum vxge_hw_status status;
293  struct vxgedev *vdev;
294  struct __vxge_hw_device *hldev;
295  int ret = 0;
296 
297  vxge_debug(VXGE_INFO, "%s: %s:%d\n",
298  VXGE_DRIVER_NAME, __func__, __LINE__);
299 
300  vdev = (struct vxgedev *)dev->priv;
301  hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev);
302 
303  /* make sure you have link off by default every time Nic is
304  * initialized */
305  netdev_link_down(dev);
306 
307  /* Open VPATHs */
308  status = vxge_open_vpaths(vdev);
309  if (status != VXGE_HW_OK) {
310  vxge_debug(VXGE_ERR, "%s: fatal: Vpath open failed\n",
312  ret = -EPERM;
313  goto out0;
314  }
315 
316  vdev->mtu = VXGE_HW_DEFAULT_MTU;
317  /* set initial mtu before enabling the device */
318  status = vxge_hw_vpath_mtu_set(vdev->vpath.vpathh, vdev->mtu);
319  if (status != VXGE_HW_OK) {
321  "%s: fatal: can not set new MTU\n", dev->name);
322  ret = -EPERM;
323  goto out2;
324  }
326  "%s: MTU is %d\n", vdev->ndev->name, vdev->mtu);
327 
329 
330  wmb();
331 
333  netdev_link_up(vdev->ndev);
334  vxge_debug(VXGE_INFO, "%s: Link Up\n", vdev->ndev->name);
335  }
336 
338 
340  wmb();
342 
343  goto out0;
344 
345 out2:
346  vxge_close_vpaths(vdev);
347 out0:
348  vxge_debug(VXGE_INFO, "%s: %s:%d Exiting...\n",
349  dev->name, __func__, __LINE__);
350  return ret;
351 }
wmb()
void vxge_hw_vpath_enable(struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1854
int vxge_open_vpaths(struct vxgedev *vdev)
Definition: vxge_main.c:136
#define VXGE_HW_DEFAULT_MTU
Definition: vxge_config.h:36
int mtu
Definition: vxge_main.h:209
static enum vxge_hw_device_link_state vxge_hw_device_link_state_get(struct __vxge_hw_device *devh)
vxge_hw_device_link_state_get - Get link state.
Definition: vxge_config.h:629
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
Definition: netdevice.c:230
#define VXGE_INFO
Definition: vxge_config.h:50
struct __vxge_hw_device * devh
Definition: vxge_main.h:201
#define vxge_debug(mask, fmt...)
Definition: vxge_config.h:762
struct vxgedev * vdev
Definition: vxge_config.h:484
uint8_t status
Status.
Definition: ena.h:16
struct vxge_vpath vpath
Definition: vxge_main.h:206
struct net_device * ndev
Definition: vxge_main.h:199
void * priv
Driver private data.
Definition: netdevice.h:431
unsigned long state
Definition: vxge_main.h:204
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
Definition: netdevice.h:774
void vxge_hw_device_intr_enable(struct __vxge_hw_device *hldev)
vxge_hw_device_intr_enable - Enable interrupts.
Definition: vxge_traffic.c:250
struct pci_device * pdev
Definition: vxge_main.h:200
enum vxge_hw_status vxge_hw_vpath_mtu_set(struct __vxge_hw_virtualpath *vpath, u32 new_mtu)
Definition: vxge_config.c:1661
void set_bit(unsigned int bit, volatile void *bits)
void vxge_hw_vpath_rx_doorbell_init(struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1737
void vxge_close_vpaths(struct vxgedev *vdev)
Definition: vxge_main.c:125
#define EPERM
Operation not permitted.
Definition: errno.h:614
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition: pci.h:369
struct __vxge_hw_device - Hal device object @magic: Magic Number @bar0: BAR0 virtual address.
Definition: vxge_config.h:477
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
vxge_hw_status
Definition: vxge_config.h:70
#define __VXGE_STATE_CARD_UP
Definition: vxge_main.h:163
#define VXGE_DRIVER_NAME
Definition: vxge_main.h:24
struct __vxge_hw_virtualpath * vpathh
Definition: vxge_main.h:195
#define VXGE_ERR
Definition: vxge_config.h:54

References __VXGE_STATE_CARD_UP, vxgedev::devh, EPERM, vxgedev::mtu, net_device::name, vxgedev::ndev, netdev_link_down(), netdev_link_up(), pci_get_drvdata(), vxgedev::pdev, net_device::priv, set_bit(), vxgedev::state, status, __vxge_hw_device::vdev, vxgedev::vpath, vxge_vpath::vpathh, vxge_close_vpaths(), vxge_debug, VXGE_DRIVER_NAME, VXGE_ERR, VXGE_HW_DEFAULT_MTU, vxge_hw_device_intr_enable(), vxge_hw_device_link_state_get(), VXGE_HW_LINK_UP, VXGE_HW_OK, vxge_hw_vpath_enable(), vxge_hw_vpath_mtu_set(), vxge_hw_vpath_rx_doorbell_init(), VXGE_INFO, vxge_open_vpaths(), and wmb().

◆ vxge_close()

static void vxge_close ( struct net_device dev)
static

vxge_close @dev: device pointer.

This is the stop entry point of the driver. It needs to undo exactly whatever was done by the open entry point, thus it's usually referred to as the close function.Among other things this function mainly stops the Rx side of the NIC and frees all the Rx buffers in the Rx rings. Return value: '0' on success and an appropriate (-)ve integer as defined in errno.h file on failure.

Definition at line 364 of file vxge_main.c.

365 {
366  struct vxgedev *vdev;
367  struct __vxge_hw_device *hldev;
368 
369  vxge_debug(VXGE_INFO, "%s: %s:%d\n",
370  dev->name, __func__, __LINE__);
371 
372  vdev = (struct vxgedev *)dev->priv;
373  hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev);
374 
375  if (!is_vxge_card_up(vdev))
376  return;
377 
379 
381 
382  netdev_link_down(vdev->ndev);
383  vxge_debug(VXGE_INFO, "%s: Link Down\n", vdev->ndev->name);
384 
385  /* Note that at this point xmit() is stopped by upper layer */
387 
388  /* Multi function shares INTA, hence we should
389  * leave it in enabled state
390  */
391  if (is_mf(hldev->hw_info.function_mode))
393 
394  vxge_reset_all_vpaths(vdev);
395 
396  vxge_close_vpaths(vdev);
397 
399  "%s: %s:%d Exiting...\n", dev->name, __func__, __LINE__);
400 }
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
Definition: netdevice.c:230
static int is_vxge_card_up(struct vxgedev *vdev)
Definition: vxge_main.c:51
#define VXGE_INFO
Definition: vxge_config.h:50
#define vxge_debug(mask, fmt...)
Definition: vxge_config.h:762
void vxge_hw_device_intr_disable(struct __vxge_hw_device *hldev)
vxge_hw_device_intr_disable - Disable Titan interrupts.
Definition: vxge_traffic.c:295
struct vxgedev * vdev
Definition: vxge_config.h:484
void vxge_hw_device_unmask_all(struct __vxge_hw_device *hldev)
vxge_hw_device_unmask_all - Unmask all device interrupts.
Definition: vxge_traffic.c:231
struct net_device * ndev
Definition: vxge_main.h:199
void * priv
Driver private data.
Definition: netdevice.h:431
unsigned long state
Definition: vxge_main.h:204
#define is_mf(function_mode)
Definition: vxge_main.h:151
struct pci_device * pdev
Definition: vxge_main.h:200
enum vxge_hw_status vxge_reset_all_vpaths(struct vxgedev *vdev)
Definition: vxge_main.c:91
void vxge_close_vpaths(struct vxgedev *vdev)
Definition: vxge_main.c:125
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition: pci.h:369
struct __vxge_hw_device - Hal device object @magic: Magic Number @bar0: BAR0 virtual address.
Definition: vxge_config.h:477
struct vxge_hw_device_hw_info hw_info
Definition: vxge_config.h:514
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
#define __VXGE_STATE_CARD_UP
Definition: vxge_main.h:163
void vxge_hw_vpath_set_zero_rx_frm_len(struct __vxge_hw_device *hldev)
Definition: vxge_config.c:30
void clear_bit(unsigned int bit, volatile void *bits)

References __VXGE_STATE_CARD_UP, clear_bit(), vxge_hw_device_hw_info::function_mode, __vxge_hw_device::hw_info, is_mf, is_vxge_card_up(), net_device::name, vxgedev::ndev, netdev_link_down(), pci_get_drvdata(), vxgedev::pdev, net_device::priv, vxgedev::state, __vxge_hw_device::vdev, vxge_close_vpaths(), vxge_debug, vxge_hw_device_intr_disable(), vxge_hw_device_unmask_all(), vxge_hw_vpath_set_zero_rx_frm_len(), VXGE_INFO, and vxge_reset_all_vpaths().

◆ vxge_device_register()

int vxge_device_register ( struct __vxge_hw_device hldev,
struct vxgedev **  vdev_out 
)

Definition at line 404 of file vxge_main.c.

406 {
407  struct net_device *ndev;
408  struct vxgedev *vdev;
409  int ret = 0;
410 
411  *vdev_out = NULL;
412 
413  ndev = alloc_etherdev(sizeof(struct vxgedev));
414  if (ndev == NULL) {
415  vxge_debug(VXGE_ERR, "%s : device allocation failed\n",
416  __func__);
417  ret = -ENODEV;
418  goto _out0;
419  }
420 
421  vxge_debug(VXGE_INFO, "%s:%d netdev registering\n",
422  __func__, __LINE__);
423  vdev = ndev->priv;
424  memset(vdev, 0, sizeof(struct vxgedev));
425 
426  vdev->ndev = ndev;
427  vdev->devh = hldev;
428  vdev->pdev = hldev->pdev;
429 
430  ndev->dev = &vdev->pdev->dev;
431  /* Associate vxge-specific network operations operations with
432  * generic network device layer */
434 
436  (u8 *)hldev->hw_info.mac_addrs[hldev->first_vp_id], ETH_ALEN);
437 
438  if (register_netdev(ndev)) {
439  vxge_debug(VXGE_ERR, "%s : device registration failed!\n",
440  __func__);
441  ret = -ENODEV;
442  goto _out2;
443  }
444 
445  /* Leave link state as off at this point, when the link change
446  * interrupt comes the state will be automatically changed to
447  * the right state.
448  */
449 
450  vxge_debug(VXGE_INFO, "%s: Ethernet device registered\n",
452 
453  *vdev_out = vdev;
454 
455  return ret;
456 _out2:
457  netdev_put(ndev);
458 _out0:
459  return ret;
460 }
struct device dev
Generic device.
Definition: pci.h:208
#define VXGE_INFO
Definition: vxge_config.h:50
struct __vxge_hw_device * devh
Definition: vxge_main.h:201
#define vxge_debug(mask, fmt...)
Definition: vxge_config.h:762
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition: netdevice.h:515
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:572
struct net_device * ndev
Definition: vxge_main.h:199
void * priv
Driver private data.
Definition: netdevice.h:431
static struct net_device_operations vxge_operations
Definition: vxge_main.c:402
struct pci_device * pdev
Definition: vxge_main.h:200
int register_netdev(struct net_device *netdev)
Register network device.
Definition: netdevice.c:759
A network device.
Definition: netdevice.h:352
#define ENODEV
No such device.
Definition: errno.h:509
#define ETH_ALEN
Definition: if_ether.h:8
struct device * dev
Underlying hardware device.
Definition: netdevice.h:364
struct vxge_hw_device_hw_info hw_info
Definition: vxge_config.h:514
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
Definition: ethernet.c:264
struct pci_device * pdev
Definition: vxge_config.h:482
#define VXGE_DRIVER_NAME
Definition: vxge_main.h:24
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
Definition: netdevice.h:381
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
uint8_t u8
Definition: stdint.h:19
#define VXGE_ERR
Definition: vxge_config.h:54
void * memset(void *dest, int character, size_t len) __nonnull

References alloc_etherdev(), pci_device::dev, net_device::dev, vxgedev::devh, ENODEV, ETH_ALEN, __vxge_hw_device::first_vp_id, net_device::hw_addr, __vxge_hw_device::hw_info, memcpy(), memset(), vxgedev::ndev, netdev_init(), netdev_put(), NULL, vxgedev::pdev, __vxge_hw_device::pdev, net_device::priv, register_netdev(), vxge_debug, VXGE_DRIVER_NAME, VXGE_ERR, VXGE_INFO, and vxge_operations.

Referenced by vxge_probe().

◆ vxge_device_unregister()

void vxge_device_unregister ( struct __vxge_hw_device hldev)

Definition at line 468 of file vxge_main.c.

469 {
470  struct net_device *ndev;
471 
472  ndev = hldev->ndev;
473 
474  unregister_netdev(ndev);
475  netdev_nullify(ndev);
476  netdev_put(ndev);
477 
478  vxge_debug(VXGE_INFO, "%s: ethernet device unregistered\n",
480 }
#define VXGE_INFO
Definition: vxge_config.h:50
#define vxge_debug(mask, fmt...)
Definition: vxge_config.h:762
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:572
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition: netdevice.c:941
A network device.
Definition: netdevice.h:352
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition: netdevice.h:528
#define VXGE_DRIVER_NAME
Definition: vxge_main.h:24
struct net_device * ndev
Definition: vxge_config.h:483

References __vxge_hw_device::ndev, netdev_nullify(), netdev_put(), unregister_netdev(), vxge_debug, VXGE_DRIVER_NAME, and VXGE_INFO.

Referenced by vxge_remove().

◆ vxge_probe()

static int vxge_probe ( struct pci_device pdev)
static

vxge_probe @pdev : structure containing the PCI related information of the device.

@id: List of PCI devices supported by the driver listed in vxge_id_table. Description: This function is called when a new PCI device gets detected and initializes it. Return value: returns 0 on success and negative on failure.

Definition at line 494 of file vxge_main.c.

495 {
496  struct __vxge_hw_device *hldev;
497  enum vxge_hw_status status;
498  int ret = 0;
499  u64 vpath_mask = 0;
500  struct vxgedev *vdev;
501  int i;
502  u8 revision, titan1;
503  u32 function_mode;
504  unsigned long mmio_start, mmio_len;
505  void *bar0;
506  struct vxge_hw_device_hw_info hw_info;
507  struct vxge_hw_device_version *fw_version;
508 
509  vxge_debug(VXGE_INFO, "vxge_probe for device " PCI_FMT "\n",
510  PCI_ARGS(pdev));
511 
513  titan1 = is_titan1(pdev->device, revision);
514 
515  mmio_start = pci_bar_start(pdev, PCI_BASE_ADDRESS_0);
516  mmio_len = pci_bar_size(pdev, PCI_BASE_ADDRESS_0);
517  vxge_debug(VXGE_INFO, "mmio_start: %#08lx, mmio_len: %#08lx\n",
518  mmio_start, mmio_len);
519 
520  /* sets the bus master */
521  adjust_pci_device(pdev);
522 
523  bar0 = pci_ioremap(pdev, mmio_start, mmio_len);
524  if (!bar0) {
526  "%s : cannot remap io memory bar0\n", __func__);
527  ret = -ENODEV;
528  goto _exit0;
529  }
530 
531  status = vxge_hw_device_hw_info_get(pdev, bar0, &hw_info);
532  if (status != VXGE_HW_OK) {
534  "%s: Reading of hardware info failed.\n",
536  ret = -EINVAL;
537  goto _exit1;
538  }
539 
540  if (hw_info.func_id != 0) {
541  /* Non zero function, So do not load the driver */
542  iounmap(bar0);
543  pci_set_drvdata(pdev, NULL);
544  return -EINVAL;
545  }
546 
547 
548  vpath_mask = hw_info.vpath_mask;
549  if (vpath_mask == 0) {
551  "%s: No vpaths available in device\n",
553  ret = -EINVAL;
554  goto _exit1;
555  }
557  "%s:%d Vpath mask = %llx\n", __func__, __LINE__,
558  (unsigned long long)vpath_mask);
559 
560  fw_version = &hw_info.fw_version;
561  /* fail the driver loading if firmware is incompatible */
562  if ((fw_version->major != VXGE_CERT_FW_VER_MAJOR) ||
563  (fw_version->minor < VXGE_CERT_FW_VER_MINOR)) {
564  printf("%s: Adapter's current firmware version: %d.%d.%d\n",
565  VXGE_DRIVER_NAME, fw_version->major,
566  fw_version->minor, fw_version->build);
567 
568  printf("%s: Upgrade firmware to version %d.%d.%d\n",
571 
572  ret = -EACCES;
573  goto _exit1;
574  }
575 
576  status = vxge_hw_device_initialize(&hldev, bar0, pdev, titan1);
577  if (status != VXGE_HW_OK) {
579  "Failed to initialize device (%d)\n", status);
580  ret = -EINVAL;
581  goto _exit1;
582  }
583  memcpy(&hldev->hw_info, &hw_info,
584  sizeof(struct vxge_hw_device_hw_info));
585 
586  /* find the vpath id of the first available one */
587  for (i = 0; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++)
588  if (vpath_mask & vxge_mBIT(i)) {
589  hldev->first_vp_id = i;
590  break;
591  }
592  /* if FCS stripping is not disabled in MAC fail driver load */
593  if (vxge_hw_vpath_strip_fcs_check(hldev, vpath_mask) != VXGE_HW_OK) {
595  "%s: FCS stripping is not disabled in MAC"
596  " failing driver load\n", VXGE_DRIVER_NAME);
597  ret = -EINVAL;
598  goto _exit2;
599  }
600 
601  /* Read function mode */
602  status = vxge_hw_get_func_mode(hldev, &function_mode);
603  if (status != VXGE_HW_OK)
604  goto _exit2;
605 
606  hldev->hw_info.function_mode = function_mode;
607 
608  /* set private device info */
609  pci_set_drvdata(pdev, hldev);
610 
611  if (vxge_device_register(hldev, &vdev)) {
612  ret = -EINVAL;
613  goto _exit2;
614  }
615 
616  /* set private HW device info */
617  hldev->ndev = vdev->ndev;
618  hldev->vdev = vdev;
619  hldev->pdev = pdev;
620  vdev->mtu = VXGE_HW_DEFAULT_MTU;
621  vdev->bar0 = bar0;
622  vdev->titan1 = titan1;
623  /* Virtual Path count */
624  vdev->vpath.device_id = hldev->first_vp_id;
625  vdev->vpath.vdev = vdev;
626  memcpy((u8 *)vdev->vpath.macaddr,
627  (u8 *)hldev->hw_info.mac_addrs[hldev->first_vp_id],
628  ETH_ALEN);
629 
630  hldev->hw_info.serial_number[VXGE_HW_INFO_LEN - 1] = '\0';
631  hldev->hw_info.product_desc[VXGE_HW_INFO_LEN - 1] = '\0';
632  hldev->hw_info.part_number[VXGE_HW_INFO_LEN - 1] = '\0';
633 
634  vxge_debug(VXGE_INFO, "%s: Neterion %s Server Adapter\n",
636  vxge_debug(VXGE_INFO, "%s: SERIAL NUMBER: %s\n",
638  vxge_debug(VXGE_INFO, "%s: PART NUMBER: %s\n",
640  vxge_debug(VXGE_INFO, "%s: MAC ADDR: %s\n",
641  VXGE_DRIVER_NAME, eth_ntoa(vdev->vpath.macaddr));
643  "%s: Firmware version : %s Date : %s\n", VXGE_DRIVER_NAME,
644  hldev->hw_info.fw_version.version,
645  hldev->hw_info.fw_date.date);
646  vxge_debug(VXGE_INFO, "%s: %s Enabled\n",
647  VXGE_DRIVER_NAME, vxge_func_mode_names[function_mode]);
648 
649  vxge_debug(VXGE_INFO, "%s: %s:%d Probe Exiting...\n",
650  VXGE_DRIVER_NAME, __func__, __LINE__);
651 
652  return 0;
653 
654 _exit2:
656 _exit1:
657  iounmap(bar0);
658 _exit0:
659  pci_set_drvdata(pdev, NULL);
660  printf("%s: WARNING!! Driver loading failed!!\n",
662 
663  return ret;
664 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
#define is_titan1(dev_id, rev)
Definition: vxge_main.h:157
#define VXGE_CERT_FW_VER_BUILD
Definition: vxge_version.h:35
struct vxge_hw_device_date fw_date
Definition: vxge_config.h:457
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
#define VXGE_HW_DEFAULT_MTU
Definition: vxge_config.h:36
int device_id
Definition: vxge_main.h:189
struct vxge_hw_device_version fw_version
Definition: vxge_config.h:456
char date[VXGE_HW_FW_STRLEN]
Definition: vxge_config.h:262
struct vxgedev * vdev
Definition: vxge_main.h:194
int mtu
Definition: vxge_main.h:209
#define PCI_BASE_ADDRESS_0
Definition: pci.h:62
#define EACCES
Permission denied.
Definition: errno.h:298
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition: pci.c:154
#define VXGE_INFO
Definition: vxge_config.h:50
#define vxge_debug(mask, fmt...)
Definition: vxge_config.h:762
struct vxge_hw_device_hw_info - Device information @host_type: Host Type @func_id: Function Id @vpath...
Definition: vxge_config.h:427
struct vxgedev * vdev
Definition: vxge_config.h:484
u8 titan1
Definition: vxge_main.h:202
uint8_t status
Status.
Definition: ena.h:16
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
Definition: pci.h:359
void * memcpy(void *dest, const void *src, size_t len) __nonnull
struct vxge_vpath vpath
Definition: vxge_main.h:206
uint16_t device
Device ID.
Definition: pci.h:225
enum vxge_hw_status vxge_hw_device_initialize(struct __vxge_hw_device **devh, void *bar0, struct pci_device *pdev, u8 titan1)
Definition: vxge_config.c:495
int vxge_device_register(struct __vxge_hw_device *hldev, struct vxgedev **vdev_out)
Definition: vxge_main.c:404
struct net_device * ndev
Definition: vxge_main.h:199
u8 serial_number[VXGE_HW_INFO_LEN]
Definition: vxge_config.h:460
void __iomem * bar0
Definition: vxge_main.h:208
#define VXGE_HW_MAX_VIRTUAL_PATHS
Definition: vxge_traffic.h:30
enum vxge_hw_status vxge_hw_get_func_mode(struct __vxge_hw_device *hldev, u32 *func_mode)
Definition: vxge_config.c:97
uint64_t u64
Definition: stdint.h:25
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
Definition: pci.c:96
uint32_t revision
Entry point revision.
Definition: ib_mad.h:20
#define PCI_FMT
PCI device debug message format.
Definition: pci.h:307
unsigned long pci_bar_size(struct pci_device *pci, unsigned int reg)
Find the size of a PCI BAR.
Definition: pciextra.c:92
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
#define VXGE_HW_INFO_LEN
Definition: vxge_config.h:409
enum vxge_hw_status vxge_hw_device_hw_info_get(struct pci_device *pdev, void __iomem *bar0, struct vxge_hw_device_hw_info *hw_info)
vxge_hw_device_hw_info_get - Get the hw information Returns the vpath mask that has the bits set for ...
Definition: vxge_config.c:384
#define ENODEV
No such device.
Definition: errno.h:509
u8 product_desc[VXGE_HW_INFO_LEN]
Definition: vxge_config.h:462
#define ETH_ALEN
Definition: if_ether.h:8
enum vxge_hw_status vxge_hw_vpath_strip_fcs_check(struct __vxge_hw_device *hldev, u64 vpath_mask)
Definition: vxge_config.c:789
static char * vxge_func_mode_names[]
Definition: vxge_main.c:36
#define VXGE_CERT_FW_VER_MAJOR
Definition: vxge_version.h:33
#define vxge_mBIT(loc)
Definition: vxge_reg.h:24
struct __vxge_hw_device - Hal device object @magic: Magic Number @bar0: BAR0 virtual address.
Definition: vxge_config.h:477
struct vxge_hw_device_hw_info hw_info
Definition: vxge_config.h:514
#define VXGE_CERT_FW_VER_MINOR
Definition: vxge_version.h:34
u8 part_number[VXGE_HW_INFO_LEN]
Definition: vxge_config.h:461
#define PCI_ARGS(pci)
PCI device debug message arguments.
Definition: pci.h:310
vxge_hw_status
Definition: vxge_config.h:70
void iounmap(volatile const void *io_addr)
Unmap I/O address.
#define PCI_REVISION
PCI revision.
Definition: pci.h:44
struct pci_device * pdev
Definition: vxge_config.h:482
#define VXGE_DRIVER_NAME
Definition: vxge_main.h:24
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
void vxge_hw_device_terminate(struct __vxge_hw_device *hldev)
Definition: vxge_config.c:542
struct net_device * ndev
Definition: vxge_config.h:483
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
uint8_t u8
Definition: stdint.h:19
uint32_t u32
Definition: stdint.h:23
#define VXGE_ERR
Definition: vxge_config.h:54
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.
char version[VXGE_HW_FW_STRLEN]
Definition: vxge_config.h:269

References adjust_pci_device(), vxgedev::bar0, vxge_hw_device_version::build, vxge_hw_device_date::date, pci_device::device, vxge_vpath::device_id, EACCES, EINVAL, ENODEV, ETH_ALEN, eth_ntoa(), __vxge_hw_device::first_vp_id, vxge_hw_device_hw_info::func_id, vxge_hw_device_hw_info::function_mode, vxge_hw_device_hw_info::fw_date, vxge_hw_device_hw_info::fw_version, __vxge_hw_device::hw_info, iounmap(), is_titan1, vxge_hw_device_version::major, memcpy(), vxge_hw_device_version::minor, vxgedev::mtu, vxgedev::ndev, __vxge_hw_device::ndev, NULL, vxge_hw_device_hw_info::part_number, PCI_ARGS, pci_bar_size(), pci_bar_start(), PCI_BASE_ADDRESS_0, PCI_FMT, pci_ioremap(), pci_read_config_byte(), PCI_REVISION, pci_set_drvdata(), __vxge_hw_device::pdev, printf(), vxge_hw_device_hw_info::product_desc, revision, vxge_hw_device_hw_info::serial_number, status, vxgedev::titan1, vxge_vpath::vdev, __vxge_hw_device::vdev, vxge_hw_device_version::version, vxgedev::vpath, vxge_hw_device_hw_info::vpath_mask, VXGE_CERT_FW_VER_BUILD, VXGE_CERT_FW_VER_MAJOR, VXGE_CERT_FW_VER_MINOR, vxge_debug, vxge_device_register(), VXGE_DRIVER_NAME, VXGE_ERR, vxge_func_mode_names, VXGE_HW_DEFAULT_MTU, vxge_hw_device_hw_info_get(), vxge_hw_device_initialize(), vxge_hw_device_terminate(), vxge_hw_get_func_mode(), VXGE_HW_INFO_LEN, VXGE_HW_MAX_VIRTUAL_PATHS, VXGE_HW_OK, vxge_hw_vpath_strip_fcs_check(), VXGE_INFO, and vxge_mBIT.

◆ vxge_remove()

static void vxge_remove ( struct pci_device pdev)
static

vxge_remove - Free the PCI device @pdev: structure containing the PCI related information of the device.

Description: This function is called by the Pci subsystem to release a PCI device and free up all resource held up by the device.

Definition at line 673 of file vxge_main.c.

674 {
675  struct __vxge_hw_device *hldev;
676  struct vxgedev *vdev = NULL;
677  struct net_device *ndev;
678 
680  "%s:%d\n", __func__, __LINE__);
681  hldev = (struct __vxge_hw_device *) pci_get_drvdata(pdev);
682  if (hldev == NULL)
683  return;
684 
685  ndev = hldev->ndev;
686  vdev = ndev->priv;
687 
688  iounmap(vdev->bar0);
689 
690  vxge_device_unregister(hldev);
691 
693  "%s:%d Device unregistered\n", __func__, __LINE__);
694 
697 }
#define VXGE_INFO
Definition: vxge_config.h:50
void vxge_device_unregister(struct __vxge_hw_device *hldev)
Definition: vxge_main.c:468
#define vxge_debug(mask, fmt...)
Definition: vxge_config.h:762
struct vxgedev * vdev
Definition: vxge_config.h:484
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
Definition: pci.h:359
void * priv
Driver private data.
Definition: netdevice.h:431
void __iomem * bar0
Definition: vxge_main.h:208
A network device.
Definition: netdevice.h:352
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition: pci.h:369
struct __vxge_hw_device - Hal device object @magic: Magic Number @bar0: BAR0 virtual address.
Definition: vxge_config.h:477
void iounmap(volatile const void *io_addr)
Unmap I/O address.
struct pci_device * pdev
Definition: vxge_config.h:482
void vxge_hw_device_terminate(struct __vxge_hw_device *hldev)
Definition: vxge_config.c:542
struct net_device * ndev
Definition: vxge_config.h:483
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References vxgedev::bar0, iounmap(), __vxge_hw_device::ndev, NULL, pci_get_drvdata(), pci_set_drvdata(), __vxge_hw_device::pdev, net_device::priv, __vxge_hw_device::vdev, vxge_debug, vxge_device_unregister(), vxge_hw_device_terminate(), and VXGE_INFO.

Variable Documentation

◆ vxge_func_mode_names

char* vxge_func_mode_names[]
static
Initial value:
= {
"Single Function - 1 func, 17 vpath",
"Multi Function 8 - 8 func, 2 vpath per func",
"SRIOV 17 - 17 VF, 1 vpath per VF",
"WLPEX/SharedIO 17 - 17 VH, 1 vpath/func/hierarchy",
"WLPEX/SharedIO 8 - 8 VH, 2 vpath/func/hierarchy",
"Multi Function 17 - 17 func, 1 vpath per func",
"SRIOV 8 - 1 PF, 7 VF, 2 vpath per VF",
"SRIOV 4 - 1 PF, 3 VF, 4 vpath per VF",
"Multi Function 2 - 2 func, 8 vpath per func",
"Multi Function 4 - 4 func, 4 vpath per func",
"WLPEX/SharedIO 4 - 17 func, 1 vpath per func (PCIe ARI)",
"Multi Function 8 - For ESX DirectIO - 8 func, 2 vpath per func",
}

Definition at line 36 of file vxge_main.c.

Referenced by vxge_probe().

◆ vxge_operations

static struct net_device_operations vxge_operations
static
Initial value:
= {
.open = vxge_open,
.close = vxge_close,
.transmit = vxge_xmit,
.poll = vxge_poll,
.irq = vxge_irq,
}
static void vxge_poll(struct net_device *ndev)
Definition: vxge_main.c:231
static void vxge_close(struct net_device *dev)
vxge_close @dev: device pointer.
Definition: vxge_main.c:364
int vxge_open(struct net_device *dev)
vxge_open @dev: pointer to the device structure.
Definition: vxge_main.c:290
static void vxge_irq(struct net_device *netdev __unused, int action)
Definition: vxge_main.c:258
static int vxge_xmit(struct net_device *dev, struct io_buffer *iobuf)
Functions that implement the iPXE driver API.
Definition: vxge_main.c:180

Definition at line 402 of file vxge_main.c.

Referenced by vxge_device_register().

◆ vxge_main_nics

struct pci_device_id vxge_main_nics[]
static
Initial value:
= {
PCI_ID(0x17d5, 0x5833, "vxge-x3100", "Neterion X3100 Series", 0),
}
#define PCI_ID(_vendor, _device, _name, _description, _data)
Definition: pci.h:297

Definition at line 708 of file vxge_main.c.

◆ __pci_driver

struct pci_driver vxge_driver __pci_driver
Initial value:
= {
.id_count = (sizeof(vxge_main_nics) / sizeof(vxge_main_nics[0])),
.probe = vxge_probe,
}
static int vxge_probe(struct pci_device *pdev)
vxge_probe @pdev : structure containing the PCI related information of the device.
Definition: vxge_main.c:494
static void vxge_remove(struct pci_device *pdev)
vxge_remove - Free the PCI device @pdev: structure containing the PCI related information of the devi...
Definition: vxge_main.c:673
static struct xen_remove_from_physmap * remove
Definition: xenmem.h:39
static struct pci_device_id vxge_main_nics[]
Definition: vxge_main.c:708

Definition at line 713 of file vxge_main.c.