72 unsigned int bits_len,
73 unsigned int num_bits ) {
76 unsigned int found = 0;
79 while (
bit < bits_len ) {
80 if ( ( mask & *
bits ) == 0 ) {
81 if ( ++found == num_bits )
87 mask = ( mask << 1 ) | ( mask >> ( 8 *
sizeof ( mask ) - 1 ) );
99 mask = ( mask >> 1 ) | ( mask << ( 8 *
sizeof ( mask ) - 1 ) );
102 return (
bit - num_bits + 1 );
113 int bit,
unsigned int num_bits ) {
116 for ( ; num_bits ;
bit++, num_bits-- ) {
117 mask = ( 1 << (
bit % ( 8 *
sizeof ( mask ) ) ) );
118 bits[ (
bit / ( 8 *
sizeof ( mask ) ) ) ] &= ~mask;
137 struct hermonprm_hca_command_register *hcr ) {
143 if ( (
MLX_GET ( hcr, go ) == 0 ) &&
163 unsigned int op_mod,
const void *
in,
164 unsigned int in_mod,
void *
out ) {
165 struct hermonprm_hca_command_register hcr;
178 DBGC2 (
hermon,
"Hermon %p command %04x in %zx%s out %zx%s\n",
185 DBGC (
hermon,
"Hermon %p command interface locked\n",
194 memset ( &hcr, 0,
sizeof ( hcr ) );
195 in_buffer = &hcr.u.dwords[0];
203 MLX_FILL_1 ( &hcr, 2, input_modifier, in_mod );
204 out_buffer = &hcr.u.dwords[3];
214 opcode_modifier, op_mod,
218 &hcr, sizeof ( hcr ) );
222 ( ( in_len < 512 ) ? in_len : 512 ) );
226 for ( i = 0 ; i < (
sizeof ( hcr ) /
sizeof ( hcr.u.dwords[0] ) ) ;
235 DBGC (
hermon,
"Hermon %p timed out waiting for command " 239 &hcr, sizeof ( hcr ) );
246 DBGC (
hermon,
"Hermon %p command %04x failed with status " 250 &hcr, sizeof ( hcr ) );
262 ( ( out_len < 512 ) ? out_len : 512 ) );
270 struct hermonprm_query_dev_cap *dev_cap ) {
273 1,
sizeof ( *dev_cap ) ),
274 0,
NULL, 0, dev_cap );
287 const struct hermonprm_init_hca *init_hca ) {
290 1,
sizeof ( *init_hca ) ),
291 0, init_hca, 0,
NULL );
317 unsigned int port_selector,
321 1,
sizeof ( *set_port ) ),
322 is_ethernet, set_port, port_selector,
NULL );
327 const struct hermonprm_mpt *mpt ) {
330 1,
sizeof ( *mpt ) ),
346 1,
sizeof ( *write_mtt ) ),
347 0, write_mtt, 1,
NULL );
352 const struct hermonprm_event_mask *mask ) {
355 0,
sizeof ( *mask ) ),
356 0, mask, index_map,
NULL );
361 const struct hermonprm_eqc *eqctx ) {
364 1,
sizeof ( *eqctx ) ),
370 struct hermonprm_eqc *eqctx ) {
373 1,
sizeof ( *eqctx ) ),
379 struct hermonprm_eqc *eqctx ) {
382 1,
sizeof ( *eqctx ) ),
388 const struct hermonprm_completion_queue_context *cqctx ){
391 1,
sizeof ( *cqctx ) ),
397 struct hermonprm_completion_queue_context *cqctx ) {
400 1,
sizeof ( *cqctx ) ),
406 struct hermonprm_completion_queue_context *cqctx ) {
409 1,
sizeof ( *cqctx ) ),
415 const struct hermonprm_qp_ee_state_transitions *
ctx ){
418 1,
sizeof ( *
ctx ) ),
424 const struct hermonprm_qp_ee_state_transitions *
ctx ){
427 1,
sizeof ( *
ctx ) ),
433 const struct hermonprm_qp_ee_state_transitions *
ctx ) {
436 1,
sizeof ( *
ctx ) ),
442 const struct hermonprm_qp_ee_state_transitions *
ctx ) {
445 1,
sizeof ( *
ctx ) ),
458 struct hermonprm_qp_ee_state_transitions *
ctx ) {
461 1,
sizeof ( *
ctx ) ),
467 unsigned long base_qpn ) {
470 internal_qps,
NULL, base_qpn,
NULL );
479 1,
sizeof ( *
mad ) ),
485 struct hermonprm_mcg_entry *mcg ) {
488 1,
sizeof ( *mcg ) ),
494 const struct hermonprm_mcg_entry *mcg ) {
497 1,
sizeof ( *mcg ) ),
503 struct hermonprm_mgm_hash *
hash ) {
507 0,
sizeof ( *
hash ) ),
513 unsigned int input_mod,
514 struct hermonprm_scalar_parameter *portion ) {
517 0,
sizeof ( *portion ),
518 0,
sizeof ( *portion ) ),
519 mode, portion, input_mod, portion );
524 struct hermonprm_query_port_cap *query_port ) {
527 1,
sizeof ( *query_port ) ),
533 struct hermonprm_sense_port *port_type ) {
536 0,
sizeof ( *port_type ) ),
549 const struct hermonprm_scalar_parameter *
offset ) {
558 const struct hermonprm_virtual_physical_mapping *
map ) {
561 1,
sizeof ( *
map ) ),
574 const struct hermonprm_virtual_physical_mapping *
map ) {
577 1,
sizeof ( *
map ) ),
583 const struct hermonprm_scalar_parameter *icm_size,
584 struct hermonprm_scalar_parameter *icm_aux_size ) {
587 0,
sizeof ( *icm_size ),
588 0,
sizeof (*icm_aux_size) ),
589 0, icm_size, 0, icm_aux_size );
601 const struct hermonprm_virtual_physical_mapping *
map ) {
604 1,
sizeof ( *
map ) ),
625 const void *memory,
size_t len,
645 if ( mtt_offset < 0 ) {
647 DBGC (
hermon,
"Hermon %p could not allocate %d MTT entries: " 656 mtt->mtt_offset = mtt_offset;
663 memset ( &write_mtt, 0,
sizeof ( write_mtt ) );
669 ptag_l, (
addr >> 3 ) );
671 &write_mtt ) ) != 0 ) {
672 DBGC (
hermon,
"Hermon %p could not write MTT at %x: " 681 DBGC (
hermon,
"Hermon %p MTT entries [%#x,%#x] for " 682 "[%08lx,%08lx,%08lx,%08lx)\n",
hermon,
mtt->mtt_offset,
703 DBGC (
hermon,
"Hermon %p MTT entries [%#x,%#x] freed\n",
705 (
mtt->mtt_offset +
mtt->num_pages - 1 ) );
723 #define HERMON_MOD_STAT_CFG_OFFSET( field ) \ 724 ( ( MLX_BIT_OFFSET ( struct hermonprm_mod_stat_cfg_st, field ) / 8 ) \ 725 & ~( sizeof ( struct hermonprm_scalar_parameter ) - 1 ) ) 738 unsigned int mode,
unsigned int offset,
739 struct hermonprm_mod_stat_cfg *stat_cfg ) {
740 struct hermonprm_scalar_parameter *portion =
741 ( (
void * ) &stat_cfg->u.bytes[
offset] );
742 struct hermonprm_mod_stat_cfg_input_mod mod;
749 memset ( &mod, 0,
sizeof ( mod ) );
790 &mad_ifc ) ) != 0 ) {
791 DBGC (
hermon,
"Hermon %p port %d could not issue MAD IFC: " 800 DBGC (
hermon,
"Hermon %p port %d MAD IFC status %04x\n",
823 struct hermonprm_completion_queue_context cqctx;
831 memset ( &cqctx, 0,
sizeof ( cqctx ) );
833 DBGC (
hermon,
"Hermon %p CQN %#lx QUERY_CQ failed: %s\n",
854 struct hermonprm_completion_queue_context cqctx;
862 if ( cqn_offset < 0 ) {
863 DBGC (
hermon,
"Hermon %p out of completion queues\n",
871 hermon_cq =
zalloc (
sizeof ( *hermon_cq ) );
873 DBGC (
hermon,
"Hermon %p CQN %#lx could not allocate CQ\n",
881 sizeof ( hermon_cq->
doorbell[0] ) );
883 DBGC (
hermon,
"Hermon %p CQN %#lx could not allocate " 893 sizeof ( hermon_cq->
cqe[0] ) );
894 if ( ! hermon_cq->
cqe ) {
895 DBGC (
hermon,
"Hermon %p CQN %#lx could not allocate CQEs\n",
901 for ( i = 0 ; i < cq->
num_cqes ; i++ ) {
909 &hermon_cq->
mtt ) ) != 0 ) {
910 DBGC (
hermon,
"Hermon %p CQN %#lx could not allocate MTTs: " 916 memset ( &cqctx, 0,
sizeof ( cqctx ) );
933 DBGC (
hermon,
"Hermon %p CQN %#lx SW2HW_CQ failed: %s\n",
938 DBGC (
hermon,
"Hermon %p CQN %#lx ring [%08lx,%08lx), doorbell " 969 struct hermonprm_completion_queue_context cqctx;
975 DBGC (
hermon,
"Hermon %p CQN %#lx FATAL HW2SW_CQ failed: " 1013 unsigned int port_offset;
1019 switch (
qp->type ) {
1032 if ( qpn_offset < 0 ) {
1033 DBGC (
hermon,
"Hermon %p out of queue pairs\n",
1041 DBGC (
hermon,
"Hermon %p unsupported QP type %d\n",
1060 if ( qpn_offset >= 0 )
1072 ? ( av->
rate + 5 ) : 0 );
1086 ( ( ibdev->
port - 1 ) << 6 ) );
1108 struct hermonprm_qp_ee_state_transitions qpctx;
1117 memset ( &qpctx, 0,
sizeof ( qpctx ) );
1119 DBGC (
hermon,
"Hermon %p QPN %#lx QUERY_QP failed: %s\n",
1125 DBGC (
hermon,
"Hermon %p QPN %#lx state %d unexpected " 1129 DBGC (
hermon,
"Hermon %p QPN %#lx state %d context:\n",
1131 DBGC_HDA (
hermon, 0, &qpctx.u.dwords[2], ( sizeof ( qpctx ) - 8 ) );
1147 struct hermonprm_qp_ee_state_transitions qpctx;
1148 struct hermonprm_wqe_segment_data_ptr *
data;
1157 hermon_qp =
zalloc (
sizeof ( *hermon_qp ) );
1158 if ( ! hermon_qp ) {
1159 DBGC (
hermon,
"Hermon %p QPN %#lx could not allocate QP\n",
1170 DBGC (
hermon,
"Hermon %p QPN %#lx could not allocate " 1173 goto err_recv_doorbell;
1183 ( 2048 /
sizeof ( hermon_qp->
send.
wqe[0] ) ) );
1187 sizeof ( hermon_qp->
send.
wqe[0] ) );
1189 sizeof ( hermon_qp->
recv.
wqe[0] ) );
1193 sizeof ( hermon_qp->
recv.
grh[0] ));
1199 sizeof ( hermon_qp->
send.
wqe[0] ) );
1200 if ( ! hermon_qp->
wqe ) {
1201 DBGC (
hermon,
"Hermon %p QPN %#lx could not allocate WQEs\n",
1218 for ( i = 0 ; i < ( hermon_qp->
recv.
wqe_size /
sizeof ( *data ) ); i++){
1226 &hermon_qp->
mtt ) ) != 0 ) {
1227 DBGC (
hermon,
"Hermon %p QPN %#lx could not allocate MTTs: " 1233 memset ( &qpctx, 0,
sizeof ( qpctx ) );
1239 qpc_eec_data.log_rq_size,
fls (
qp->recv.num_wqes - 1 ),
1240 qpc_eec_data.log_rq_stride,
1241 (
fls (
sizeof ( hermon_qp->
recv.
wqe[0] ) - 1 ) - 4 ),
1242 qpc_eec_data.log_sq_size,
1244 qpc_eec_data.log_sq_stride,
1245 (
fls (
sizeof ( hermon_qp->
send.
wqe[0] ) - 1 ) - 4 ) );
1248 MLX_FILL_1 ( &qpctx, 33, qpc_eec_data.cqn_snd,
qp->send.cq->cqn );
1250 qpc_eec_data.rre, 1,
1251 qpc_eec_data.rwe, 1,
1252 qpc_eec_data.rae, 1,
1253 qpc_eec_data.page_offset,
1255 MLX_FILL_1 ( &qpctx, 41, qpc_eec_data.cqn_rcv,
qp->recv.cq->cqn );
1256 MLX_FILL_H ( &qpctx, 42, qpc_eec_data.db_record_addr_h,
1258 MLX_FILL_1 ( &qpctx, 43, qpc_eec_data.db_record_addr_l,
1260 MLX_FILL_H ( &qpctx, 52, qpc_eec_data.mtt_base_addr_h,
1262 MLX_FILL_1 ( &qpctx, 53, qpc_eec_data.mtt_base_addr_l,
1266 DBGC (
hermon,
"Hermon %p QPN %#lx RST2INIT_QP failed: %s\n",
1268 goto err_rst2init_qp;
1272 DBGC (
hermon,
"Hermon %p QPN %#lx send ring [%08lx,%08lx), doorbell " 1278 DBGC (
hermon,
"Hermon %p QPN %#lx receive ring [%08lx,%08lx), " 1279 "doorbell %08lx\n",
hermon,
qp->qpn,
1284 DBGC (
hermon,
"Hermon %p QPN %#lx send CQN %#lx receive CQN %#lx\n",
1316 struct hermonprm_qp_ee_state_transitions qpctx;
1321 memset ( &qpctx, 0,
sizeof ( qpctx ) );
1326 qpc_eec_data.msg_max, 31 );
1328 qpc_eec_data.remote_qpn_een,
qp->av.qpn );
1330 qpc_eec_data.primary_address_path.rlid,
1333 qpc_eec_data.primary_address_path.max_stat_rate,
1335 memcpy ( &qpctx.u.dwords[12], &
qp->av.gid,
1336 sizeof (
qp->av.gid ) );
1338 qpc_eec_data.primary_address_path.sched_queue,
1341 qpc_eec_data.next_rcv_psn,
qp->recv.psn );
1344 DBGC (
hermon,
"Hermon %p QPN %#lx INIT2RTR_QP failed:" 1353 memset ( &qpctx, 0,
sizeof ( qpctx ) );
1355 qpc_eec_data.primary_address_path.ack_timeout,
1361 qpc_eec_data.next_send_psn,
qp->send.psn );
1364 DBGC (
hermon,
"Hermon %p QPN %#lx RTR2RTS_QP failed: " 1372 memset ( &qpctx, 0,
sizeof ( qpctx ) );
1374 MLX_FILL_1 ( &qpctx, 44, qpc_eec_data.q_key,
qp->qkey );
1376 DBGC (
hermon,
"Hermon %p QPN %#lx RTS2RTS_QP failed: %s\n",
1398 DBGC (
hermon,
"Hermon %p QPN %#lx FATAL 2RST_QP failed: %s\n",
1471 ud_address_vector.port_number, ibdev->
port );
1473 ud_address_vector.rlid,
dest->lid,
1474 ud_address_vector.g,
dest->gid_present );
1639 unsigned long wqe_idx_mask;
1640 unsigned long wqe_idx;
1647 wqe_idx_mask = ( wq->
num_wqes - 1 );
1648 if ( wq->
iobufs[ wqe_idx & wqe_idx_mask ] ) {
1649 DBGC (
hermon,
"Hermon %p QPN %#lx send queue full",
1653 wq->
iobufs[ wqe_idx & wqe_idx_mask ] = iobuf;
1654 wqe = &hermon_send_wq->
wqe[wqe_idx];
1657 memset ( ( ( (
void * ) wqe ) + 4 ), 0,
1658 (
sizeof ( *wqe ) - 4 ) );
1667 DBGCP (
hermon,
"Hermon %p QPN %#lx posting send WQE %#lx:\n",
1698 struct hermonprm_wqe_segment_data_ptr *
data;
1700 unsigned int wqe_idx_mask;
1703 wqe_idx_mask = ( wq->
num_wqes - 1 );
1705 DBGC (
hermon,
"Hermon %p QPN %#lx receive queue full",
1761 unsigned long wqe_idx;
1762 unsigned long wqe_idx_mask;
1773 DBGC (
hermon,
"Hermon %p CQN %#lx syndrome %x vendor %x\n",
1783 DBGC (
hermon,
"Hermon %p CQN %#lx unknown %s QPN %#lx\n",
1792 wqe_idx_mask = ( wq->
num_wqes - 1 );
1793 DBGCP (
hermon,
"Hermon %p CQN %#lx QPN %#lx %s WQE %#lx completed:\n",
1794 hermon, cq->
cqn,
qp->qpn, ( is_send ?
"send" :
"recv" ),
1799 iobuf = wq->
iobufs[ wqe_idx & wqe_idx_mask ];
1801 DBGC (
hermon,
"Hermon %p CQN %#lx QPN %#lx empty %s WQE " 1803 ( is_send ?
"send" :
"recv" ), wqe_idx );
1811 }
else if (
rc != 0 ) {
1819 memset ( &recv_dest, 0,
sizeof ( recv_dest ) );
1821 memset ( &recv_source, 0,
sizeof ( recv_source ) );
1822 switch (
qp->type ) {
1828 grh = &hermon_qp->
recv.
grh[ wqe_idx & wqe_idx_mask ];
1829 len -=
sizeof ( *grh );
1831 source = &recv_source;
1838 sizeof ( recv_dest.
gid ) );
1840 sizeof ( source->
gid ) );
1847 source = &recv_source;
1875 unsigned int cqe_idx_mask;
1880 cqe_idx_mask = ( cq->
num_cqes - 1 );
1881 cqe = &hermon_cq->
cqe[cq->
next_idx & cqe_idx_mask];
1890 DBGC (
hermon,
"Hermon %p CQN %#lx failed to complete:" 1893 cqe,
sizeof ( *cqe ) );
1922 struct hermonprm_eqc eqctx;
1930 memset ( &eqctx, 0,
sizeof ( eqctx ) );
1933 DBGC (
hermon,
"Hermon %p EQN %#lx QUERY_EQ failed: %s\n",
1937 DBGC (
hermon,
"Hermon %p EQN %#lx context:\n",
1954 struct hermonprm_eqc eqctx;
1967 memset ( &eqctx, 0,
sizeof ( eqctx ) );
1970 DBGC (
hermon,
"Hermon %p EQN %#lx QUERY_EQ failed: %s\n",
1978 if ( ( idx & mask ) != (
cons & mask ) ) {
1979 DBGC (
hermon,
"Hermon %p EQN %#lx mismatch: SW %#x != HW " 1982 for ( ; ( idx & mask ) != ( prod & mask ) ; idx++ ) {
1983 eqe = &hermon_eq->
eqe[idx & mask];
1984 DBGC (
hermon,
"Hermon %p EQN %#lx event %#x owner %d type " 1985 "%#02x:%#02x\n",
hermon, hermon_eq->
eqn, idx,
2003 struct hermonprm_eqc eqctx;
2004 struct hermonprm_event_mask mask;
2021 sizeof ( hermon_eq->
eqe[0] ) );
2022 if ( ! hermon_eq->
eqe ) {
2023 DBGC (
hermon,
"Hermon %p EQN %#lx could not allocate EQEs\n",
2037 &hermon_eq->
mtt ) ) != 0 ) {
2038 DBGC (
hermon,
"Hermon %p EQN %#lx could not allocate MTTs: " 2044 memset ( &eqctx, 0,
sizeof ( eqctx ) );
2057 DBGC (
hermon,
"Hermon %p EQN %#lx SW2HW_EQ failed: %s\n",
2063 memset ( &mask, 0xff,
sizeof ( mask ) );
2067 DBGC (
hermon,
"Hermon %p EQN %#lx MAP_EQ failed: %s\n",
2072 DBGC (
hermon,
"Hermon %p EQN %#lx ring [%08lx,%08lx), doorbell " 2086 memset ( hermon_eq, 0,
sizeof ( *hermon_eq ) );
2097 struct hermonprm_eqc eqctx;
2098 struct hermonprm_event_mask mask;
2102 memset ( &mask, 0xff,
sizeof ( mask ) );
2106 DBGC (
hermon,
"Hermon %p EQN %#lx FATAL MAP_EQ failed to " 2114 DBGC (
hermon,
"Hermon %p EQN %#lx FATAL HW2SW_EQ failed: %s\n",
2125 memset ( hermon_eq, 0,
sizeof ( *hermon_eq ) );
2143 ( link_up ?
"up" :
"down" ) );
2147 DBGC (
hermon,
"Hermon %p port %d does not exist!\n",
2169 DBGC (
hermon,
"Hermon %p port %d management change\n",
2174 DBGC (
hermon,
"Hermon %p port %d does not exist!\n",
2194 unsigned long elapsed;
2195 unsigned int eqe_idx_mask;
2196 unsigned int event_type;
2215 eqe = &hermon_eq->
eqe[hermon_eq->
next_idx & eqe_idx_mask];
2224 eqe,
sizeof ( *eqe ) );
2228 switch ( event_type ) {
2236 DBGC (
hermon,
"Hermon %p EQN %#lx unrecognised event " 2237 "type %#02x:%#02x\n",
2241 eqe,
sizeof ( *eqe ) );
2250 ci, ( hermon_eq->
next_idx & 0x00ffffffUL ) );
2274 const struct hermonprm_virtual_physical_mapping* ),
2276 struct hermonprm_virtual_physical_mapping mapping;
2322 memset ( &mapping, 0,
sizeof ( mapping ) );
2323 MLX_FILL_1 ( &mapping, 0, va_h, ( va >> 32 ) );
2324 MLX_FILL_1 ( &mapping, 1, va_l, ( va >> 12 ) );
2327 log2size, ( (
fls (
size ) - 1 ) - 12 ),
2328 pa_l, ( pa >> 12 ) );
2331 DBGC (
hermon,
"Hermon %p could not map %08llx+%zx to " 2352 struct hermonprm_query_fw fw;
2353 unsigned int fw_pages;
2360 DBGC (
hermon,
"Hermon %p could not query firmware: %s\n",
2366 MLX_GET ( &fw, fw_rev_subminor ) );
2367 fw_pages =
MLX_GET ( &fw, fw_pages );
2368 DBGC (
hermon,
"Hermon %p requires %d pages (%d kB) for firmware\n",
2369 hermon, fw_pages, ( fw_pages * 4 ) );
2377 DBGC (
hermon,
"Hermon %p could not allocate firmware " 2386 DBGC (
hermon,
"Hermon %p firmware area at physical [%08lx,%08lx)\n",
2387 hermon, fw_base, ( fw_base + fw_len ) );
2389 0, fw_base, fw_len ) ) != 0 ) {
2390 DBGC (
hermon,
"Hermon %p could not map firmware: %s\n",
2397 DBGC (
hermon,
"Hermon %p could not run firmware: %s\n",
2422 DBGC (
hermon,
"Hermon %p FATAL could not stop firmware: %s\n",
2444 struct hermonprm_query_dev_cap dev_cap;
2448 DBGC (
hermon,
"Hermon %p could not get device limits: %s\n",
2455 ( 1 <<
MLX_GET ( &dev_cap, log2_rsvd_qps ) );
2460 ( 1 <<
MLX_GET ( &dev_cap, log2_rsvd_srqs ) );
2463 ( 1 <<
MLX_GET ( &dev_cap, log2_rsvd_cqs ) );
2469 ( 1 <<
MLX_GET ( &dev_cap, log2_rsvd_eqs ) );
2473 ( 1 <<
MLX_GET ( &dev_cap, log2_rsvd_mtts ) );
2476 ( 1 <<
MLX_GET ( &dev_cap, log2_rsvd_mrws ) );
2484 DBGC (
hermon,
"Hermon %p has %d ports (only %d supported)\n",
2503 return ( ( icm_offset +
len - 1 ) & ~( ( (
uint64_t )
len ) - 1 ) );
2514 struct hermonprm_init_hca *init_hca ) {
2515 struct hermonprm_scalar_parameter icm_size;
2516 struct hermonprm_scalar_parameter icm_aux_size;
2518 unsigned int log_num_qps, log_num_srqs, log_num_cqs, log_num_eqs;
2519 unsigned int log_num_mtts, log_num_mpts, log_num_mcs;
2520 size_t cmpt_max_len;
2521 size_t icm_len, icm_aux_len;
2549 icm_offset += cmpt_max_len;
2554 icm_offset += cmpt_max_len;
2559 icm_offset += cmpt_max_len;
2564 icm_offset += cmpt_max_len;
2572 qpc_eec_cqc_eqc_rdb_parameters.qpc_base_addr_h,
2573 ( icm_offset >> 32 ) );
2575 qpc_eec_cqc_eqc_rdb_parameters.qpc_base_addr_l,
2576 ( icm_offset >> 5 ),
2577 qpc_eec_cqc_eqc_rdb_parameters.log_num_of_qp,
2579 DBGC (
hermon,
"Hermon %p ICM QPC is %d x %#zx at [%08llx,%08llx)\n",
2581 icm_offset, ( icm_offset +
len ) );
2588 qpc_eec_cqc_eqc_rdb_parameters.altc_base_addr_h,
2589 ( icm_offset >> 32 ) );
2591 qpc_eec_cqc_eqc_rdb_parameters.altc_base_addr_l,
2593 DBGC (
hermon,
"Hermon %p ICM ALTC is %d x %#zx at [%08llx,%08llx)\n",
2595 icm_offset, ( icm_offset +
len ) );
2602 qpc_eec_cqc_eqc_rdb_parameters.auxc_base_addr_h,
2603 ( icm_offset >> 32 ) );
2605 qpc_eec_cqc_eqc_rdb_parameters.auxc_base_addr_l,
2607 DBGC (
hermon,
"Hermon %p ICM AUXC is %d x %#zx at [%08llx,%08llx)\n",
2609 icm_offset, ( icm_offset +
len ) );
2616 qpc_eec_cqc_eqc_rdb_parameters.srqc_base_addr_h,
2617 ( icm_offset >> 32 ) );
2619 qpc_eec_cqc_eqc_rdb_parameters.srqc_base_addr_l,
2620 ( icm_offset >> 5 ),
2621 qpc_eec_cqc_eqc_rdb_parameters.log_num_of_srq,
2623 DBGC (
hermon,
"Hermon %p ICM SRQC is %d x %#zx at [%08llx,%08llx)\n",
2625 icm_offset, ( icm_offset +
len ) );
2632 qpc_eec_cqc_eqc_rdb_parameters.cqc_base_addr_h,
2633 ( icm_offset >> 32 ) );
2635 qpc_eec_cqc_eqc_rdb_parameters.cqc_base_addr_l,
2636 ( icm_offset >> 5 ),
2637 qpc_eec_cqc_eqc_rdb_parameters.log_num_of_cq,
2639 DBGC (
hermon,
"Hermon %p ICM CQC is %d x %#zx at [%08llx,%08llx)\n",
2641 icm_offset, ( icm_offset +
len ) );
2648 qpc_eec_cqc_eqc_rdb_parameters.eqc_base_addr_h,
2649 ( icm_offset >> 32 ) );
2651 qpc_eec_cqc_eqc_rdb_parameters.eqc_base_addr_l,
2652 ( icm_offset >> 5 ),
2653 qpc_eec_cqc_eqc_rdb_parameters.log_num_of_eq,
2655 DBGC (
hermon,
"Hermon %p ICM EQC is %d x %#zx at [%08llx,%08llx)\n",
2657 icm_offset, ( icm_offset +
len ) );
2664 tpt_parameters.mtt_base_addr_h, ( icm_offset >> 32 ) );
2666 tpt_parameters.mtt_base_addr_l, icm_offset );
2667 DBGC (
hermon,
"Hermon %p ICM MTT is %d x %#zx at [%08llx,%08llx)\n",
2669 icm_offset, ( icm_offset +
len ) );
2676 tpt_parameters.dmpt_base_adr_h, ( icm_offset >> 32 ) );
2678 tpt_parameters.dmpt_base_adr_l, icm_offset );
2680 tpt_parameters.log_dmpt_sz, log_num_mpts );
2681 DBGC (
hermon,
"Hermon %p ICM DMPT is %d x %#zx at [%08llx,%08llx)\n",
2683 icm_offset, ( icm_offset +
len ) );
2687 len = ( ( 1 << log_num_mcs ) *
sizeof (
struct hermonprm_mcg_entry ) );
2690 multicast_parameters.mc_base_addr_h,
2691 ( icm_offset >> 32 ) );
2693 multicast_parameters.mc_base_addr_l, icm_offset );
2695 multicast_parameters.log_mc_table_entry_sz,
2696 fls (
sizeof (
struct hermonprm_mcg_entry ) - 1 ) );
2698 multicast_parameters.log_mc_table_hash_sz, log_num_mcs );
2700 multicast_parameters.log_mc_table_sz, log_num_mcs );
2701 DBGC (
hermon,
"Hermon %p ICM MC is %d x %#zx at [%08llx,%08llx)\n",
2702 hermon, ( 1 << log_num_mcs ),
2703 sizeof (
struct hermonprm_mcg_entry ),
2704 icm_offset, ( icm_offset +
len ) );
2727 memset ( &icm_size, 0,
sizeof ( icm_size ) );
2728 MLX_FILL_1 ( &icm_size, 0, value_hi, ( icm_offset >> 32 ) );
2731 &icm_aux_size ) ) != 0 ) {
2732 DBGC (
hermon,
"Hermon %p could not set ICM size: %s\n",
2734 goto err_set_icm_size;
2739 DBGC (
hermon,
"Hermon %p requires %zd kB ICM and %zd kB AUX ICM\n",
2740 hermon, ( icm_len / 1024 ), ( icm_aux_len / 1024 ) );
2746 DBGC (
hermon,
"Hermon %p could not allocate ICM\n",
2758 DBGC (
hermon,
"Hermon %p mapping ICM AUX => %08lx\n",
2761 0, icm_phys, icm_aux_len ) ) != 0 ) {
2762 DBGC (
hermon,
"Hermon %p could not map AUX ICM: %s\n",
2764 goto err_map_icm_aux;
2766 icm_phys += icm_aux_len;
2770 DBGC (
hermon,
"Hermon %p mapping ICM %llx+%zx => %08lx\n",
2777 DBGC (
hermon,
"Hermon %p could not map ICM: %s\n",
2801 struct hermonprm_scalar_parameter unmap_icm;
2805 memset ( &unmap_icm, 0,
sizeof ( unmap_icm ) );
2834 static const uint8_t backup_exclude[] =
2858 DBGC (
hermon,
"Hermon %p reset after %dms\n",
2878 struct hermonprm_mpt mpt;
2887 memset ( &mpt, 0,
sizeof ( mpt ) );
2903 DBGC (
hermon,
"Hermon %p could not set up MPT: %s\n",
2922 DBGC (
hermon,
"Hermon %p could not unmap MPT: %s\n",
2951 DBGC (
hermon,
"Hermon %p could not configure special QPs: " 2967 struct hermonprm_init_hca init_hca;
2974 goto err_start_firmware;
2978 memset ( &init_hca, 0,
sizeof ( init_hca ) );
2985 MLX_FILL_1 ( &init_hca, 74, uar_parameters.log_max_uars, 8 );
2987 DBGC (
hermon,
"Hermon %p could not initialise HCA: %s\n",
3004 goto err_conf_special_qps;
3009 err_conf_special_qps:
3097 memset ( &set_port, 0,
sizeof ( set_port ) );
3111 link_speed_supported, 1 );
3113 &set_port ) ) != 0 ) {
3114 DBGC (
hermon,
"Hermon %p port %d could not set port: %s\n",
3121 DBGC (
hermon,
"Hermon %p port %d could not initialise port: " 3149 DBGC (
hermon,
"Hermon %p port %d could not close port: %s\n",
3198 struct hermonprm_mgm_hash
hash;
3199 struct hermonprm_mcg_entry mcg;
3205 DBGC (
hermon,
"Hermon %p could not hash GID: %s\n",
3213 DBGC (
hermon,
"Hermon %p could not read MCG %#x: %s\n",
3217 if (
MLX_GET ( &mcg,
hdr.members_count ) != 0 ) {
3223 DBGC (
hermon,
"Hermon %p MGID index %#x already in use\n",
3233 DBGC (
hermon,
"Hermon %p could not write MCG %#x: %s\n",
3252 struct hermonprm_mgm_hash
hash;
3253 struct hermonprm_mcg_entry mcg;
3259 DBGC (
hermon,
"Hermon %p could not hash GID: %s\n",
3266 memset ( &mcg, 0,
sizeof ( mcg ) );
3268 DBGC (
hermon,
"Hermon %p could not write MCG %#x: %s\n",
3313 DBGC (
hermon,
"Hermon %p port %d could not register IB " 3365 #define HERMON_ETH_NUM_SEND_WQES 16 3368 #define HERMON_ETH_NUM_RECV_WQES 8 3371 #define HERMON_ETH_NUM_CQES 32 3390 DBGC (
hermon,
"Hermon %p port %d could not transmit: %s\n",
3486 DBGC (
hermon,
"Hermon %p port %d could not create completion " 3496 DBGC (
hermon,
"Hermon %p port %d could not create queue " 3504 DBGC (
hermon,
"Hermon %p port %d could not modify queue " 3513 memset ( &set_port, 0,
sizeof ( set_port ) );
3527 &set_port ) ) != 0 ) {
3528 DBGC (
hermon,
"Hermon %p port %d could not set port general " 3531 goto err_set_port_general_params;
3535 memset ( &set_port, 0,
sizeof ( set_port ) );
3538 mac_miss_index, 128 );
3540 vlan_miss_index, 127 ,
3541 no_vlan_index, 126 );
3543 promisc_qpn,
port->eth_qp->qpn,
3546 def_mcast_qpn,
port->eth_qp->qpn,
3547 mc_promisc_mode, 2 );
3551 &set_port ) ) != 0 ) {
3552 DBGC (
hermon,
"Hermon %p port %d could not set port receive " 3554 goto err_set_port_receive_qp;
3559 DBGC (
hermon,
"Hermon %p port %d could not initialise port: " 3567 err_set_port_receive_qp:
3568 err_set_port_general_params:
3592 DBGC (
hermon,
"Hermon %p port %d could not close port: %s\n",
3631 DBGC (
hermon,
"Hermon %p port %d could not register network " 3633 goto err_register_netdev;
3639 DBGC (
hermon,
"Hermon %p port %d could not register non-" 3640 "volatile options: %s\n",
3642 goto err_register_nvo;
3650 err_register_netdev:
3702 #define HERMON_SENSE_PORT_TIMEOUT ( TICKS_PER_SEC / 2 ) 3711 switch ( port_type ) {
3715 default:
return "INVALID";
3729 struct hermonprm_sense_port sense_port;
3736 DBGC (
hermon,
"Hermon %p port %d does not support DPDP; " 3737 "assuming an %s network\n",
hermon, ibdev->
port,
3744 &sense_port ) ) != 0 ) {
3745 DBGC (
hermon,
"Hermon %p port %d sense failed: %s\n",
3749 port_type =
MLX_GET ( &sense_port, port_type );
3751 DBGC (
hermon,
"Hermon %p port %d sensed an %s network\n",
3766 struct hermonprm_query_port_cap query_port;
3770 unsigned long start;
3771 unsigned long elapsed;
3776 &query_port ) ) != 0 ) {
3777 DBGC (
hermon,
"Hermon %p port %d could not query port: %s\n",
3781 ib_supported =
MLX_GET ( &query_port, ib );
3782 eth_supported =
MLX_GET ( &query_port, eth );
3783 DBGC (
hermon,
"Hermon %p port %d supports%s%s%s\n",
3784 hermon, ibdev->
port, ( ib_supported ?
" Infiniband" :
"" ),
3785 ( ( ib_supported && eth_supported ) ?
" and" :
"" ),
3786 ( eth_supported ?
" Ethernet" :
"" ) );
3793 if ( ib_supported && eth_supported ) {
3800 if ( port_type < 0 ) {
3814 switch ( port_type ) {
3826 }
else if ( eth_supported ) {
3854 struct hermonprm_mod_stat_cfg stat_cfg;
3865 &stat_cfg ) ) != 0 ) {
3866 DBGC (
hermon,
"Hermon %p port %d could not query " 3872 buf.dwords[0] =
htonl (
MLX_GET ( &stat_cfg, mac_high ) );
3873 buf.dwords[1] =
htonl (
MLX_GET ( &stat_cfg, mac_low ) );
3877 DBGC (
hermon,
"Hermon %p port %d harvested MAC address %s\n",
3894 struct hermonprm_mod_stat_cfg stat_cfg;
3902 memset ( &buf, 0,
sizeof ( buf ) );
3907 memset ( &stat_cfg, 0,
sizeof ( stat_cfg ) );
3910 mac_high,
ntohl ( buf.dwords[0] ) );
3915 &stat_cfg ) ) != 0 ) {
3916 DBGC (
hermon,
"Hermon %p port %d could not modify " 3921 DBGC (
hermon,
"Hermon %p port %d updated MAC address to %s\n",
3959 goto err_mailbox_in;
3963 goto err_mailbox_out;
4002 unsigned long config;
4033 goto err_start_firmware;
4044 goto err_alloc_ibdev;
4059 goto err_alloc_netdev;
4075 goto err_set_port_type;
4102 for ( i-- ; (
signed int ) i >= 0 ; i-- ) {
4111 for ( i-- ; (
signed int ) i >= 0 ; i-- ) {
4117 for ( i-- ; (
signed int ) i >= 0 ; i-- )
4189 DBGC (
hermon,
"Hermon %p could not register BOFM device: " 4191 goto err_bofm_register;
4218 PCI_ROM ( 0x15b3, 0x1003,
"mt4099",
"ConnectX-3 HCA driver", 0 ),
4219 PCI_ROM ( 0x15b3, 0x1007,
"mt4103",
"ConnectX-3 Pro HCA driver", 0 ),
4221 PCI_ROM ( 0x15b3, 0x6340,
"mt25408",
"MT25408 HCA driver", 0 ),
4222 PCI_ROM ( 0x15b3, 0x634a,
"mt25418",
"MT25418 HCA driver", 0 ),
4225 PCI_ROM ( 0x15b3, 0x6368,
"mt25448",
"MT25448 HCA driver", 0 ),
4226 PCI_ROM ( 0x15b3, 0x6372,
"mt25458",
"MT25458 HCA driver", 0 ),
4229 PCI_ROM ( 0x15b3, 0x6732,
"mt26418",
"MT26418 HCA driver", 0 ),
4230 PCI_ROM ( 0x15b3, 0x673c,
"mt26428",
"MT26428 HCA driver", 0 ),
4231 PCI_ROM ( 0x15b3, 0x6746,
"mt26438",
"MT26438 HCA driver", 0 ),
4234 PCI_ROM ( 0x15b3, 0x6750,
"mt26448",
"MT26448 HCA driver", 0 ),
4235 PCI_ROM ( 0x15b3, 0x675a,
"mt26458",
"MT26458 HCA driver", 0 ),
4236 PCI_ROM ( 0x15b3, 0x6764,
"mt26468",
"MT26468 HCA driver", 0 ),
4237 PCI_ROM ( 0x15b3, 0x676e,
"mt26478",
"MT26478 HCA driver", 0 ),
4238 PCI_ROM ( 0x15b3, 0x6778,
"mt26488",
"MT26488 HCA driver", 0 ),
void unregister_ibdev(struct ib_device *ibdev)
Unregister Infiniband device.
static int hermon_cmd_query_dev_cap(struct hermon *hermon, struct hermonprm_query_dev_cap *dev_cap)
size_t eqe_size
Size of event queue.
static void hermon_ib_close(struct ib_device *ibdev)
Close Infiniband link.
struct hermonprm_port_mgmnt_change_event port_mgmnt_change
#define EINVAL
Invalid argument.
static __always_inline void ib_set_drvdata(struct ib_device *ibdev, void *priv)
Set Infiniband device driver-private data.
#define HERMON_SCHED_DEFAULT
void ib_poll_eq(struct ib_device *ibdev)
Poll event queue.
static void hermon_event_port_state_change(struct hermon *hermon, union hermonprm_event_entry *eqe)
Handle port state event.
struct arbelprm_rc_send_wqe rc
pseudo_bit_t hash[0x00010]
#define HERMON_HCR_OUT_LEN(_command)
struct ib_device * ibdev
Infiniband device.
#define MLX_FILL_7(_ptr, _index,...)
struct net_device * netdev
Network device.
void pci_restore(struct pci_device *pci, struct pci_config_backup *backup, unsigned int limit, const uint8_t *exclude)
Restore PCI configuration space.
uint32_t low
Low 16 bits of address.
static int hermon_cmd_unmap_icm_aux(struct hermon *hermon)
struct hermonprm_set_port_rqp_calc rqp_calc
#define MLX_FILL_2(_ptr, _index,...)
static __always_inline void off_t int c
struct hermon_send_work_queue send
Send work queue.
static int hermon_cmd_sw2hw_cq(struct hermon *hermon, unsigned long cqn, const struct hermonprm_completion_queue_context *cqctx)
struct hermon_mtt mtt
MTT descriptor.
static int hermon_cmd_sw2hw_eq(struct hermon *hermon, unsigned int index, const struct hermonprm_eqc *eqctx)
#define iob_put(iobuf, len)
static int hermon_post_send(struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_address_vector *dest, struct io_buffer *iobuf)
Post send work queue entry.
#define MLX_FILL_4(_ptr, _index,...)
static void hermon_unmap_icm(struct hermon *hermon)
Unmap ICM.
#define IB_QPN_SMI
Subnet management interface QPN.
#define HERMON_PCI_CONFIG_BAR_SIZE
static void bofm_init(struct bofm_device *bofm, struct pci_device *pci, struct bofm_operations *op)
Initialise BOFM device.
static void hermon_eth_complete_send(struct ib_device *ibdev __unused, struct ib_queue_pair *qp, struct io_buffer *iobuf, int rc)
Handle Hermon Ethernet device send completion.
static int hermon_sense_port_type(struct hermon *hermon, struct hermon_port *port)
Sense port type.
#define HERMON_CMPT_MAX_ENTRIES
Number of cMPT entries of each type.
void nvs_vpd_nvo_init(struct nvs_vpd_device *nvsvpd, unsigned int field, struct nvo_block *nvo, struct refcnt *refcnt)
Initialise non-volatile option storage within NVS VPD device.
static int hermon_cmd_rst2init_qp(struct hermon *hermon, unsigned long qpn, const struct hermonprm_qp_ee_state_transitions *ctx)
struct hermonprm_wqe_segment_data_ptr data[HERMON_MAX_GATHER]
#define HERMON_HCR_READ_MCG
struct hermonprm_event_db_register event
static int hermon_cmd_wait(struct hermon *hermon, struct hermonprm_hca_command_register *hcr)
Wait for Hermon command completion.
int nvs_vpd_init(struct nvs_vpd_device *nvsvpd, struct pci_device *pci)
Initialise NVS VPD device.
#define EBUSY
Device or resource busy.
#define HERMON_OPCODE_NOP
size_t auxc_entry_size
Auxiliary context entry size.
static int ib_is_open(struct ib_device *ibdev)
Check whether or not Infiniband device is open.
#define MLX_FILL_8(_ptr, _index,...)
struct hermon_recv_work_queue recv
Receive work queue.
#define HERMON_HCR_INIT_PORT
Infiniband device operations.
#define HERMON_MOD_STAT_CFG_OFFSET(field)
Calculate offset within static configuration.
static int hermon_alloc_mtt(struct hermon *hermon, const void *memory, size_t len, struct hermon_mtt *mtt)
Allocate MTT entries.
static int hermon_cmd_query_fw(struct hermon *hermon, struct hermonprm_query_fw *fw)
void * doorbell
Doorbell register.
#define HERMON_MOD_STAT_CFG_SET
static unsigned int unsigned int bit
struct hermonprm_send_db_register send
static struct ib_completion_queue_operations hermon_eth_cq_op
Hermon Ethernet device completion operations.
int(* open)(struct net_device *netdev)
Open network device.
struct hermonprm_recv_wqe recv
#define HERMON_MKEY_PREFIX
Memory key prefix.
static int hermon_dump_eqctx(struct hermon *hermon, struct hermon_event_queue *hermon_eq)
Dump event queue context (for debugging only)
#define HERMON_ETH_NUM_SEND_WQES
Number of Hermon Ethernet send work queue entries.
static int hermon_cmd_write_mtt(struct hermon *hermon, const struct hermonprm_write_mtt *write_mtt)
static int hermon_cmd_set_icm_size(struct hermon *hermon, const struct hermonprm_scalar_parameter *icm_size, struct hermonprm_scalar_parameter *icm_aux_size)
#define HERMON_OPCODE_SEND
size_t cqc_entry_size
CQ context entry size.
static int hermon_mcast_attach(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Attach to multicast group.
static int hermon_cmd_query_qp(struct hermon *hermon, unsigned long qpn, struct hermonprm_qp_ee_state_transitions *ctx)
#define HERMON_PORT_TYPE_ETH
void * mailbox_in
Command input mailbox.
struct golan_inbox_hdr hdr
Message header.
#define HERMON_SET_PORT_RECEIVE_QP
static int hermon_modify_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Modify queue pair.
static void hermon_event_port_mgmnt_change(struct hermon *hermon, union hermonprm_event_entry *eqe)
Handle port management event.
#define HERMON_MAX_EQS
Maximum number of allocatable event queues.
#define HERMON_LOG_MULTICAST_HASH_SIZE
#define DBG_ENABLE(level)
struct pci_device_id * ids
PCI ID table.
static unsigned short vendor
Non-Volatile Storage using Vital Product Data.
int register_nvo(struct nvo_block *nvo, struct settings *parent)
Register non-volatile stored options.
size_t mtt_entry_size
MTT entry size.
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
int ib_modify_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Modify queue pair.
static void hermon_destroy_eq(struct hermon *hermon)
Destroy event queue.
unsigned long user_to_phys(userptr_t userptr, off_t offset)
Convert user pointer to physical address.
int ib_create_cq(struct ib_device *ibdev, unsigned int num_cqes, struct ib_completion_queue_operations *op, struct ib_completion_queue **new_cq)
Create completion queue.
#define FCOE_VLAN_PRIORITY
FCoE VLAN priority.
void ib_refill_recv(struct ib_device *ibdev, struct ib_queue_pair *qp)
Refill receive work queue.
unsigned long last_poll
Last unsolicited link state poll.
static struct hermon_port_type hermon_port_type_ib
Hermon Infiniband port type.
static int hermon_cmd_mod_stat_cfg(struct hermon *hermon, unsigned int mode, unsigned int input_mod, struct hermonprm_scalar_parameter *portion)
struct pci_driver hermon_bofm_driver __bofm_driver
struct io_buffer *(* alloc_iob)(size_t len)
Allocate receive I/O buffer.
static int hermon_cmd_query_eq(struct hermon *hermon, unsigned int index, struct hermonprm_eqc *eqctx)
static void hermon_poll_eq(struct ib_device *ibdev)
Poll event queue.
struct device * dev
Underlying device.
static int hermon_start(struct hermon *hermon, int running)
Start Hermon device.
unsigned long long uint64_t
#define DBG_DISABLE(level)
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
unsigned long special_qpn_base
Special QPN base.
static __always_inline void * ib_qp_get_drvdata(struct ib_queue_pair *qp)
Get Infiniband queue pair driver-private data.
static void hermon_stop_firmware(struct hermon *hermon)
Stop firmware running.
static void hermon_destroy_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Destroy completion queue.
int pci_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
struct ib_global_route_header grh
A Hermon send work queue entry.
#define HERMON_HCR_QUERY_PORT
static int hermon_set_port_type(struct hermon *hermon, struct hermon_port *port)
Set port type.
static int hermon_cmd_map_icm(struct hermon *hermon, const struct hermonprm_virtual_physical_mapping *map)
#define HERMON_DB_POST_SND_OFFSET
#define HERMON_OPCODE_RECV_ERROR
#define HERMON_PORT_TYPE_IB
A Hermon completion queue.
#define offsetof(type, field)
Get offset of a field within a structure.
uint8_t mac[ETH_ALEN]
MAC address.
struct golan_eq_context ctx
unsigned int gid_present
GID is present.
#define HERMON_HCR_MAP_ICM
#define static_assert(x)
Assert a condition at build time.
static int hermon_cmd_hw2sw_eq(struct hermon *hermon, unsigned int index, struct hermonprm_eqc *eqctx)
unsigned int vlan
VLAN, if present.
static void iob_populate(struct io_buffer *iobuf, void *data, size_t len, size_t max_len)
Create a temporary I/O buffer.
union hermonprm_event_entry * eqe
Event queue entries.
struct hermonprm_wqe_segment_ctrl_mlx ctrl
#define PCI_CONFIG_BACKUP_ALL
Limit of PCI configuration space.
#define HERMON_HCR_UNMAP_ICM_AUX
unsigned int reserved_cqs
Number of reserved CQs.
#define HERMON_ETH_NUM_CQES
Number of Hermon Ethernet completion entries.
userptr_t firmware_area
Firmware area in external memory.
#define HERMON_PCI_UAR_BAR
size_t cqe_size
Size of completion queue.
#define HERMON_HCR_IN_LEN(_command)
static void hermon_free_qpn(struct ib_device *ibdev, struct ib_queue_pair *qp)
Free queue pair number.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
An Infiniband Global Identifier.
#define HERMON_HCR_RTR2RTS_QP
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
struct hermonprm_qp_db_record * doorbell
Doorbell record.
enum hermon_queue_pair_state state
Queue state.
struct device dev
Generic device.
static unsigned int hermon_fill_rc_send_wqe(struct ib_device *ibdev, struct ib_queue_pair *qp __unused, struct ib_address_vector *dest __unused, struct io_buffer *iobuf, union hermon_send_wqe *wqe)
Construct RC send work queue entry.
static struct settings * netdev_settings(struct net_device *netdev)
Get per-netdevice configuration settings block.
static int hermon_reset(struct hermon *hermon)
Reset device.
struct hermonprm_set_port_general_context general
#define ENOTSUP
Operation not supported.
void ib_destroy_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Destroy completion queue.
static int hermon_dump_cqctx(struct hermon *hermon, struct ib_completion_queue *cq)
Dump completion queue context (for debugging only)
#define HERMON_SET_PORT_GENERAL_PARAM
static unsigned int hermon_fill_ud_send_wqe(struct ib_device *ibdev, struct ib_queue_pair *qp __unused, struct ib_address_vector *dest, struct io_buffer *iobuf, union hermon_send_wqe *wqe)
Construct UD send work queue entry.
#define HERMON_INVALID_LKEY
Dynamic memory allocation.
#define HERMON_HCR_RTS2RTS_QP
#define HERMON_HCR_INOUT_CMD(_opcode, _in_mbox, _in_len, _out_mbox, _out_len)
Build HCR command from component parts.
struct bofm_device bofm
BOFM device.
union hermon_recv_wqe * wqe
Work queue entries.
struct hermonprm_wqe_segment_data_ptr data[HERMON_MAX_GATHER]
uint32_t start
Starting offset.
struct hermonprm_wqe_segment_ctrl_send ctrl
static int hermon_cmd_write_mcg(struct hermon *hermon, unsigned int index, const struct hermonprm_mcg_entry *mcg)
Fibre Channel over Ethernet.
struct hermon_mtt mtt
MTT descriptor.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
#define MLX_FILL_3(_ptr, _index,...)
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
static int hermon_cmd_rts2rts_qp(struct hermon *hermon, unsigned long qpn, const struct hermonprm_qp_ee_state_transitions *ctx)
#define HERMON_HCR_INIT_HCA
#define ENOMEM
Not enough space.
static int hermon_map_icm(struct hermon *hermon, struct hermonprm_init_hca *init_hca)
Map ICM (allocating if necessary)
unsigned int mtt_base_addr
MTT base address.
static void hermon_free(struct hermon *hermon)
Free Hermon device.
Infiniband completion queue operations.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define HERMON_HCR_IN_MBOX
Infiniband queue pair operations.
hermon_bitmask_t cq_inuse[HERMON_BITMASK_SIZE(HERMON_MAX_CQS)]
Completion queue in-use bitmask.
unsigned int num_ports
Number of ports.
static int hermon_cmd_sw2hw_mpt(struct hermon *hermon, unsigned int index, const struct hermonprm_mpt *mpt)
static int hermon_cmd_rtr2rts_qp(struct hermon *hermon, unsigned long qpn, const struct hermonprm_qp_ee_state_transitions *ctx)
struct hermonprm_wqe_segment_data_ptr data[HERMON_MAX_GATHER]
static int hermon_open(struct hermon *hermon)
Open Hermon device.
void * mailbox_out
Command output mailbox.
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
u32 version
Driver version.
static int hermon_start_firmware(struct hermon *hermon)
Start firmware running.
uint32_t hermon_bitmask_t
A Hermon resource bitmask.
#define __unused
Declare a variable or data structure as unused.
IBM BladeCenter Open Fabric Manager (BOFM)
static int hermon_cmd(struct hermon *hermon, unsigned long command, unsigned int op_mod, const void *in, unsigned int in_mod, void *out)
Issue HCA command.
int ib_smc_init(struct ib_device *ibdev, ib_local_mad_t local_mad)
Initialise Infiniband parameters using SMC.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
size_t wqe_size
Size of work queue buffer.
static int hermon_configure_special_qps(struct hermon *hermon)
Configure special queue pairs.
struct hermonprm_eth_send_wqe eth
#define be32_to_cpu(value)
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define HERMON_SENSE_PORT_TIMEOUT
Timeout for port sensing.
#define container_of(ptr, type, field)
Get containing structure.
#define HERMON_HCR_INIT2RTR_QP
struct hermonprm_rc_send_wqe rc
struct ib_device_operations * op
Infiniband operations.
struct hermonprm_wqe_segment_ctrl_send ctrl
uint64_t offset
Offset (virtual address within ICM)
struct hermonprm_event_queue_entry generic
An Infiniband Work Queue.
static int hermon_bofm_update(struct bofm_device *bofm, unsigned int mport, const uint8_t *mac)
Update Ethernet MAC for BOFM.