iPXE
Data Structures | Macros | Enumerations | Functions
flexboot_nodnic.h File Reference
#include "mlx_nodnic/include/mlx_nodnic_data_structures.h"
#include "nodnic_prm.h"
#include <ipxe/io.h>
#include <ipxe/infiniband.h>
#include <ipxe/netdevice.h>
#include "mlx_utils/mlx_lib/mlx_nvconfig/mlx_nvconfig.h"

Go to the source code of this file.

Data Structures

struct  flexboot_nodnic_port
 A flexboot nodnic port. More...
 
struct  flexboot_nodnic_queue_pair
 A flexboot nodnic queue pair. More...
 
struct  flexboot_nodnic_completion_queue
 A flexboot nodnic cq. More...
 
struct  flexboot_nodnic
 A flexboot_nodnic device. More...
 
struct  flexboot_nodnic_port_type
 A flexboot_nodnic port type. More...
 
struct  cqe_data
 
union  arm_cq_uar
 
struct  flexboot_nodnic_callbacks
 

Macros

#define NODNIC_IRQ_ENABLED
 
#define FLEXBOOT_NODNIC_MAX_PORTS   2
 
#define FLEXBOOT_NODNIC_PORT_BASE   1
 
#define FLEXBOOT_NODNIC_OPCODE_SEND   0xa
 
#define FLEXBOOT_NODNIC_HCA_BAR   PCI_BASE_ADDRESS_0
 
#define FLEXBOOT_NODNIC_PAGE_SHIFT   12
 
#define FLEXBOOT_NODNIC_PAGE_SIZE   (1 << FLEXBOOT_NODNIC_PAGE_SHIFT)
 
#define FLEXBOOT_NODNIC_PAGE_MASK   (FLEXBOOT_NODNIC_PAGE_SIZE - 1)
 
#define EN_DEFAULT_ADMIN_MTU   1522
 

Enumerations

enum  flexboot_nodnic_protocol { FLEXBOOT_NODNIC_PROT_IB_IPV6 = 0, FLEXBOOT_NODNIC_PROT_ETH, FLEXBOOT_NODNIC_PROT_IB_IPV4, FLEXBOOT_NODNIC_PROT_FCOE }
 

Functions

 FILE_LICENCE (GPL2_OR_LATER)
 
int flexboot_nodnic_probe (struct pci_device *pci, struct flexboot_nodnic_callbacks *callbacks, void *drv_priv)
 
void flexboot_nodnic_remove (struct pci_device *pci)
 
void flexboot_nodnic_eth_irq (struct net_device *netdev, int enable)
 
int flexboot_nodnic_is_supported (struct pci_device *pci)
 
void flexboot_nodnic_copy_mac (uint8_t mac_addr[], uint32_t low_byte, uint16_t high_byte)
 
int init_mlx_utils (mlx_utils **utils, struct pci_device *pci)
 
void free_mlx_utils (mlx_utils **utils)
 

Macro Definition Documentation

◆ NODNIC_IRQ_ENABLED

#define NODNIC_IRQ_ENABLED

Definition at line 35 of file flexboot_nodnic.h.

◆ FLEXBOOT_NODNIC_MAX_PORTS

#define FLEXBOOT_NODNIC_MAX_PORTS   2

Definition at line 37 of file flexboot_nodnic.h.

◆ FLEXBOOT_NODNIC_PORT_BASE

#define FLEXBOOT_NODNIC_PORT_BASE   1

Definition at line 38 of file flexboot_nodnic.h.

◆ FLEXBOOT_NODNIC_OPCODE_SEND

#define FLEXBOOT_NODNIC_OPCODE_SEND   0xa

Definition at line 40 of file flexboot_nodnic.h.

◆ FLEXBOOT_NODNIC_HCA_BAR

#define FLEXBOOT_NODNIC_HCA_BAR   PCI_BASE_ADDRESS_0

Definition at line 41 of file flexboot_nodnic.h.

◆ FLEXBOOT_NODNIC_PAGE_SHIFT

