Skip to content

Commit

Permalink
Fill the NH of the packet in fragment assembler
Browse files Browse the repository at this point in the history
When fragments are recieved out of order, assembler code caches them
till head fragment is received. While holding the packet, packet's nh is
not cached to avoid taking a reference to NH. Once the head fragment is
received, these out of order fragments are released for flow processing.
While doing this, packet's nh is not filled if the encap is Vxlan packet
as this requires a mac address lookup. For Mpls packets, label is looked
up to extract the NH. Not filling the NH, is resulting in Flow lookup
failure as NH id is also a key for the flow table. Failure to look up
the original flow entry (of head fragment) results in either creating
the new flow entry (with wrong key nh id) in Hold state, or dropping the
packet without flow processing.

To avoid this, bridge look up is done in the given VRF, to extract the
NH.

closes-bug: #1698986

Conflicts:
	dp-core/vr_bridge.c
	dp-core/vr_flow.c
	include/vr_bridge.h

Change-Id: Idf50ba23c1b04c828080cf258d1af35205bb1b4a
  • Loading branch information
divakardhar committed Jun 21, 2017
1 parent 07aaa41 commit f107eaf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
19 changes: 19 additions & 0 deletions dp-core/vr_bridge.c
Expand Up @@ -252,6 +252,25 @@ bridge_table_lookup(unsigned int vrf_id, struct vr_route_req *rt)
return rt->rtr_nh;
}

struct vr_nexthop *
__vrouter_bridge_lookup(unsigned int vrf_id, unsigned char *mac)
{
struct vr_route_req rt;

if (!mac)
return NULL;

rt.rtr_req.rtr_label_flags = 0;
rt.rtr_req.rtr_index = VR_BE_INVALID_INDEX;
rt.rtr_req.rtr_mac_size = VR_ETHER_ALEN;
rt.rtr_req.rtr_mac = mac;
/* If multicast L2 packet, use broadcast composite nexthop */
if (IS_MAC_BMCAST(rt.rtr_req.rtr_mac))
rt.rtr_req.rtr_mac = (int8_t *)vr_bcast_mac;
rt.rtr_req.rtr_vrf_id = vrf_id;

return vr_bridge_lookup(vrf_id, &rt);
}

unsigned short
vr_bridge_route_flags(unsigned int vrf_id, unsigned char *mac)
Expand Down
7 changes: 6 additions & 1 deletion dp-core/vr_flow.c
Expand Up @@ -18,6 +18,7 @@
#include "vr_datapath.h"
#include "vr_hash.h"
#include "vr_ip_mtrie.h"
#include "vr_bridge.h"

#define VR_NUM_FLOW_TABLES 1

Expand Down Expand Up @@ -1436,8 +1437,12 @@ vr_flow_flush_pnode(struct vrouter *router, struct vr_packet_node *pnode,
if (!pkt->vp_nh) {
if (vif_is_fabric(pkt->vp_if) && fmd &&
(fmd->fmd_label >= 0)) {
if (!vr_forwarding_md_label_is_vxlan_id(fmd))
if (!vr_forwarding_md_label_is_vxlan_id(fmd)) {
pkt->vp_nh = __vrouter_get_label(router, fmd->fmd_label);
} else {
pkt->vp_nh = __vrouter_bridge_lookup(fmd->fmd_dvrf,
pkt_data(pkt));
}
}
}

Expand Down
1 change: 1 addition & 0 deletions include/vr_bridge.h
Expand Up @@ -45,5 +45,6 @@ extern char vr_bcast_mac[];

unsigned int vr_bridge_table_used_oflow_entries(struct vrouter *);
unsigned int vr_bridge_table_used_total_entries(struct vrouter *);
struct vr_nexthop * __vrouter_bridge_lookup(unsigned int, unsigned char *);

#endif

0 comments on commit f107eaf

Please sign in to comment.