Skip to content

Commit

Permalink
Combine streams of configured L4 protocol, port into a single stream
Browse files Browse the repository at this point in the history
Change-Id: Iaf6b5ae27fec9d58e60852aee267aacb875a773f
Partial-BUG: 1518234
  • Loading branch information
anandhk-juniper committed Nov 27, 2015
1 parent a5e9411 commit 1cc6cc9
Show file tree
Hide file tree
Showing 10 changed files with 598 additions and 9 deletions.
32 changes: 32 additions & 0 deletions dp-core/vr_bitmap.c
Expand Up @@ -74,6 +74,38 @@ vr_bitmap_alloc_bit(vr_bmap_t b)
return -1;
}

bool
vr_bitmap_is_set_bit(vr_bmap_t b, unsigned int bit)
{
unsigned int bit_data;
struct vr_bitmap *bmap = (struct vr_bitmap *)b;

bit_data = bmap->bmap_data[(bit / VR_BITMAP_STRIDE_LEN)];
if (bit_data & (1 << (bit % VR_BITMAP_STRIDE_LEN)))
return true;

return false;
}

bool
vr_bitmap_set_bit(vr_bmap_t b, unsigned int bit)
{
struct vr_bitmap *bmap = (struct vr_bitmap *)b;

if (!bmap || (bit >= bmap->bmap_bits))
return false;

if (vr_bitmap_is_set_bit(b, bit))
return false;

(void)__sync_fetch_and_or(&bmap->bmap_data[(bit / VR_BITMAP_STRIDE_LEN)],
(1 << (bit % VR_BITMAP_STRIDE_LEN)));
(void)__sync_add_and_fetch(&bmap->bmap_used_bits, 1);

return true;
}


bool
vr_bitmap_clear_bit(vr_bmap_t b, unsigned int bit)
{
Expand Down
21 changes: 21 additions & 0 deletions dp-core/vr_flow.c
Expand Up @@ -1152,6 +1152,27 @@ __vr_flow_forward(flow_result_t result, struct vr_packet *pkt,
return forward;
}

fat_flow_port_mask_t
vr_flow_fat_flow_lookup(struct vrouter *router, struct vr_packet *pkt,
uint16_t l4_proto, uint16_t sport, uint16_t dport)
{
struct vr_nexthop *nh;
struct vr_interface *vif_l = NULL;

if (vif_is_virtual(pkt->vp_if)) {
vif_l = pkt->vp_if;
} else if (vif_is_fabric(pkt->vp_if)) {
if ((nh = pkt->vp_nh) && (nh->nh_flags & NH_FLAG_VALID)) {
vif_l = nh->nh_dev;
}
}

if (!vif_l)
return NO_PORT_MASK;

return vif_fat_flow_lookup(vif_l, l4_proto, sport, dport);
}

bool
vr_flow_forward(struct vrouter *router, struct vr_packet *pkt,
struct vr_forwarding_md *fmd)
Expand Down

0 comments on commit 1cc6cc9

Please sign in to comment.