Skip to content

Commit 13926d1

Browse files
zhengbaowendavem330
authored andcommitted
flow_offload: add reoffload process to update hw_count
Add reoffload process to update hw_count when driver is inserted or removed. We will delete the action if it is with skip_sw flag and not offloaded to any hardware in reoffload process. When reoffloading actions, we still offload the actions that are added independent of filters. Signed-off-by: Baowen Zheng <[email protected]> Signed-off-by: Louis Peens <[email protected]> Signed-off-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e8cb5bc commit 13926d1

File tree

3 files changed

+250
-17
lines changed

3 files changed

+250
-17
lines changed

include/net/act_api.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
#include <linux/refcount.h>
10+
#include <net/flow_offload.h>
1011
#include <net/sch_generic.h>
1112
#include <net/pkt_sched.h>
1213
#include <net/net_namespace.h>
@@ -254,6 +255,8 @@ void tcf_action_update_stats(struct tc_action *a, u64 bytes, u64 packets,
254255
int tcf_action_copy_stats(struct sk_buff *, struct tc_action *, int);
255256

256257
int tcf_action_update_hw_stats(struct tc_action *action);
258+
int tcf_action_reoffload_cb(flow_indr_block_bind_cb_t *cb,
259+
void *cb_priv, bool add);
257260
int tcf_action_check_ctrlact(int action, struct tcf_proto *tp,
258261
struct tcf_chain **handle,
259262
struct netlink_ext_ack *newchain);
@@ -265,6 +268,14 @@ DECLARE_STATIC_KEY_FALSE(tcf_frag_xmit_count);
265268
#endif
266269

267270
int tcf_dev_queue_xmit(struct sk_buff *skb, int (*xmit)(struct sk_buff *skb));
271+
272+
#else /* !CONFIG_NET_CLS_ACT */
273+
274+
static inline int tcf_action_reoffload_cb(flow_indr_block_bind_cb_t *cb,
275+
void *cb_priv, bool add) {
276+
return 0;
277+
}
278+
268279
#endif /* CONFIG_NET_CLS_ACT */
269280

270281
static inline void tcf_action_stats_update(struct tc_action *a, u64 bytes,

net/core/flow_offload.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
#include <linux/kernel.h>
33
#include <linux/slab.h>
4+
#include <net/act_api.h>
45
#include <net/flow_offload.h>
56
#include <linux/rtnetlink.h>
67
#include <linux/mutex.h>
@@ -417,6 +418,8 @@ int flow_indr_dev_register(flow_indr_block_bind_cb_t *cb, void *cb_priv)
417418
existing_qdiscs_register(cb, cb_priv);
418419
mutex_unlock(&flow_indr_block_lock);
419420

421+
tcf_action_reoffload_cb(cb, cb_priv, true);
422+
420423
return 0;
421424
}
422425
EXPORT_SYMBOL(flow_indr_dev_register);
@@ -469,6 +472,7 @@ void flow_indr_dev_unregister(flow_indr_block_bind_cb_t *cb, void *cb_priv,
469472
__flow_block_indr_cleanup(release, cb_priv, &cleanup_list);
470473
mutex_unlock(&flow_indr_block_lock);
471474

475+
tcf_action_reoffload_cb(cb, cb_priv, false);
472476
flow_block_indr_notify(&cleanup_list);
473477
kfree(indr_dev);
474478
}

0 commit comments

Comments
 (0)