mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	net: sched: cls_api: add skip_sw counter
Maintain a count of skip_sw filters. This counter is protected by the cb_lock, and is updated at the same time as offloadcnt. Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									fd2162a501
								
							
						
					
					
						commit
						f631ef39d8
					
				
					 2 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
					@ -471,6 +471,7 @@ struct tcf_block {
 | 
				
			||||||
	struct flow_block flow_block;
 | 
						struct flow_block flow_block;
 | 
				
			||||||
	struct list_head owner_list;
 | 
						struct list_head owner_list;
 | 
				
			||||||
	bool keep_dst;
 | 
						bool keep_dst;
 | 
				
			||||||
 | 
						atomic_t skipswcnt; /* Number of skip_sw filters */
 | 
				
			||||||
	atomic_t offloadcnt; /* Number of oddloaded filters */
 | 
						atomic_t offloadcnt; /* Number of oddloaded filters */
 | 
				
			||||||
	unsigned int nooffloaddevcnt; /* Number of devs unable to do offload */
 | 
						unsigned int nooffloaddevcnt; /* Number of devs unable to do offload */
 | 
				
			||||||
	unsigned int lockeddevcnt; /* Number of devs that require rtnl lock. */
 | 
						unsigned int lockeddevcnt; /* Number of devs that require rtnl lock. */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3483,6 +3483,8 @@ static void tcf_block_offload_inc(struct tcf_block *block, u32 *flags)
 | 
				
			||||||
	if (*flags & TCA_CLS_FLAGS_IN_HW)
 | 
						if (*flags & TCA_CLS_FLAGS_IN_HW)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	*flags |= TCA_CLS_FLAGS_IN_HW;
 | 
						*flags |= TCA_CLS_FLAGS_IN_HW;
 | 
				
			||||||
 | 
						if (tc_skip_sw(*flags))
 | 
				
			||||||
 | 
							atomic_inc(&block->skipswcnt);
 | 
				
			||||||
	atomic_inc(&block->offloadcnt);
 | 
						atomic_inc(&block->offloadcnt);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3491,6 +3493,8 @@ static void tcf_block_offload_dec(struct tcf_block *block, u32 *flags)
 | 
				
			||||||
	if (!(*flags & TCA_CLS_FLAGS_IN_HW))
 | 
						if (!(*flags & TCA_CLS_FLAGS_IN_HW))
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	*flags &= ~TCA_CLS_FLAGS_IN_HW;
 | 
						*flags &= ~TCA_CLS_FLAGS_IN_HW;
 | 
				
			||||||
 | 
						if (tc_skip_sw(*flags))
 | 
				
			||||||
 | 
							atomic_dec(&block->skipswcnt);
 | 
				
			||||||
	atomic_dec(&block->offloadcnt);
 | 
						atomic_dec(&block->offloadcnt);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue