Skip to content

Commit f631ef3

Browse files
Asbjørn Sloth Tønnesendavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Marcelo Ricardo Leitner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fd2162a commit f631ef3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

include/net/sch_generic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ struct tcf_block {
471471
struct flow_block flow_block;
472472
struct list_head owner_list;
473473
bool keep_dst;
474+
atomic_t skipswcnt; /* Number of skip_sw filters */
474475
atomic_t offloadcnt; /* Number of oddloaded filters */
475476
unsigned int nooffloaddevcnt; /* Number of devs unable to do offload */
476477
unsigned int lockeddevcnt; /* Number of devs that require rtnl lock. */

net/sched/cls_api.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3483,6 +3483,8 @@ static void tcf_block_offload_inc(struct tcf_block *block, u32 *flags)
34833483
if (*flags & TCA_CLS_FLAGS_IN_HW)
34843484
return;
34853485
*flags |= TCA_CLS_FLAGS_IN_HW;
3486+
if (tc_skip_sw(*flags))
3487+
atomic_inc(&block->skipswcnt);
34863488
atomic_inc(&block->offloadcnt);
34873489
}
34883490

@@ -3491,6 +3493,8 @@ static void tcf_block_offload_dec(struct tcf_block *block, u32 *flags)
34913493
if (!(*flags & TCA_CLS_FLAGS_IN_HW))
34923494
return;
34933495
*flags &= ~TCA_CLS_FLAGS_IN_HW;
3496+
if (tc_skip_sw(*flags))
3497+
atomic_dec(&block->skipswcnt);
34943498
atomic_dec(&block->offloadcnt);
34953499
}
34963500

0 commit comments

Comments
 (0)