[openib-general] How to avoid "ibwarn: [27319] port_alloc: umad port id 0 is already allocated for mthca0 1" when trying to reconnect to SA.

Hal Rosenstock halr at voltaire.com
Mon Nov 27 16:24:14 PST 2006


On Thu, 2006-11-23 at 12:11, Bub Thomas wrote:
> Our application is querying the LID, GUID and subnetID for a given
> service at the SA.
> 
> In order to do so before every connection to the data source, which
> might last for several ours or some seconds, a connection to the SA is
> established via the osm interface.
> 
> After that I’m tearing down the connection to the SA
> 
> For the next connection, which might be to another server,  I have to
> do all over again.
> 
> My problem is that I can only establish a connection to the SA once!
> 
> A second attempt to build up a connection gives the error message
> above.
> 
> Any idea/help welcome:
> 
> Here is the code I’m using to build up the connection to the SA:
> 
> complib_init();
> 
> osm_log_construct(&_osmLog);
> 
> if ((status = osm_log_init_v2(&_osmLog, TRUE, 0x0001, NULL, 0, TRUE ))
> != IB_SUCCESS )
> 
> {
> 
>      return -1;
> 
> }
> 
> osm_log_set_level(&_osmLog, OSM_LOG_NONE);
> 
> _osmVendorPtr  = osm_vendor_new(&_osmLog, 100);
> 
> osm_mad_pool_construct(&_osmMadPool);
> 
> if ((status = osm_mad_pool_init(&_osmMadPool, &_osmLog)) != IB_SUCCESS
> )
> 
> {
> 
>      return -1;
> 
> }
> 
> _osmBindHandle = osmv_bind_sa  (_osmVendorPtr, &_osmMadPool,
> _localGid.global.interface_id);
> 
> if (_osmBindHandle == OSM_BIND_INVALID_HANDLE)
> 
> {
> 
>     return -1;
> 
> }
> 
> And this is the code I’m trying to tear down the connection to th SA
> 
> osm_mad_pool_destroy(&_osmMadPool);
> 
> if (_osmVendorPtr)
> 
> {
> 
>     osm_vendor_delete(&_osmVendorPtr);
> 
>     _osmVendorPtr = NULL;
> 
> }
> 
> 

Can you do something like this instead:

void do_stuff(int num)
{
        ...
}

int main()
{
        osm_vendor_init();

        do_stuff(0);
        do_stuff(1);

        osm_vendor_delete();

        return 0;
}

rather than:

void do_stuff(int num)
{
        osm_vendor_init();
        ...
        osm_vendor_delete();
}

int main()
{
        do_stuff(0);
        do_stuff(1);

        return 0;
}

-- Hal

________________________________________________________________________
> 
> _______________________________________________
> openib-general mailing list
> openib-general at openib.org
> http://openib.org/mailman/listinfo/openib-general
> 
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general





More information about the general mailing list