Skip to content

Commit 2339ef1

Browse files
committed
Merge branch 'flow_offload-add-indr-block-in-nf_table_offload'
wenxu says: ==================== flow_offload: add indr-block in nf_table_offload This series patch make nftables offload support the vlan and tunnel device offload through indr-block architecture. The first four patches mv tc indr block to flow offload and rename to flow-indr-block. Because the new flow-indr-block can't get the tcf_block directly. The fifth patch provide a callback list to get flow_block of each subsystem immediately when the device register and contain a block. The last patch make nf_tables_offload support flow-indr-block. This version add a mutex lock for add/del flow_indr_block_ing_cb ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 61552d2 + 9a32669 commit 2339ef1

File tree

10 files changed

+464
-285
lines changed

10 files changed

+464
-285
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,9 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv,
781781
{
782782
int err;
783783

784-
err = __tc_indr_block_cb_register(netdev, rpriv,
785-
mlx5e_rep_indr_setup_tc_cb,
786-
rpriv);
784+
err = __flow_indr_block_cb_register(netdev, rpriv,
785+
mlx5e_rep_indr_setup_tc_cb,
786+
rpriv);
787787
if (err) {
788788
struct mlx5e_priv *priv = netdev_priv(rpriv->netdev);
789789

@@ -796,8 +796,8 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv,
796796
static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv,
797797
struct net_device *netdev)
798798
{
799-
__tc_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb,
800-
rpriv);
799+
__flow_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb,
800+
rpriv);
801801
}
802802

803803
static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb,

drivers/net/ethernet/netronome/nfp/flower/offload.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,16 +1649,17 @@ int nfp_flower_reg_indir_block_handler(struct nfp_app *app,
16491649
return NOTIFY_OK;
16501650

16511651
if (event == NETDEV_REGISTER) {
1652-
err = __tc_indr_block_cb_register(netdev, app,
1653-
nfp_flower_indr_setup_tc_cb,
1654-
app);
1652+
err = __flow_indr_block_cb_register(netdev, app,
1653+
nfp_flower_indr_setup_tc_cb,
1654+
app);
16551655
if (err)
16561656
nfp_flower_cmsg_warn(app,
16571657
"Indirect block reg failed - %s\n",
16581658
netdev->name);
16591659
} else if (event == NETDEV_UNREGISTER) {
1660-
__tc_indr_block_cb_unregister(netdev,
1661-
nfp_flower_indr_setup_tc_cb, app);
1660+
__flow_indr_block_cb_unregister(netdev,
1661+
nfp_flower_indr_setup_tc_cb,
1662+
app);
16621663
}
16631664

16641665
return NOTIFY_OK;

include/net/flow_offload.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <linux/kernel.h>
55
#include <linux/list.h>
66
#include <net/flow_dissector.h>
7+
#include <linux/rhashtable.h>
78

89
struct flow_match {
910
struct flow_dissector *dissector;
@@ -370,4 +371,40 @@ static inline void flow_block_init(struct flow_block *flow_block)
370371
INIT_LIST_HEAD(&flow_block->cb_list);
371372
}
372373

374+
typedef int flow_indr_block_bind_cb_t(struct net_device *dev, void *cb_priv,
375+
enum tc_setup_type type, void *type_data);
376+
377+
typedef void flow_indr_block_ing_cmd_t(struct net_device *dev,
378+
flow_indr_block_bind_cb_t *cb,
379+
void *cb_priv,
380+
enum flow_block_command command);
381+
382+
struct flow_indr_block_ing_entry {
383+
flow_indr_block_ing_cmd_t *cb;
384+
struct list_head list;
385+
};
386+
387+
void flow_indr_add_block_ing_cb(struct flow_indr_block_ing_entry *entry);
388+
389+
void flow_indr_del_block_ing_cb(struct flow_indr_block_ing_entry *entry);
390+
391+
int __flow_indr_block_cb_register(struct net_device *dev, void *cb_priv,
392+
flow_indr_block_bind_cb_t *cb,
393+
void *cb_ident);
394+
395+
void __flow_indr_block_cb_unregister(struct net_device *dev,
396+
flow_indr_block_bind_cb_t *cb,
397+
void *cb_ident);
398+
399+
int flow_indr_block_cb_register(struct net_device *dev, void *cb_priv,
400+
flow_indr_block_bind_cb_t *cb, void *cb_ident);
401+
402+
void flow_indr_block_cb_unregister(struct net_device *dev,
403+
flow_indr_block_bind_cb_t *cb,
404+
void *cb_ident);
405+
406+
void flow_indr_block_call(struct net_device *dev,
407+
struct flow_block_offload *bo,
408+
enum flow_block_command command);
409+
373410
#endif /* _NET_FLOW_OFFLOAD_H */

include/net/netfilter/nf_tables_offload.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ struct nft_rule;
6363
struct nft_flow_rule *nft_flow_rule_create(const struct nft_rule *rule);
6464
void nft_flow_rule_destroy(struct nft_flow_rule *flow);
6565
int nft_flow_rule_offload_commit(struct net *net);
66+
void nft_indr_block_get_and_ing_cmd(struct net_device *dev,
67+
flow_indr_block_bind_cb_t *cb,
68+
void *cb_priv,
69+
enum flow_block_command command);
6670

6771
#define NFT_OFFLOAD_MATCH(__key, __base, __field, __len, __reg) \
6872
(__reg)->base_offset = \

include/net/pkt_cls.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,6 @@ static inline struct Qdisc *tcf_block_q(struct tcf_block *block)
7070
return block->q;
7171
}
7272

