Skip to content

Commit

Permalink
ofp-errors: Add OFPET_FLOW_MONITOR_FAILED
Browse files Browse the repository at this point in the history
Add OFPET_FLOW_MONITOR_FAILED which is added in OpenFLow1.4.
Map the OFPERR_NXBRC_FM_* errors to the corresponding new OpenFlow errors.

This is a step towards supporting OpenFlow1.4 flow monitors.

Signed-off-by: Simon Horman <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
horms authored and blp committed Jun 13, 2014
1 parent 0f75cc6 commit 04f9f28
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 18 deletions.
47 changes: 32 additions & 15 deletions lib/ofp-errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,6 @@ enum ofperr {
* is not valid. */
OFPERR_NXBRC_BAD_REASON,

/* NX1.0-1.1(1,517), NX1.2+(6). The 'id' in an NXST_FLOW_MONITOR request
* is the same as an existing monitor id (or two monitors in the same
* NXST_FLOW_MONITOR request have the same 'id'). */
OFPERR_NXBRC_FM_DUPLICATE_ID,

/* NX1.0-1.1(1,518), NX1.2+(7). The 'flags' in an NXST_FLOW_MONITOR
* request either does not specify at least one of the NXFMF_ADD,
* NXFMF_DELETE, or NXFMF_MODIFY flags, or specifies a flag bit that is not
* defined. */
OFPERR_NXBRC_FM_BAD_FLAGS,

/* NX1.0-1.1(1,519), NX1.2+(8). The 'id' in an NXT_FLOW_MONITOR_CANCEL
* request is not the id of any existing monitor. */
OFPERR_NXBRC_FM_BAD_ID,

/* NX1.0-1.1(1,520), NX1.2+(9). The 'event' in an NXST_FLOW_MONITOR reply
* does not specify one of the NXFME_ABBREV, NXFME_ADD, NXFME_DELETE, or
* NXFME_MODIFY. */
Expand Down Expand Up @@ -637,6 +622,38 @@ enum ofperr {
/* OF1.4+(17,15). Bundle is locking the resource. */
OFPERR_OFPBFC_BUNDLE_IN_PROGRESS,

/* ## ------------------------- ## */
/* ## OFPET_FLOW_MONITOR_FAILED ## */
/* ## ------------------------- ## */

/* OF1.4+(16,0). Unspecified error. */
OFPERR_OFPMOFC_UNKNOWN,

/* NX1.0-1.1(1,517), NX1.2-1.3(6), OF1.4+(16,1). Monitor not added
* because a Monitor ADD attempted to replace an existing Monitor. */
OFPERR_OFPMOFC_MONITOR_EXISTS,

/* OF1.4+(16,2). Monitor not added because
* Monitor specified is invalid. */
OFPERR_OFPMOFC_INVALID_MONITOR,

/* NX1.0-1.1(1,519), NX1.2-1.3(8), OF1.4+(16,3). Monitor not modified
* because a Monitor MODIFY attempted to modify a non-existent Monitor. */
OFPERR_OFPMOFC_UNKNOWN_MONITOR,

/* OF1.4+(16,4). Unsupported or unknown command. */
OFPERR_OFPMOFC_BAD_COMMAND,

/* NX1.0-1.1(1,518), NX1.2-1.3(7), OF1.4+(16,5). Flag configuration
* unsupported. */
OFPERR_OFPMOFC_BAD_FLAGS,

/* OF1.4+(16,6). Specified table does not exist. */
OFPERR_OFPMOFC_BAD_TABLE_ID,

/* OF1.4+(16,7). Error in output port/group. */
OFPERR_OFPMOFC_BAD_OUT,

/* ## ------------------ ## */
/* ## OFPET_EXPERIMENTER ## */
/* ## ------------------ ## */
Expand Down
2 changes: 1 addition & 1 deletion lib/ofp-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -5232,7 +5232,7 @@ ofputil_decode_flow_monitor_request(struct ofputil_flow_monitor_request *rq,
| NXFMF_MODIFY | NXFMF_ACTIONS | NXFMF_OWN)) {
VLOG_WARN_RL(&bad_ofmsg_rl, "NXST_FLOW_MONITOR has bad flags %#"PRIx16,
flags);
return OFPERR_NXBRC_FM_BAD_FLAGS;
return OFPERR_OFPMOFC_BAD_FLAGS;
}

if (!is_all_zeros(nfmr->zeros, sizeof nfmr->zeros)) {
Expand Down
2 changes: 1 addition & 1 deletion ofproto/connmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,7 @@ ofmonitor_create(const struct ofputil_flow_monitor_request *request,

m = ofmonitor_lookup(ofconn, request->id);
if (m) {
return OFPERR_NXBRC_FM_DUPLICATE_ID;
return OFPERR_OFPMOFC_MONITOR_EXISTS;
}

m = xmalloc(sizeof *m);
Expand Down
2 changes: 1 addition & 1 deletion ofproto/ofproto.c
Original file line number Diff line number Diff line change
Expand Up @@ -4895,7 +4895,7 @@ handle_flow_monitor_cancel(struct ofconn *ofconn, const struct ofp_header *oh)
ofmonitor_destroy(m);
error = 0;
} else {
error = OFPERR_NXBRC_FM_BAD_ID;
error = OFPERR_OFPMOFC_UNKNOWN_MONITOR;
}
ovs_mutex_unlock(&ofproto_mutex);

Expand Down

0 comments on commit 04f9f28

Please sign in to comment.