|
@@ -23,6 +23,22 @@ Skeleton NIC driver for Etherboot
|
23
|
23
|
|
24
|
24
|
#include "mt25218_imp.c"
|
25
|
25
|
|
|
26
|
+struct arbel_send_work_queue {
|
|
27
|
+ /** Doorbell number */
|
|
28
|
+ unsigned int doorbell_idx;
|
|
29
|
+ /** Work queue entries */
|
|
30
|
+ struct ud_send_wqe_st *wqe;
|
|
31
|
+};
|
|
32
|
+
|
|
33
|
+struct arbel {
|
|
34
|
+ /** User Access Region */
|
|
35
|
+ unsigned long uar;
|
|
36
|
+ /** Doorbell records */
|
|
37
|
+ union db_record_st *db_rec;
|
|
38
|
+};
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
26
|
42
|
struct mlx_nic {
|
27
|
43
|
/** Queue pair handle */
|
28
|
44
|
udqp_t ipoib_qph;
|
|
@@ -224,44 +240,31 @@ static struct net_device_operations mlx_operations = {
|
224
|
240
|
};
|
225
|
241
|
|
226
|
242
|
|
227
|
|
-struct mlx_send_work_queue {
|
228
|
|
- /** Doorbell number */
|
229
|
|
- unsigned int doorbell_idx;
|
230
|
|
- /** Work queue entries */
|
231
|
|
- struct ud_send_wqe_st *wqe;
|
232
|
|
-};
|
233
|
243
|
|
234
|
|
-struct mlx {
|
235
|
|
- /** User Access Region */
|
236
|
|
- unsigned long uar;
|
237
|
|
- /** Doorbell records */
|
238
|
|
- union db_record_st *db_rec;
|
239
|
|
-};
|
240
|
|
-
|
241
|
|
-static struct ib_gid mlx_no_gid = {
|
|
244
|
+static struct ib_gid arbel_no_gid = {
|
242
|
245
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 }
|
243
|
246
|
};
|
244
|
247
|
|
245
|
|
-static void mlx_ring_doorbell ( struct mlx *mlx, void *db_reg,
|
246
|
|
- unsigned int offset ) {
|
|
248
|
+static void arbel_ring_doorbell ( struct arbel *arbel, void *db_reg,
|
|
249
|
+ unsigned int offset ) {
|
247
|
250
|
uint32_t *db_reg_dword = db_reg;
|
248
|
251
|
|
249
|
252
|
barrier();
|
250
|
|
- writel ( db_reg_dword[0], ( mlx->uar + offset + 0 ) );
|
|
253
|
+ writel ( db_reg_dword[0], ( arbel->uar + offset + 0 ) );
|
251
|
254
|
barrier();
|
252
|
|
- writel ( db_reg_dword[1], ( mlx->uar + offset + 4 ) );
|
|
255
|
+ writel ( db_reg_dword[1], ( arbel->uar + offset + 4 ) );
|
253
|
256
|
}
|
254
|
257
|
|
255
|
|
-static int mlx_post_send ( struct ib_device *ibdev, struct io_buffer *iobuf,
|
256
|
|
- struct ib_address_vector *av,
|
257
|
|
- struct ib_queue_pair *qp ) {
|
258
|
|
- struct mlx *mlx = ibdev->priv;
|
|
258
|
+static int arbel_post_send ( struct ib_device *ibdev, struct io_buffer *iobuf,
|
|
259
|
+ struct ib_address_vector *av,
|
|
260
|
+ struct ib_queue_pair *qp ) {
|
|
261
|
+ struct arbel *arbel = ibdev->priv;
|
259
|
262
|
struct ib_work_queue *wq = &qp->send;
|
260
|
|
- struct mlx_send_work_queue *mlx_wq = wq->priv;
|
|
263
|
+ struct arbel_send_work_queue *arbel_wq = wq->priv;
|
261
|
264
|
unsigned int wqe_idx_mask = ( wq->num_wqes - 1 );
|
262
|
265
|
unsigned int prev_wqe_idx;
|
263
|
|
- struct ud_send_wqe_st *prev_wqe;
|
264
|
266
|
unsigned int wqe_idx;
|
|
267
|
+ struct ud_send_wqe_st *prev_wqe;
|
265
|
268
|
struct ud_send_wqe_st *wqe;
|
266
|
269
|
struct ib_gid *gid;
|
267
|
270
|
size_t nds;
|
|
@@ -272,11 +275,11 @@ static int mlx_post_send ( struct ib_device *ibdev, struct io_buffer *iobuf,
|
272
|
275
|
prev_wqe_idx = wq->posted;
|
273
|
276
|
wqe_idx = ( prev_wqe_idx + 1 );
|
274
|
277
|
if ( wq->iobuf[wqe_idx & wqe_idx_mask] ) {
|
275
|
|
- DBGC ( mlx, "MLX %p send queue full", mlx );
|
|
278
|
+ DBGC ( arbel, "ARBEL %p send queue full", arbel );
|
276
|
279
|
return -ENOBUFS;
|
277
|
280
|
}
|
278
|
|
- prev_wqe = &mlx_wq->wqe[prev_wqe_idx & wqe_idx_mask];
|
279
|
|
- wqe = &mlx_wq->wqe[wqe_idx & wqe_idx_mask];
|
|
281
|
+ prev_wqe = &arbel_wq->wqe[prev_wqe_idx & wqe_idx_mask];
|
|
282
|
+ wqe = &arbel_wq->wqe[wqe_idx & wqe_idx_mask];
|
280
|
283
|
|
281
|
284
|
/* Construct work queue entry */
|
282
|
285
|
memset ( &wqe->next.control, 0,
|
|
@@ -296,7 +299,7 @@ static int mlx_post_send ( struct ib_device *ibdev, struct io_buffer *iobuf,
|
296
|
299
|
msg, 3 );
|
297
|
300
|
MLX_POPULATE_1 ( &wqe->udseg, arbelprm_ud_address_vector_st, 3,
|
298
|
301
|
sl, av->sl );
|
299
|
|
- gid = ( av->gid_present ? &av->gid : &mlx_no_gid );
|
|
302
|
+ gid = ( av->gid_present ? &av->gid : &arbel_no_gid );
|
300
|
303
|
memcpy ( ( ( ( void * ) &wqe->udseg ) + 16 ),
|
301
|
304
|
gid, sizeof ( *gid ) );
|
302
|
305
|
MLX_POPULATE_1 ( &wqe->udseg, arbelprm_wqe_segment_ud_st, 8,
|
|
@@ -318,7 +321,7 @@ static int mlx_post_send ( struct ib_device *ibdev, struct io_buffer *iobuf,
|
318
|
321
|
always1, 1 );
|
319
|
322
|
|
320
|
323
|
/* Update doorbell record */
|
321
|
|
- db_rec = &mlx->db_rec[mlx_wq->doorbell_idx];
|
|
324
|
+ db_rec = &arbel->db_rec[arbel_wq->doorbell_idx];
|
322
|
325
|
MLX_POPULATE_1 ( db_rec, arbelprm_qp_db_record_st, 0,
|
323
|
326
|
counter, ( wqe_idx & 0xffff ) );
|
324
|
327
|
barrier();
|
|
@@ -332,7 +335,7 @@ static int mlx_post_send ( struct ib_device *ibdev, struct io_buffer *iobuf,
|
332
|
335
|
MLX_POPULATE_2 ( &db_reg, arbelprm_send_doorbell_st, 1,
|
333
|
336
|
nds, nds,
|
334
|
337
|
qpn, qp->qpn );
|
335
|
|
- mlx_ring_doorbell ( mlx, &db_reg, POST_SND_OFFSET );
|
|
338
|
+ arbel_ring_doorbell ( arbel, &db_reg, POST_SND_OFFSET );
|
336
|
339
|
|
337
|
340
|
/* Update work queue's posted index */
|
338
|
341
|
wq->posted = wqe_idx;
|
|
@@ -340,8 +343,8 @@ static int mlx_post_send ( struct ib_device *ibdev, struct io_buffer *iobuf,
|
340
|
343
|
return 0;
|
341
|
344
|
}
|
342
|
345
|
|
343
|
|
-static struct ib_device_operations mlx_ib_operations = {
|
344
|
|
- .post_send = mlx_post_send,
|
|
346
|
+static struct ib_device_operations arbel_ib_operations = {
|
|
347
|
+ .post_send = arbel_post_send,
|
345
|
348
|
};
|
346
|
349
|
|
347
|
350
|
/**
|
|
@@ -349,7 +352,7 @@ static struct ib_device_operations mlx_ib_operations = {
|
349
|
352
|
*
|
350
|
353
|
* @v pci PCI device
|
351
|
354
|
*/
|
352
|
|
-static void mlx_remove ( struct pci_device *pci ) {
|
|
355
|
+static void arbel_remove ( struct pci_device *pci ) {
|
353
|
356
|
struct net_device *netdev = pci_get_drvdata ( pci );
|
354
|
357
|
|
355
|
358
|
unregister_netdev ( netdev );
|
|
@@ -365,8 +368,8 @@ static void mlx_remove ( struct pci_device *pci ) {
|
365
|
368
|
* @v id PCI ID
|
366
|
369
|
* @ret rc Return status code
|
367
|
370
|
*/
|
368
|
|
-static int mlx_probe ( struct pci_device *pci,
|
369
|
|
- const struct pci_device_id *id __unused ) {
|
|
371
|
+static int arbel_probe ( struct pci_device *pci,
|
|
372
|
+ const struct pci_device_id *id __unused ) {
|
370
|
373
|
struct net_device *netdev;
|
371
|
374
|
struct mlx_nic *mlx;
|
372
|
375
|
struct ib_mac *mac;
|
|
@@ -411,14 +414,14 @@ static int mlx_probe ( struct pci_device *pci,
|
411
|
414
|
return rc;
|
412
|
415
|
}
|
413
|
416
|
|
414
|
|
-static struct pci_device_id mlx_nics[] = {
|
|
417
|
+static struct pci_device_id arbel_nics[] = {
|
415
|
418
|
PCI_ROM ( 0x15b3, 0x6282, "MT25218", "MT25218 HCA driver" ),
|
416
|
419
|
PCI_ROM ( 0x15b3, 0x6274, "MT25204", "MT25204 HCA driver" ),
|
417
|
420
|
};
|
418
|
421
|
|
419
|
|
-struct pci_driver mlx_driver __pci_driver = {
|
420
|
|
- .ids = mlx_nics,
|
421
|
|
- .id_count = ( sizeof ( mlx_nics ) / sizeof ( mlx_nics[0] ) ),
|
422
|
|
- .probe = mlx_probe,
|
423
|
|
- .remove = mlx_remove,
|
|
422
|
+struct pci_driver arbel_driver __pci_driver = {
|
|
423
|
+ .ids = arbel_nics,
|
|
424
|
+ .id_count = ( sizeof ( arbel_nics ) / sizeof ( arbel_nics[0] ) ),
|
|
425
|
+ .probe = arbel_probe,
|
|
426
|
+ .remove = arbel_remove,
|
424
|
427
|
};
|