Skip to content

Commit

Permalink
datapath-windows: Add annotations to find vport functions
Browse files Browse the repository at this point in the history
Add annotations to find vport functions to check if the dispatch lock is
held.

Signed-off-by: Alin Gabriel Serdean <[email protected]>
Acked-by: Anand Kumar <[email protected]>
Acked-by: Sairam Venugopal <[email protected]>
  • Loading branch information
aserdean committed Mar 13, 2019
1 parent 3cdf29c commit 228355c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion datapath-windows/ovsext/Vport.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ HvCreatePort(POVS_SWITCH_CONTEXT switchContext,
* Lookup by port name to see if this port with this name had been added
* (and deleted) previously.
*/
vport = OvsFindVportByHvNameW(gOvsSwitchContext,
vport = OvsFindVportByHvNameW(switchContext,
portParam->PortFriendlyName.String,
portParam->PortFriendlyName.Length);
if (vport && vport->isAbsentOnHv == FALSE) {
Expand Down Expand Up @@ -692,6 +692,7 @@ HvDeleteNic(POVS_SWITCH_CONTEXT switchContext,
/*
* OVS Vport related functionality.
*/
_Use_decl_annotations_
POVS_VPORT_ENTRY
OvsFindVportByPortNo(POVS_SWITCH_CONTEXT switchContext,
UINT32 portNo)
Expand Down Expand Up @@ -786,6 +787,7 @@ OvsFindTunnelVportByPortType(POVS_SWITCH_CONTEXT switchContext,
return NULL;
}

_Use_decl_annotations_
POVS_VPORT_ENTRY
OvsFindVportByOvsName(POVS_SWITCH_CONTEXT switchContext,
PSTR name)
Expand All @@ -809,6 +811,7 @@ OvsFindVportByOvsName(POVS_SWITCH_CONTEXT switchContext,
}

/* OvsFindVportByHvName: "name" is assumed to be null-terminated */
_Use_decl_annotations_
POVS_VPORT_ENTRY
OvsFindVportByHvNameW(POVS_SWITCH_CONTEXT switchContext,
PWSTR wsName, SIZE_T wstrSize)
Expand Down Expand Up @@ -861,6 +864,7 @@ OvsFindVportByHvNameW(POVS_SWITCH_CONTEXT switchContext,
return vport;
}

_Use_decl_annotations_
POVS_VPORT_ENTRY
OvsFindVportByHvNameA(POVS_SWITCH_CONTEXT switchContext,
PSTR name)
Expand All @@ -883,6 +887,7 @@ OvsFindVportByHvNameA(POVS_SWITCH_CONTEXT switchContext,
return vport;
}

_Use_decl_annotations_
POVS_VPORT_ENTRY
OvsFindVportByPortIdAndNicIndex(POVS_SWITCH_CONTEXT switchContext,
NDIS_SWITCH_PORT_ID portId,
Expand Down
5 changes: 5 additions & 0 deletions datapath-windows/ovsext/Vport.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,20 @@ typedef struct _OVS_VPORT_ENTRY {

struct _OVS_SWITCH_CONTEXT;

_Requires_lock_held_(switchContext->dispatchLock)
POVS_VPORT_ENTRY OvsFindVportByPortNo(POVS_SWITCH_CONTEXT switchContext,
UINT32 portNo);
/* "name" is null-terminated */
_Requires_lock_held_(switchContext->dispatchLock)
POVS_VPORT_ENTRY OvsFindVportByOvsName(POVS_SWITCH_CONTEXT switchContext,
PSTR name);
_Requires_lock_held_(switchContext->dispatchLock)
POVS_VPORT_ENTRY OvsFindVportByHvNameA(POVS_SWITCH_CONTEXT switchContext,
PSTR name);
_Requires_lock_held_(switchContext->dispatchLock)
POVS_VPORT_ENTRY OvsFindVportByHvNameW(POVS_SWITCH_CONTEXT switchContext,
PWSTR wsName, SIZE_T wstrSize);
_Requires_lock_held_(switchContext->dispatchLock)
POVS_VPORT_ENTRY OvsFindVportByPortIdAndNicIndex(POVS_SWITCH_CONTEXT switchContext,
NDIS_SWITCH_PORT_ID portId,
NDIS_SWITCH_NIC_INDEX index);
Expand Down

0 comments on commit 228355c

Please sign in to comment.