#define FLEXBOOT_NODNIC_PAGE_SHIFT   12

Definition at line 42 of file flexboot_nodnic.h.

◆ FLEXBOOT_NODNIC_PAGE_SIZE

#define FLEXBOOT_NODNIC_PAGE_SIZE   (1 << FLEXBOOT_NODNIC_PAGE_SHIFT)

Definition at line 43 of file flexboot_nodnic.h.

◆ FLEXBOOT_NODNIC_PAGE_MASK

#define FLEXBOOT_NODNIC_PAGE_MASK   (FLEXBOOT_NODNIC_PAGE_SIZE - 1)

Definition at line 44 of file flexboot_nodnic.h.

◆ EN_DEFAULT_ADMIN_MTU

#define EN_DEFAULT_ADMIN_MTU   1522

Definition at line 45 of file flexboot_nodnic.h.

Enumeration Type Documentation

◆ flexboot_nodnic_protocol

Enumerator
FLEXBOOT_NODNIC_PROT_IB_IPV6 
FLEXBOOT_NODNIC_PROT_ETH 
FLEXBOOT_NODNIC_PROT_IB_IPV4 
FLEXBOOT_NODNIC_PROT_FCOE 

Definition at line 48 of file flexboot_nodnic.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ flexboot_nodnic_probe()

int flexboot_nodnic_probe ( struct pci_device pci,
struct flexboot_nodnic_callbacks callbacks,
void *  drv_priv 
)

◆ flexboot_nodnic_remove()

void flexboot_nodnic_remove ( struct pci_device pci)

Definition at line 1580 of file flexboot_nodnic.c.

1581 {
1582  struct flexboot_nodnic *flexboot_nodnic_priv = pci_get_drvdata ( pci );
1583  nodnic_device_priv *device_priv = & ( flexboot_nodnic_priv->device_priv );
1584 
1585  flexboot_nodnic_dealloc_uar ( flexboot_nodnic_priv );
1586  flexboot_nodnic_ports_unregister_dev ( flexboot_nodnic_priv );
1589  free( flexboot_nodnic_priv );
1590 }
nodnic_device_priv device_priv
nodnic device
static int flexboot_nodnic_dealloc_uar(struct flexboot_nodnic *flexboot_nodnic)
struct pci_device * pci
PCI device.
mlx_status nodnic_device_teardown(IN nodnic_device_priv *device_priv)
Definition: mlx_device.c:218
static mlx_status flexboot_nodnic_ports_unregister_dev(struct flexboot_nodnic *flexboot_nodnic_priv)
A flexboot_nodnic device.
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition: pci.h:348
void free_mlx_utils(mlx_utils **utils)

References flexboot_nodnic::device_priv, flexboot_nodnic_dealloc_uar(), flexboot_nodnic_ports_unregister_dev(), free, free_mlx_utils(), nodnic_device_teardown(), flexboot_nodnic::pci, pci_get_drvdata(), and _nodnic_device_priv::utils.

Referenced by golan_remove().

◆ flexboot_nodnic_eth_irq()

void flexboot_nodnic_eth_irq ( struct net_device netdev,
int  enable 
)

Definition at line 1026 of file flexboot_nodnic.c.

1026  {
1027  struct flexboot_nodnic_port *port = netdev->priv;
1028 
1029  if ( enable ) {
1030  if ( ( port->port_priv.port_state & NODNIC_PORT_OPENED ) &&
1031  ! ( port->port_priv.port_state & NODNIC_PORT_DISABLING_DMA ) ) {
1033  } else {
1034  /* do nothing */
1035  }
1036  } else {
1037  nodnic_device_clear_int( port->port_priv.device );
1038  }
1039 }
#define NODNIC_PORT_DISABLING_DMA
mlx_status nodnic_device_clear_int(IN nodnic_device_priv *device_priv)
Definition: mlx_device.c:165
u8 port
Port number.
Definition: CIB_PRM.h:31
void * priv
Driver private data.
Definition: netdevice.h:425
static struct net_device * netdev
Definition: gdbudp.c:52
#define NODNIC_PORT_OPENED
static int flexboot_nodnic_arm_cq(struct flexboot_nodnic_port *port)
A flexboot nodnic port.

