|
@@ -37,14 +37,14 @@ struct arbel_completion_queue {
|
37
|
37
|
/** Doorbell record number */
|
38
|
38
|
unsigned int doorbell_idx;
|
39
|
39
|
/** Completion queue entries */
|
40
|
|
- union cqe_st *cqe;
|
|
40
|
+ union arbelprm_completion_entry *cqe;
|
41
|
41
|
};
|
42
|
42
|
|
43
|
43
|
struct arbel {
|
44
|
44
|
/** User Access Region */
|
45
|
45
|
void *uar;
|
46
|
46
|
/** Doorbell records */
|
47
|
|
- union db_record_st *db_rec;
|
|
47
|
+ union arbelprm_doorbell_record *db_rec;
|
48
|
48
|
};
|
49
|
49
|
|
50
|
50
|
|
|
@@ -157,9 +157,9 @@ static int mlx_transmit_direct ( struct net_device *netdev,
|
157
|
157
|
struct ib_address_vector av = {
|
158
|
158
|
.dest_qp = bcast_av->dest_qp,
|
159
|
159
|
.qkey = bcast_av->qkey,
|
160
|
|
- .dlid = MLX_EXTRACT ( bav, rlid ),
|
161
|
|
- .rate = ( MLX_EXTRACT ( bav, max_stat_rate ) ? 1 : 4 ),
|
162
|
|
- .sl = MLX_EXTRACT ( bav, sl ),
|
|
160
|
+ .dlid = MLX_GET ( bav, rlid ),
|
|
161
|
+ .rate = ( MLX_GET ( bav, max_stat_rate ) ? 1 : 4 ),
|
|
162
|
+ .sl = MLX_GET ( bav, sl ),
|
163
|
163
|
.gid_present = 1,
|
164
|
164
|
};
|
165
|
165
|
memcpy ( &av.gid, ( ( void * ) bav ) + 16, 16 );
|
|
@@ -318,18 +318,18 @@ static struct ib_gid arbel_no_gid = {
|
318
|
318
|
* @v db_reg Doorbell register structure
|
319
|
319
|
* @v offset Address of doorbell
|
320
|
320
|
*/
|
321
|
|
-static void arbel_ring_doorbell ( struct arbel *arbel, void *db_reg,
|
|
321
|
+static void arbel_ring_doorbell ( struct arbel *arbel,
|
|
322
|
+ union arbelprm_doorbell_register *db_reg,
|
322
|
323
|
unsigned int offset ) {
|
323
|
|
- uint32_t *db_reg_dword = db_reg;
|
324
|
324
|
|
325
|
325
|
DBG ( "arbel_ring_doorbell %08lx:%08lx to %lx\n",
|
326
|
|
- db_reg_dword[0], db_reg_dword[1],
|
|
326
|
+ db_reg->dword[0], db_reg->dword[1],
|
327
|
327
|
virt_to_phys ( arbel->uar + offset ) );
|
328
|
328
|
|
329
|
329
|
barrier();
|
330
|
|
- writel ( db_reg_dword[0], ( arbel->uar + offset + 0 ) );
|
|
330
|
+ writel ( db_reg->dword[0], ( arbel->uar + offset + 0 ) );
|
331
|
331
|
barrier();
|
332
|
|
- writel ( db_reg_dword[1], ( arbel->uar + offset + 4 ) );
|
|
332
|
+ writel ( db_reg->dword[1], ( arbel->uar + offset + 4 ) );
|
333
|
333
|
}
|
334
|
334
|
|
335
|
335
|
/**
|
|
@@ -347,15 +347,16 @@ static int arbel_post_send ( struct ib_device *ibdev, struct io_buffer *iobuf,
|
347
|
347
|
struct arbel *arbel = ibdev->priv;
|
348
|
348
|
struct ib_work_queue *wq = &qp->send;
|
349
|
349
|
struct arbel_send_work_queue *arbel_wq = wq->priv;
|
350
|
|
- unsigned int wqe_idx_mask = ( wq->num_wqes - 1 );
|
351
|
|
- struct ud_send_wqe_st *prev_wqe;
|
352
|
|
- struct ud_send_wqe_st *wqe;
|
|
350
|
+ struct arbelprm_ud_send_wqe *prev_wqe;
|
|
351
|
+ struct arbelprm_ud_send_wqe *wqe;
|
|
352
|
+ union arbelprm_doorbell_record *db_rec;
|
|
353
|
+ union arbelprm_doorbell_register db_reg;
|
353
|
354
|
struct ib_gid *gid;
|
|
355
|
+ unsigned int wqe_idx_mask;
|
354
|
356
|
size_t nds;
|
355
|
|
- union db_record_st *db_rec;
|
356
|
|
- struct send_doorbell_st db_reg;
|
357
|
357
|
|
358
|
358
|
/* Allocate work queue entry */
|
|
359
|
+ wqe_idx_mask = ( wq->num_wqes - 1 );
|
359
|
360
|
if ( wq->iobufs[wq->next_idx & wqe_idx_mask] ) {
|
360
|
361
|
DBGC ( arbel, "ARBEL %p send queue full", arbel );
|
361
|
362
|
return -ENOBUFS;
|
|
@@ -365,69 +366,61 @@ static int arbel_post_send ( struct ib_device *ibdev, struct io_buffer *iobuf,
|
365
|
366
|
wqe = &arbel_wq->wqe_u[wq->next_idx & wqe_idx_mask].wqe_cont.wqe;
|
366
|
367
|
|
367
|
368
|
/* Construct work queue entry */
|
368
|
|
- MLX_POPULATE_1 ( &wqe->next.next, arbelprm_wqe_segment_next_st, 1,
|
369
|
|
- always1, 1 );
|
370
|
|
- memset ( &wqe->next.control, 0,
|
371
|
|
- sizeof ( wqe->next.control ) );
|
372
|
|
- MLX_POPULATE_1 ( &wqe->next.control,
|
373
|
|
- arbelprm_wqe_segment_ctrl_send_st, 0,
|
374
|
|
- always1, 1 );
|
375
|
|
- memset ( &wqe->udseg, 0, sizeof ( wqe->udseg ) );
|
376
|
|
- MLX_POPULATE_2 ( &wqe->udseg, arbelprm_ud_address_vector_st, 0,
|
377
|
|
- pd, GLOBAL_PD,
|
378
|
|
- port_number, PXE_IB_PORT );
|
379
|
|
- MLX_POPULATE_2 ( &wqe->udseg, arbelprm_ud_address_vector_st, 1,
|
380
|
|
- rlid, av->dlid,
|
381
|
|
- g, av->gid_present );
|
382
|
|
- MLX_POPULATE_2 ( &wqe->udseg, arbelprm_ud_address_vector_st, 2,
|
383
|
|
- max_stat_rate, ( ( av->rate >= 3 ) ? 0 : 1 ),
|
384
|
|
- msg, 3 );
|
385
|
|
- MLX_POPULATE_1 ( &wqe->udseg, arbelprm_ud_address_vector_st, 3,
|
386
|
|
- sl, av->sl );
|
|
369
|
+ MLX_FILL_1 ( &wqe->next, 1, always1, 1 );
|
|
370
|
+ memset ( &wqe->ctrl, 0, sizeof ( wqe->ctrl ) );
|
|
371
|
+ MLX_FILL_1 ( &wqe->ctrl, 0, always1, 1 );
|
|
372
|
+ memset ( &wqe->ud, 0, sizeof ( wqe->ud ) );
|
|
373
|
+ MLX_FILL_2 ( &wqe->ud, 0,
|
|
374
|
+ ud_address_vector.pd, GLOBAL_PD,
|
|
375
|
+ ud_address_vector.port_number, PXE_IB_PORT );
|
|
376
|
+ MLX_FILL_2 ( &wqe->ud, 1,
|
|
377
|
+ ud_address_vector.rlid, av->dlid,
|
|
378
|
+ ud_address_vector.g, av->gid_present );
|
|
379
|
+ MLX_FILL_2 ( &wqe->ud, 2,
|
|
380
|
+ ud_address_vector.max_stat_rate,
|
|
381
|
+ ( ( av->rate >= 3 ) ? 0 : 1 ),
|
|
382
|
+ ud_address_vector.msg, 3 );
|
|
383
|
+ MLX_FILL_1 ( &wqe->ud, 3, ud_address_vector.sl, av->sl );
|
387
|
384
|
gid = ( av->gid_present ? &av->gid : &arbel_no_gid );
|
388
|
|
- memcpy ( ( ( ( void * ) &wqe->udseg ) + 16 ),
|
389
|
|
- gid, sizeof ( *gid ) );
|
390
|
|
- MLX_POPULATE_1 ( &wqe->udseg, arbelprm_wqe_segment_ud_st, 8,
|
391
|
|
- destination_qp, av->dest_qp );
|
392
|
|
- MLX_POPULATE_1 ( &wqe->udseg, arbelprm_wqe_segment_ud_st, 9,
|
393
|
|
- q_key, av->qkey );
|
394
|
|
- wqe->mpointer[0].local_addr_l =
|
395
|
|
- cpu_to_be32 ( virt_to_bus ( iobuf->data ) );
|
396
|
|
- wqe->mpointer[0].byte_count = cpu_to_be32 ( iob_len ( iobuf ) );
|
|
385
|
+ memcpy ( &wqe->ud.u.dwords[4], gid, sizeof ( *gid ) );
|
|
386
|
+ MLX_FILL_1 ( &wqe->ud, 8, destination_qp, av->dest_qp );
|
|
387
|
+ MLX_FILL_1 ( &wqe->ud, 9, q_key, av->qkey );
|
|
388
|
+ MLX_FILL_1 ( &wqe->data[0], 3,
|
|
389
|
+ local_address_l, virt_to_bus ( iobuf->data ) );
|
|
390
|
+ MLX_FILL_1 ( &wqe->data[0], 0, byte_count, iob_len ( iobuf ) );
|
397
|
391
|
|
398
|
392
|
DBG ( "Work queue entry:\n" );
|
399
|
393
|
DBG_HD ( wqe, sizeof ( *wqe ) );
|
400
|
394
|
|
401
|
395
|
/* Update previous work queue entry's "next" field */
|
402
|
|
- nds = ( ( offsetof ( typeof ( *wqe ), mpointer ) +
|
403
|
|
- sizeof ( wqe->mpointer[0] ) ) >> 4 );
|
404
|
|
- MLX_MODIFY ( &prev_wqe->next.next, arbelprm_wqe_segment_next_st, 0,
|
405
|
|
- nopcode, XDEV_NOPCODE_SEND );
|
406
|
|
- MLX_POPULATE_3 ( &prev_wqe->next.next, arbelprm_wqe_segment_next_st, 1,
|
407
|
|
- nds, nds,
|
408
|
|
- f, 1,
|
409
|
|
- always1, 1 );
|
|
396
|
+ nds = ( ( offsetof ( typeof ( *wqe ), data ) +
|
|
397
|
+ sizeof ( wqe->data[0] ) ) >> 4 );
|
|
398
|
+ MLX_SET ( &prev_wqe->next, nopcode, XDEV_NOPCODE_SEND );
|
|
399
|
+ MLX_FILL_3 ( &prev_wqe->next, 1,
|
|
400
|
+ nds, nds,
|
|
401
|
+ f, 1,
|
|
402
|
+ always1, 1 );
|
410
|
403
|
|
411
|
404
|
DBG ( "Previous work queue entry's next field:\n" );
|
412
|
|
- DBG_HD ( &prev_wqe->next.next, sizeof ( prev_wqe->next.next ) );
|
|
405
|
+ DBG_HD ( &prev_wqe->next, sizeof ( prev_wqe->next ) );
|
413
|
406
|
|
414
|
407
|
/* Update doorbell record */
|
415
|
408
|
db_rec = &arbel->db_rec[arbel_wq->doorbell_idx];
|
416
|
|
- MLX_POPULATE_1 ( db_rec, arbelprm_qp_db_record_st, 0,
|
417
|
|
- counter, ( ( wq->next_idx + 1 ) & 0xffff ) );
|
|
409
|
+ MLX_FILL_1 ( &db_rec->qp, 0,
|
|
410
|
+ counter, ( ( wq->next_idx + 1 ) & 0xffff ) );
|
418
|
411
|
barrier();
|
419
|
412
|
DBG ( "Doorbell record:\n" );
|
420
|
413
|
DBG_HD ( db_rec, 8 );
|
421
|
414
|
|
422
|
415
|
/* Ring doorbell register */
|
423
|
|
- MLX_POPULATE_4 ( &db_reg, arbelprm_send_doorbell_st, 0,
|
424
|
|
- nopcode, XDEV_NOPCODE_SEND,
|
425
|
|
- f, 1,
|
426
|
|
- wqe_counter, ( wq->next_idx & 0xffff ),
|
427
|
|
- wqe_cnt, 1 );
|
428
|
|
- MLX_POPULATE_2 ( &db_reg, arbelprm_send_doorbell_st, 1,
|
429
|
|
- nds, nds,
|
430
|
|
- qpn, qp->qpn );
|
|
416
|
+ MLX_FILL_4 ( &db_reg.send, 0,
|
|
417
|
+ nopcode, XDEV_NOPCODE_SEND,
|
|
418
|
+ f, 1,
|
|
419
|
+ wqe_counter, ( wq->next_idx & 0xffff ),
|
|
420
|
+ wqe_cnt, 1 );
|
|
421
|
+ MLX_FILL_2 ( &db_reg.send, 1,
|
|
422
|
+ nds, nds,
|
|
423
|
+ qpn, qp->qpn );
|
431
|
424
|
arbel_ring_doorbell ( arbel, &db_reg, POST_SND_OFFSET );
|
432
|
425
|
|
433
|
426
|
/* Update work queue's index */
|
|
@@ -437,13 +430,12 @@ static int arbel_post_send ( struct ib_device *ibdev, struct io_buffer *iobuf,
|
437
|
430
|
}
|
438
|
431
|
|
439
|
432
|
static void arbel_parse_completion ( struct arbel *arbel,
|
440
|
|
- union cqe_st *cqe,
|
|
433
|
+ union arbelprm_completion_entry *cqe,
|
441
|
434
|
struct ib_completion *completion ) {
|
442
|
435
|
memset ( completion, 0, sizeof ( *completion ) );
|
443
|
|
- is_send = MLX_EXTRACT ( cqe, arbelprm_completion_queue_entry_st, s );
|
444
|
|
- completion->len =
|
445
|
|
- MLX_EXTRACT ( cqe, arbelprm_completion_queue_entry_st,
|
446
|
|
- byte_cnt );}
|
|
436
|
+ completion->is_send = MLX_GET ( &cqe->normal, s );
|
|
437
|
+ completion->len = MLX_GET ( &cqe->normal, byte_cnt );
|
|
438
|
+}
|
447
|
439
|
|
448
|
440
|
/**
|
449
|
441
|
* Poll completion queue
|
|
@@ -459,8 +451,8 @@ static void arbel_poll_cq ( struct ib_device *ibdev,
|
459
|
451
|
struct arbel *arbel = ibdev->priv;
|
460
|
452
|
struct arbel_completion_queue *arbel_cq = cq->priv;
|
461
|
453
|
unsigned int cqe_idx_mask = ( cq->num_cqes - 1 );
|
462
|
|
- union db_record_st *db_rec = &arbel->db_rec[arbel_cq->doorbell_idx];
|
463
|
|
- union cqe_st *cqe;
|
|
454
|
+ union arbelprm_doorbell_record *db_rec;
|
|
455
|
+ union arbelprm_completion_entry *cqe;
|
464
|
456
|
struct ib_completion completion;
|
465
|
457
|
struct io_buffer *iobuf;
|
466
|
458
|
int is_send;
|
|
@@ -468,8 +460,7 @@ static void arbel_poll_cq ( struct ib_device *ibdev,
|
468
|
460
|
while ( 1 ) {
|
469
|
461
|
/* Look for completion entry */
|
470
|
462
|
cqe = &arbel_cq->cqe[cq->next_idx & cqe_idx_mask];
|
471
|
|
- if ( MLX_EXTRACT ( cqe, arbelprm_completion_queue_entry_st,
|
472
|
|
- owner ) != 0 ) {
|
|
463
|
+ if ( MLX_GET ( &cqe->normal, owner ) != 0 ) {
|
473
|
464
|
/* Entry still owned by hardware; end of poll */
|
474
|
465
|
break;
|
475
|
466
|
}
|
|
@@ -484,14 +475,14 @@ static void arbel_poll_cq ( struct ib_device *ibdev,
|
484
|
475
|
iobuf );
|
485
|
476
|
|
486
|
477
|
/* Return ownership to hardware */
|
487
|
|
- MLX_POPULATE_1 ( cqe, arbelprm_completion_queue_entry_st, 7,
|
488
|
|
- owner, 1 );
|
|
478
|
+ MLX_FILL_1 ( &cqe->normal, 7, owner, 1 );
|
489
|
479
|
barrier();
|
490
|
480
|
/* Update completion queue's index */
|
491
|
481
|
cq->next_idx++;
|
492
|
482
|
/* Update doorbell record */
|
493
|
|
- MLX_POPULATE_1 ( db_rec, arbelprm_cq_ci_db_record_st, 0,
|
494
|
|
- counter, ( cq->next_idx & 0xffffffffUL ) );
|
|
483
|
+ db_rec = &arbel->db_rec[arbel_cq->doorbell_idx];
|
|
484
|
+ MLX_FILL_1 ( &db_rec->cq_ci, 0,
|
|
485
|
+ counter, ( cq->next_idx & 0xffffffffUL ) );
|
495
|
486
|
}
|
496
|
487
|
}
|
497
|
488
|
|