73-
int __tc_indr_block_cb_register(struct net_device *dev, void *cb_priv,
74-
tc_indr_block_bind_cb_t *cb, void *cb_ident);
75-
int tc_indr_block_cb_register(struct net_device *dev, void *cb_priv,
76-
tc_indr_block_bind_cb_t *cb, void *cb_ident);
77-
void __tc_indr_block_cb_unregister(struct net_device *dev,
78-
tc_indr_block_bind_cb_t *cb, void *cb_ident);
79-
void tc_indr_block_cb_unregister(struct net_device *dev,
80-
tc_indr_block_bind_cb_t *cb, void *cb_ident);
81-
8273
int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
8374
struct tcf_result *res, bool compat_mode);
8475

@@ -137,32 +128,6 @@ void tc_setup_cb_block_unregister(struct tcf_block *block, flow_setup_cb_t *cb,
137128
{
138129
}
139130

140-
static inline
141-
int __tc_indr_block_cb_register(struct net_device *dev, void *cb_priv,
142-
tc_indr_block_bind_cb_t *cb, void *cb_ident)
143-
{
144-
return 0;
145-
}
146-
147-
static inline
148-
int tc_indr_block_cb_register(struct net_device *dev, void *cb_priv,
149-
tc_indr_block_bind_cb_t *cb, void *cb_ident)
150-
{
151-
return 0;
152-
}
153-
154-
static inline
155-
void __tc_indr_block_cb_unregister(struct net_device *dev,
156-
tc_indr_block_bind_cb_t *cb, void *cb_ident)
157-
{
158-
}
159-
160-
static inline
161-
void tc_indr_block_cb_unregister(struct net_device *dev,
162-
tc_indr_block_bind_cb_t *cb, void *cb_ident)
163-
{
164-
}
165-
166131
static inline int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
167132
struct tcf_result *res, bool compat_mode)
168133
{

include/net/sch_generic.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ struct tcf_walker;
2323
struct module;
2424
struct bpf_flow_keys;
2525

26-
typedef int tc_indr_block_bind_cb_t(struct net_device *dev, void *cb_priv,
27-
enum tc_setup_type type, void *type_data);
28-
2926
struct qdisc_rate_table {
3027
struct tc_ratespec rate;
3128
u32 data[256];

0 commit comments

Comments
 (0)