Skip to content

Commit

Permalink
Dont delete BGP as a service port once set
Browse files Browse the repository at this point in the history
Right now the BGP As A Service uses the same methodlogy as Link local
services and sets up the flow with link local flag. Once this flag is
set the destination port is added to a bit map by Vrouter and uses when
the packet arrives on Fabric to subject it to Flow. If the flag is
removed from the Flow entry, the port is removed from Bitmap. This
mechanism has a problem if multiple flows use the same destination port
with Link Local flag. Removing the flag from one flow removes the port
from bitmap and because of this packets belonging to other flow never
gets subjected to flow processing as the bitmap does not have the port
any more.

As a temporary fix, a new flag is introduced in flow entry. When this
flag is set, the port is added to bitmap and is never removed from
bitmap even if the flag is removed from flow entry. This way, even if
multiple flows use the same port there would not be any issues.

This fix would be revoked once a new messaging comes between Agent and
Vrouter.

partial-bug: #1551576

Change-Id: I0474a91c3d1275d542f3e4d2ae11bc15f62cdbcf
  • Loading branch information
divakardhar authored and manishsing committed Jun 8, 2016
1 parent 7c74988 commit 320cc4d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 14 deletions.
46 changes: 33 additions & 13 deletions dp-core/vr_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,38 @@ vr_flow_udp_src_port (struct vrouter *router, struct vr_flow_entry *fe)
fe->fe_udp_src_port = port + VR_MUDP_PORT_RANGE_START;
}

static void
vr_flow_update_link_local_port(struct vrouter *router, vr_flow_req *req,
struct vr_flow_entry *fe)
{
bool set_port = false;

if (!req || !fe)
return;

if (fe->fe_type != VP_TYPE_IP)
return;

if (req->fr_flags & VR_FLOW_FLAG_LINK_LOCAL) {
if (!(fe->fe_flags & VR_FLOW_FLAG_LINK_LOCAL))
set_port = true;
} else if (fe->fe_flags & VR_FLOW_FLAG_LINK_LOCAL) {
vr_clear_link_local_port(router, AF_INET, fe->fe_key.flow_proto,
ntohs(fe->fe_key.flow_dport));
}

if (req->fr_flags & VR_FLOW_BGP_SERVICE) {
if (!(fe->fe_flags & VR_FLOW_BGP_SERVICE))
set_port = true;
}

if (set_port) {
vr_set_link_local_port(router, AF_INET, fe->fe_key.flow_proto,
ntohs(fe->fe_key.flow_dport));
}

return;
}

/* command from agent */
static int
Expand Down Expand Up @@ -1845,19 +1877,7 @@ vr_flow_set(struct vrouter *router, vr_flow_req *req)
if (req->fr_flags & VR_FLOW_FLAG_VRFT)
fe->fe_dvrf = req->fr_flow_dvrf;

if (fe->fe_type == VP_TYPE_IP) {
if (req->fr_flags & VR_FLOW_FLAG_LINK_LOCAL) {
if (!(fe->fe_flags & VR_FLOW_FLAG_LINK_LOCAL))
vr_set_link_local_port(router, AF_INET,
fe->fe_key.flow_proto,
ntohs(fe->fe_key.flow_dport));
} else {
if (fe->fe_flags & VR_FLOW_FLAG_LINK_LOCAL)
vr_clear_link_local_port(router, AF_INET,
fe->fe_key.flow_proto,
ntohs(fe->fe_key.flow_dport));
}
}
vr_flow_update_link_local_port(router, req, fe);

fe->fe_ecmp_nh_index = req->fr_ecmp_nh_index;
fe->fe_src_nh_index = req->fr_src_nh_index;
Expand Down
2 changes: 1 addition & 1 deletion include/vr_flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ typedef enum {
#define VR_FLOW_FLAG_TRAP_ECMP 0x20
#define VR_FLOW_FLAG_TRAP_MASK (VR_FLOW_FLAG_TRAP_ECMP)


#define VR_FLOW_FLAG_DELETE_MARKED 0x40
#define VR_FLOW_BGP_SERVICE 0x80

/* Flow Action Reason code */
#define VR_FLOW_DR_UNKNOWN 0x00
Expand Down

0 comments on commit 320cc4d

Please sign in to comment.