diff options
| author | David S. Miller <davem@davemloft.net> | 2017-10-11 13:15:01 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2017-10-11 13:15:01 -0400 |
| commit | df2fd38a08272fcc2c658f2c4d7d6318e8da593e (patch) | |
| tree | 0573548f36917a3af84d571cac557da6f5eab032 /include/net/fq_impl.h | |
| parent | b8226962b1c49c784aeddb9d2fafbf53dfdc2190 (diff) | |
| parent | 90a53e4432b12288316efaa5f308adafb8d304b0 (diff) | |
Merge tag 'mac80211-next-for-davem-2017-10-11' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next
Johannes Berg says:
====================
Work continues in various areas:
* port authorized event for 4-way-HS offload (Avi)
* enable MFP optional for such devices (Emmanuel)
* Kees's timer setup patch for mac80211 mesh
(the part that isn't trivially scripted)
* improve VLAN vs. TXQ handling (myself)
* load regulatory database as firmware file (myself)
* with various other small improvements and cleanups
I merged net-next once in the meantime to allow Kees's
timer setup patch to go in.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/fq_impl.h')
| -rw-r--r-- | include/net/fq_impl.h | 72 |
1 files changed, 62 insertions, 10 deletions
diff --git a/include/net/fq_impl.h b/include/net/fq_impl.h index 4e6131cd3f43..8b237e4afee6 100644 --- a/include/net/fq_impl.h +++ b/include/net/fq_impl.h | |||
| @@ -12,24 +12,22 @@ | |||
| 12 | 12 | ||
| 13 | /* functions that are embedded into includer */ | 13 | /* functions that are embedded into includer */ |
| 14 | 14 | ||
| 15 | static struct sk_buff *fq_flow_dequeue(struct fq *fq, | 15 | static void fq_adjust_removal(struct fq *fq, |
| 16 | struct fq_flow *flow) | 16 | struct fq_flow *flow, |
| 17 | struct sk_buff *skb) | ||
| 17 | { | 18 | { |
| 18 | struct fq_tin *tin = flow->tin; | 19 | struct fq_tin *tin = flow->tin; |
| 19 | struct fq_flow *i; | ||
| 20 | struct sk_buff *skb; | ||
| 21 | |||
| 22 | lockdep_assert_held(&fq->lock); | ||
| 23 | |||
| 24 | skb = __skb_dequeue(&flow->queue); | ||
| 25 | if (!skb) | ||
| 26 | return NULL; | ||
| 27 | 20 | ||
| 28 | tin->backlog_bytes -= skb->len; | 21 | tin->backlog_bytes -= skb->len; |
| 29 | tin->backlog_packets--; | 22 | tin->backlog_packets--; |
| 30 | flow->backlog -= skb->len; | 23 | flow->backlog -= skb->len; |
| 31 | fq->backlog--; | 24 | fq->backlog--; |
| 32 | fq->memory_usage -= skb->truesize; | 25 | fq->memory_usage -= skb->truesize; |
| 26 | } | ||
| 27 | |||
| 28 | static void fq_rejigger_backlog(struct fq *fq, struct fq_flow *flow) | ||
| 29 | { | ||
| 30 | struct fq_flow *i; | ||
| 33 | 31 | ||
| 34 | if (flow->backlog == 0) { | 32 | if (flow->backlog == 0) { |
| 35 | list_del_init(&flow->backlogchain); | 33 | list_del_init(&flow->backlogchain); |
| @@ -43,6 +41,21 @@ static struct sk_buff *fq_flow_dequeue(struct fq *fq, | |||
| 43 | list_move_tail(&flow->backlogchain, | 41 | list_move_tail(&flow->backlogchain, |
| 44 | &i->backlogchain); | 42 | &i->backlogchain); |
| 45 | } | 43 | } |
| 44 | } | ||
| 45 | |||
| 46 | static struct sk_buff *fq_flow_dequeue(struct fq *fq, | ||
| 47 | struct fq_flow *flow) | ||
| 48 | { | ||
| 49 | struct sk_buff *skb; | ||
| 50 | |||
| 51 | lockdep_assert_held(&fq->lock); | ||
| 52 | |||
| 53 | skb = __skb_dequeue(&flow->queue); | ||
| 54 | if (!skb) | ||
| 55 | return NULL; | ||
| 56 | |||
| 57 | fq_adjust_removal(fq, flow, skb); | ||
| 58 | fq_rejigger_backlog(fq, flow); | ||
| 46 | 59 | ||
| 47 | return skb; | 60 | return skb; |
| 48 | } | 61 | } |
| @@ -188,6 +201,45 @@ static void fq_tin_enqueue(struct fq *fq, | |||
| 188 | } | 201 | } |
| 189 | } | 202 | } |
| 190 | 203 | ||
| 204 | static void fq_flow_filter(struct fq *fq, | ||
| 205 | struct fq_flow *flow, | ||
| 206 | fq_skb_filter_t filter_func, | ||
| 207 | void *filter_data, | ||
| 208 | fq_skb_free_t free_func) | ||
| 209 | { | ||
| 210 | struct fq_tin *tin = flow->tin; | ||
| 211 | struct sk_buff *skb, *tmp; | ||
| 212 | |||
| 213 | lockdep_assert_held(&fq->lock); | ||
| 214 | |||
| 215 | skb_queue_walk_safe(&flow->queue, skb, tmp) { | ||
| 216 | if (!filter_func(fq, tin, flow, skb, filter_data)) | ||
| 217 | continue; | ||
| 218 | |||
| 219 | __skb_unlink(skb, &flow->queue); | ||
| 220 | fq_adjust_removal(fq, flow, skb); | ||
| 221 | free_func(fq, tin, flow, skb); | ||
| 222 | } | ||
| 223 | |||
| 224 | fq_rejigger_backlog(fq, flow); | ||
| 225 | } | ||
| 226 | |||
| 227 | static void fq_tin_filter(struct fq *fq, | ||
| 228 | struct fq_tin *tin, | ||
| 229 | fq_skb_filter_t filter_func, | ||
| 230 | void *filter_data, | ||
| 231 | fq_skb_free_t free_func) | ||
| 232 | { | ||
| 233 | struct fq_flow *flow; | ||
| 234 | |||
| 235 | lockdep_assert_held(&fq->lock); | ||
| 236 | |||
| 237 | list_for_each_entry(flow, &tin->new_flows, flowchain) | ||
| 238 | fq_flow_filter(fq, flow, filter_func, filter_data, free_func); | ||
| 239 | list_for_each_entry(flow, &tin->old_flows, flowchain) | ||
| 240 | fq_flow_filter(fq, flow, filter_func, filter_data, free_func); | ||
| 241 | } | ||
| 242 | |||
| 191 | static void fq_flow_reset(struct fq *fq, | 243 | static void fq_flow_reset(struct fq *fq, |
| 192 | struct fq_flow *flow, | 244 | struct fq_flow *flow, |
| 193 | fq_skb_free_t free_func) | 245 | fq_skb_free_t free_func) |
