Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- /mnt/HDD/Projects/Sophos/linux-kernel/net/sched/sch_prio.c
- +++ /mnt/HDD/Projects/Sophos/linux-kernel/net/sched/sch_headprio.c
- @@ -37,9 +37,18 @@
- u32 band = skb->priority;
- struct tcf_result res;
- int err;
- + /*Change start*/
- + //Storing major number of skb->prio from ffff---- to 0000ffff
- + int majorofband=TC_H_MAJ(band)>>ffz(TC_H_MIN_MASK);
- + //For all child qdisc only
- + if(likely(majorofband!=0 && majorofband<=q->bands)){
- + //As per our implementation, all child of this prio are 1:,2:.. bands:
- + band=TC_H_MAKE(sch->handle,majorofband); //changing band from X:Y to Z:X where X=child qdisc Z=prio
- + }
- + /*Change end*/
- *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
- - if (TC_H_MAJ(skb->priority) != sch->handle) {
- + if (TC_H_MAJ(band) != sch->handle) { //minor change instead of skb->prio we use band (but ideally band=skb->prio)
- err = tc_classify(skb, q->filter_list, &res);
- --- /mnt/HDD/Projects/Sophos/linux-kernel/net/sched/sch_prio.c
- +++ /mnt/HDD/Projects/Sophos/linux-kernel/net/sched/sch_leafprio.c
- +
- +
- +extern struct Qdisc_ops sfq_qdisc_ops;
- +
- +#define XT_DSCP_MASK 0xfc /* 11111100*/
- +#define EF_DSCP_VAL 0xb8 /* 10111000*/
- +/* Prioritizing Expedited Forwarding traffic */
- +static inline char rt_tos2priority_leafprio(u8 tos){
- + if((tos & XT_DSCP_MASK) == EF_DSCP_VAL){
- + return TC_PRIO_INTERACTIVE;
- + }else{
- + return TC_PRIO_BESTEFFORT;
- + }
- +}
- struct prio_sched_data {
- @@ -29,14 +49,47 @@
- struct Qdisc *queues[TCQ_PRIO_BANDS];
- };
- -
- static struct Qdisc *
- prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
- {
- struct prio_sched_data *q = qdisc_priv(sch);
- u32 band = skb->priority;
- struct tcf_result res;
- - int err;
- + int err, protooff = 0;
- + struct tcphdr _thdr, *thp;
- +
- + if (TC_H_MAJ(skb->priority) != sch->handle){
- + switch (skb->protocol) {
- + case htons(ETH_P_IP):
- + band = rt_tos2priority_leafprio(ip_hdr(skb)->tos);
- + /* favouring tcp pkts with NO_DATA (Ack etc) thereby trying to
- + reduce retransmission due to delayed acks*/
- + if (unlikely((band != TC_PRIO_INTERACTIVE) && (skb->len < 128)
- + && (ip_hdr(skb)->protocol == IPPROTO_TCP))){
- + thp = skb_header_pointer(skb, ip_hdr(skb)->ihl<<2, sizeof(_thdr), &_thdr);
- + /* ip hrd size + tcp hdr size = ip datagram size (i.e. no tcp data)*/
- + if(likely(thp && (((ip_hdr(skb)->ihl<<2) + (thp->doff<<2)) == skb->len))){
- + band = TC_PRIO_INTERACTIVE;
- + }
- + }
- + break;
- +
- + case htons(ETH_P_IPV6):
- + band = rt_tos2priority_leafprio(ipv6_get_dsfield((const struct ipv6hdr *)ipv6_hdr(skb)));
- + /* favouring tcp pkts with NO_DATA (Ack etc) thereby trying to
- + reduce retransmission due to delayed acks, with assumption that
- + there will be limited extra-headers in ipv6 header.*/
- + if (unlikely((band != TC_PRIO_INTERACTIVE) && (skb->len < 128)
- + && ipv6_find_hdr(skb, &protooff, IPPROTO_TCP, NULL, NULL) == IPPROTO_TCP)){
- + thp = skb_header_pointer(skb, protooff, sizeof(_thdr), &_thdr);
- + /* ip hrd size + tcp hdr size = ip datagram size (i.e. no tcp data)*/
- + if(likely(thp && ((protooff + (thp->doff<<2)) == skb->len))){
- + band = TC_PRIO_INTERACTIVE;
- + }
- + }
- + break;
- + }
- + }
- *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
- if (TC_H_MAJ(skb->priority) != sch->handle) {
- @@ -200,7 +253,7 @@
- struct Qdisc *child, *old;
- child = qdisc_create_dflt(sch->dev_queue,
- - &pfifo_qdisc_ops,
- + &sfq_qdisc_ops,
- TC_H_MAKE(sch->handle, i + 1));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement