Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e481908 authored by wenxu's avatar wenxu Committed by David S. Miller
Browse files

flow_offload: move tc indirect block to flow offload



move tc indirect block to flow_offload and rename
it to flow indirect block.The nf_tables can use the
indr block architecture.

Signed-off-by: default avatarwenxu <wenxu@ucloud.cn>
Acked-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e4da9102
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -781,7 +781,7 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv,
{
	int err;

	err = __tc_indr_block_cb_register(netdev, rpriv,
	err = __flow_indr_block_cb_register(netdev, rpriv,
					    mlx5e_rep_indr_setup_tc_cb,
					    rpriv);
	if (err) {
@@ -796,7 +796,7 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv,
static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv,
					    struct net_device *netdev)
{
	__tc_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb,
	__flow_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb,
					rpriv);
}

+6 −5
Original line number Diff line number Diff line
@@ -1649,7 +1649,7 @@ int nfp_flower_reg_indir_block_handler(struct nfp_app *app,
		return NOTIFY_OK;

	if (event == NETDEV_REGISTER) {
		err = __tc_indr_block_cb_register(netdev, app,
		err = __flow_indr_block_cb_register(netdev, app,
						    nfp_flower_indr_setup_tc_cb,
						    app);
		if (err)
@@ -1657,8 +1657,9 @@ int nfp_flower_reg_indir_block_handler(struct nfp_app *app,
					     "Indirect block reg failed - %s\n",
					     netdev->name);
	} else if (event == NETDEV_UNREGISTER) {
		__tc_indr_block_cb_unregister(netdev,
					      nfp_flower_indr_setup_tc_cb, app);
		__flow_indr_block_cb_unregister(netdev,
						nfp_flower_indr_setup_tc_cb,
						app);
	}

	return NOTIFY_OK;
+29 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
#include <linux/kernel.h>
#include <linux/list.h>
#include <net/flow_dissector.h>
#include <linux/rhashtable.h>

struct flow_match {
	struct flow_dissector	*dissector;
@@ -370,4 +371,32 @@ static inline void flow_block_init(struct flow_block *flow_block)
	INIT_LIST_HEAD(&flow_block->cb_list);
}

typedef int flow_indr_block_bind_cb_t(struct net_device *dev, void *cb_priv,
				      enum tc_setup_type type, void *type_data);

typedef void flow_indr_block_ing_cmd_t(struct net_device *dev,
					flow_indr_block_bind_cb_t *cb,
					void *cb_priv,
					enum flow_block_command command);

int __flow_indr_block_cb_register(struct net_device *dev, void *cb_priv,
				  flow_indr_block_bind_cb_t *cb,
				  void *cb_ident);

void __flow_indr_block_cb_unregister(struct net_device *dev,
				     flow_indr_block_bind_cb_t *cb,
				     void *cb_ident);

int flow_indr_block_cb_register(struct net_device *dev, void *cb_priv,
				flow_indr_block_bind_cb_t *cb, void *cb_ident);

void flow_indr_block_cb_unregister(struct net_device *dev,
				   flow_indr_block_bind_cb_t *cb,
				   void *cb_ident);

void flow_indr_block_call(struct net_device *dev,
			  flow_indr_block_ing_cmd_t *cb,
			  struct flow_block_offload *bo,
			  enum flow_block_command command);

#endif /* _NET_FLOW_OFFLOAD_H */
+0 −35
Original line number Diff line number Diff line
@@ -70,15 +70,6 @@ static inline struct Qdisc *tcf_block_q(struct tcf_block *block)
	return block->q;
}

int __tc_indr_block_cb_register(struct net_device *dev, void *cb_priv,
				tc_indr_block_bind_cb_t *cb, void *cb_ident);
int tc_indr_block_cb_register(struct net_device *dev, void *cb_priv,
			      tc_indr_block_bind_cb_t *cb, void *cb_ident);
void __tc_indr_block_cb_unregister(struct net_device *dev,
				   tc_indr_block_bind_cb_t *cb, void *cb_ident);
void tc_indr_block_cb_unregister(struct net_device *dev,
				 tc_indr_block_bind_cb_t *cb, void *cb_ident);

int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
		 struct tcf_result *res, bool compat_mode);

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

static inline
int __tc_indr_block_cb_register(struct net_device *dev, void *cb_priv,
				tc_indr_block_bind_cb_t *cb, void *cb_ident)
{
	return 0;
}

static inline
int tc_indr_block_cb_register(struct net_device *dev, void *cb_priv,
			      tc_indr_block_bind_cb_t *cb, void *cb_ident)
{
	return 0;
}

static inline
void __tc_indr_block_cb_unregister(struct net_device *dev,
				   tc_indr_block_bind_cb_t *cb, void *cb_ident)
{
}

static inline
void tc_indr_block_cb_unregister(struct net_device *dev,
				 tc_indr_block_bind_cb_t *cb, void *cb_ident)
{
}

static inline int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
			       struct tcf_result *res, bool compat_mode)
{
+0 −3
Original line number Diff line number Diff line
@@ -23,9 +23,6 @@ struct tcf_walker;
struct module;
struct bpf_flow_keys;

typedef int tc_indr_block_bind_cb_t(struct net_device *dev, void *cb_priv,
				    enum tc_setup_type type, void *type_data);

struct qdisc_rate_table {
	struct tc_ratespec rate;
	u32		data[256];
Loading