iPXE
flexboot_nodnic.h
Go to the documentation of this file.
1#ifndef SRC_DRIVERS_INFINIBAND_FLEXBOOT_NODNIC_FLEXBOOT_NODNIC_H_
2#define SRC_DRIVERS_INFINIBAND_FLEXBOOT_NODNIC_FLEXBOOT_NODNIC_H_
3
4/*
5 * Copyright (C) 2015 Mellanox Technologies Ltd.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 */
22
23FILE_LICENCE ( GPL2_OR_LATER );
24
26#include "nodnic_prm.h"
27#include <ipxe/io.h>
28#include <ipxe/infiniband.h>
29#include <ipxe/netdevice.h>
31
32/*
33 * If defined, use interrupts in NODNIC driver
34 */
35#define NODNIC_IRQ_ENABLED
36
37#define FLEXBOOT_NODNIC_MAX_PORTS 2
38#define FLEXBOOT_NODNIC_PORT_BASE 1
39
40#define FLEXBOOT_NODNIC_OPCODE_SEND 0xa
41#define FLEXBOOT_NODNIC_HCA_BAR PCI_BASE_ADDRESS_0 //BAR 0
42#define FLEXBOOT_NODNIC_PAGE_SHIFT 12
43#define FLEXBOOT_NODNIC_PAGE_SIZE (1 << FLEXBOOT_NODNIC_PAGE_SHIFT)
44#define FLEXBOOT_NODNIC_PAGE_MASK (FLEXBOOT_NODNIC_PAGE_SIZE - 1)
45#define EN_DEFAULT_ADMIN_MTU 1522
46
47/* Port protocol */
54
55/** A flexboot nodnic port */
57 /** Infiniband device */
59 /** Network device */
61 /** nodic port */
63 /** Port type */
65 /** Ethernet completion queue */
67 /** Ethernet queue pair */
70};
71
72
73/** A flexboot nodnic queue pair */
77
78/** A flexboot nodnic cq */
82
83/** A flexboot_nodnic device */
85 /** PCI device */
86 struct pci_device *pci;
87 /** nic specific data*/
89 /**nodnic device*/
91 /**flexboot_nodnic ports*/
93 /** Device open request counter */
94 unsigned int open_count;
95 /** Port masking */
97 /** device private data */
98 void *priv_data;
99};
100
101/** A flexboot_nodnic port type */
103 /** Register port
104 *
105 * @v flexboot_nodnic flexboot_nodnic device
106 * @v port flexboot_nodnic port
107 * @ret mlx_status Return status code
108 */
112 );
113 /** Port state changed
114 *
115 * @v flexboot_nodnic flexboot_nodnic device
116 * @v port flexboot_nodnic port
117 * @v link_up Link is up
118 */
119 void ( * state_change ) (
122 int link_up
123 );
124 /** Unregister port
125 *
126 * @v flexboot_nodnic flexboot_nodnic device
127 * @v port flexboot_nodnic port
128 */
129 void ( * unregister_dev ) (
132 );
133};
134
145
160
162 mlx_status ( * fill_completion ) ( void *cqe, struct cqe_data *cqe_data );
163 mlx_status ( * cqe_set_owner ) ( void *cq, unsigned int num_cqes );
166 struct ib_device *ibdev,
167 struct ib_queue_pair *qp,
168 struct ib_address_vector *av,
169 struct io_buffer *iobuf,
170 struct nodnic_send_wqbb *wqbb,
171 unsigned long wqe_idx
172 );
173 void ( * irq ) ( struct net_device *netdev, int enable );
175 struct ib_device *ibdev,
176 struct nodnic_send_wqbb *wqbb
177 );
178};
179
180int flexboot_nodnic_probe ( struct pci_device *pci,
181 struct flexboot_nodnic_callbacks *callbacks,
182 void *drv_priv );
183void flexboot_nodnic_remove ( struct pci_device *pci );
184void flexboot_nodnic_eth_irq ( struct net_device *netdev, int enable );
185int flexboot_nodnic_is_supported ( struct pci_device *pci );
186void flexboot_nodnic_copy_mac ( uint8_t mac_addr[], uint32_t low_byte,
187 uint16_t high_byte );
188int init_mlx_utils ( mlx_utils **utils, struct pci_device *pci );
189void free_mlx_utils ( mlx_utils **utils );
190#endif /* SRC_DRIVERS_INFINIBAND_FLEXBOOT_NODNIC_FLEXBOOT_NODNIC_H_ */
u8 port
Port number.
Definition CIB_PRM.h:3
struct arbelprm_qp_db_record qp
Definition arbel.h:2
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
unsigned char uint8_t
Definition stdint.h:10
#define FLEXBOOT_NODNIC_MAX_PORTS
void flexboot_nodnic_eth_irq(struct net_device *netdev, int enable)
int init_mlx_utils(mlx_utils **utils, struct pci_device *pci)
int flexboot_nodnic_is_supported(struct pci_device *pci)
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_copy_mac(uint8_t mac_addr[], uint32_t low_byte, uint16_t high_byte)
flexboot_nodnic_protocol
@ FLEXBOOT_NODNIC_PROT_FCOE
@ FLEXBOOT_NODNIC_PROT_ETH
@ FLEXBOOT_NODNIC_PROT_IB_IPV6
@ FLEXBOOT_NODNIC_PROT_IB_IPV4
void free_mlx_utils(mlx_utils **utils)
static struct net_device * netdev
Definition gdbudp.c:53
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
iPXE I/O API
Infiniband protocol.
struct _nodnic_device_priv nodnic_device_priv
struct _nodnic_port_priv nodnic_port_priv
struct _nodnic_qp nodnic_qp
struct _nodnic_cq nodnic_cq
uint32_t mlx_uint32
size_t mlx_size
uint64_t mlx_uint64
int mlx_status
uint8_t mlx_boolean
uint8_t mlx_uint8
Network device management.
mlx_uint32 vendor_err_syndrome
mlx_uint32 syndrome
mlx_uint32 byte_cnt
mlx_uint32 is_send
mlx_boolean owner
mlx_uint32 wqe_counter
mlx_uint32 is_error
mlx_uint32 qpn
mlx_status(* tx_uar_send_doorbell_fn)(struct ib_device *ibdev, struct nodnic_send_wqbb *wqbb)
mlx_status(* fill_send_wqe[5])(struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_address_vector *av, struct io_buffer *iobuf, struct nodnic_send_wqbb *wqbb, unsigned long wqe_idx)
mlx_status(* fill_completion)(void *cqe, struct cqe_data *cqe_data)
void(* irq)(struct net_device *netdev, int enable)
mlx_status(* cqe_set_owner)(void *cq, unsigned int num_cqes)
A flexboot_nodnic port type.
mlx_status(* register_dev)(struct flexboot_nodnic *flexboot_nodnic, struct flexboot_nodnic_port *port)
Register port.
void(* state_change)(struct flexboot_nodnic *flexboot_nodnic, struct flexboot_nodnic_port *port, int link_up)
Port state changed.
void(* unregister_dev)(struct flexboot_nodnic *flexboot_nodnic, struct flexboot_nodnic_port *port)
Unregister port.
A flexboot nodnic port.
nodnic_port_priv port_priv
nodic port
struct ib_completion_queue * eth_cq
Ethernet completion queue.
struct flexboot_nodnic_port_type * type
Port type.
struct ib_queue_pair * eth_qp
Ethernet queue pair.
struct ib_device * ibdev
Infiniband device.
struct net_device * netdev
Network device.
A flexboot nodnic queue pair.
A flexboot_nodnic device.
nodnic_device_priv device_priv
nodnic device
void * priv_data
device private data
unsigned int open_count
Device open request counter.
struct pci_device * pci
PCI device.
struct flexboot_nodnic_callbacks * callbacks
nic specific data
struct flexboot_nodnic_port port[FLEXBOOT_NODNIC_MAX_PORTS]
flexboot_nodnic ports
u16 port_mask
Port masking.
An Infiniband Address Vector.
Definition infiniband.h:73
An Infiniband Completion Queue.
Definition infiniband.h:225
An Infiniband device.
Definition infiniband.h:399
An Infiniband Queue Pair.
Definition infiniband.h:158
A persistent I/O buffer.
Definition iobuf.h:38
A network device.
Definition netdevice.h:353
A PCI device.
Definition pci.h:211
mlx_uint32 cmd
mlx_uint32 reserved2
mlx_uint64 qword
mlx_uint32 dword[2]
mlx_uint32 reserved0
mlx_uint32 reserved1
mlx_uint32 cq_n
mlx_uint32 cq_ci
mlx_uint32 cmdn
#define u16
Definition vga.h:20