#include "random.h"
#include "unaligned.h"
#include "type-props.h"
-#include "vlog.h"
+#include "openvswitch/vlog.h"
#include "bitmap.h"
VLOG_DEFINE_THIS_MODULE(ofp_util);
return ofputil_pull_property__(msg, property, 8, typep);
}
-static void PRINTF_FORMAT(2, 3)
+static void OVS_PRINTF_FORMAT(2, 3)
log_property(bool loose, const char *message, ...)
{
enum vlog_level level = loose ? VLL_DBG : VLL_WARN;
/* Encode a meter stat for 'mc' and append it to 'replies'. */
void
-ofputil_append_meter_config(struct list *replies,
+ofputil_append_meter_config(struct ovs_list *replies,
const struct ofputil_meter_config *mc)
{
struct ofpbuf *msg = ofpbuf_from_list(list_back(replies));
/* Encode a meter stat for 'ms' and append it to 'replies'. */
void
-ofputil_append_meter_stats(struct list *replies,
+ofputil_append_meter_stats(struct ovs_list *replies,
const struct ofputil_meter_stats *ms)
{
struct ofp13_meter_stats *reply;
* have been initialized with ofpmp_init(). */
void
ofputil_append_flow_stats_reply(const struct ofputil_flow_stats *fs,
- struct list *replies)
+ struct ovs_list *replies)
{
struct ofpbuf *reply = ofpbuf_from_list(list_back(replies));
size_t start_ofs = ofpbuf_size(reply);
packet_in_size = sizeof (struct ofp12_packet_in);
} else {
packet_in_raw = OFPRAW_OFPT13_PACKET_IN;
- packet_in_version = OFP13_VERSION;
+ packet_in_version = ofputil_protocol_to_ofp_version(protocol);
packet_in_size = sizeof (struct ofp13_packet_in);
}
opi->pi.total_len = htons(pin->total_len);
opi->pi.reason = pin->reason;
opi->pi.table_id = pin->table_id;
- if (protocol == OFPUTIL_P_OF13_OXM) {
+ if (protocol != OFPUTIL_P_OF12_OXM) {
opi->cookie = pin->cookie;
}
return "action";
case OFPR_INVALID_TTL:
return "invalid_ttl";
+ case OFPR_ACTION_SET:
+ return "action_set";
+ case OFPR_GROUP:
+ return "group";
+ case OFPR_PACKET_OUT:
+ return "packet_out";
case OFPR_N_REASONS:
default:
void
ofputil_append_port_desc_stats_reply(const struct ofputil_phy_port *pp,
- struct list *replies)
+ struct ovs_list *replies)
{
struct ofpbuf *reply = ofpbuf_from_list(list_back(replies));
size_t start_ofs = ofpbuf_size(reply);
static uint32_t
ofputil_capabilities_mask(enum ofp_version ofp_version)
{
- /* Handle capabilities whose bit is unique for all Open Flow versions */
+ /* Handle capabilities whose bit is unique for all OpenFlow versions */
switch (ofp_version) {
case OFP10_VERSION:
case OFP11_VERSION:
void
ofputil_append_table_features_reply(const struct ofputil_table_features *tf,
- struct list *replies)
+ struct ovs_list *replies)
{
struct ofpbuf *reply = ofpbuf_from_list(list_back(replies));
enum ofp_version version = ofpmp_version(replies);
}
void
-ofputil_start_flow_update(struct list *replies)
+ofputil_start_flow_update(struct ovs_list *replies)
{
struct ofpbuf *msg;
void
ofputil_append_flow_update(const struct ofputil_flow_update *update,
- struct list *replies)
+ struct ovs_list *replies)
{
enum ofp_version version = ofpmp_version(replies);
struct nx_flow_update_header *nfuh;
}
/* Encode a dump ports request for 'port', the encoded message
- * will be for Open Flow version 'ofp_version'. Returns message
+ * will be for OpenFlow version 'ofp_version'. Returns message
* as a struct ofpbuf. Returns encoded message on success, NULL on error */
struct ofpbuf *
ofputil_encode_dump_ports_request(enum ofp_version ofp_version, ofp_port_t port)
static void
ofputil_append_ofp14_port_stats(const struct ofputil_port_stats *ops,
- struct list *replies)
+ struct ovs_list *replies)
{
struct ofp14_port_stats_prop_ethernet *eth;
struct ofp14_port_stats *ps14;
/* Encode a ports stat for 'ops' and append it to 'replies'. */
void
-ofputil_append_port_stat(struct list *replies,
+ofputil_append_port_stat(struct ovs_list *replies,
const struct ofputil_port_stats *ops)
{
switch (ofpmp_version(replies)) {
/* Frees all of the "struct ofputil_bucket"s in the 'buckets' list. */
void
-ofputil_bucket_list_destroy(struct list *buckets)
+ofputil_bucket_list_destroy(struct ovs_list *buckets)
{
struct ofputil_bucket *bucket, *next_bucket;
* This allows all of 'src' or 'all of 'src' except 'skip' to
* be cloned and appended to 'dest'. */
void
-ofputil_bucket_clone_list(struct list *dest, const struct list *src,
+ofputil_bucket_clone_list(struct ovs_list *dest, const struct ovs_list *src,
const struct ofputil_bucket *skip)
{
struct ofputil_bucket *bucket;
/* Find a bucket in the list 'buckets' whose bucket id is 'bucket_id'
* Returns the first bucket found or NULL if no buckets are found. */
struct ofputil_bucket *
-ofputil_bucket_find(const struct list *buckets, uint32_t bucket_id)
+ofputil_bucket_find(const struct ovs_list *buckets, uint32_t bucket_id)
{
struct ofputil_bucket *bucket;
/* Returns true if more than one bucket in the list 'buckets'
* have the same bucket id. Returns false otherwise. */
bool
-ofputil_bucket_check_duplicate_id(const struct list *buckets)
+ofputil_bucket_check_duplicate_id(const struct ovs_list *buckets)
{
struct ofputil_bucket *i, *j;
/* Returns the bucket at the front of the list 'buckets'.
* Undefined if 'buckets is empty. */
struct ofputil_bucket *
-ofputil_bucket_list_front(const struct list *buckets)
+ofputil_bucket_list_front(const struct ovs_list *buckets)
{
static struct ofputil_bucket *bucket;
/* Returns the bucket at the back of the list 'buckets'.
* Undefined if 'buckets is empty. */
struct ofputil_bucket *
-ofputil_bucket_list_back(const struct list *buckets)
+ofputil_bucket_list_back(const struct ovs_list *buckets)
{
static struct ofputil_bucket *bucket;
* replies already begun in 'replies' and appends it to the list. 'replies'
* must have originally been initialized with ofpmp_init(). */
void
-ofputil_append_group_stats(struct list *replies,
+ofputil_append_group_stats(struct ovs_list *replies,
const struct ofputil_group_stats *gs)
{
size_t bucket_counter_size;
ob = ofpbuf_at_assert(openflow, start, sizeof *ob);
ob->len = htons(ofpbuf_size(openflow) - start);
- ob->actions_len = htons(actions_len);
+ ob->action_array_len = htons(actions_len);
ob->bucket_id = htonl(bucket_id);
}
static void
ofputil_append_ofp11_group_desc_reply(const struct ofputil_group_desc *gds,
- struct list *buckets,
- struct list *replies,
+ struct ovs_list *buckets,
+ struct ovs_list *replies,
enum ofp_version version)
{
struct ofpbuf *reply = ofpbuf_from_list(list_back(replies));
static void
ofputil_append_ofp15_group_desc_reply(const struct ofputil_group_desc *gds,
- struct list *buckets,
- struct list *replies,
+ struct ovs_list *buckets,
+ struct ovs_list *replies,
enum ofp_version version)
{
struct ofpbuf *reply = ofpbuf_from_list(list_back(replies));
* initialized with ofpmp_init(). */
void
ofputil_append_group_desc_reply(const struct ofputil_group_desc *gds,
- struct list *buckets,
- struct list *replies)
+ struct ovs_list *buckets,
+ struct ovs_list *replies)
{
enum ofp_version version = ofpmp_version(replies);
static enum ofperr
ofputil_pull_ofp11_buckets(struct ofpbuf *msg, size_t buckets_length,
- enum ofp_version version, struct list *buckets)
+ enum ofp_version version, struct ovs_list *buckets)
{
struct ofp11_bucket *ob;
uint32_t bucket_id = 0;
static enum ofperr
ofputil_pull_ofp15_buckets(struct ofpbuf *msg, size_t buckets_length,
- enum ofp_version version, struct list *buckets)
+ enum ofp_version version, struct ovs_list *buckets)
{
struct ofp15_bucket *ob;
}
ob_len = ntohs(ob->len);
- actions_len = ntohs(ob->actions_len);
+ actions_len = ntohs(ob->action_array_len);
if (ob_len < sizeof *ob) {
VLOG_WARN_RL(&bad_ofmsg_rl, "OpenFlow message bucket length "
ogm->type = gm->type;
ogm->group_id = htonl(gm->group_id);
ogm->command_bucket_id = htonl(gm->command_bucket_id);
- ogm->bucket_list_len = htons(ofpbuf_size(b) - start_ogm - sizeof *ogm);
+ ogm->bucket_array_len = htons(ofpbuf_size(b) - start_ogm - sizeof *ogm);
id_pool_destroy(bucket_ids);
return b;
return OFPERR_OFPGMFC_BAD_BUCKET;
}
- bucket_list_len = ntohs(ogm->bucket_list_len);
+ bucket_list_len = ntohs(ogm->bucket_array_len);
if (bucket_list_len < ofpbuf_size(msg)) {
VLOG_WARN_RL(&bad_ofmsg_rl, "group has %u trailing bytes",
ofpbuf_size(msg) - bucket_list_len);
}
}
-/* Encode a queue statsrequest for 'oqsr', the encoded message
- * will be fore Open Flow version 'ofp_version'. Returns message
- * as a struct ofpbuf. Returns encoded message on success, NULL on error */
+/* Encode a queue stats request for 'oqsr', the encoded message
+ * will be for OpenFlow version 'ofp_version'. Returns message
+ * as a struct ofpbuf. Returns encoded message on success, NULL on error. */
struct ofpbuf *
ofputil_encode_queue_stats_request(enum ofp_version ofp_version,
const struct ofputil_queue_stats_request *oqsr)
/* Encode a queue stat for 'oqs' and append it to 'replies'. */
void
-ofputil_append_queue_stat(struct list *replies,
+ofputil_append_queue_stat(struct ovs_list *replies,
const struct ofputil_queue_stats *oqs)
{
switch (ofpmp_version(replies)) {