| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 | 
							- From: Felix Fietkau <[email protected]>
 
- Date: Wed, 25 Nov 2020 18:09:10 +0100
 
- Subject: [PATCH] net/fq_impl: drop get_default_func, move default flow to
 
-  fq_tin
 
- Simplifies the code and prepares for a rework of scanning for flows on
 
- overmemory drop.
 
- Signed-off-by: Felix Fietkau <[email protected]>
 
- ---
 
- --- a/include/net/fq.h
 
- +++ b/include/net/fq.h
 
- @@ -47,6 +47,7 @@ struct fq_flow {
 
-  struct fq_tin {
 
-  	struct list_head new_flows;
 
-  	struct list_head old_flows;
 
- +	struct fq_flow default_flow;
 
-  	u32 backlog_bytes;
 
-  	u32 backlog_packets;
 
-  	u32 overlimit;
 
- --- a/include/net/fq_impl.h
 
- +++ b/include/net/fq_impl.h
 
- @@ -151,8 +151,7 @@ static u32 fq_flow_idx(struct fq *fq, st
 
-  
 
-  static struct fq_flow *fq_flow_classify(struct fq *fq,
 
-  					struct fq_tin *tin, u32 idx,
 
- -					struct sk_buff *skb,
 
- -					fq_flow_get_default_t get_default_func)
 
- +					struct sk_buff *skb)
 
-  {
 
-  	struct fq_flow *flow;
 
-  
 
- @@ -160,7 +159,7 @@ static struct fq_flow *fq_flow_classify(
 
-  
 
-  	flow = &fq->flows[idx];
 
-  	if (flow->tin && flow->tin != tin) {
 
- -		flow = get_default_func(fq, tin, idx, skb);
 
- +		flow = &tin->default_flow;
 
-  		tin->collisions++;
 
-  		fq->collisions++;
 
-  	}
 
- @@ -192,15 +191,14 @@ static void fq_recalc_backlog(struct fq
 
-  static void fq_tin_enqueue(struct fq *fq,
 
-  			   struct fq_tin *tin, u32 idx,
 
-  			   struct sk_buff *skb,
 
- -			   fq_skb_free_t free_func,
 
- -			   fq_flow_get_default_t get_default_func)
 
- +			   fq_skb_free_t free_func)
 
-  {
 
-  	struct fq_flow *flow;
 
-  	bool oom;
 
-  
 
-  	lockdep_assert_held(&fq->lock);
 
-  
 
- -	flow = fq_flow_classify(fq, tin, idx, skb, get_default_func);
 
- +	flow = fq_flow_classify(fq, tin, idx, skb);
 
-  
 
-  	flow->tin = tin;
 
-  	flow->backlog += skb->len;
 
- @@ -331,6 +329,7 @@ static void fq_tin_init(struct fq_tin *t
 
-  {
 
-  	INIT_LIST_HEAD(&tin->new_flows);
 
-  	INIT_LIST_HEAD(&tin->old_flows);
 
- +	fq_flow_init(&tin->default_flow);
 
-  }
 
-  
 
-  static int fq_init(struct fq *fq, int flows_cnt)
 
- --- a/net/mac80211/ieee80211_i.h
 
- +++ b/net/mac80211/ieee80211_i.h
 
- @@ -855,7 +855,6 @@ enum txq_info_flags {
 
-   */
 
-  struct txq_info {
 
-  	struct fq_tin tin;
 
- -	struct fq_flow def_flow;
 
-  	struct codel_vars def_cvars;
 
-  	struct codel_stats cstats;
 
-  	struct sk_buff_head frags;
 
- --- a/net/mac80211/tx.c
 
- +++ b/net/mac80211/tx.c
 
- @@ -1322,7 +1322,7 @@ static struct sk_buff *codel_dequeue_fun
 
-  	fq = &local->fq;
 
-  
 
-  	if (cvars == &txqi->def_cvars)
 
- -		flow = &txqi->def_flow;
 
- +		flow = &txqi->tin.default_flow;
 
-  	else
 
-  		flow = &fq->flows[cvars - local->cvars];
 
-  
 
- @@ -1365,7 +1365,7 @@ static struct sk_buff *fq_tin_dequeue_fu
 
-  		cparams = &local->cparams;
 
-  	}
 
-  
 
- -	if (flow == &txqi->def_flow)
 
- +	if (flow == &tin->default_flow)
 
-  		cvars = &txqi->def_cvars;
 
-  	else
 
-  		cvars = &local->cvars[flow - fq->flows];
 
- @@ -1392,17 +1392,6 @@ static void fq_skb_free_func(struct fq *
 
-  	ieee80211_free_txskb(&local->hw, skb);
 
-  }
 
-  
 
- -static struct fq_flow *fq_flow_get_default_func(struct fq *fq,
 
- -						struct fq_tin *tin,
 
- -						int idx,
 
- -						struct sk_buff *skb)
 
- -{
 
- -	struct txq_info *txqi;
 
- -
 
- -	txqi = container_of(tin, struct txq_info, tin);
 
- -	return &txqi->def_flow;
 
- -}
 
- -
 
-  static void ieee80211_txq_enqueue(struct ieee80211_local *local,
 
-  				  struct txq_info *txqi,
 
-  				  struct sk_buff *skb)
 
- @@ -1415,8 +1404,7 @@ static void ieee80211_txq_enqueue(struct
 
-  
 
-  	spin_lock_bh(&fq->lock);
 
-  	fq_tin_enqueue(fq, tin, flow_idx, skb,
 
- -		       fq_skb_free_func,
 
- -		       fq_flow_get_default_func);
 
- +		       fq_skb_free_func);
 
-  	spin_unlock_bh(&fq->lock);
 
-  }
 
-  
 
- @@ -1459,7 +1447,6 @@ void ieee80211_txq_init(struct ieee80211
 
-  			struct txq_info *txqi, int tid)
 
-  {
 
-  	fq_tin_init(&txqi->tin);
 
- -	fq_flow_init(&txqi->def_flow);
 
-  	codel_vars_init(&txqi->def_cvars);
 
-  	codel_stats_init(&txqi->cstats);
 
-  	__skb_queue_head_init(&txqi->frags);
 
- @@ -3310,8 +3297,7 @@ static bool ieee80211_amsdu_aggregate(st
 
-  	 */
 
-  
 
-  	tin = &txqi->tin;
 
- -	flow = fq_flow_classify(fq, tin, flow_idx, skb,
 
- -				fq_flow_get_default_func);
 
- +	flow = fq_flow_classify(fq, tin, flow_idx, skb);
 
-  	head = skb_peek_tail(&flow->queue);
 
-  	if (!head || skb_is_gso(head))
 
-  		goto out;
 
 
  |