datapath-windows/ovsext/Vport.c
/*
 * --------------------------------------------------------------------------
 * Functionality common to any port on the Hyper-V switch. This function is not
 * to be called for a port that is not on the Hyper-V switch.
 *
 * Inserts the port into 'portIdHashArray' and caches the pointer in the
 * 'switchContext' if needed.
 * --------------------------------------------------------------------------
 */
Functionality common to any port on the Hyper-V switch. This function is not
to be called for a port that is not on the Hyper-V switch.

Inserts the port into 'portIdHashArray' and caches the pointer in the
'switchContext' if needed.
Functionality common to any port on the Hyper - V switch . This function is not to be called for a port that is not on the Hyper - V switch . Inserts the port into ' portIdHashArray ' and caches the pointer in the ' switchContext ' if needed .
static VOID
UpdateSwitchCtxWithVport(POVS_SWITCH_CONTEXT switchContext,
                         POVS_VPORT_ENTRY vport,
                         BOOLEAN newPort)
{
    UINT32 hash;
    switch (vport->portType) {
    case NdisSwitchPortTypeExternal:
        if (vport->nicIndex == 0) {
            switchContext->virtualExternalPortId = vport->portId;
            switchContext->virtualExternalVport = vport;
        } else if (newPort == TRUE) {
            switchContext->numPhysicalNics++;
        }
        break;
    case NdisSwitchPortTypeInternal:
        switchContext->countInternalVports++;
        break;
    case NdisSwitchPortTypeSynthetic:
    case NdisSwitchPortTypeEmulated:
        break;
    }
    if (vport->portType == NdisSwitchPortTypeExternal &&
        vport->nicIndex == 0) {
        return;
    }
    hash = OvsJhashWords(&vport->portId, 1, OVS_HASH_BASIS);
    InsertHeadList(&switchContext->portIdHashArray[hash & OVS_VPORT_MASK],
                   &vport->portIdLink);
    if (newPort) {
        switchContext->numHvVports++;
    }
}
static VOID UpdateSwitchCtxWithVport ( POVS_SWITCH_CONTEXT switchContext , POVS_VPORT_ENTRY vport , BOOLEAN newPort ) { UINT32 hash ; switch ( vport -> portType ) { case NdisSwitchPortTypeExternal : if ( vport -> nicIndex == 0 ) { switchContext -> virtualExternalPortId = vport -> portId ; switchContext -> virtualExternalVport = vport ; } else if ( newPort == TRUE ) { switchContext -> numPhysicalNics ++ ; } break ; case NdisSwitchPortTypeInternal : switchContext -> countInternalVports ++ ; break ; case NdisSwitchPortTypeSynthetic : case NdisSwitchPortTypeEmulated : break ; } if ( vport -> portType == NdisSwitchPortTypeExternal && vport -> nicIndex == 0 ) { return ; } hash = OvsJhashWords ( & vport -> portId , 1 , OVS_HASH_BASIS ) ; InsertHeadList ( & switchContext -> portIdHashArray [ hash & OVS_VPORT_MASK ] , & vport -> portIdLink ) ; if ( newPort ) { switchContext -> numHvVports ++ ; } }
Functionality common to any port on the Hyper-V switch.
Functionality common to any port on the Hyper - V switch .
/*
     * It is important to not insert vport corresponding to virtual external
     * port into the 'portIdHashArray' since the port should not be exposed to
     * OVS userspace.
     */ /*
     * NOTE: OvsJhashWords has portId as "1" word. This should be ok, even
     * though sizeof(NDIS_SWITCH_PORT_ID) = 4, not 2, because the
     * hyper-v switch seems to use only 2 bytes out of 4.
     */