Emergency flow cache: Suppress flow removed notification for flows in
emergency flow table, add logic to emergency flow to reject entries with timer
This commit is contained in:
1 parent
46c78aa8aa
commit
36a60a74fc
16 files changed
+139
-141
No files matched your search
+23
-8
@@ -537,7 +537,7 @@ output_packet(struct datapath *dp, struct ofpbuf *buffer, uint16_t out_port)
|
||||
*/
|
||||
void
|
||||
dp_output_port(struct datapath *dp, struct ofpbuf *buffer,
|
||||
int in_port, int out_port, bool ignore_no_fwd)
|
||||
int in_port, int out_port, bool ignore_no_fwd UNUSED)
|
||||
{
|
||||
|
||||
assert(buffer);
|
||||
@@ -735,7 +735,11 @@ dp_send_flow_end(struct datapath *dp, struct sw_flow *flow,
|
||||
struct ofpbuf *buffer;
|
||||
struct nx_flow_end *nfe;
|
||||
|
||||
if (!dp->send_flow_end && !flow->send_flow_exp) {
|
||||
if (!dp->send_flow_end && !flow->send_flow_rem) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (flow->emerg_flow) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -754,7 +758,7 @@ dp_send_flow_end(struct datapath *dp, struct sw_flow *flow,
|
||||
nfe->tcp_flags = flow->tcp_flags;
|
||||
nfe->ip_tos = flow->ip_tos;
|
||||
|
||||
nfe->send_flow_exp = flow->send_flow_exp;
|
||||
nfe->send_flow_exp = flow->send_flow_rem;
|
||||
|
||||
nfe->idle_timeout = htons(flow->idle_timeout);
|
||||
|
||||
@@ -1016,10 +1020,19 @@ add_flow(struct datapath *dp, const struct sender *sender,
|
||||
}
|
||||
}
|
||||
|
||||
if (ntohs(ofm->flags) & OFPFF_EMERG) {
|
||||
if (ntohs(ofm->idle_timeout) != 0 || ntohs(ofm->hard_timeout) != 0) {
|
||||
dp_send_error_msg(dp, sender, OFPET_FLOW_MOD_FAILED,
|
||||
OFPFMFC_EMERG, ofm, ntohs(ofm->header.length));
|
||||
goto error_free_flow;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fill out flow. */
|
||||
flow->idle_timeout = ntohs(ofm->idle_timeout);
|
||||
flow->hard_timeout = ntohs(ofm->hard_timeout);
|
||||
flow->send_flow_exp = (ntohs(ofm->flags) & OFPFF_SEND_FLOW_REM) ? 1 : 0;
|
||||
flow->send_flow_rem = (ntohs(ofm->flags) & OFPFF_SEND_FLOW_REM) ? 1 : 0;
|
||||
flow->emerg_flow = (ntohs(ofm->flags) & OFPFF_EMERG) ? 1 : 0;
|
||||
flow_setup_actions(flow, ofm->actions, actions_len);
|
||||
|
||||
/* Act. */
|
||||
@@ -1092,7 +1105,8 @@ mod_flow(struct datapath *dp, const struct sender *sender,
|
||||
/* Fill out flow. */
|
||||
flow->idle_timeout = ntohs(ofm->idle_timeout);
|
||||
flow->hard_timeout = ntohs(ofm->hard_timeout);
|
||||
flow->send_flow_exp = (ntohs(ofm->flags) & OFPFF_SEND_FLOW_REM) ? 1 : 0;
|
||||
flow->send_flow_rem = (ntohs(ofm->flags) & OFPFF_SEND_FLOW_REM) ? 1 : 0;
|
||||
flow->emerg_flow = (ntohs(ofm->flags) & OFPFF_EMERG) ? 1 : 0;
|
||||
flow_setup_actions(flow, ofm->actions, actions_len);
|
||||
error = chain_insert(dp->chain, flow,
|
||||
(ntohs(ofm->flags) & OFPFF_EMERG) ? 1 : 0);
|
||||
@@ -1407,8 +1421,8 @@ static void port_stats_done(void *state)
|
||||
* };
|
||||
*/
|
||||
static int
|
||||
vendor_stats_init(const void *body, int body_len,
|
||||
void **state)
|
||||
vendor_stats_init(const void *body, int body_len UNUSED,
|
||||
void **state UNUSED)
|
||||
{
|
||||
/* min_body was checked, this should be safe */
|
||||
const uint32_t vendor = ntohl(*((uint32_t *)body));
|
||||
@@ -1423,7 +1437,8 @@ vendor_stats_init(const void *body, int body_len,
|
||||
}
|
||||
|
||||
static int
|
||||
vendor_stats_dump(struct datapath *dp, void *state, struct ofpbuf *buffer)
|
||||
vendor_stats_dump(struct datapath *dp UNUSED, void *state,
|
||||
struct ofpbuf *buffer UNUSED)
|
||||
{
|
||||
const uint32_t vendor = *((uint32_t *)state);
|
||||
int err;
|
||||
|
||||
@@ -78,11 +78,12 @@ protection_callback(struct sw_flow *flow, void *private_)
|
||||
memset(&match, 0, sizeof(match));
|
||||
flow_fill_match(&match, &flow->key.flow, flow->key.wildcards);
|
||||
flow_extract_match(&tgtflow->key, &match);
|
||||
/* Fill out flow. */
|
||||
/* Fill out flow. */
|
||||
tgtflow->priority = flow->priority;
|
||||
tgtflow->idle_timeout = 0;
|
||||
tgtflow->hard_timeout = 0;
|
||||
tgtflow->send_flow_exp = flow->send_flow_exp;
|
||||
tgtflow->send_flow_rem = flow->send_flow_rem;
|
||||
tgtflow->emerg_flow = 0;
|
||||
flow_setup_actions(tgtflow, actions->actions, actions->actions_len);
|
||||
|
||||
error = chain_insert(private->dp->chain, tgtflow, 0);
|
||||
@@ -112,11 +113,11 @@ do_protection(struct datapath *dp)
|
||||
}
|
||||
|
||||
int
|
||||
private_recv_msg(struct datapath *dp, const struct sender *sender,
|
||||
private_recv_msg(struct datapath *dp, const struct sender *sender UNUSED,
|
||||
const void *ofph)
|
||||
{
|
||||
struct private_vxhdr *vxhdr = ofph;
|
||||
struct private_vxopt *vxopt = (vxhdr + 1);
|
||||
struct private_vxhdr *vxhdr = (struct private_vxhdr *)ofph;
|
||||
struct private_vxopt *vxopt = (struct private_vxopt *)(vxhdr + 1);
|
||||
int error = 0;
|
||||
|
||||
switch (ntohs(vxopt->pvo_type)) {
|
||||
|
||||
@@ -185,7 +185,7 @@ flow_setup_actions(struct sw_flow * flow,
|
||||
if (actions_len > flow->sf_acts->actions_len)
|
||||
ofp_fatal(0,
|
||||
"flow_setup_actions: actions_len is too big (%d > %lu)",
|
||||
actions_len, flow->sf_acts->actions_len);
|
||||
actions_len, (unsigned long)flow->sf_acts->actions_len);
|
||||
|
||||
flow->used = flow->created = time_msec();
|
||||
flow->sf_acts->actions_len = actions_len;
|
||||
|
||||
@@ -64,8 +64,9 @@ struct sw_flow {
|
||||
uint64_t created; /* When the flow was created. */
|
||||
uint64_t packet_count; /* Number of packets seen. */
|
||||
uint64_t byte_count; /* Number of bytes seen. */
|
||||
uint8_t reason; /* Reason flow expired (one of NXFER_*). */
|
||||
uint8_t send_flow_exp; /* Send a flow expiry to the controller */
|
||||
uint8_t reason; /* Reason flow removed (one of NXFER_*). */
|
||||
uint8_t send_flow_rem; /* Send a flow removed to the controller */
|
||||
uint8_t emerg_flow; /* Emergency flow indicator */
|
||||
|
||||
uint8_t tcp_flags; /* Union of seen TCP flags. */
|
||||
uint8_t ip_tos; /* IP TOS value. */
|
||||
|
||||
Reference in new issue
Block a user