Skip to content

Commit

Permalink
datapath-windows: Define OVS_DPPORT_NUMBER_INVALID
Browse files Browse the repository at this point in the history
The fields externalVport and internalVport of the OVS_SWITCH_CONTEXT
struct are currently defined as PVOID. However, all over the code they
are used as POVS_VPORT_ENTRY. In order to improve clarity and reduce the
need for useless casts to POVS_VPORT_ENTRY, this patch changes the type
from PVOID to POVS_VPORT_ENTRY.

This patch does not cleanup the code that already uses casts to
POVS_VPORT_ENTRY. This cleanup can be done later on as well.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
  • Loading branch information
Alin Serdean authored and blp committed Oct 9, 2014
1 parent 9930aae commit 29a5b29
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions datapath-windows/ovsext/Datapath.c
Expand Up @@ -1462,7 +1462,7 @@ OvsGetVportDumpNext(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
*/
ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
NdisAcquireRWLockRead(gOvsSwitchContext->dispatchLock, &lockState,
NDIS_RWL_AT_DISPATCH_LEVEL);
NDIS_RWL_AT_DISPATCH_LEVEL);

if (gOvsSwitchContext->numVports > 0) {
/* inBucket: the bucket, used for lookup */
Expand Down Expand Up @@ -1490,7 +1490,7 @@ OvsGetVportDumpNext(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
if (outIndex >= inIndex) {
vport = CONTAINING_RECORD(link, OVS_VPORT_ENTRY, portLink);

if (vport->portNo != 0) {
if (vport->portNo != OVS_DPPORT_NUMBER_INVALID) {
OvsCreateMsgFromVport(vport, msgIn,
usrParamsCtx->outputBuffer,
usrParamsCtx->outputLength,
Expand Down
2 changes: 1 addition & 1 deletion datapath-windows/ovsext/Vport.c
Expand Up @@ -718,7 +718,7 @@ POVS_VPORT_ENTRY vport)
vport->nicIndex != 0) {
vport->portNo = OvsGetVportNo(switchContext, vport->nicIndex,
vport->ovsType, vport->portType == NdisSwitchPortTypeExternal);
if (vport->portNo == 0) {
if (vport->portNo == OVS_DPPORT_NUMBER_INVALID) {
return NDIS_STATUS_RESOURCES;
}
ASSERT(OVS_IS_VPORT_ENTRY_NULL(switchContext,
Expand Down
2 changes: 2 additions & 0 deletions datapath-windows/ovsext/Vport.h
Expand Up @@ -19,6 +19,8 @@

#include "Switch.h"

#define OVS_DPPORT_NUMBER_INVALID 0

/*
* A Vport, or Virtual Port, is a port on the OVS. It can be one of the
* following types. Some of the Vports are "real" ports on the hyper-v switch,
Expand Down

0 comments on commit 29a5b29

Please sign in to comment.