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.

Change-Id: I03101536e3ac063f16bc4ea31a4b4f5041a5f2f6
closes-bug: #1698986
  • Loading branch information
divakardhar committed Jun 21, 2017
1 parent 6fe8204 commit 83b005a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
21 changes: 21 additions & 0 deletions dp-core/vr_bridge.c
Expand Up @@ -321,6 +321,27 @@ bridge_lookup(uint8_t *mac, struct vr_forwarding_md *fmd)
return be;
}

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 @@ -1645,8 +1646,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_fmd_label_is_vxlan_id(fmd))
if (!vr_fmd_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 @@ -101,5 +101,6 @@ void *vr_bridge_get_va(struct vrouter *, uint64_t);
unsigned int vr_bridge_table_size(struct vrouter *);
mac_learn_t vr_bridge_learn(struct vrouter *, struct vr_packet *,
struct vr_eth *, struct vr_forwarding_md *);
struct vr_nexthop * __vrouter_bridge_lookup(unsigned int, unsigned char *);

#endif

0 comments on commit 83b005a

Please sign in to comment.