Skip to content

Commit

Permalink
Merge "Fix DSCP bits position in the IP header" into R3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jul 20, 2016
2 parents 47b9067 + 839a6fb commit 43a5ed9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions dp-core/vr_nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ nh_udp_tunnel_helper(struct vr_packet *pkt, unsigned short sport,
ip->ip_version = 4;
ip->ip_hl = 5;
if (qos) {
ip->ip_tos = qos->vfcq_dscp;
ip->ip_tos = VR_IP_DSCP(qos->vfcq_dscp);
pkt->vp_queue = qos->vfcq_queue_id + 1;
pkt->vp_priority = qos->vfcq_dotonep_qos;
} else {
Expand Down Expand Up @@ -1869,7 +1869,7 @@ nh_gre_tunnel(struct vr_packet *pkt, struct vr_nexthop *nh,
ip->ip_version = 4;
ip->ip_hl = 5;
if (qos) {
ip->ip_tos = qos->vfcq_dscp;
ip->ip_tos = VR_IP_DSCP(qos->vfcq_dscp);
pkt->vp_queue = qos->vfcq_queue_id + 1;
pkt->vp_priority = qos->vfcq_dotonep_qos;
} else {
Expand Down Expand Up @@ -1998,7 +1998,7 @@ nh_encap_l2(struct vr_packet *pkt, struct vr_nexthop *nh,
if (qos) {
if (pkt->vp_type == VP_TYPE_IP) {
vr_inet_set_tos((struct vr_ip *)pkt_network_header(pkt),
qos->vfcq_dscp);
VR_IP_DSCP(qos->vfcq_dscp));
} else if (pkt->vp_type == VP_TYPE_IP6) {
vr_inet6_set_tos((struct vr_ip6 *)pkt_network_header(pkt),
qos->vfcq_dscp);
Expand Down Expand Up @@ -2066,7 +2066,7 @@ nh_encap_l3(struct vr_packet *pkt, struct vr_nexthop *nh,
} else if (vr_ip_is_ip4(ip)) {
pkt->vp_type = VP_TYPE_IP;
if (qos)
vr_inet_set_tos(ip, qos->vfcq_dscp);
vr_inet_set_tos(ip, VR_IP_DSCP(qos->vfcq_dscp));
} else {
vr_pfree(pkt, VP_DROP_INVALID_PROTOCOL);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion dp-core/vr_proto_ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ vr_ip_rcv(struct vrouter *router, struct vr_packet *pkt,
}

if (qos) {
vr_inet_set_tos(ip, qos->vfcq_dscp);
vr_inet_set_tos(ip, VR_IP_DSCP(qos->vfcq_dscp));
pkt->vp_queue = qos->vfcq_queue_id + 1;
pkt->vp_priority = qos->vfcq_dotonep_qos;
}
Expand Down
11 changes: 6 additions & 5 deletions include/vr_packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,12 @@ vr_grat_arp(struct vr_arp *sarp)
return false;
}

#define VR_IP_DF (0x1 << 14)
#define VR_IP_MF (0x1 << 13)
#define VR_IP_FRAG_OFFSET_MASK (VR_IP_MF - 1)
#define VR_IP_DF (0x1 << 14)
#define VR_IP_MF (0x1 << 13)
#define VR_IP_FRAG_OFFSET_MASK (VR_IP_MF - 1)
#define VR_IP_DSCP(val) ((val) << 2)

#define VR_IP_ADDRESS_LEN 4
#define VR_IP_ADDRESS_LEN 4

struct vr_ip {
#if defined(__KERNEL__) && defined(__linux__)
Expand Down Expand Up @@ -408,7 +409,7 @@ vr_ip_incremental_csum(struct vr_ip *ip, unsigned int diff)
static inline uint8_t
vr_inet_get_tos(struct vr_ip *iph)
{
return iph->ip_tos & 0x3F;
return (iph->ip_tos & 0xFC) >> 2;
}

static inline void
Expand Down

0 comments on commit 43a5ed9

Please sign in to comment.