X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fofp-util.h;h=ad9f2bbbde4cd529f66f0ae04278f532fceab4cd;hb=03e1125c312b223a28eb75454cc418a044df3ade;hp=38e7b029d021ffa65a0d57ca7129c8267c2b812a;hpb=3ddcaf2d7de751346775b3d6183d01a0c0986ce0;p=openvswitch diff --git a/lib/ofp-util.h b/lib/ofp-util.h index 38e7b029..ad9f2bbb 100644 --- a/lib/ofp-util.h +++ b/lib/ofp-util.h @@ -36,7 +36,7 @@ enum ofperr ofputil_port_from_ofp11(ovs_be32 ofp11_port, uint16_t *ofp10_port); ovs_be32 ofputil_port_to_ofp11(uint16_t ofp10_port); enum ofperr ofputil_check_output_port(uint16_t ofp_port, int max_ports); -uint16_t ofputil_port_from_string(const char *); +bool ofputil_port_from_string(const char *, uint16_t *portp); void ofputil_format_port(uint16_t port, struct ds *); /* Converting OFPFW10_NW_SRC_MASK and OFPFW10_NW_DST_MASK wildcard bit counts @@ -98,6 +98,32 @@ char *ofputil_protocols_to_string(enum ofputil_protocol); enum ofputil_protocol ofputil_protocols_from_string(const char *); enum ofputil_protocol ofputil_usable_protocols(const struct match *); +void ofputil_format_version(struct ds *, enum ofp_version); +void ofputil_format_version_name(struct ds *, enum ofp_version); + +/* A bitmap of version numbers + * + * Bit offsets correspond to ofp_version numbers which in turn correspond to + * wire-protocol numbers for Open Flow versions.. E.g. (1u << OFP11_VERSION) + * is the mask for Open Flow 1.1. If the bit for a version is set then it is + * allowed, otherwise it is disallowed. */ + +void ofputil_format_version_bitmap(struct ds *msg, uint32_t bitmap); +void ofputil_format_version_bitmap_names(struct ds *msg, uint32_t bitmap); + +/* Bitmap of OpenFlow versions that Open vSwitch supports. */ +#define OFPUTIL_SUPPORTED_VERSIONS \ + ((1u << OFP10_VERSION) | (1u << OFP12_VERSION)) + +/* Bitmap of OpenFlow versions to enable by default (a subset of + * OFPUTIL_SUPPORTED_VERSIONS). */ +#define OFPUTIL_DEFAULT_VERSIONS (1u << OFP10_VERSION) + +enum ofputil_protocol ofputil_protocols_from_string(const char *s); + +const char *ofputil_version_to_string(enum ofp_version ofp_version); +uint32_t ofputil_versions_from_string(const char *s); + struct ofpbuf *ofputil_encode_set_protocol(enum ofputil_protocol current, enum ofputil_protocol want, enum ofputil_protocol *next); @@ -131,7 +157,8 @@ ovs_be16 ofputil_dl_type_from_openflow(ovs_be16 ofp_dl_type); bool ofputil_packet_in_format_is_valid(enum nx_packet_in_format); int ofputil_packet_in_format_from_string(const char *); const char *ofputil_packet_in_format_to_string(enum nx_packet_in_format); -struct ofpbuf *ofputil_make_set_packet_in_format(enum nx_packet_in_format); +struct ofpbuf *ofputil_make_set_packet_in_format(enum ofp_version, + enum nx_packet_in_format); /* NXT_FLOW_MOD_TABLE_ID extension. */ struct ofpbuf *ofputil_make_flow_mod_table_id(bool flow_mod_table_id); @@ -243,6 +270,7 @@ struct ofputil_flow_removed { uint16_t priority; ovs_be64 cookie; uint8_t reason; /* One of OFPRR_*. */ + uint8_t table_id; /* 255 if message didn't include table ID. */ uint32_t duration_sec; uint32_t duration_nsec; uint16_t idle_timeout; @@ -538,6 +566,7 @@ bool ofputil_frag_handling_from_string(const char *, enum ofp_config_flags *); * OFPUTIL_OFPAT10_ENQUEUE * OFPUTIL_NXAST_RESUBMIT * OFPUTIL_NXAST_SET_TUNNEL + * OFPUTIL_NXAST_SET_METADATA * OFPUTIL_NXAST_SET_QUEUE * OFPUTIL_NXAST_POP_QUEUE * OFPUTIL_NXAST_REG_MOVE @@ -618,4 +647,43 @@ union ofp_action *ofputil_actions_clone(const union ofp_action *, size_t n); /* Handy utility for parsing flows and actions. */ bool ofputil_parse_key_value(char **stringp, char **keyp, char **valuep); +struct ofpbuf *ofputlil_dump_ports(enum ofp_version ofp_version, int16_t port); + +struct ofputil_port_stats { + uint16_t port_no; + struct netdev_stats stats; +}; + +struct ofpbuf *ofputil_encode_dump_ports_request(enum ofp_version ofp_version, + int16_t port); +void ofputil_append_port_stat(struct list *replies, + const struct ofputil_port_stats *ops); +size_t ofputil_count_port_stats(const struct ofp_header *); +int ofputil_decode_port_stats(struct ofputil_port_stats *, struct ofpbuf *msg); +enum ofperr ofputil_decode_port_stats_request(const struct ofp_header *request, + uint16_t *ofp10_port); + +struct ofputil_queue_stats_request { + uint16_t port_no; + uint32_t queue_id; +}; + +enum ofperr +ofputil_decode_queue_stats_request(const struct ofp_header *request, + struct ofputil_queue_stats_request *oqsr); +struct ofpbuf * +ofputil_encode_queue_stats_request(enum ofp_version ofp_version, + const struct ofputil_queue_stats_request *oqsr); + +struct ofputil_queue_stats { + uint16_t port_no; + uint32_t queue_id; + struct netdev_queue_stats stats; +}; + +size_t ofputil_count_queue_stats(const struct ofp_header *); +int ofputil_decode_queue_stats(struct ofputil_queue_stats *qs, struct ofpbuf *msg); +void ofputil_append_queue_stat(struct list *replies, + const struct ofputil_queue_stats *oqs); + #endif /* ofp-util.h */