dn_sched_fq_codel.c (302408) | dn_sched_fq_codel.c (325730) |
---|---|
1/* 2 * FQ_Codel - The FlowQueue-Codel scheduler/AQM 3 * | 1/* 2 * FQ_Codel - The FlowQueue-Codel scheduler/AQM 3 * |
4 * $FreeBSD: stable/11/sys/netpfil/ipfw/dn_sched_fq_codel.c 300779 2016-05-26 21:40:13Z truckman $ | 4 * $FreeBSD: stable/11/sys/netpfil/ipfw/dn_sched_fq_codel.c 325730 2017-11-12 01:26:43Z truckman $ |
5 * 6 * Copyright (C) 2016 Centre for Advanced Internet Architectures, 7 * Swinburne University of Technology, Melbourne, Australia. 8 * Portions of this code were made possible in part by a gift from 9 * The Comcast Innovation Fund. 10 * Implemented by Rasool Al-Saadi <ralsaadi@swin.edu.au> 11 * 12 * Redistribution and use in source and binary forms, with or without --- 200 unchanged lines hidden (view full) --- 213fq_codel_classify_flow(struct mbuf *m, uint16_t fcount, struct fq_codel_si *si) 214{ 215 struct ip *ip; 216 struct tcphdr *th; 217 struct udphdr *uh; 218 uint8_t tuple[41]; 219 uint16_t hash=0; 220 | 5 * 6 * Copyright (C) 2016 Centre for Advanced Internet Architectures, 7 * Swinburne University of Technology, Melbourne, Australia. 8 * Portions of this code were made possible in part by a gift from 9 * The Comcast Innovation Fund. 10 * Implemented by Rasool Al-Saadi <ralsaadi@swin.edu.au> 11 * 12 * Redistribution and use in source and binary forms, with or without --- 200 unchanged lines hidden (view full) --- 213fq_codel_classify_flow(struct mbuf *m, uint16_t fcount, struct fq_codel_si *si) 214{ 215 struct ip *ip; 216 struct tcphdr *th; 217 struct udphdr *uh; 218 uint8_t tuple[41]; 219 uint16_t hash=0; 220 |
221 ip = (struct ip *)mtodo(m, dn_tag_get(m)->iphdr_off); |
|
221//#ifdef INET6 222 struct ip6_hdr *ip6; 223 int isip6; | 222//#ifdef INET6 223 struct ip6_hdr *ip6; 224 int isip6; |
224 isip6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0; | 225 isip6 = (ip->ip_v == 6); |
225 226 if(isip6) { | 226 227 if(isip6) { |
227 ip6 = mtod(m, struct ip6_hdr *); | 228 ip6 = (struct ip6_hdr *)ip; |
228 *((uint8_t *) &tuple[0]) = ip6->ip6_nxt; 229 *((uint32_t *) &tuple[1]) = si->perturbation; 230 memcpy(&tuple[5], ip6->ip6_src.s6_addr, 16); 231 memcpy(&tuple[21], ip6->ip6_dst.s6_addr, 16); 232 233 switch (ip6->ip6_nxt) { 234 case IPPROTO_TCP: 235 th = (struct tcphdr *)(ip6 + 1); --- 12 unchanged lines hidden (view full) --- 248 } 249 250 hash = jenkins_hash(tuple, 41, HASHINIT) % fcount; 251 return hash; 252 } 253//#endif 254 255 /* IPv4 */ | 229 *((uint8_t *) &tuple[0]) = ip6->ip6_nxt; 230 *((uint32_t *) &tuple[1]) = si->perturbation; 231 memcpy(&tuple[5], ip6->ip6_src.s6_addr, 16); 232 memcpy(&tuple[21], ip6->ip6_dst.s6_addr, 16); 233 234 switch (ip6->ip6_nxt) { 235 case IPPROTO_TCP: 236 th = (struct tcphdr *)(ip6 + 1); --- 12 unchanged lines hidden (view full) --- 249 } 250 251 hash = jenkins_hash(tuple, 41, HASHINIT) % fcount; 252 return hash; 253 } 254//#endif 255 256 /* IPv4 */ |
256 ip = mtod(m, struct ip *); | |
257 *((uint8_t *) &tuple[0]) = ip->ip_p; 258 *((uint32_t *) &tuple[1]) = si->perturbation; 259 *((uint32_t *) &tuple[5]) = ip->ip_src.s_addr; 260 *((uint32_t *) &tuple[9]) = ip->ip_dst.s_addr; 261 262 switch (ip->ip_p) { 263 case IPPROTO_TCP: 264 th = (struct tcphdr *)(ip + 1); --- 353 unchanged lines hidden --- | 257 *((uint8_t *) &tuple[0]) = ip->ip_p; 258 *((uint32_t *) &tuple[1]) = si->perturbation; 259 *((uint32_t *) &tuple[5]) = ip->ip_src.s_addr; 260 *((uint32_t *) &tuple[9]) = ip->ip_dst.s_addr; 261 262 switch (ip->ip_p) { 263 case IPPROTO_TCP: 264 th = (struct tcphdr *)(ip + 1); --- 353 unchanged lines hidden --- |