Skip to content

Commit edd5861

Browse files
Paul Blakeydavem330
authored andcommitted
net/sched: act_ct: Enable hardware offload of flow table entires
Pass the zone's flow table instance on the flow action to the drivers. Thus, allowing drivers to register FT add/del/stats callbacks. Finally, enable hardware offload on the flow table instance. Signed-off-by: Paul Blakey <paulb@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8b3646d commit edd5861

4 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎include/net/flow_offload.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ struct flow_action_entry {
225225
struct { /* FLOW_ACTION_CT */
226226
int action;
227227
u16 zone;
228+
struct nf_flowtable *flow_table;
228229
} ct;
229230
struct {
230231
unsigned long cookie;

‎include/net/tc_act/tc_ct.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct tcf_ct_params {
2727
struct rcu_head rcu;
2828

2929
struct tcf_ct_flow_table *ct_ft;
30+
struct nf_flowtable *nf_ft;
3031
};
3132

3233
struct tcf_ct {
@@ -50,9 +51,18 @@ static inline int tcf_ct_action(const struct tc_action *a)
5051
return to_ct_params(a)->ct_action;
5152
}
5253

54+
static inline struct nf_flowtable *tcf_ct_ft(const struct tc_action *a)
55+
{
56+
return to_ct_params(a)->nf_ft;
57+
}
58+
5359
#else
5460
static inline uint16_t tcf_ct_zone(const struct tc_action *a) { return 0; }
5561
static inline int tcf_ct_action(const struct tc_action *a) { return 0; }
62+
static inline struct nf_flowtable *tcf_ct_ft(const struct tc_action *a)
63+
{
64+
return NULL;
65+
}
5666
#endif /* CONFIG_NF_CONNTRACK */
5767

5868
#if IS_ENABLED(CONFIG_NET_ACT_CT)

‎net/sched/act_ct.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,15 @@ static int tcf_ct_flow_table_get(struct tcf_ct_params *params)
292292
goto err_insert;
293293

294294
ct_ft->nf_ft.type = &flowtable_ct;
295+
ct_ft->nf_ft.flags |= NF_FLOWTABLE_HW_OFFLOAD;
295296
err = nf_flow_table_init(&ct_ft->nf_ft);
296297
if (err)
297298
goto err_init;
298299

299300
__module_get(THIS_MODULE);
300301
out_unlock:
301302
params->ct_ft = ct_ft;
303+
params->nf_ft = &ct_ft->nf_ft;
302304
mutex_unlock(&zones_mutex);
303305

304306
return 0;

‎net/sched/cls_api.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3636,6 +3636,7 @@ int tc_setup_flow_action(struct flow_action *flow_action,
36363636
entry->id = FLOW_ACTION_CT;
36373637
entry->ct.action = tcf_ct_action(act);
36383638
entry->ct.zone = tcf_ct_zone(act);
3639+
entry->ct.flow_table = tcf_ct_ft(act);
36393640
} else if (is_tcf_mpls(act)) {
36403641
switch (tcf_mpls_action(act)) {
36413642
case TCA_MPLS_ACT_PUSH:

0 commit comments

Comments
 (0)