datapath-windows/ovsext/Conntrack-nat.c
/*
 *---------------------------------------------------------------------------
 * OvsNatInit
 *     Initialize NAT related resources.
 *---------------------------------------------------------------------------
 */
OvsNatInit
Initialize NAT related resources.
OvsNatInit Initialize NAT related resources .
NTSTATUS OvsNatInit()
{
    ASSERT(ovsNatTable == NULL);
    ovsNatTable = OvsAllocateMemoryWithTag(
        sizeof(LIST_ENTRY) * NAT_HASH_TABLE_SIZE,
        OVS_CT_POOL_TAG);
    if (ovsNatTable == NULL) {
        return STATUS_INSUFFICIENT_RESOURCES;
    }
    ovsUnNatTable = OvsAllocateMemoryWithTag(
        sizeof(LIST_ENTRY) * NAT_HASH_TABLE_SIZE,
        OVS_CT_POOL_TAG);
    if (ovsUnNatTable == NULL) {
        OvsFreeMemoryWithTag(ovsNatTable, OVS_CT_POOL_TAG);
        return STATUS_INSUFFICIENT_RESOURCES;
    }
    for (int i = 0; i < NAT_HASH_TABLE_SIZE; i++) {
        InitializeListHead(&ovsNatTable[i]);
        InitializeListHead(&ovsUnNatTable[i]);
    }
    NdisAllocateSpinLock(&ovsCtNatLock);
    ovsNatEntries = 0;
    return STATUS_SUCCESS;
}
NTSTATUS OvsNatInit ( ) { ASSERT ( ovsNatTable == NULL ) ; ovsNatTable = OvsAllocateMemoryWithTag ( sizeof ( LIST_ENTRY ) * NAT_HASH_TABLE_SIZE , OVS_CT_POOL_TAG ) ; if ( ovsNatTable == NULL ) { return STATUS_INSUFFICIENT_RESOURCES ; } ovsUnNatTable = OvsAllocateMemoryWithTag ( sizeof ( LIST_ENTRY ) * NAT_HASH_TABLE_SIZE , OVS_CT_POOL_TAG ) ; if ( ovsUnNatTable == NULL ) { OvsFreeMemoryWithTag ( ovsNatTable , OVS_CT_POOL_TAG ) ; return STATUS_INSUFFICIENT_RESOURCES ; } for ( int i = 0 ; i < NAT_HASH_TABLE_SIZE ; i ++ ) { InitializeListHead ( & ovsNatTable [ i ] ) ; InitializeListHead ( & ovsUnNatTable [ i ] ) ; } NdisAllocateSpinLock ( & ovsCtNatLock ) ; ovsNatEntries = 0 ; return STATUS_SUCCESS ; }
OvsNatInit
     Initialize NAT related resources.
OvsNatInit Initialize NAT related resources .
/* Init the Hash Buffer */