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 
23 FILE_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 */
53 };
54 
55 /** A flexboot nodnic port */
57  /** Infiniband device */
58  struct ib_device *ibdev;
59  /** Network device */
60  struct net_device *netdev;
61  /** nodic port */
63  /** Port type */
65  /** Ethernet completion queue */
67  /** Ethernet queue pair */
70 };
71 
72 
73 /** A flexboot nodnic queue pair */
76 };
77 
78 /** A flexboot nodnic cq */
81 };
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  */
111  struct flexboot_nodnic_port *port
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 ) (
121  struct flexboot_nodnic_port *port,
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 ) (
131  struct flexboot_nodnic_port *port
132  );
133 };
134 
135 struct cqe_data{
144 };
145 
146 union arm_cq_uar {
147  struct {
148  //big endian
156  };
159 };
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 
180 int flexboot_nodnic_probe ( struct pci_device *pci,
181  struct flexboot_nodnic_callbacks *callbacks,
182  void *drv_priv );
183 void flexboot_nodnic_remove ( struct pci_device *pci );
184 void flexboot_nodnic_eth_irq ( struct net_device *netdev, int enable );
185 int flexboot_nodnic_is_supported ( struct pci_device *pci );
186 void flexboot_nodnic_copy_mac ( uint8_t mac_addr[], uint32_t low_byte,
187  uint16_t high_byte );
188 int init_mlx_utils ( mlx_utils **utils, struct pci_device *pci );
189 void free_mlx_utils ( mlx_utils **utils );
190 #endif /* SRC_DRIVERS_INFINIBAND_FLEXBOOT_NODNIC_FLEXBOOT_NODNIC_H_ */
uint16_t u16
Definition: stdint.h:21
uint8_t mlx_boolean
mlx_uint32 cmdn
iPXE I/O API
Infiniband protocol.
unsigned short uint16_t
Definition: stdint.h:11
void flexboot_nodnic_remove(struct pci_device *pci)
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_uint32 reserved0
#define FLEXBOOT_NODNIC_MAX_PORTS
struct ib_device * ibdev
Infiniband device.
mlx_uint32 is_error
mlx_uint32 cmd
void flexboot_nodnic_eth_irq(struct net_device *netdev, int enable)
nodnic_device_priv device_priv
nodnic device
void(* state_change)(struct flexboot_nodnic *flexboot_nodnic, struct flexboot_nodnic_port *port, int link_up)
Port state changed.
mlx_uint32 byte_cnt
struct pci_device * pci
PCI device.
u16 port_mask
Port masking.
mlx_uint32 cq_n
mlx_uint32 reserved2
mlx_status(* cqe_set_owner)(void *cq, unsigned int num_cqes)
struct ib_completion_queue * eth_cq
Ethernet completion queue.
int flexboot_nodnic_is_supported(struct pci_device *pci)
An Infiniband device.
Definition: infiniband.h:398
uint32_t mlx_uint32
int init_mlx_utils(mlx_utils **utils, struct pci_device *pci)
u8 port
Port number.
Definition: CIB_PRM.h:31
struct net_device * netdev
Network device.
mlx_uint32 reserved1
static struct net_device * netdev
Definition: gdbudp.c:52
mlx_status(* tx_uar_send_doorbell_fn)(struct ib_device *ibdev, struct nodnic_send_wqbb *wqbb)
void * priv_data
device private data
struct ib_queue_pair * eth_qp
Ethernet queue pair.
mlx_status(* fill_completion)(void *cqe, struct cqe_data *cqe_data)
A flexboot_nodnic device.
mlx_status(* register_dev)(struct flexboot_nodnic *flexboot_nodnic, struct flexboot_nodnic_port *port)
Register port.
A PCI device.
Definition: pci.h:187
void free_mlx_utils(mlx_utils **utils)
A network device.
Definition: netdevice.h:348
void(* unregister_dev)(struct flexboot_nodnic *flexboot_nodnic, struct flexboot_nodnic_port *port)
Unregister port.
An Infiniband Completion Queue.
Definition: infiniband.h:224
size_t mlx_size
unsigned char uint8_t
Definition: stdint.h:10
mlx_uint32 vendor_err_syndrome
mlx_uint64 qword
A flexboot_nodnic port type.
unsigned int uint32_t
Definition: stdint.h:12
An Infiniband Queue Pair.
Definition: infiniband.h:157
Network device management.
nodnic_port_priv port_priv
nodic port
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
uint8_t mlx_uint8
mlx_uint32 syndrome
struct flexboot_nodnic_port port[FLEXBOOT_NODNIC_MAX_PORTS]
flexboot_nodnic ports
A flexboot nodnic port.
An Infiniband Address Vector.
Definition: infiniband.h:72
mlx_boolean owner
int mlx_status
struct flexboot_nodnic_callbacks * callbacks
nic specific data
mlx_uint32 qpn
flexboot_nodnic_protocol
mlx_uint32 wqe_counter
uint64_t mlx_uint64
mlx_uint32 cq_ci
struct flexboot_nodnic_port_type * type
Port type.
int flexboot_nodnic_probe(struct pci_device *pci, struct flexboot_nodnic_callbacks *callbacks, void *drv_priv)
void flexboot_nodnic_copy_mac(uint8_t mac_addr[], uint32_t low_byte, uint16_t high_byte)
void(* irq)(struct net_device *netdev, int enable)
unsigned long int dword
Definition: smc9000.h:40
FILE_LICENCE(GPL2_OR_LATER)
mlx_uint32 is_send
unsigned int open_count
Device open request counter.
A flexboot nodnic queue pair.
A persistent I/O buffer.
Definition: iobuf.h:32