fq_impl.h (75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37) | fq_impl.h (55667441c84fa5e0911a0aac44fb059c15ba6da2) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright (c) 2016 Qualcomm Atheros, Inc 4 * 5 * Based on net/sched/sch_fq_codel.c 6 */ 7#ifndef __NET_SCHED_FQ_IMPL_H 8#define __NET_SCHED_FQ_IMPL_H --- 94 unchanged lines hidden (view full) --- 103 tin->tx_bytes += skb->len; 104 tin->tx_packets++; 105 106 return skb; 107} 108 109static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb) 110{ | 1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright (c) 2016 Qualcomm Atheros, Inc 4 * 5 * Based on net/sched/sch_fq_codel.c 6 */ 7#ifndef __NET_SCHED_FQ_IMPL_H 8#define __NET_SCHED_FQ_IMPL_H --- 94 unchanged lines hidden (view full) --- 103 tin->tx_bytes += skb->len; 104 tin->tx_packets++; 105 106 return skb; 107} 108 109static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb) 110{ |
111 u32 hash = skb_get_hash_perturb(skb, fq->perturbation); | 111 u32 hash = skb_get_hash_perturb(skb, &fq->perturbation); |
112 113 return reciprocal_scale(hash, fq->flows_cnt); 114} 115 116static struct fq_flow *fq_flow_classify(struct fq *fq, 117 struct fq_tin *tin, u32 idx, 118 struct sk_buff *skb, 119 fq_flow_get_default_t get_default_func) --- 183 unchanged lines hidden (view full) --- 303static int fq_init(struct fq *fq, int flows_cnt) 304{ 305 int i; 306 307 memset(fq, 0, sizeof(fq[0])); 308 INIT_LIST_HEAD(&fq->backlogs); 309 spin_lock_init(&fq->lock); 310 fq->flows_cnt = max_t(u32, flows_cnt, 1); | 112 113 return reciprocal_scale(hash, fq->flows_cnt); 114} 115 116static struct fq_flow *fq_flow_classify(struct fq *fq, 117 struct fq_tin *tin, u32 idx, 118 struct sk_buff *skb, 119 fq_flow_get_default_t get_default_func) --- 183 unchanged lines hidden (view full) --- 303static int fq_init(struct fq *fq, int flows_cnt) 304{ 305 int i; 306 307 memset(fq, 0, sizeof(fq[0])); 308 INIT_LIST_HEAD(&fq->backlogs); 309 spin_lock_init(&fq->lock); 310 fq->flows_cnt = max_t(u32, flows_cnt, 1); |
311 fq->perturbation = prandom_u32(); | 311 get_random_bytes(&fq->perturbation, sizeof(fq->perturbation)); |
312 fq->quantum = 300; 313 fq->limit = 8192; 314 fq->memory_limit = 16 << 20; /* 16 MBytes */ 315 316 fq->flows = kcalloc(fq->flows_cnt, sizeof(fq->flows[0]), GFP_KERNEL); 317 if (!fq->flows) 318 return -ENOMEM; 319 --- 19 unchanged lines hidden --- | 312 fq->quantum = 300; 313 fq->limit = 8192; 314 fq->memory_limit = 16 << 20; /* 16 MBytes */ 315 316 fq->flows = kcalloc(fq->flows_cnt, sizeof(fq->flows[0]), GFP_KERNEL); 317 if (!fq->flows) 318 return -ENOMEM; 319 --- 19 unchanged lines hidden --- |