46 #define DEVICE_IS_CIB( device ) ( device == 0x1011 ) 74 goto err_golan_init_fw_areas_bad_param;
82 err_golan_init_fw_areas_bad_param:
101 DBG (
"HCA is busy (rc = -EBUSY)\n" );
103 }
else if ( out_hdr->
status ) {
104 DBG(
"%s status = 0x%x - syndrom = 0x%x\n", __FUNCTION__,
111 #define GOLAN_CHECK_RC_AND_CMD_STATUS(_lable) \ 113 if ( ( rc = golan_check_rc_and_cmd_status ( cmd, rc ) ) ) \ 117 #define GOLAN_PRINT_RC_AND_CMD_STATUS golan_check_rc_and_cmd_status ( cmd, rc ) 130 return (
fls ( mem ) - 1 );
133 #define CTRL_SIG_SZ (sizeof(mailbox->mblock) - sizeof(mailbox->mblock.bdata) - 2) 141 for (i = 0; i <
len; ++i)
150 case 0x0:
return "OK";
151 case 0x1:
return "internal error";
152 case 0x2:
return "bad operation";
153 case 0x3:
return "bad parameter";
154 case 0x4:
return "bad system state";
155 case 0x5:
return "bad resource";
156 case 0x6:
return "resource busy";
157 case 0x8:
return "limits exceeded";
158 case 0x9:
return "bad resource state";
159 case 0xa:
return "bad index";
160 case 0xf:
return "no resources";
161 case 0x50:
return "bad input length";
162 case 0x51:
return "bad output length";
163 case 0x10:
return "bad QP state";
164 case 0x30:
return "bad packet (discarded)";
165 case 0x40:
return "bad size too many outstanding CQEs";
166 case 0xff:
return "Command Timed Out";
167 default:
return "unknown status";
406 while ( pages > 0 ) {
428 DBGC (
golan ,
"HCA is busy (rc = -EBUSY)\n" );
430 DBGC (
golan ,
"%s: rc =0x%x[%s]<%x> syn 0x%x[0x%x] for %d pages\n",
439 pages -= out_num_entries;
441 DBGC(
golan ,
"%s Pages handled\n", __FUNCTION__);
447 struct mbox *mailbox;
454 if ( ! fw_area->
area ) {
458 DBGC (
golan ,
"Failed to allocated %d pages \n",pages);
459 goto err_golan_alloc_fw_area;
464 next_page_addr = fw_area->
area;
465 while ( pages > 0 ) {
488 addr = next_page_addr;
500 DBGC (
golan ,
"HCA is busy (rc = -EBUSY)\n" );
502 DBGC (
golan ,
"%s: rc =0x%x[%s]<%x> syn 0x%x[0x%x] for %d pages\n",
508 goto err_send_command;
511 DBGC(
golan ,
"%s Pages handled\n", __FUNCTION__);
515 err_golan_alloc_fw_area:
519 DBGC (
golan ,
"%s Failed (rc = 0x%x)\n", __FUNCTION__,
rc);
546 DBGC(
golan ,
"%s pages needed: %d\n", __FUNCTION__, pages);
550 total_pages = (( pages >= 0 ) ? pages : ( pages * ( -1 ) ));
560 DBGC (
golan ,
"Failed to %s pages (rc = %d) - DMA pages allocated = %d\n",
567 err_handle_pages_query:
568 DBGC (
golan ,
"%s Qyery pages failed (rc = 0x%x)\n", __FUNCTION__,
rc);
582 DBGC (
golan ,
" %s Not implemented yet\n", __FUNCTION__);
607 goto malloc_phys_failed;
611 goto malloc_phys_inbox_failed;
615 goto malloc_phys_outbox_failed;
629 DBGC(
golan ,
"%s Command interface was initialized\n", __FUNCTION__);
632 malloc_phys_outbox_failed:
634 malloc_phys_inbox_failed:
637 DBGC (
golan ,
"%s Failed to initialize command interface (rc = 0x%x)\n",
674 DBGC (
golan,
"%s HCA teardown compleated\n", __FUNCTION__);
698 DBGC(
golan ,
"%s: UAR allocated with index 0x%x\n", __FUNCTION__, uar->
index);
724 DBGC (
golan,
"%s UAR (0x%x) was destroyed\n", __FUNCTION__, uar_index);
749 goto err_create_eq_eqe_alloc;
780 DBGC(
golan ,
"%s: Event queue created (EQN = 0x%x)\n", __FUNCTION__, eq->
eqn);
785 err_create_eq_eqe_alloc:
812 DBGC(
golan,
"%s Event queue (0x%x) was destroyed\n", __FUNCTION__,
eqn);
831 DBGC(
golan ,
"%s: Protection domain created (PDN = 0x%x)\n", __FUNCTION__,
858 DBGC (
golan ,
"%s Protection domain (0x%x) was destroyed\n", __FUNCTION__,
pdn);
884 DBGC(
golan ,
"%s: Got DMA Key for local access read/write (MKEY = 0x%x)\n",
907 DBGC(
golan ,
"%s DMA Key (0x%x) for local access write was destroyed\n" 908 , __FUNCTION__,
mkey);
959 golan_cq =
zalloc(
sizeof(*golan_cq));
969 goto err_create_cq_db_alloc;
973 if (!golan_cq->
cqes) {
975 goto err_create_cq_cqe_alloc;
979 for (i = 0; i < cq->
num_cqes; ++i) {
1007 DBGC(
golan ,
"%s CQ created successfully (CQN = 0x%lx)\n", __FUNCTION__, cq->
cqn);
1012 err_create_cq_cqe_alloc:
1014 err_create_cq_db_alloc:
1017 DBGC (
golan ,
"%s out rc = 0x%x\n", __FUNCTION__,
rc);
1052 DBGC (
golan,
"%s CQ number 0x%x was destroyed\n", __FUNCTION__,
cqn);
1099 golan_qp =
zalloc(
sizeof(*golan_qp));
1108 sizeof ( golan_qp->
rq.
grh[0] ));
1114 DBGC (
golan ,
"%s receive wqe size [%zd] > max wqe size [%d]\n", __FUNCTION__,
1117 goto err_create_qp_rq_size;
1120 wqe_size_in_bytes =
sizeof(golan_qp->
sq.
wqes[0]);
1123 DBGC (
golan ,
"%s send WQE size [%d] > max WQE size [%d]\n", __FUNCTION__,
1127 goto err_create_qp_sq_wqe_size;
1129 golan_qp->
sq.
size = (
qp->send.num_wqes * wqe_size_in_bytes);
1131 if (
qp->send.num_wqes > max_qp_size_in_wqes) {
1132 DBGC (
golan ,
"%s send wq size [%d] > max wq size [%d]\n", __FUNCTION__,
1133 golan_qp->
sq.
size, max_qp_size_in_wqes);
1135 goto err_create_qp_sq_size;
1142 if (!golan_qp->
wqes) {
1144 goto err_create_qp_wqe_alloc;
1158 for ( i = 0 ; i < ( golan_qp->
rq.
size /
sizeof ( *data ) ); i++ ){
1167 goto err_create_qp_db_alloc;
1189 in->ctx.rq_size_stride = ((
ilog2(
qp->recv.num_wqes) <<
1217 err_create_qp_db_alloc:
1219 err_create_qp_wqe_alloc:
1220 err_create_qp_sq_size:
1221 err_create_qp_sq_wqe_size:
1222 err_create_qp_rq_size:
1246 DBG (
"%s Failed to create QP (rc = 0x%x)\n", __FUNCTION__,
rc);
1255 DBG (
"%s unsupported QP type (0x%x)\n", __FUNCTION__,
qp->type);
1270 in->ctx.pri_path.port = ibdev->
port;
1272 in->ctx.pri_path.pkey_index = 0;
1316 DBGC(
golan ,
"%s QP number 0x%lx was modified to RESET\n",
1317 __FUNCTION__,
qp->qpn);
1321 err_modify_qp_2rst_cmd:
1322 DBGC (
golan ,
"%s Failed to modify QP number 0x%lx (rc = 0x%x)\n",
1323 __FUNCTION__,
qp->qpn,
rc);
1350 prev_state = golan_qp->
state;
1360 goto err_modify_qp_fill_inbox;
1366 ++(golan_qp->
state);
1368 DBGC(
golan ,
"%s QP number 0x%lx was modified from %s to %s\n",
1373 DBGC(
golan ,
"%s QP number 0x%lx is ready to receive/send packets.\n",
1374 __FUNCTION__,
qp->qpn);
1378 err_modify_qp_fill_inbox:
1379 DBGC (
golan ,
"%s Failed to modify QP number 0x%lx (rc = 0x%x)\n",
1380 __FUNCTION__,
qp->qpn,
rc);
1396 unsigned long qpn =
qp->qpn;
1403 DBGC (
golan ,
"%s Failed to modify QP 0x%lx to RESET\n", __FUNCTION__,
1411 if (
qp->send.cq && (
qp->send.cq !=
qp->recv.cq)) {
1429 DBGC(
golan ,
"%s QP 0x%lx was destroyed\n", __FUNCTION__,
qpn);
1460 unsigned long wqe_idx_mask;
1461 unsigned long wqe_idx;
1466 wqe_idx_mask = (
qp->send.num_wqes - 1);
1467 wqe_idx = (
qp->send.next_idx & wqe_idx_mask);
1468 if (
qp->send.iobufs[wqe_idx]) {
1469 DBGC (
golan ,
"%s Send queue of QPN 0x%lx is full\n", __FUNCTION__,
qp->qpn);
1473 qp->send.iobufs[wqe_idx] = iobuf;
1478 wqe = &golan_qp->
sq.
wqes[wqe_idx].
ud;
1482 memset(wqe, 0,
sizeof(*wqe));
1490 ctrl->fm_ce_se = 0x8;
1509 ++(
qp->send.next_idx);
1537 unsigned int wqe_idx_mask;
1542 DBGC (
golan ,
"%s Receive queue of QPN 0x%lx is full\n", __FUNCTION__,
qp->qpn);
1549 memset(wqe, 0,
sizeof(*wqe));
1551 if ( golan_qp->
rq.
grh ) {
1603 err_query_vport_context_cmd:
1632 err_query_vport_gid_cmd:
1652 in->pkey_index = 0xffff;
1657 err_query_vport_pkey_cmd:
1667 DBG (
"golan_get_ib_info: golan_query_vport_context Failed (rc = %d)\n",
rc );
1668 goto err_query_vport_context;
1673 DBG (
"golan_get_ib_info: golan_query_vport_gid Failed (rc = %d)\n",
rc );
1674 goto err_query_vport_gid;
1679 DBG (
"golan_get_ib_info: golan_query_vport_pkey Failed (rc = %d)\n",
rc );
1680 goto err_query_vport_pkey;
1683 err_query_vport_pkey:
1684 err_query_vport_gid:
1685 err_query_vport_context:
1686 DBG (
"%s [%d] out\n", __FUNCTION__,
rc);
1703 int gid_present, idx;
1706 static int error_state;
1722 if (!error_state++) {
1724 for ( i = 0 ; i < 16 ; i += 2 ) {
1729 DBGC (
golan ,
"CQE with error: Syndrome(0x%x), VendorSynd(0x%x), HW_SYN(0x%x)\n",
1737 DBGC (
golan ,
"%s unknown %s QPN 0x%x in CQN 0x%lx\n",
1738 __FUNCTION__, (is_send ?
"send" :
"recv"),
qpn, cq->
cqn);
1750 idx = wqe_ctr & (wq->
num_wqes - 1);
1755 DBGC (
golan ,
"%s IO Buffer 0x%x not found in QPN 0x%x\n",
1756 __FUNCTION__, idx,
qpn);
1765 memset(&recv_dest, 0,
sizeof(recv_dest));
1768 memset(&recv_source, 0,
sizeof(recv_source));
1794 len -=
sizeof ( *grh );
1799 DBGC (
golan ,
"%s Unsupported QP type (0x%x)\n", __FUNCTION__,
qp->type);
1820 unsigned int cqe_idx_mask;
1825 for (i = 0; i < cq->
num_cqes; ++i) {
1844 DBGC (
golan ,
"%s CQN 0x%lx failed to complete\n", __FUNCTION__, cq->
cqn);
1859 return "GOLAN_EVENT_TYPE_COMP";
1861 return "GOLAN_EVENT_TYPE_PATH_MIG";
1863 return "GOLAN_EVENT_TYPE_COMM_EST";
1865 return "GOLAN_EVENT_TYPE_SQ_DRAINED";
1867 return "GOLAN_EVENT_TYPE_SRQ_LAST_WQE";
1869 return "GOLAN_EVENT_TYPE_SRQ_RQ_LIMIT";
1871 return "GOLAN_EVENT_TYPE_CQ_ERROR";
1873 return "GOLAN_EVENT_TYPE_WQ_CATAS_ERROR";
1875 return "GOLAN_EVENT_TYPE_PATH_MIG_FAILED";
1877 return "GOLAN_EVENT_TYPE_WQ_INVAL_REQ_ERROR";
1879 return "GOLAN_EVENT_TYPE_WQ_ACCESS_ERROR";
1881 return "GOLAN_EVENT_TYPE_SRQ_CATAS_ERROR";
1883 return "GOLAN_EVENT_TYPE_INTERNAL_ERROR";
1885 return "GOLAN_EVENT_TYPE_PORT_CHANGE";
1887 return "GOLAN_EVENT_TYPE_GPIO_EVENT";
1889 return "GOLAN_EVENT_TYPE_REMOTE_CONFIG";
1891 return "GOLAN_EVENT_TYPE_DB_BF_CONGESTION";
1893 return "GOLAN_EVENT_TYPE_STALL_EVENT";
1895 return "GOLAN_EVENT_TYPE_CMD";
1897 return "GOLAN_EVENT_TYPE_PAGE_REQUEST";
1899 return "Unrecognized event";
1907 return "GOLAN_PORT_CHANGE_SUBTYPE_DOWN";
1909 return "GOLAN_PORT_CHANGE_SUBTYPE_ACTIVE";
1911 return "GOLAN_PORT_CHANGE_SUBTYPE_INITIALIZED";
1913 return "GOLAN_PORT_CHANGE_SUBTYPE_LID";
1915 return "GOLAN_PORT_CHANGE_SUBTYPE_PKEY";
1917 return "GOLAN_PORT_CHANGE_SUBTYPE_GUID";
1919 return "GOLAN_PORT_CHANGE_SUBTYPE_CLIENT_REREG";
1921 return "Unrecognized event";
1965 DBGC(
golan ,
"%s event %s(%d) (sub event %s(%d))arrived on port %d\n",
1971 DBGC (
golan ,
"%s Port event with unrecognized subtype: port %d, sub_type %d\n",
2004 DBGC(
golan ,
"%s eqn %d, eqe type %s\n", __FUNCTION__, eq->
eqn,
2006 switch (eqe->
type) {
2021 DBGC(
golan ,
"%s event %s(%d) arrived\n", __FUNCTION__,
2032 DBGC (
golan ,
"CQ error on CQN 0x%x, syndrom 0x%x\n",
2055 DBGC (
golan ,
"%s Unhandled event 0x%x on EQ 0x%x\n", __FUNCTION__,
2083 DBGC(
golan,
"%s: Invalid pointer, could not attach QPN to MCG\n",
2099 DBGC(
golan ,
"%s: QPN 0x%lx was attached to MCG\n", __FUNCTION__,
qp->qpn);
2101 err_attach_to_mcg_cmd:
2133 DBGC(
golan ,
"%s: QPN 0x%lx was detached from MCG\n", __FUNCTION__,
qp->qpn);
2146 if (!ibdev || !
mad) {
2161 DBG (
"%s port %d could not register IB device: (rc = %d)\n",
2162 __FUNCTION__, ibdev->
port,
rc);
2173 DBGC(
golan,
"%s: start\n", __FUNCTION__);
2176 DBGC(
golan,
"%s: end (already closed)\n", __FUNCTION__);
2195 int utils_inited = 0;
2243 goto pages_teardown;
2294 DBG (
"%s start\n", __FUNCTION__ );
2299 DBG (
"%s end\n", __FUNCTION__ );
2310 DBG (
"%s start\n", __FUNCTION__ );
2318 DBG (
"%s end\n", __FUNCTION__ );
2351 goto err_golan_alloc;
2357 goto err_golan_golan_init_pages;
2368 goto err_golan_bringup;
2374 goto err_utils_init;
2382 goto err_golan_probe_alloc_ibdev;
2397 goto err_golan_probe_register_ibdev;
2406 err_golan_probe_register_ibdev:
2407 for ( i-- ; (
signed int ) i >= 0 ; i-- )
2411 err_golan_probe_alloc_ibdev:
2412 for ( i-- ; (
signed int ) i >= 0 ; i-- )
2422 err_golan_golan_init_pages:
2463 struct shomronprm_wqe_segment_ctrl_send *
ctrl;
2466 DBG(
"%s: Invalid parameters\n",__FUNCTION__);
2482 unsigned long wqe_index ) {
2494 memset ( ( ( (
void * ) eth_wqe ) ), 0,
2495 (
sizeof ( *eth_wqe ) ) );
2500 DBG(
"nodnic_port_get_qpn failed\n");
2504 #define SHOMRON_GENERATE_CQE 0x3 2505 #define SHOMRON_INLINE_HEADERS_SIZE ETH_HLEN 2506 #define SHOMRON_INLINE_HEADERS_OFFSET 32 2508 wqe_index, wqe_index & 0xFFFF);
2540 #define FLEXBOOT_NODNIC_OPCODE_CQ_SEND 0 2541 #define FLEXBOOT_NODNIC_OPCODE_CQ_RECV 2 2542 #define FLEXBOOT_NODNIC_OPCODE_CQ_SEND_ERR 13 2543 #define FLEXBOOT_NODNIC_OPCODE_CQ_RECV_ERR 14 2572 for ( ; i < num_cqes ; i++ )
2601 DBG (
"%s: start\n", __FUNCTION__ );
2604 DBG (
"%s: PCI is NULL\n", __FUNCTION__ );
2610 DBG (
"%s: Using NODNIC driver\n", __FUNCTION__ );
2613 DBG (
"%s: Using normal driver\n", __FUNCTION__ );
2618 DBG (
"%s: rc = %d\n", __FUNCTION__,
rc );
2623 DBG (
"%s: start\n", __FUNCTION__ );
2626 DBG (
"%s: Using normal driver remove\n", __FUNCTION__ );
2631 DBG (
"%s: Using NODNIC driver remove\n", __FUNCTION__ );
2635 DBG (
"%s: end\n", __FUNCTION__ );
2639 PCI_ROM ( 0x15b3, 0x1011,
"ConnectIB",
"ConnectIB HCA driver: DevID 4113", 0 ),
2640 PCI_ROM ( 0x15b3, 0x1013,
"ConnectX-4",
"ConnectX-4 HCA driver, DevID 4115", 0 ),
2641 PCI_ROM ( 0x15b3, 0x1015,
"ConnectX-4Lx",
"ConnectX-4Lx HCA driver, DevID 4117", 0 ),
2642 PCI_ROM ( 0x15b3, 0x1017,
"ConnectX-5",
"ConnectX-5 HCA driver, DevID 4119", 0 ),
2643 PCI_ROM ( 0x15b3, 0x1019,
"ConnectX-5EX",
"ConnectX-5EX HCA driver, DevID 4121", 0 ),
2644 PCI_ROM ( 0x15b3, 0x101b,
"ConnectX-6",
"ConnectX-6 HCA driver, DevID 4123", 0 ),
2645 PCI_ROM ( 0x15b3, 0x101d,
"ConnectX-6DX",
"ConnectX-6DX HCA driver, DevID 4125", 0 ),
2646 PCI_ROM ( 0x15b3, 0x101f,
"ConnectX-6Lx",
"ConnectX-6LX HCA driver, DevID 4127", 0 ),
2647 PCI_ROM ( 0x15b3, 0x1021,
"ConnectX-7",
"ConnectX-7 HCA driver, DevID 4129", 0 ),
2648 PCI_ROM ( 0x15b3, 0xa2d2,
"BlueField",
"BlueField integrated ConnectX-5 network controller HCA driver, DevID 41682", 0 ),
2649 PCI_ROM ( 0x15b3, 0xa2d6,
"BlueField-2",
"BlueField-2 network controller HCA driver, DevID 41686", 0 ),
2650 PCI_ROM ( 0x15b3, 0xa2dc,
"BlueField-3",
"BlueField-3 network controller HCA driver, DevID 41692", 0 ),
void unregister_ibdev(struct ib_device *ibdev)
Unregister Infiniband device.
struct nodnic_ring nodnic_ring
#define cpu_to_be16(value)
#define iob_pull(iobuf, len)
static struct pci_device_id golan_nics[]
#define EINVAL
Invalid argument.
static __always_inline void ib_set_drvdata(struct ib_device *ibdev, void *priv)
Set Infiniband device driver-private data.
#define GET_OUTBOX(golan, idx)
struct golan_cmd_prot_block mblock
struct arbelprm_rc_send_wqe rc
#define SHOMRON_INLINE_HEADERS_OFFSET
#define MLX_FILL_2(_ptr, _index,...)
#define FLEXBOOT_NODNIC_OPCODE_CQ_RECV_ERR
#define iob_put(iobuf, len)
struct golan_wqe_data_seg data[2]
struct nodnic_send_ring send
mlx_size(* get_cqe_size)()
#define EBUSY
Device or resource busy.
struct arbelprm_completion_queue_entry normal
union ib_gid gid
Port GID (comprising GID prefix and port GUID)
static int ib_is_open(struct ib_device *ibdev)
Check whether or not Infiniband device is open.
static unsigned int unsigned int reg
struct golan_firmware_area fw_areas[GOLAN_FW_AREAS_NUM]
static int golan_cmd_wait(struct golan *golan, int idx, const char *command)
Wait for Golan command completion.
static mlx_status shomron_tx_uar_send_db(struct ib_device *ibdev, struct nodnic_send_wqbb *wqbb)
Infiniband device operations.
static int golan_probe_normal(struct pci_device *pci)
struct shomronprm_completion_queue_entry normal
static int golan_create_qp_aux(struct ib_device *ibdev, struct ib_queue_pair *qp, int *qpn)
int flexboot_nodnic_is_supported(struct pci_device *pci)
struct ib_device * ibdev
Infiniband device.
#define DB_BUFFER0_EVEN_OFFSET
static void golan_ib_close(struct ib_device *ibdev)
Close Infiniband link.
#define GOLAN_INVALID_LKEY
static int(* golan_modify_qp_methods[])(struct ib_device *ibdev, struct ib_queue_pair *qp, struct golan_modify_qp_mbox_in_data *in)
static int golan_hca_init(struct golan *golan)
struct golan_inbox_hdr hdr
Message header.
static int golan_take_pages(struct golan *golan, uint32_t pages, __be16 func_id)
struct net_device * ipoib_netdev(struct ib_device *ibdev)
Find IPoIB network device.
static int golan_is_hw_ownership(struct ib_completion_queue *cq, struct golan_cqe64 *cqe64)
struct pci_device_id * ids
PCI ID table.
#define GOLAN_CQ_DB_RECORD_SIZE
uint32_t type
Operating system type.
static int golan_probe(struct pci_device *pci)
struct golan_wqe_ctrl_seg ctrl
static void show_out_status(uint32_t *out)
struct shomronprm_completion_with_error error
static void golan_cq_clean(struct ib_completion_queue *cq)
nodnic_device_priv device_priv
nodnic device
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
unsigned long user_to_phys(userptr_t userptr, off_t offset)
Convert user pointer to physical address.
#define FLEXBOOT_NODNIC_OPCODE_CQ_SEND
static mlx_status shomron_cqe_set_owner(void *cq, unsigned int num_cqes)
#define GOLAN_CREATE_MKEY_SEG_QPN_BIT
struct device * dev
Underlying device.
static int golan_qry_hca_cap(struct golan *golan)
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
static void golan_destory_eq(struct golan *golan)
static __always_inline void * ib_qp_get_drvdata(struct ib_queue_pair *qp)
Get Infiniband queue pair driver-private data.
static uint32_t ilog2(uint32_t mem)
#define GOLAN_QP_CTX_PM_STATE_BIT
static int golan_get_ib_info(struct ib_device *ibdev)
#define GOLAN_WQEBBS_PER_SEND_UD_WQE
int init_mlx_utils(mlx_utils **utils, struct pci_device *pci)
static void golan_handle_port_event(struct golan *golan, struct golan_eqe *eqe)
struct ib_global_route_header grh
static void golan_mcast_detach(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Detach from multicast group.
void ib_link_state_changed(struct ib_device *ibdev)
Notify of Infiniband link state change.
static int golan_inform_sma(struct ib_device *ibdev, union ib_mad *mad)
Inform embedded subnet management agent of a received MAD.
static void golan_pci_init(struct golan *golan)
Initialise Golan PCI parameters.
static mlx_size shomron_get_cqe_size()
unsigned int gid_present
GID is present.
static int golan_modify_qp_to_rst(struct ib_device *ibdev, struct ib_queue_pair *qp)
static void golan_destroy_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Destroy completion queue.
#define GOLAN_QP_CTX_RQ_SIZE_BIT
struct golan_hca_cap caps
static struct golan * golan_alloc()
#define GOLAN_PRINT_RC_AND_CMD_STATUS
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
const char * golan_qp_state_as_string[]
An Infiniband Global Identifier.
struct device dev
Generic device.
static void golan_teardown_hca(struct golan *golan, enum golan_teardown op_mod)
unsigned long long __be64
#define ENOTSUP
Operation not supported.
A doubly-linked list entry (or list head)
static int golan_create_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Create queue pair.
Dynamic memory allocation.
#define GOLAN_QP_CTX_ST_BIT
static void golan_disable_hca(struct golan *golan)
static int golan_set_hca_cap(struct golan *golan)
#define DEVICE_IS_CIB(device)
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define ENOMEM
Not enough space.
#define QRY_PAGES_OUT(golan, idx)
#define GOLAN_IB_ACCESS_LOCAL_READ
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static int golan_query_vport_context(struct ib_device *ibdev)
#define GOLAN_FW_AREAS_NUM
static struct ib_device_operations golan_ib_operations
Golan Infiniband operations.
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
uint32_t userptr_t
A pointer to a user buffer.
#define __unused
Declare a variable or data structure as unused.
unsigned long qkey
Queue key.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
struct golan_query_hca_vport_context_data context_data
uint16_t device
Device ID.
static int golan_ib_open(struct ib_device *ibdev)
Initialise Infiniband link.
__be64 qdata[MAILBOX_STRIDE >> 3]
#define be32_to_cpu(value)
union golan_send_wqe * wqes
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static unsigned int golan_rate(enum ib_rate rate)
Calculate transmission rate.
struct ib_device_operations * op
Infiniband operations.
void flexboot_nodnic_eth_irq(struct net_device *netdev, int enable)
static int golan_complete(struct ib_device *ibdev, struct ib_completion_queue *cq, struct golan_cqe64 *cqe64)
An Infiniband Work Queue.
#define GOLAN_IB_ACCESS_LOCAL_WRITE
static int send_command_and_wait(struct golan *golan, uint32_t cmd_idx, uint32_t inbox_idx, uint32_t outbox_idx, const char *command)
static void golan_poll_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
struct golan_port ports[GOLAN_MAX_PORTS]
void ib_complete_send(struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf, int rc)
Complete send work queue entry.
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
struct golan_hca_init_seg * iseg
#define GOLAN_WQE_CTRL_WQE_IDX_BIT
struct pci_driver golan_driver __pci_driver
A 16-bit general register.
#define GOLAN_SEND_UD_WQE_SIZE
static uint32_t is_command_finished(struct golan *golan, int idx)
Check if CMD has finished.
__be64 data[GOLAN_CMD_PAS_CNT]
#define be16_to_cpu(value)
uint16_t sm_lid
Subnet manager LID.
static int golan_alloc_pd(struct golan *golan)
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
static u16 fw_rev_sub(struct golan *golan)
static struct golan_eqe * golan_next_eqe_sw(struct golan_event_queue *eq)
struct golan_eqe_cq_err cq_err
#define CMD_STATUS(golan, idx)
#define EFAULT
Bad address.
struct ib_work_queue * ib_find_wq(struct ib_completion_queue *cq, unsigned long qpn, int is_send)
Find work queue belonging to completion queue.
struct golan_wqe_data_seg data
static int golan_qp_type_to_st(enum ib_queue_pair_type type)
unsigned int num_wqes
Number of work queue entries.
static void golan_poll_eq(struct ib_device *ibdev)
Poll event queue.
static struct golan_cmd_layout * get_cmd(struct golan *golan, int idx)
uint8_t sm_sl
Subnet manager SL.
static mlx_status shomron_fill_completion(void *cqe, struct cqe_data *cqe_data)
static void golan_free_fw_areas(struct golan *golan)
struct golan_mboxes mboxes
static const char * golan_eqe_type_str(u8 type)
#define GOLAN_CQE_OPCODE_NOT_VALID
A flexboot_nodnic device.
static u16 fw_rev_min(struct golan *golan)
static u8 xor8_buf(void *buf, int len)
unsigned int port
Port number.
static __always_inline void ibdev_put(struct ib_device *ibdev)
Drop reference to Infiniband device.
static __always_inline void ib_cq_set_drvdata(struct ib_completion_queue *cq, void *priv)
Set Infiniband completion queue driver-private data.
static void(* free)(struct refcnt *refcnt))
struct net_device * netdev
Network device.
ib_queue_pair_type
An Infiniband queue pair type.
#define MANAGE_PAGES_PSA_OFFSET
#define GOLAN_HCR_MAX_WAIT_MS
void * zalloc(size_t size)
Allocate cleared memory.
#define GOLAN_CQE_OPCODE_BIT
uint8_t subtype
Slow protocols subtype.
static void golan_cmd_uninit(struct golan *golan)
size_t grh_size
Size of GRH buffers.
static int golan_check_rc_and_cmd_status(struct golan_cmd_layout *cmd, int rc)
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
static int golan_modify_qp_rtr_to_rts(struct ib_device *ibdev __attribute__((unused)), struct ib_queue_pair *qp __attribute__((unused)), struct golan_modify_qp_mbox_in_data *in __attribute__((unused)))
struct ib_device * ibdev
Infiniband device.
struct ib_device * alloc_ibdev(size_t priv_size)
Allocate Infiniband device.
#define SHOMRON_GENERATE_CQE
#define MLX_GET(_ptr, _field)
static size_t iob_tailroom(struct io_buffer *iobuf)
Calculate available space at end of an I/O buffer.
union ib_guid node_guid
Node GUID.
#define GOLAN_RECV_WQE_SIZE
static void golan_remove_normal(struct pci_device *pci)
An Infiniband Completion Queue.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static int shomron_nodnic_is_supported(struct pci_device *pci)
#define MLX_FILL_1(_ptr, _index,...)
#define MLX_FILL_H(_structure_st, _index, _field, _address)
static void golan_destroy_mkey(struct golan *golan)
static struct golan_cmd_layout * write_cmd(struct golan *golan, int idx, uint16_t opcode, uint16_t opmod, uint16_t inbox_idx, uint16_t outbox_idx, uint16_t inlen, uint16_t outlen)
Prepare a FW command, In - comamnd idx (Must be valid) writes the command parameters.
static int golan_bring_up(struct golan *golan)
static mlx_status shomron_fill_eth_send_wqe(struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_address_vector *av __attribute__((unused)), struct io_buffer *iobuf, struct nodnic_send_wqbb *wqbb, unsigned long wqe_index)
static const char * golan_eqe_port_subtype_str(u8 subtype)
mlx_uint32 vendor_err_syndrome
static u16 cmdif_rev(struct golan *golan)
#define FLEXBOOT_NODNIC_OPCODE_CQ_SEND_ERR
static int golan_query_vport_gid(struct ib_device *ibdev)
static void golan_dealloc_pd(struct golan *golan)
#define GOLAN_CHECK_RC_AND_CMD_STATUS(_lable)
unsigned long qpn
Queue Pair Number.
#define SHOMRON_INLINE_HEADERS_SIZE
int register_ibdev(struct ib_device *ibdev)
Register Infiniband device.
void flexboot_nodnic_remove(struct pci_device *pci)
A PCI device ID list entry.
static int golan_init_fw_areas(struct golan *golan)
struct ib_queue_pair * qp
Containing queue pair.
#define VIRT_2_BE64_BUS(addr)
static int golan_set_link_speed(struct golan *golan)
unsigned int ports
Total ports on device.
static int golan_post_send(struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_address_vector *av, struct io_buffer *iobuf)
Post send work queue entry.
struct golan_event_queue eq
unsigned long next_idx
Next work queue entry index.
uint16_t syndrome
ID of event.
struct golan_eqe_port_state port
static void send_command(struct golan *golan)
Notify the HW that commands are ready.
static struct xen_remove_from_physmap * remove
unsigned long next_idx
Next completion queue entry index.
static int golan_modify_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
struct ib_global_route_header * grh
GRH buffers (if applicable)
An Infiniband Queue Pair.
ib_rate
Infiniband transmission rates.
static void golan_calc_sig(struct golan *golan, uint32_t cmd_idx, uint32_t inbox_idx, uint32_t outbox_idx)
unsigned int sl
Service level.
FILE_LICENCE(GPL2_OR_LATER)
Network device management.
static int golan_alloc_uar(struct golan *golan)
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
struct arbelprm_qp_db_record qp
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
static int golan_provide_pages(struct golan *golan, uint32_t pages, __be16 func_id, struct golan_firmware_area *fw_area)
#define cpu_to_be32(value)
struct flexboot_nodnic_callbacks shomron_nodnic_callbacks
static int golan_query_vport_pkey(struct ib_device *ibdev)
#define GOLAN_EQ_DOORBELL_OFFSET
static int golan_create_mkey(struct golan *golan)
struct golan_recv_wqe_ud * wqes
#define UNULL
Equivalent of NULL for user pointers.
static __always_inline void ufree(userptr_t userptr)
Free external memory.
static __always_inline userptr_t umalloc(size_t size)
Allocate external memory.
struct flexboot_nodnic_port port[FLEXBOOT_NODNIC_MAX_PORTS]
flexboot_nodnic ports
#define GOLAN_SEND_OPCODE
int(* probe)(struct pci_device *pci)
Probe device.
static int golan_set_access_reg(struct golan *golan, uint32_t reg)
void * data
Start of data.
static void golan_dealloc_uar(struct golan *golan)
static void golan_bring_down(struct golan *golan)
struct golan_cqe64 * cqes
union ib_gid gid
GID, if present.
void ib_poll_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Poll completion queue.
#define USR_2_BE64_BUS(addr)
#define CMD_SYND(golan, idx)
uint8_t port_state
Port state.
static int golan_create_eq(struct golan *golan)
unsigned long cqn
Completion queue number.
void iounmap(volatile const void *io_addr)
Unmap I/O address.
uint8_t data[48]
Additional event data.
#define cpu_to_be64(value)
unsigned int num_cqes
Number of completion queue entries.
static int golan_core_enable_hca(struct golan *golan)
static int golan_modify_qp_init_to_rtr(struct ib_device *ibdev __attribute__((unused)), struct ib_queue_pair *qp __attribute__((unused)), struct golan_modify_qp_mbox_in_data *in)
static void golan_eq_update_ci(struct golan_event_queue *eq, int arm)
struct shomronprm_wqe_segment_ctrl_send ctrl
void ib_complete_recv(struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_address_vector *dest, struct ib_address_vector *source, struct io_buffer *iobuf, int rc)
Complete receive work queue entry.
static const char * cmd_status_str(u8 status)
void free_mlx_utils(mlx_utils **utils)
static int golan_cmd_init(struct golan *golan)
Initialise Golan Command Q parameters – Alocate a 4kb page for the Command Q – Read the stride and lo...
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
static void golan_destroy_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy queue pair.
An Infiniband Address Vector.
struct golan_send_wqe_ud ud
static int golan_modify_qp_rst_to_init(struct ib_device *ibdev, struct ib_queue_pair *qp __attribute__((unused)), struct golan_modify_qp_mbox_in_data *in)
Network interface management.
int flexboot_nodnic_probe(struct pci_device *pci, struct flexboot_nodnic_callbacks *callbacks, void *drv_priv __attribute__((unused)))
mlx_status nodnic_port_get_qpn(IN nodnic_port_priv *port_priv, IN struct nodnic_ring *ring, OUT mlx_uint32 *qpn)
#define GOLAN_QP_CTX_SQ_SIZE_BIT
static int golan_register_ibdev(struct golan_port *port)
Infiniband Subnet Management Client.
struct golan_qp_db * doorbell_record
unsigned int lid
Local ID.
#define GOLAN_MBOX_IN(cmd_ptr, in_ptr)
#define GOLAN_SEND_WQE_BB_SIZE
#define DBG(...)
Print a debugging message.
nodnic_qp * nodnic_queue_pair
enum golan_ib_qp_state state
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
#define MLX_CHECK_STATUS(id, status, label, message)
#define fls(x)
Find last (i.e.
static int golan_post_recv(struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf)
Post receive work queue entry.
#define FLEXBOOT_NODNIC_OPCODE_SEND
#define GOLAN_CQE_OWNER_MASK
#define GOLAN_PCI_CONFIG_BAR_SIZE
static __always_inline void * ib_cq_get_drvdata(struct ib_completion_queue *cq)
Get Infiniband completion queue driver-private data.
struct ib_device * ibdev
Containing Infiniband device.
#define NULL
NULL pointer (VOID *)
static void golan_remove(struct pci_device *pci)
#define PCI_ROM(_vendor, _device, _name, _description, _data)
static uint16_t fw_rev_maj(struct golan *golan)
static int golan_create_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Create completion queue.
static int golan_ib_update(struct ib_device *ibdev)
Update Infiniband parameters using Commands.
void writeq(uint64_t data, volatile uint64_t *io_addr)
Write 64-bit qword to memory-mapped device.
static int golan_mcast_attach(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Attach to multicast group.
userptr_t area
Firmware area in external memory.
mlx_status mlx_set_link_speed(IN mlx_utils *utils, IN mlx_uint8 port_num, IN LINK_SPEED_TYPE type, IN LINK_SPEED speed)
static __always_inline void ib_qp_set_drvdata(struct ib_queue_pair *qp, void *priv)
Set Infiniband queue pair driver-private data.
int(* create_cq)(struct ib_device *ibdev, struct ib_completion_queue *cq)
Create completion queue.
#define DB_BUFFER0_ODD_OFFSET
#define GET_INBOX(golan, idx)
void * memset(void *dest, int character, size_t len) __nonnull
#define GOLAN_PCI_CMD_XPORT
A flexboot nodnic queue pair.
static int golan_handle_pages(struct golan *golan, enum golan_qry_pages_mode qry, enum golan_manage_pages_mode mode)
struct io_buffer ** iobufs
I/O buffers assigned to work queue.