References flexboot_nodnic_arm_cq(), netdev, nodnic_device_clear_int(), NODNIC_PORT_DISABLING_DMA, NODNIC_PORT_OPENED, port, and net_device::priv.

◆ flexboot_nodnic_is_supported()

int flexboot_nodnic_is_supported ( struct pci_device pci)

Definition at line 1302 of file flexboot_nodnic.c.

1302  {
1303  mlx_utils utils;
1306  int is_supported = 0;
1307 
1308  DBG ( "%s: start\n", __FUNCTION__ );
1309 
1310  memset ( &utils, 0, sizeof ( utils ) );
1311 
1312  status = mlx_utils_init ( &utils, pci );
1313  MLX_CHECK_STATUS ( pci, status, utils_init_err, "mlx_utils_init failed" );
1314 
1315  status = mlx_pci_gw_init ( &utils );
1316  MLX_CHECK_STATUS ( pci, status, pci_gw_init_err, "mlx_pci_gw_init failed" );
1317 
1320 
1321  if ( status == MLX_SUCCESS ) {
1323  is_supported = ( buffer & 0x1 );
1324  }
1325 
1326  mlx_pci_gw_teardown( &utils );
1327 
1328 pci_gw_init_err:
1329  mlx_utils_teardown(&utils);
1330 utils_init_err:
1331  DBG ( "%s: NODNIC is %s supported (status = %d)\n",
1332  __FUNCTION__, ( is_supported ? "": "not" ), status );
1333  return is_supported;
1334 }
#define NODNIC_NIC_INTERFACE_SUPPORTED_BIT
Definition: mlx_device.h:41
mlx_status mlx_pci_gw_read(IN mlx_utils *utils, IN mlx_pci_gw_space space, IN mlx_uint32 address, OUT mlx_pci_gw_buffer *buffer)
Definition: mlx_pci_gw.c:258
#define NODNIC_NIC_INTERFACE_SUPPORTED_OFFSET
Definition: mlx_device.h:33
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition: netvsc.h:16
mlx_status mlx_pci_gw_init(IN mlx_utils *utils)
Definition: mlx_pci_gw.c:218
uint8_t status
Status.
Definition: ena.h:16
#define MLX_SUCCESS
mlx_status mlx_utils_init(IN mlx_utils *utils, IN mlx_pci *pci)
Definition: mlx_utils.c:28
mlx_status mlx_utils_teardown(IN mlx_utils *utils)
Definition: mlx_utils.c:46
int mlx_status
mlx_status mlx_pci_gw_teardown(IN mlx_utils *utils)
Definition: mlx_pci_gw.c:247
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define MLX_CHECK_STATUS(id, status, label, message)
Definition: mlx_bail.h:37
mlx_uint32 mlx_pci_gw_buffer
Definition: mlx_pci_gw.h:52
void * memset(void *dest, int character, size_t len) __nonnull
#define PCI_GW_SPACE_NODNIC
Definition: mlx_pci_gw.h:47

References buffer, DBG, memset(), MLX_CHECK_STATUS, mlx_pci_gw_init(), mlx_pci_gw_read(), mlx_pci_gw_teardown(), MLX_SUCCESS, mlx_utils_init(), mlx_utils_teardown(), NODNIC_NIC_INTERFACE_SUPPORTED_BIT, NODNIC_NIC_INTERFACE_SUPPORTED_OFFSET, PCI_GW_SPACE_NODNIC, and status.

Referenced by shomron_nodnic_is_supported().

◆ flexboot_nodnic_copy_mac()

void flexboot_nodnic_copy_mac ( uint8_t  mac_addr[],
uint32_t  low_byte,
uint16_t  high_byte 
)

Definition at line 1337 of file flexboot_nodnic.c.

