diff options
author | Alex Wang <alexw@nicira.com> | 2013-06-19 16:58:44 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-06-20 10:42:37 -0700 |
commit | 4e022ec09e14ac89add74c1b4b8e3ff3873edbf0 (patch) | |
tree | a6817234d1d992d2a7970865c1464dfaaf247c7f /ofproto/netflow.h | |
parent | e6cc0babc25de1800aeffad66d2804e64e5bd602 (diff) | |
download | openvswitch-4e022ec09e14ac89add74c1b4b8e3ff3873edbf0.tar.gz |
Create specific types for ofp and odp port
Until now, datapath ports and openflow ports were both represented by
unsigned integers of various sizes. With implicit conversions, etc., it is
easy to mix them up and use one where the other is expected. This commit
creates two typedefs, ofp_port_t and odp_port_t. Both of these two types
are marked by "__attribute__((bitwise))" so that sparse can be used to
detect any misuse.
Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'ofproto/netflow.h')
-rw-r--r-- | ofproto/netflow.h | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/ofproto/netflow.h b/ofproto/netflow.h index 969154567..7e6debcd2 100644 --- a/ofproto/netflow.h +++ b/ofproto/netflow.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2011, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,11 +38,9 @@ struct netflow_options { bool add_id_to_iface; }; -enum netflow_output_ports { - NF_OUT_FLOOD = UINT16_MAX, - NF_OUT_MULTI = UINT16_MAX - 1, - NF_OUT_DROP = UINT16_MAX - 2 -}; +#define NF_OUT_FLOOD OFP_PORT_C(UINT16_MAX) +#define NF_OUT_MULTI OFP_PORT_C(UINT16_MAX - 1) +#define NF_OUT_DROP OFP_PORT_C(UINT16_MAX - 2) struct netflow_flow { long long int last_expired; /* Time this flow last timed out. */ @@ -51,7 +49,7 @@ struct netflow_flow { uint64_t packet_count_off; /* Packet count at last time out. */ uint64_t byte_count_off; /* Byte count at last time out. */ - uint16_t output_iface; /* Output interface index. */ + ofp_port_t output_iface; /* Output interface index. */ uint8_t tcp_flags; /* Bitwise-OR of all TCP flags seen. */ }; |