Commit 95cf6674 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'More-fixes-for-unlocked-cls-hardware-offload-API-refactoring'



Vlad Buslov says:

====================
More fixes for unlocked cls hardware offload API refactoring

Two fixes for my "Refactor cls hardware offload API to support
rtnl-independent drivers" series and refactoring patch that implements
infrastructure necessary for the fixes.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 28c9eb90 470d5060
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ static inline void tcf_tm_dump(struct tcf_t *dtm, const struct tcf_t *stm)
#define ACT_P_CREATED 1
#define ACT_P_DELETED 1

typedef void (*tc_action_priv_destructor)(void *priv);

struct tc_action_ops {
	struct list_head head;
	char    kind[IFNAMSIZ];
@@ -99,8 +101,11 @@ struct tc_action_ops {
			struct netlink_ext_ack *);
	void	(*stats_update)(struct tc_action *, u64, u32, u64, bool);
	size_t  (*get_fill_size)(const struct tc_action *act);
	struct net_device *(*get_dev)(const struct tc_action *a);
	void	(*put_dev)(struct net_device *dev);
	struct net_device *(*get_dev)(const struct tc_action *a,
				      tc_action_priv_destructor *destructor);
	struct psample_group *
	(*get_psample_group)(const struct tc_action *a,
			     tc_action_priv_destructor *destructor);
};

struct tc_action_net {
+5 −1
Original line number Diff line number Diff line
@@ -154,8 +154,12 @@ enum flow_action_mangle_base {
	FLOW_ACT_MANGLE_HDR_TYPE_UDP,
};

typedef void (*action_destr)(void *priv);

struct flow_action_entry {
	enum flow_action_id		id;
	action_destr			destructor;
	void				*destructor_priv;
	union {
		u32			chain_index;	/* FLOW_ACTION_GOTO */
		struct net_device	*dev;		/* FLOW_ACTION_REDIRECT */
@@ -170,7 +174,7 @@ struct flow_action_entry {
			u32		mask;
			u32		val;
		} mangle;
		const struct ip_tunnel_info *tunnel;	/* FLOW_ACTION_TUNNEL_ENCAP */
		struct ip_tunnel_info	*tunnel;	/* FLOW_ACTION_TUNNEL_ENCAP */
		u32			csum_flags;	/* FLOW_ACTION_CSUM */
		u32			mark;		/* FLOW_ACTION_MARK */
		u16                     ptype;          /* FLOW_ACTION_PTYPE */
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ struct psample_group {
};

struct psample_group *psample_group_get(struct net *net, u32 group_num);
void psample_group_take(struct psample_group *group);
void psample_group_put(struct psample_group *group);

#if IS_ENABLED(CONFIG_PSAMPLE)
+0 −6
Original line number Diff line number Diff line
@@ -41,10 +41,4 @@ static inline int tcf_sample_trunc_size(const struct tc_action *a)
	return to_sample(a)->trunc_size;
}

static inline struct psample_group *
tcf_sample_psample_group(const struct tc_action *a)
{
	return rcu_dereference_rtnl(to_sample(a)->psample_group);
}

#endif /* __NET_TC_SAMPLE_H */
+14 −6
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ static int psample_nl_cmd_get_group_dumpit(struct sk_buff *msg,
	int idx = 0;
	int err;

	spin_lock(&psample_groups_lock);
	spin_lock_bh(&psample_groups_lock);
	list_for_each_entry(group, &psample_groups_list, list) {
		if (!net_eq(group->net, sock_net(msg->sk)))
			continue;
@@ -89,7 +89,7 @@ static int psample_nl_cmd_get_group_dumpit(struct sk_buff *msg,
		idx++;
	}

	spin_unlock(&psample_groups_lock);
	spin_unlock_bh(&psample_groups_lock);
	cb->args[0] = idx;
	return msg->len;
}
@@ -172,7 +172,7 @@ struct psample_group *psample_group_get(struct net *net, u32 group_num)
{
	struct psample_group *group;

	spin_lock(&psample_groups_lock);
	spin_lock_bh(&psample_groups_lock);

	group = psample_group_lookup(net, group_num);
	if (!group) {
@@ -183,19 +183,27 @@ struct psample_group *psample_group_get(struct net *net, u32 group_num)
	group->refcount++;

out:
	spin_unlock(&psample_groups_lock);
	spin_unlock_bh(&psample_groups_lock);
	return group;
}
EXPORT_SYMBOL_GPL(psample_group_get);

void psample_group_take(struct psample_group *group)
{
	spin_lock_bh(&psample_groups_lock);
	group->refcount++;
	spin_unlock_bh(&psample_groups_lock);
}
EXPORT_SYMBOL_GPL(psample_group_take);

void psample_group_put(struct psample_group *group)
{
	spin_lock(&psample_groups_lock);
	spin_lock_bh(&psample_groups_lock);

	if (--group->refcount == 0)
		psample_group_destroy(group);

	spin_unlock(&psample_groups_lock);
	spin_unlock_bh(&psample_groups_lock);
}
EXPORT_SYMBOL_GPL(psample_group_put);

Loading