|
|
@@ -43,9 +43,6 @@
|
|
43
|
43
|
*
|
|
44
|
44
|
*/
|
|
45
|
45
|
|
|
46
|
|
-/* Port to use */
|
|
47
|
|
-#define PXE_IB_PORT 1
|
|
48
|
|
-
|
|
49
|
46
|
/***************************************************************************
|
|
50
|
47
|
*
|
|
51
|
48
|
* Queue number allocation
|
|
|
@@ -482,7 +479,7 @@ arbel_cmd_map_fa ( struct arbel *arbel,
|
|
482
|
479
|
*/
|
|
483
|
480
|
static int arbel_create_cq ( struct ib_device *ibdev,
|
|
484
|
481
|
struct ib_completion_queue *cq ) {
|
|
485
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
|
482
|
+ struct arbel *arbel = ib_get_drvdata ( ibdev );
|
|
486
|
483
|
struct arbel_completion_queue *arbel_cq;
|
|
487
|
484
|
struct arbelprm_completion_queue_context cqctx;
|
|
488
|
485
|
struct arbelprm_cq_ci_db_record *ci_db_rec;
|
|
|
@@ -560,7 +557,7 @@ static int arbel_create_cq ( struct ib_device *ibdev,
|
|
560
|
557
|
DBGC ( arbel, "Arbel %p CQN %#lx ring at [%p,%p)\n",
|
|
561
|
558
|
arbel, cq->cqn, arbel_cq->cqe,
|
|
562
|
559
|
( ( ( void * ) arbel_cq->cqe ) + arbel_cq->cqe_size ) );
|
|
563
|
|
- cq->dev_priv = arbel_cq;
|
|
|
560
|
+ ib_cq_set_drvdata ( cq, arbel_cq );
|
|
564
|
561
|
return 0;
|
|
565
|
562
|
|
|
566
|
563
|
err_sw2hw_cq:
|
|
|
@@ -583,8 +580,8 @@ static int arbel_create_cq ( struct ib_device *ibdev,
|
|
583
|
580
|
*/
|
|
584
|
581
|
static void arbel_destroy_cq ( struct ib_device *ibdev,
|
|
585
|
582
|
struct ib_completion_queue *cq ) {
|
|
586
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
587
|
|
- struct arbel_completion_queue *arbel_cq = cq->dev_priv;
|
|
|
583
|
+ struct arbel *arbel = ib_get_drvdata ( ibdev );
|
|
|
584
|
+ struct arbel_completion_queue *arbel_cq = ib_cq_get_drvdata ( cq );
|
|
588
|
585
|
struct arbelprm_completion_queue_context cqctx;
|
|
589
|
586
|
struct arbelprm_cq_ci_db_record *ci_db_rec;
|
|
590
|
587
|
struct arbelprm_cq_arm_db_record *arm_db_rec;
|
|
|
@@ -613,7 +610,7 @@ static void arbel_destroy_cq ( struct ib_device *ibdev,
|
|
613
|
610
|
cqn_offset = ( cq->cqn - arbel->limits.reserved_cqs );
|
|
614
|
611
|
arbel_free_qn_offset ( arbel->cq_inuse, cqn_offset );
|
|
615
|
612
|
|
|
616
|
|
- cq->dev_priv = NULL;
|
|
|
613
|
+ ib_cq_set_drvdata ( cq, NULL );
|
|
617
|
614
|
}
|
|
618
|
615
|
|
|
619
|
616
|
/***************************************************************************
|
|
|
@@ -712,7 +709,7 @@ static int arbel_create_recv_wq ( struct arbel_recv_work_queue *arbel_recv_wq,
|
|
712
|
709
|
*/
|
|
713
|
710
|
static int arbel_create_qp ( struct ib_device *ibdev,
|
|
714
|
711
|
struct ib_queue_pair *qp ) {
|
|
715
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
|
712
|
+ struct arbel *arbel = ib_get_drvdata ( ibdev );
|
|
716
|
713
|
struct arbel_queue_pair *arbel_qp;
|
|
717
|
714
|
struct arbelprm_qp_ee_state_transitions qpctx;
|
|
718
|
715
|
struct arbelprm_qp_db_record *send_db_rec;
|
|
|
@@ -819,7 +816,7 @@ static int arbel_create_qp ( struct ib_device *ibdev,
|
|
819
|
816
|
DBGC ( arbel, "Arbel %p QPN %#lx receive ring at [%p,%p)\n",
|
|
820
|
817
|
arbel, qp->qpn, arbel_qp->recv.wqe,
|
|
821
|
818
|
( ( (void *) arbel_qp->recv.wqe ) + arbel_qp->recv.wqe_size ) );
|
|
822
|
|
- qp->dev_priv = arbel_qp;
|
|
|
819
|
+ ib_qp_set_drvdata ( qp, arbel_qp );
|
|
823
|
820
|
return 0;
|
|
824
|
821
|
|
|
825
|
822
|
err_rtr2rts_qpee:
|
|
|
@@ -847,8 +844,8 @@ static int arbel_create_qp ( struct ib_device *ibdev,
|
|
847
|
844
|
*/
|
|
848
|
845
|
static void arbel_destroy_qp ( struct ib_device *ibdev,
|
|
849
|
846
|
struct ib_queue_pair *qp ) {
|
|
850
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
851
|
|
- struct arbel_queue_pair *arbel_qp = qp->dev_priv;
|
|
|
847
|
+ struct arbel *arbel = ib_get_drvdata ( ibdev );
|
|
|
848
|
+ struct arbel_queue_pair *arbel_qp = ib_qp_get_drvdata ( qp );
|
|
852
|
849
|
struct arbelprm_qp_db_record *send_db_rec;
|
|
853
|
850
|
struct arbelprm_qp_db_record *recv_db_rec;
|
|
854
|
851
|
int qpn_offset;
|
|
|
@@ -877,7 +874,7 @@ static void arbel_destroy_qp ( struct ib_device *ibdev,
|
|
877
|
874
|
qpn_offset = ( qp->qpn - ARBEL_QPN_BASE - arbel->limits.reserved_qps );
|
|
878
|
875
|
arbel_free_qn_offset ( arbel->qp_inuse, qpn_offset );
|
|
879
|
876
|
|
|
880
|
|
- qp->dev_priv = NULL;
|
|
|
877
|
+ ib_qp_set_drvdata ( qp, NULL );
|
|
881
|
878
|
}
|
|
882
|
879
|
|
|
883
|
880
|
/***************************************************************************
|
|
|
@@ -926,8 +923,8 @@ static int arbel_post_send ( struct ib_device *ibdev,
|
|
926
|
923
|
struct ib_queue_pair *qp,
|
|
927
|
924
|
struct ib_address_vector *av,
|
|
928
|
925
|
struct io_buffer *iobuf ) {
|
|
929
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
930
|
|
- struct arbel_queue_pair *arbel_qp = qp->dev_priv;
|
|
|
926
|
+ struct arbel *arbel = ib_get_drvdata ( ibdev );
|
|
|
927
|
+ struct arbel_queue_pair *arbel_qp = ib_qp_get_drvdata ( qp );
|
|
931
|
928
|
struct ib_work_queue *wq = &qp->send;
|
|
932
|
929
|
struct arbel_send_work_queue *arbel_send_wq = &arbel_qp->send;
|
|
933
|
930
|
struct arbelprm_ud_send_wqe *prev_wqe;
|
|
|
@@ -1016,8 +1013,8 @@ static int arbel_post_send ( struct ib_device *ibdev,
|
|
1016
|
1013
|
static int arbel_post_recv ( struct ib_device *ibdev,
|
|
1017
|
1014
|
struct ib_queue_pair *qp,
|
|
1018
|
1015
|
struct io_buffer *iobuf ) {
|
|
1019
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
1020
|
|
- struct arbel_queue_pair *arbel_qp = qp->dev_priv;
|
|
|
1016
|
+ struct arbel *arbel = ib_get_drvdata ( ibdev );
|
|
|
1017
|
+ struct arbel_queue_pair *arbel_qp = ib_qp_get_drvdata ( qp );
|
|
1021
|
1018
|
struct ib_work_queue *wq = &qp->recv;
|
|
1022
|
1019
|
struct arbel_recv_work_queue *arbel_recv_wq = &arbel_qp->recv;
|
|
1023
|
1020
|
struct arbelprm_recv_wqe *wqe;
|
|
|
@@ -1066,7 +1063,7 @@ static int arbel_complete ( struct ib_device *ibdev,
|
|
1066
|
1063
|
union arbelprm_completion_entry *cqe,
|
|
1067
|
1064
|
ib_completer_t complete_send,
|
|
1068
|
1065
|
ib_completer_t complete_recv ) {
|
|
1069
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
|
1066
|
+ struct arbel *arbel = ib_get_drvdata ( ibdev );
|
|
1070
|
1067
|
struct ib_completion completion;
|
|
1071
|
1068
|
struct ib_work_queue *wq;
|
|
1072
|
1069
|
struct ib_queue_pair *qp;
|
|
|
@@ -1108,7 +1105,7 @@ static int arbel_complete ( struct ib_device *ibdev,
|
|
1108
|
1105
|
return -EIO;
|
|
1109
|
1106
|
}
|
|
1110
|
1107
|
qp = wq->qp;
|
|
1111
|
|
- arbel_qp = qp->dev_priv;
|
|
|
1108
|
+ arbel_qp = ib_qp_get_drvdata ( qp );
|
|
1112
|
1109
|
arbel_send_wq = &arbel_qp->send;
|
|
1113
|
1110
|
arbel_recv_wq = &arbel_qp->recv;
|
|
1114
|
1111
|
|
|
|
@@ -1170,8 +1167,8 @@ static void arbel_poll_cq ( struct ib_device *ibdev,
|
|
1170
|
1167
|
struct ib_completion_queue *cq,
|
|
1171
|
1168
|
ib_completer_t complete_send,
|
|
1172
|
1169
|
ib_completer_t complete_recv ) {
|
|
1173
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
1174
|
|
- struct arbel_completion_queue *arbel_cq = cq->dev_priv;
|
|
|
1170
|
+ struct arbel *arbel = ib_get_drvdata ( ibdev );
|
|
|
1171
|
+ struct arbel_completion_queue *arbel_cq = ib_cq_get_drvdata ( cq );
|
|
1175
|
1172
|
struct arbelprm_cq_ci_db_record *ci_db_rec;
|
|
1176
|
1173
|
union arbelprm_completion_entry *cqe;
|
|
1177
|
1174
|
unsigned int cqe_idx_mask;
|
|
|
@@ -1220,7 +1217,7 @@ static void arbel_poll_cq ( struct ib_device *ibdev,
|
|
1220
|
1217
|
* @ret rc Return status code
|
|
1221
|
1218
|
*/
|
|
1222
|
1219
|
static int arbel_open ( struct ib_device *ibdev ) {
|
|
1223
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
|
1220
|
+ struct arbel *arbel = ib_get_drvdata ( ibdev );
|
|
1224
|
1221
|
struct arbelprm_init_ib init_ib;
|
|
1225
|
1222
|
int rc;
|
|
1226
|
1223
|
|
|
|
@@ -1247,7 +1244,7 @@ static int arbel_open ( struct ib_device *ibdev ) {
|
|
1247
|
1244
|
* @v ibdev Infiniband device
|
|
1248
|
1245
|
*/
|
|
1249
|
1246
|
static void arbel_close ( struct ib_device *ibdev ) {
|
|
1250
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
|
1247
|
+ struct arbel *arbel = ib_get_drvdata ( ibdev );
|
|
1251
|
1248
|
int rc;
|
|
1252
|
1249
|
|
|
1253
|
1250
|
if ( ( rc = arbel_cmd_close_ib ( arbel, ibdev->port ) ) != 0 ) {
|
|
|
@@ -1275,7 +1272,7 @@ static void arbel_close ( struct ib_device *ibdev ) {
|
|
1275
|
1272
|
static int arbel_mcast_attach ( struct ib_device *ibdev,
|
|
1276
|
1273
|
struct ib_queue_pair *qp,
|
|
1277
|
1274
|
struct ib_gid *gid ) {
|
|
1278
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
|
1275
|
+ struct arbel *arbel = ib_get_drvdata ( ibdev );
|
|
1279
|
1276
|
struct arbelprm_mgm_hash hash;
|
|
1280
|
1277
|
struct arbelprm_mgm_entry mgm;
|
|
1281
|
1278
|
unsigned int index;
|
|
|
@@ -1330,7 +1327,7 @@ static int arbel_mcast_attach ( struct ib_device *ibdev,
|
|
1330
|
1327
|
static void arbel_mcast_detach ( struct ib_device *ibdev,
|
|
1331
|
1328
|
struct ib_queue_pair *qp __unused,
|
|
1332
|
1329
|
struct ib_gid *gid ) {
|
|
1333
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
|
1330
|
+ struct arbel *arbel = ib_get_drvdata ( ibdev );
|
|
1334
|
1331
|
struct arbelprm_mgm_hash hash;
|
|
1335
|
1332
|
struct arbelprm_mgm_entry mgm;
|
|
1336
|
1333
|
unsigned int index;
|
|
|
@@ -1370,7 +1367,7 @@ static void arbel_mcast_detach ( struct ib_device *ibdev,
|
|
1370
|
1367
|
*/
|
|
1371
|
1368
|
static int arbel_mad ( struct ib_device *ibdev, struct ib_mad_hdr *mad,
|
|
1372
|
1369
|
size_t len ) {
|
|
1373
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
|
1370
|
+ struct arbel *arbel = ib_get_drvdata ( ibdev );
|
|
1374
|
1371
|
union arbelprm_mad mad_ifc;
|
|
1375
|
1372
|
int rc;
|
|
1376
|
1373
|
|
|
|
@@ -1837,23 +1834,33 @@ static int arbel_setup_mpt ( struct arbel *arbel ) {
|
|
1837
|
1834
|
*/
|
|
1838
|
1835
|
static int arbel_probe ( struct pci_device *pci,
|
|
1839
|
1836
|
const struct pci_device_id *id __unused ) {
|
|
1840
|
|
- struct ib_device *ibdev;
|
|
1841
|
1837
|
struct arbel *arbel;
|
|
|
1838
|
+ struct ib_device *ibdev;
|
|
1842
|
1839
|
struct arbelprm_init_hca init_hca;
|
|
|
1840
|
+ int i;
|
|
1843
|
1841
|
int rc;
|
|
1844
|
1842
|
|
|
1845
|
|
- /* Allocate Infiniband device */
|
|
1846
|
|
- ibdev = alloc_ibdev ( sizeof ( *arbel ) );
|
|
1847
|
|
- if ( ! ibdev ) {
|
|
|
1843
|
+ /* Allocate Arbel device */
|
|
|
1844
|
+ arbel = zalloc ( sizeof ( *arbel ) );
|
|
|
1845
|
+ if ( ! arbel ) {
|
|
1848
|
1846
|
rc = -ENOMEM;
|
|
1849
|
|
- goto err_ibdev;
|
|
|
1847
|
+ goto err_alloc_arbel;
|
|
|
1848
|
+ }
|
|
|
1849
|
+ pci_set_drvdata ( pci, arbel );
|
|
|
1850
|
+
|
|
|
1851
|
+ /* Allocate Infiniband devices */
|
|
|
1852
|
+ for ( i = 0 ; i < ARBEL_NUM_PORTS ; i++ ) {
|
|
|
1853
|
+ ibdev = alloc_ibdev ( 0 );
|
|
|
1854
|
+ if ( ! ibdev ) {
|
|
|
1855
|
+ rc = -ENOMEM;
|
|
|
1856
|
+ goto err_alloc_ibdev;
|
|
|
1857
|
+ }
|
|
|
1858
|
+ arbel->ibdev[i] = ibdev;
|
|
|
1859
|
+ ibdev->op = &arbel_ib_operations;
|
|
|
1860
|
+ ibdev->dev = &pci->dev;
|
|
|
1861
|
+ ibdev->port = ( ARBEL_PORT_BASE + i );
|
|
|
1862
|
+ ib_set_drvdata ( ibdev, arbel );
|
|
1850
|
1863
|
}
|
|
1851
|
|
- ibdev->op = &arbel_ib_operations;
|
|
1852
|
|
- pci_set_drvdata ( pci, ibdev );
|
|
1853
|
|
- ibdev->dev = &pci->dev;
|
|
1854
|
|
- ibdev->port = PXE_IB_PORT;
|
|
1855
|
|
- arbel = ibdev->dev_priv;
|
|
1856
|
|
- memset ( arbel, 0, sizeof ( *arbel ) );
|
|
1857
|
1864
|
|
|
1858
|
1865
|
/* Fix up PCI device */
|
|
1859
|
1866
|
adjust_pci_device ( pci );
|
|
|
@@ -1902,16 +1909,21 @@ static int arbel_probe ( struct pci_device *pci,
|
|
1902
|
1909
|
if ( ( rc = arbel_setup_mpt ( arbel ) ) != 0 )
|
|
1903
|
1910
|
goto err_setup_mpt;
|
|
1904
|
1911
|
|
|
1905
|
|
- /* Register Infiniband device */
|
|
1906
|
|
- if ( ( rc = register_ibdev ( ibdev ) ) != 0 ) {
|
|
1907
|
|
- DBGC ( arbel, "Arbel %p could not register IB device: %s\n",
|
|
1908
|
|
- arbel, strerror ( rc ) );
|
|
1909
|
|
- goto err_register_ibdev;
|
|
|
1912
|
+ /* Register Infiniband devices */
|
|
|
1913
|
+ for ( i = 0 ; i < ARBEL_NUM_PORTS ; i++ ) {
|
|
|
1914
|
+ if ( ( rc = register_ibdev ( arbel->ibdev[i] ) ) != 0 ) {
|
|
|
1915
|
+ DBGC ( arbel, "Arbel %p could not register IB "
|
|
|
1916
|
+ "device: %s\n", arbel, strerror ( rc ) );
|
|
|
1917
|
+ goto err_register_ibdev;
|
|
|
1918
|
+ }
|
|
1910
|
1919
|
}
|
|
1911
|
1920
|
|
|
1912
|
1921
|
return 0;
|
|
1913
|
1922
|
|
|
|
1923
|
+ i = ( ARBEL_NUM_PORTS - 1 );
|
|
1914
|
1924
|
err_register_ibdev:
|
|
|
1925
|
+ for ( ; i >= 0 ; i-- )
|
|
|
1926
|
+ unregister_ibdev ( arbel->ibdev[i] );
|
|
1915
|
1927
|
err_setup_mpt:
|
|
1916
|
1928
|
arbel_cmd_close_hca ( arbel );
|
|
1917
|
1929
|
err_init_hca:
|
|
|
@@ -1924,8 +1936,12 @@ static int arbel_probe ( struct pci_device *pci,
|
|
1924
|
1936
|
err_mailbox_out:
|
|
1925
|
1937
|
free_dma ( arbel->mailbox_in, ARBEL_MBOX_SIZE );
|
|
1926
|
1938
|
err_mailbox_in:
|
|
1927
|
|
- free_ibdev ( ibdev );
|
|
1928
|
|
- err_ibdev:
|
|
|
1939
|
+ i = ( ARBEL_NUM_PORTS - 1 );
|
|
|
1940
|
+ err_alloc_ibdev:
|
|
|
1941
|
+ for ( ; i >= 0 ; i-- )
|
|
|
1942
|
+ free_ibdev ( arbel->ibdev[i] );
|
|
|
1943
|
+ free ( arbel );
|
|
|
1944
|
+ err_alloc_arbel:
|
|
1929
|
1945
|
return rc;
|
|
1930
|
1946
|
}
|
|
1931
|
1947
|
|
|
|
@@ -1935,17 +1951,20 @@ static int arbel_probe ( struct pci_device *pci,
|
|
1935
|
1951
|
* @v pci PCI device
|
|
1936
|
1952
|
*/
|
|
1937
|
1953
|
static void arbel_remove ( struct pci_device *pci ) {
|
|
1938
|
|
- struct ib_device *ibdev = pci_get_drvdata ( pci );
|
|
1939
|
|
- struct arbel *arbel = ibdev->dev_priv;
|
|
|
1954
|
+ struct arbel *arbel = pci_get_drvdata ( pci );
|
|
|
1955
|
+ int i;
|
|
1940
|
1956
|
|
|
1941
|
|
- unregister_ibdev ( ibdev );
|
|
|
1957
|
+ for ( i = ( ARBEL_NUM_PORTS - 1 ) ; i >= 0 ; i-- )
|
|
|
1958
|
+ unregister_ibdev ( arbel->ibdev[i] );
|
|
1942
|
1959
|
arbel_cmd_close_hca ( arbel );
|
|
1943
|
1960
|
arbel_free_icm ( arbel );
|
|
1944
|
1961
|
arbel_stop_firmware ( arbel );
|
|
1945
|
1962
|
arbel_stop_firmware ( arbel );
|
|
1946
|
1963
|
free_dma ( arbel->mailbox_out, ARBEL_MBOX_SIZE );
|
|
1947
|
1964
|
free_dma ( arbel->mailbox_in, ARBEL_MBOX_SIZE );
|
|
1948
|
|
- free_ibdev ( ibdev );
|
|
|
1965
|
+ for ( i = ( ARBEL_NUM_PORTS - 1 ) ; i >= 0 ; i-- )
|
|
|
1966
|
+ free_ibdev ( arbel->ibdev[i] );
|
|
|
1967
|
+ free ( arbel );
|
|
1949
|
1968
|
}
|
|
1950
|
1969
|
|
|
1951
|
1970
|
static struct pci_device_id arbel_nics[] = {
|