dn_sched_fq_pie.c (318904) | dn_sched_fq_pie.c (325730) |
---|---|
1/* 2 * FQ_PIE - The FlowQueue-PIE scheduler/AQM 3 * | 1/* 2 * FQ_PIE - The FlowQueue-PIE scheduler/AQM 3 * |
4 * $FreeBSD: stable/11/sys/netpfil/ipfw/dn_sched_fq_pie.c 318904 2017-05-25 22:39:48Z truckman $ | 4 * $FreeBSD: stable/11/sys/netpfil/ipfw/dn_sched_fq_pie.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 --- 774 unchanged lines hidden (view full) --- 787fq_pie_classify_flow(struct mbuf *m, uint16_t fcount, struct fq_pie_si *si) 788{ 789 struct ip *ip; 790 struct tcphdr *th; 791 struct udphdr *uh; 792 uint8_t tuple[41]; 793 uint16_t hash=0; 794 | 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 --- 774 unchanged lines hidden (view full) --- 787fq_pie_classify_flow(struct mbuf *m, uint16_t fcount, struct fq_pie_si *si) 788{ 789 struct ip *ip; 790 struct tcphdr *th; 791 struct udphdr *uh; 792 uint8_t tuple[41]; 793 uint16_t hash=0; 794 |
795 ip = (struct ip *)mtodo(m, dn_tag_get(m)->iphdr_off); |
|
795//#ifdef INET6 796 struct ip6_hdr *ip6; 797 int isip6; | 796//#ifdef INET6 797 struct ip6_hdr *ip6; 798 int isip6; |
798 isip6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0; | 799 isip6 = (ip->ip_v == 6); |
799 800 if(isip6) { | 800 801 if(isip6) { |
801 ip6 = mtod(m, struct ip6_hdr *); | 802 ip6 = (struct ip6_hdr *)ip; |
802 *((uint8_t *) &tuple[0]) = ip6->ip6_nxt; 803 *((uint32_t *) &tuple[1]) = si->perturbation; 804 memcpy(&tuple[5], ip6->ip6_src.s6_addr, 16); 805 memcpy(&tuple[21], ip6->ip6_dst.s6_addr, 16); 806 807 switch (ip6->ip6_nxt) { 808 case IPPROTO_TCP: 809 th = (struct tcphdr *)(ip6 + 1); --- 11 unchanged lines hidden (view full) --- 821 } 822 823 hash = jenkins_hash(tuple, 41, HASHINIT) % fcount; 824 return hash; 825 } 826//#endif 827 828 /* IPv4 */ | 803 *((uint8_t *) &tuple[0]) = ip6->ip6_nxt; 804 *((uint32_t *) &tuple[1]) = si->perturbation; 805 memcpy(&tuple[5], ip6->ip6_src.s6_addr, 16); 806 memcpy(&tuple[21], ip6->ip6_dst.s6_addr, 16); 807 808 switch (ip6->ip6_nxt) { 809 case IPPROTO_TCP: 810 th = (struct tcphdr *)(ip6 + 1); --- 11 unchanged lines hidden (view full) --- 822 } 823 824 hash = jenkins_hash(tuple, 41, HASHINIT) % fcount; 825 return hash; 826 } 827//#endif 828 829 /* IPv4 */ |
829 ip = mtod(m, struct ip *); | |
830 *((uint8_t *) &tuple[0]) = ip->ip_p; 831 *((uint32_t *) &tuple[1]) = si->perturbation; 832 *((uint32_t *) &tuple[5]) = ip->ip_src.s_addr; 833 *((uint32_t *) &tuple[9]) = ip->ip_dst.s_addr; 834 835 switch (ip->ip_p) { 836 case IPPROTO_TCP: 837 th = (struct tcphdr *)(ip + 1); --- 398 unchanged lines hidden --- | 830 *((uint8_t *) &tuple[0]) = ip->ip_p; 831 *((uint32_t *) &tuple[1]) = si->perturbation; 832 *((uint32_t *) &tuple[5]) = ip->ip_src.s_addr; 833 *((uint32_t *) &tuple[9]) = ip->ip_dst.s_addr; 834 835 switch (ip->ip_p) { 836 case IPPROTO_TCP: 837 th = (struct tcphdr *)(ip + 1); --- 398 unchanged lines hidden --- |