Пример #1
0
static eHalStatus tdlsSaveTdlsPeerInfo(tpAniSirGlobal pMac, 
                                          tSirTdlsPeerInfo *disPeerInfo)
{
    tCsrTdlsPeerLinkinfo *peerInfo = NULL ; 
    tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
    eHalStatus status = eHAL_STATUS_FAILURE ;
    status = palAllocateMemory( pMac->hHdd, (void **)&peerInfo, 
                                sizeof(tCsrTdlsPeerLinkinfo));

 
    if (HAL_STATUS_SUCCESS(status))
    {
        palZeroMemory(pMac->hHdd, &peerInfo->tdlsDisPeerInfo, 
                                            sizeof(tSirTdlsPeerInfo));
        palCopyMemory(pMac->hHdd, &peerInfo->tdlsDisPeerInfo, disPeerInfo, 
                                             sizeof(tSirTdlsPeerInfo));

        disInfo->tdlsPeerCount++ ;

        csrLLInsertTail( &disInfo->tdlsPotentialPeerList, 
                                 &peerInfo->tdlsPeerStaLink, LL_ACCESS_LOCK );
    }

    return status ;

}
/*
 * save TDLS peer info, this will be called after successfull completion
 * of TDLS discovery procedure.
 */
static eHalStatus tdlsSaveTdlsPeerInfo(tpAniSirGlobal pMac, 
                                          tSirTdlsPeerInfo *disPeerInfo)
{
    tCsrTdlsPeerLinkinfo *peerInfo = NULL ; 
    tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
    eHalStatus status = eHAL_STATUS_FAILURE ;
    /* 
     * Ok, allocate memory for peer info here
     * we allocate memory for each peer here and free his memory
     * at the time the peer node is getting deleted, possible case is 
     * teardown
     */
    peerInfo = vos_mem_malloc(sizeof(tCsrTdlsPeerLinkinfo));
    if ( NULL = peerInfo )
        status = eHAL_STATUS_FAILURE;
    else
        status = eHAL_STATUS_SUCCESS;

    /* 
     * go ahead and copy peerInfo and insert this node info discovery rsp
     * database.
     */ 
    if (HAL_STATUS_SUCCESS(status))
    {
        vos_mem_set( &peerInfo->tdlsDisPeerInfo,
                                            sizeof(tSirTdlsPeerInfo), 0);
        vos_mem_copy( &peerInfo->tdlsDisPeerInfo, disPeerInfo,
                                             sizeof(tSirTdlsPeerInfo));

        /*
         * update TDLS client count to indicate there is tdls client
         * in tdls potential peer list.
         */
        disInfo->tdlsPeerCount++ ;

        /*
         * finally insert this tdls peer info into tdls potential peer list
         */
        csrLLInsertTail( &disInfo->tdlsPotentialPeerList, 
                                 &peerInfo->tdlsPeerStaLink, LL_ACCESS_LOCK );
    }

    return status ;

}