1
#ifndef SRC_DRIVERS_INFINIBAND_FLEXBOOT_NODNIC_FLEXBOOT_NODNIC_H_
2
#define SRC_DRIVERS_INFINIBAND_FLEXBOOT_NODNIC_FLEXBOOT_NODNIC_H_
5
* Copyright (C) 2015 Mellanox Technologies Ltd.
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.
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.
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
23
FILE_LICENCE ( GPL2_OR_LATER );
25
#include "mlx_nodnic/include/mlx_nodnic_data_structures.h"
26
#include "nodnic_prm.h"
28
#include <ipxe/infiniband.h>
29
#include <ipxe/netdevice.h>
32
* If defined, use interrupts in NODNIC driver
34
#define NODNIC_IRQ_ENABLED
36
#define FLEXBOOT_NODNIC_MAX_PORTS 2
37
#define FLEXBOOT_NODNIC_PORT_BASE 1
39
#define FLEXBOOT_NODNIC_OPCODE_SEND 0xa
42
enum flexboot_nodnic_protocol {
43
FLEXBOOT_NODNIC_PROT_IB_IPV6 = 0,
44
FLEXBOOT_NODNIC_PROT_ETH,
45
FLEXBOOT_NODNIC_PROT_IB_IPV4,
46
FLEXBOOT_NODNIC_PROT_FCOE
49
/** A flexboot nodnic port */
50
struct flexboot_nodnic_port {
51
/** Infiniband device */
52
struct ib_device *ibdev;
54
struct net_device *netdev;
56
nodnic_port_priv port_priv;
58
struct flexboot_nodnic_port_type *type;
59
/** Ethernet completion queue */
60
struct ib_completion_queue *eth_cq;
61
/** Ethernet queue pair */
62
struct ib_queue_pair *eth_qp;
66
/** A flexboot nodnic queue pair */
67
struct flexboot_nodnic_queue_pair {
68
nodnic_qp *nodnic_queue_pair;
71
/** A flexboot nodnic cq */
72
struct flexboot_nodnic_completion_queue {
73
nodnic_cq *nodnic_completion_queue;
76
/** A flexboot_nodnic device */
77
struct flexboot_nodnic {
79
struct pci_device *pci;
80
/** nic specific data*/
81
struct flexboot_nodnic_callbacks *callbacks;
83
nodnic_device_priv device_priv;
84
/**flexboot_nodnic ports*/
85
struct flexboot_nodnic_port port[FLEXBOOT_NODNIC_MAX_PORTS];
86
/** Device open request counter */
87
unsigned int open_count;
90
/** device private data */
94
/** A flexboot_nodnic port type */
95
struct flexboot_nodnic_port_type {
98
* @v flexboot_nodnic flexboot_nodnic device
99
* @v port flexboot_nodnic port
100
* @ret mlx_status Return status code
102
mlx_status ( * register_dev ) (
103
struct flexboot_nodnic *flexboot_nodnic,
104
struct flexboot_nodnic_port *port
106
/** Port state changed
108
* @v flexboot_nodnic flexboot_nodnic device
109
* @v port flexboot_nodnic port
110
* @v link_up Link is up
112
void ( * state_change ) (
113
struct flexboot_nodnic *flexboot_nodnic,
114
struct flexboot_nodnic_port *port,
119
* @v flexboot_nodnic flexboot_nodnic device
120
* @v port flexboot_nodnic port
122
void ( * unregister_dev ) (
123
struct flexboot_nodnic *flexboot_nodnic,
124
struct flexboot_nodnic_port *port
134
mlx_uint32 vendor_err_syndrome;
135
mlx_uint32 wqe_counter;
139
struct flexboot_nodnic_callbacks {
140
mlx_status ( * fill_completion ) ( void *cqe, struct cqe_data *cqe_data );
141
mlx_status ( * cqe_set_owner ) ( void *cq, unsigned int num_cqes );
142
mlx_size ( * get_cqe_size ) ();
143
mlx_status ( * fill_send_wqe[5] ) (
144
struct ib_device *ibdev,
145
struct ib_queue_pair *qp,
146
struct ib_address_vector *av,
147
struct io_buffer *iobuf,
148
struct nodnic_send_wqbb *wqbb,
149
unsigned long wqe_idx
151
void ( * irq ) ( struct net_device *netdev, int enable );
154
int flexboot_nodnic_probe ( struct pci_device *pci,
155
struct flexboot_nodnic_callbacks *callbacks,
157
void flexboot_nodnic_remove ( struct pci_device *pci );
158
void flexboot_nodnic_eth_irq ( struct net_device *netdev, int enable );
159
int flexboot_nodnic_is_supported ( struct pci_device *pci );
160
void flexboot_nodnic_copy_mac ( uint8_t mac_addr[], uint32_t low_byte,
161
uint16_t high_byte );
163
#endif /* SRC_DRIVERS_INFINIBAND_FLEXBOOT_NODNIC_FLEXBOOT_NODNIC_H_ */