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 1582 of file flexboot_nodnic.c.

1583 {
1584  struct flexboot_nodnic *flexboot_nodnic_priv = pci_get_drvdata ( pci );
1585  nodnic_device_priv *device_priv = & ( flexboot_nodnic_priv->device_priv );
1586 
1587  flexboot_nodnic_dealloc_uar ( flexboot_nodnic_priv );
1588  flexboot_nodnic_ports_unregister_dev ( flexboot_nodnic_priv );
1591  free( flexboot_nodnic_priv );
1592 }
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 1028 of file flexboot_nodnic.c.

1028  {
1029  struct flexboot_nodnic_port *port = netdev->priv;
1030 
1031  if ( enable ) {
1032  if ( ( port->port_priv.port_state & NODNIC_PORT_OPENED ) &&
1033  ! ( port->port_priv.port_state & NODNIC_PORT_DISABLING_DMA ) ) {
1035  } else {
1036  /* do nothing */
1037  }
1038  } else {
1039  nodnic_device_clear_int( port->port_priv.device );
1040  }
1041 }
#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 1304 of file flexboot_nodnic.c.

1304  {
1305  mlx_utils utils;
1308  int is_supported = 0;
1309 
1310  DBG ( "%s: start\n", __FUNCTION__ );
1311 
1312  memset ( &utils, 0, sizeof ( utils ) );
1313 
1314  status = mlx_utils_init ( &utils, pci );
1315  MLX_CHECK_STATUS ( pci, status, utils_init_err, "mlx_utils_init failed" );
1316 
1317  status = mlx_pci_gw_init ( &utils );
1318  MLX_CHECK_STATUS ( pci, status, pci_gw_init_err, "mlx_pci_gw_init failed" );
1319 
1322 
1323  if ( status == MLX_SUCCESS ) {
1325  is_supported = ( buffer & 0x1 );
1326  }
1327 
1328  mlx_pci_gw_teardown( &utils );
1329 
1330 pci_gw_init_err:
1331  mlx_utils_teardown(&utils);
1332 utils_init_err:
1333  DBG ( "%s: NODNIC is %s supported (status = %d)\n",
1334  __FUNCTION__, ( is_supported ? "": "not" ), status );
1335  return is_supported;
1336 }
#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 1339 of file flexboot_nodnic.c.

1340  {
1341  union mac_addr {
1342  struct {
1343  uint32_t low_byte;
1344  uint16_t high_byte;
1345  };
1346  uint8_t mac_addr[ETH_ALEN];
1347  } mac_addr_aux;
1348 
1349  mac_addr_aux.high_byte = high_byte;
1350  mac_addr_aux.low_byte = low_byte;
1351 
1352  mac_addr[0] = mac_addr_aux.mac_addr[5];
1353  mac_addr[1] = mac_addr_aux.mac_addr[4];
1354  mac_addr[2] = mac_addr_aux.mac_addr[3];
1355  mac_addr[3] = mac_addr_aux.mac_addr[2];
1356  mac_addr[4] = mac_addr_aux.mac_addr[1];
1357  mac_addr[5] = mac_addr_aux.mac_addr[0];
1358 }
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 1402 of file flexboot_nodnic.c.

1402  {
1403  int rc = 0;
1404 
1405  *utils = ( mlx_utils * ) zalloc ( sizeof ( mlx_utils ) );
1406  if ( *utils == NULL ) {
1407  DBGC ( utils, "%s: Failed to allocate utils\n", __FUNCTION__ );
1408  rc = -1;
1409  goto err_utils_alloc;
1410  }
1411  if ( mlx_utils_init ( *utils, pci ) ) {
1412  DBGC ( utils, "%s: mlx_utils_init failed\n", __FUNCTION__ );
1413  rc = -1;
1414  goto err_utils_init;
1415  }
1416  if ( mlx_pci_gw_init ( *utils ) ){
1417  DBGC ( utils, "%s: mlx_pci_gw_init failed\n", __FUNCTION__ );
1418  rc = -1;
1419  goto err_cmd_init;
1420  }
1421 
1422  return 0;
1423 
1424  mlx_pci_gw_teardown ( *utils );
1425 err_cmd_init:
1426  mlx_utils_teardown ( *utils );
1427 err_utils_init:
1428  free ( *utils );
1429 err_utils_alloc:
1430  *utils = NULL;
1431 
1432  return rc;
1433 }
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 1435 of file flexboot_nodnic.c.

1435  {
1436 
1437  mlx_pci_gw_teardown ( *utils );
1438  mlx_utils_teardown ( *utils );
1439  free ( *utils );
1440  *utils = NULL;
1441 }
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().