[infiniband] Call ib_open() only when opening the IPoIB net device

Defer the call to ib_open() until we want to actually open the device,
rather than when the device is registered.
This commit is contained in:
Michael Brown
2009-01-02 21:04:31 +00:00
parent 8674bc05a0
commit 53a7dd26cd
5 changed files with 60 additions and 28 deletions

View File

@@ -2175,6 +2175,10 @@ static int arbel_probe ( struct pci_device *pci,
if ( ( rc = arbel_create_eq ( arbel ) ) != 0 )
goto err_create_eq;
/* Update MAD parameters */
for ( i = 0 ; i < ARBEL_NUM_PORTS ; i++ )
ib_smc_update ( arbel->ibdev[i], arbel_mad );
/* Register Infiniband devices */
for ( i = 0 ; i < ARBEL_NUM_PORTS ; i++ ) {
if ( ( rc = register_ibdev ( arbel->ibdev[i] ) ) != 0 ) {

View File

@@ -2244,6 +2244,10 @@ static int hermon_probe ( struct pci_device *pci,
if ( ( rc = hermon_create_eq ( hermon ) ) != 0 )
goto err_create_eq;
/* Update MAD parameters */
for ( i = 0 ; i < HERMON_NUM_PORTS ; i++ )
ib_smc_update ( hermon->ibdev[i], hermon_mad );
/* Register Infiniband devices */
for ( i = 0 ; i < HERMON_NUM_PORTS ; i++ ) {
if ( ( rc = register_ibdev ( hermon->ibdev[i] ) ) != 0 ) {

View File

@@ -926,6 +926,13 @@ static int ipoib_open ( struct net_device *netdev ) {
struct ipoib_mac *mac = ( ( struct ipoib_mac * ) netdev->ll_addr );
int rc;
/* Open IB device */
if ( ( rc = ib_open ( ipoib->ibdev ) ) != 0 ) {
DBGC ( ipoib, "IPoIB %p could not open device: %s\n",
ipoib, strerror ( rc ) );
goto err_ib_open;
}
/* Allocate metadata queue set */
if ( ( rc = ipoib_create_qset ( ipoib, &ipoib->meta,
IPOIB_META_NUM_CQES,
@@ -971,6 +978,8 @@ static int ipoib_open ( struct net_device *netdev ) {
err_create_data_qset:
ipoib_destroy_qset ( ipoib, &ipoib->meta );
err_create_meta_qset:
ib_close ( ipoib->ibdev );
err_ib_open:
return rc;
}
@@ -992,6 +1001,9 @@ static void ipoib_close ( struct net_device *netdev ) {
/* Tear down the queues */
ipoib_destroy_qset ( ipoib, &ipoib->data );
ipoib_destroy_qset ( ipoib, &ipoib->meta );
/* Close IB device */
ib_close ( ipoib->ibdev );
}
/** IPoIB network device operations */