1338  {
1339  union mac_addr {
1340  struct {
1341  uint32_t low_byte;
1342  uint16_t high_byte;
1343  };
1344  uint8_t mac_addr[ETH_ALEN];
1345  } mac_addr_aux;
1346 
1347  mac_addr_aux.high_byte = high_byte;
1348  mac_addr_aux.low_byte = low_byte;
1349 
1350  mac_addr[0] = mac_addr_aux.mac_addr[5];
1351  mac_addr[1] = mac_addr_aux.mac_addr[4];
1352  mac_addr[2] = mac_addr_aux.mac_addr[3];
1353  mac_addr[3] = mac_addr_aux.mac_addr[2];
1354  mac_addr[4] = mac_addr_aux.mac_addr[1];
1355  mac_addr[5] = mac_addr_aux.mac_addr[0];
1356 }
unsigned short uint16_t
Definition: stdint.h:11
unsigned char uint8_t
Definition: stdint.h:10
#define ETH_ALEN
Definition: if_ether.h:8
unsigned int uint32_t
Definition: stdint.h:12

References ETH_ALEN.

◆ init_mlx_utils()

int init_mlx_utils ( mlx_utils **  utils,
struct pci_device pci 
)

Definition at line 1400 of file flexboot_nodnic.c.

1400  {
1401  int rc = 0;
1402 
1403  *utils = ( mlx_utils * ) zalloc ( sizeof ( mlx_utils ) );
1404  if ( *utils == NULL ) {
1405  DBGC ( utils, "%s: Failed to allocate utils\n", __FUNCTION__ );
1406  rc = -1;
1407  goto err_utils_alloc;
1408  }
1409  if ( mlx_utils_init ( *utils, pci ) ) {
1410  DBGC ( utils, "%s: mlx_utils_init failed\n", __FUNCTION__ );
1411  rc = -1;
1412  goto err_utils_init;
1413  }
1414  if ( mlx_pci_gw_init ( *utils ) ){
1415  DBGC ( utils, "%s: mlx_pci_gw_init failed\n", __FUNCTION__ );
1416  rc = -1;
1417  goto err_cmd_init;
1418  }
1419 
1420  return 0;
1421 
1422  mlx_pci_gw_teardown ( *utils );
1423 err_cmd_init:
1424  mlx_utils_teardown ( *utils );
1425 err_utils_init:
1426  free ( *utils );
1427 err_utils_alloc:
1428  *utils = NULL;
1429 
1430  return rc;
1431 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define DBGC(...)
Definition: compiler.h:505
mlx_status mlx_pci_gw_init(IN mlx_utils *utils)
Definition: mlx_pci_gw.c:218
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
mlx_status mlx_utils_init(IN mlx_utils *utils, IN mlx_pci *pci)
Definition: mlx_utils.c:28
mlx_status mlx_utils_teardown(IN mlx_utils *utils)
Definition: mlx_utils.c:46
mlx_status mlx_pci_gw_teardown(IN mlx_utils *utils)
Definition: mlx_pci_gw.c:247
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References DBGC, free, mlx_pci_gw_init(), mlx_pci_gw_teardown(), mlx_utils_init(), mlx_utils_teardown(), NULL, rc, and zalloc().

Referenced by flexboot_nodnic_probe(), golan_probe_normal(), and golan_set_link_speed().

◆ free_mlx_utils()

void free_mlx_utils ( mlx_utils **  utils)

Definition at line 1433 of file flexboot_nodnic.c.

1433  {
1434 
1435  mlx_pci_gw_teardown ( *utils );
1436  mlx_utils_teardown ( *utils );
1437  free ( *utils );
1438  *utils = NULL;
1439 }
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
mlx_status mlx_utils_teardown(IN mlx_utils *utils)
Definition: mlx_utils.c:46
mlx_status mlx_pci_gw_teardown(IN mlx_utils *utils)
Definition: mlx_pci_gw.c:247
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References free, mlx_pci_gw_teardown(), mlx_utils_teardown(), and NULL.

Referenced by flexboot_nodnic_probe(), flexboot_nodnic_remove(), golan_probe_normal(), golan_remove_normal(), and golan_set_link_speed().