iPXE
Data Structures | Defines | 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

Defines

#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)

Define Documentation

Definition at line 35 of file flexboot_nodnic.h.

#define FLEXBOOT_NODNIC_MAX_PORTS   2

Definition at line 37 of file flexboot_nodnic.h.

#define FLEXBOOT_NODNIC_PORT_BASE   1

Definition at line 38 of file flexboot_nodnic.h.

Referenced by flexboot_nodnic_allocate_infiniband_devices().

#define FLEXBOOT_NODNIC_OPCODE_SEND   0xa

Definition at line 40 of file flexboot_nodnic.h.

Referenced by shomron_fill_eth_send_wqe().

Definition at line 41 of file flexboot_nodnic.h.

Referenced by flexboot_nodnic_alloc_uar().

#define FLEXBOOT_NODNIC_PAGE_SHIFT   12

Definition at line 42 of file flexboot_nodnic.h.

Definition at line 43 of file flexboot_nodnic.h.

Referenced by flexboot_nodnic_alloc_uar().

Definition at line 44 of file flexboot_nodnic.h.

#define EN_DEFAULT_ADMIN_MTU   1522

Definition at line 45 of file flexboot_nodnic.h.

Referenced by flexboot_nodnic_probe().


Enumeration Type Documentation

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 ( 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)

Definition at line 1580 of file flexboot_nodnic.c.

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

Referenced by golan_remove().

{
        struct flexboot_nodnic *flexboot_nodnic_priv = pci_get_drvdata ( pci );
        nodnic_device_priv *device_priv = & ( flexboot_nodnic_priv->device_priv );

        flexboot_nodnic_dealloc_uar ( flexboot_nodnic_priv );
        flexboot_nodnic_ports_unregister_dev ( flexboot_nodnic_priv );
        nodnic_device_teardown( device_priv );
        free_mlx_utils ( & device_priv->utils );
        free( flexboot_nodnic_priv );
}
void flexboot_nodnic_eth_irq ( struct net_device netdev,
int  enable 
)

Definition at line 1302 of file flexboot_nodnic.c.

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().

                                                            {
        mlx_utils utils;
        mlx_pci_gw_buffer buffer;
        mlx_status status;
        int is_supported = 0;

        DBG ( "%s: start\n", __FUNCTION__ );

        memset ( &utils, 0, sizeof ( utils ) );

        status = mlx_utils_init ( &utils, pci );
        MLX_CHECK_STATUS ( pci, status, utils_init_err, "mlx_utils_init failed" );

        status = mlx_pci_gw_init ( &utils );
        MLX_CHECK_STATUS ( pci, status, pci_gw_init_err, "mlx_pci_gw_init failed" );

        status = mlx_pci_gw_read ( &utils, PCI_GW_SPACE_NODNIC,
                        NODNIC_NIC_INTERFACE_SUPPORTED_OFFSET, &buffer );

        if ( status == MLX_SUCCESS ) {
                buffer >>= NODNIC_NIC_INTERFACE_SUPPORTED_BIT;
                is_supported = ( buffer & 0x1 );
        }

        mlx_pci_gw_teardown( &utils );

pci_gw_init_err:
        mlx_utils_teardown(&utils);
utils_init_err:
        DBG ( "%s: NODNIC is %s supported (status = %d)\n",
                        __FUNCTION__, ( is_supported ? "": "not" ), status );
        return is_supported;
}
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.

References ETH_ALEN.

                                     {
        union mac_addr {
                struct {
                        uint32_t low_byte;
                        uint16_t high_byte;
                };
                uint8_t mac_addr[ETH_ALEN];
        } mac_addr_aux;

        mac_addr_aux.high_byte = high_byte;
        mac_addr_aux.low_byte = low_byte;

        mac_addr[0] = mac_addr_aux.mac_addr[5];
        mac_addr[1] = mac_addr_aux.mac_addr[4];
        mac_addr[2] = mac_addr_aux.mac_addr[3];
        mac_addr[3] = mac_addr_aux.mac_addr[2];
        mac_addr[4] = mac_addr_aux.mac_addr[1];
        mac_addr[5] = mac_addr_aux.mac_addr[0];
}
int init_mlx_utils ( mlx_utils **  utils,
struct pci_device pci 
)

Definition at line 1400 of file flexboot_nodnic.c.

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().

                                                                 {
        int rc = 0;

        *utils = ( mlx_utils * ) zalloc ( sizeof ( mlx_utils ) );
        if ( *utils == NULL ) {
                DBGC ( utils, "%s: Failed to allocate utils\n", __FUNCTION__ );
                rc = -1;
                goto err_utils_alloc;
        }
        if ( mlx_utils_init ( *utils, pci ) ) {
                DBGC ( utils, "%s: mlx_utils_init failed\n", __FUNCTION__ );
                rc = -1;
                goto err_utils_init;
        }
        if ( mlx_pci_gw_init ( *utils ) ){
                DBGC ( utils, "%s: mlx_pci_gw_init failed\n", __FUNCTION__ );
                rc = -1;
                goto err_cmd_init;
        }

        return 0;

        mlx_pci_gw_teardown ( *utils );
err_cmd_init:
        mlx_utils_teardown ( *utils );
err_utils_init:
        free ( *utils );
err_utils_alloc:
        *utils = NULL;

        return rc;
}
void free_mlx_utils ( mlx_utils **  utils)