Skip to content

Commit

Permalink
Merge "Keeping ingres vif id in L2 header for post GRO processing" in…
Browse files Browse the repository at this point in the history
…to R2.21.x
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Mar 16, 2016
2 parents fd0566f + ca4e275 commit 1ebac01
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
11 changes: 9 additions & 2 deletions dp-core/vr_datapath.c
Expand Up @@ -653,7 +653,7 @@ vr_tag_pkt(struct vr_packet *pkt, unsigned short vlan_id)
int
vr_gro_input(struct vr_packet *pkt, struct vr_nexthop *nh)
{
unsigned short *nh_id;
unsigned short *nh_id, *vif_id;
int handled = 1;

if (!vr_gro_process)
Expand All @@ -664,8 +664,15 @@ vr_gro_input(struct vr_packet *pkt, struct vr_nexthop *nh)
vr_pfree(pkt, VP_DROP_PUSH);
return handled;
}

*nh_id = nh->nh_id;

vif_id = (unsigned short *)pkt_push(pkt, sizeof(*vif_id));
if (!vif_id) {
vr_pfree(pkt, VP_DROP_PUSH);
return handled;
}
*vif_id = pkt->vp_if->vif_idx;

handled = vr_gro_process(pkt, nh->nh_dev, (nh->nh_family == AF_BRIDGE));
return handled;
}
17 changes: 13 additions & 4 deletions linux/vr_host_interface.c
Expand Up @@ -1769,9 +1769,12 @@ pkt_gro_dev_setup(struct net_device *dev)
* undergoing GRO at the moment. In our case, each VM wil have
* unique nexthop id associated with it, so we can use nexthop id
* as the MAC header to combine packets destined for the same vif.
* In addition to nh id, we need to keep the context of receiving
* inteface, post gro, for packet processing. So vif id inaddition
* to nh id is used as L2 header
*/

dev->hard_header_len = sizeof(unsigned short);
dev->hard_header_len = 2 * sizeof(unsigned short);

dev->type = ARPHRD_VOID;
dev->netdev_ops = &pkt_gro_dev_ops;
Expand All @@ -1785,7 +1788,7 @@ static void
pkt_l2_gro_dev_setup(struct net_device *dev)
{
pkt_gro_dev_setup(dev);
dev->hard_header_len = sizeof(unsigned short) + VR_ETHER_HLEN;
dev->hard_header_len = 2 * sizeof(unsigned short) + VR_ETHER_HLEN;
return;
}

Expand Down Expand Up @@ -1984,7 +1987,7 @@ lh_gro_process(struct vr_packet *pkt, struct vr_interface *vif, bool l2_pkt)
static rx_handler_result_t
pkt_gro_dev_rx_handler(struct sk_buff **pskb)
{
unsigned short nh_id, drop_reason;
unsigned short nh_id, vif_id, drop_reason;
struct vr_nexthop *nh;
struct vr_interface *vif;
struct vr_interface *gro_vif;
Expand All @@ -2003,7 +2006,8 @@ pkt_gro_dev_rx_handler(struct sk_buff **pskb)
goto drop;
}
#else
nh_id = *((unsigned short *) skb_mac_header(skb));
vif_id = *((unsigned short *)skb_mac_header(skb));
nh_id = *((unsigned short *)(skb_mac_header(skb) + sizeof(vif_id)));
#endif


Expand Down Expand Up @@ -2033,6 +2037,11 @@ pkt_gro_dev_rx_handler(struct sk_buff **pskb)
* since vif was not available when we did linux_get_packet, set vif
* manually here
*/
vif = __vrouter_get_interface(router, vif_id);
if (!vif) {
drop_reason = VP_DROP_INVALID_IF;
goto drop;
}
pkt->vp_if = vif;

vr_init_forwarding_md(&fmd);
Expand Down

0 comments on commit 1ebac01

Please sign in to comment.