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

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

Merge branch 'net-sched-get-rid-of-cls_flower-egress_dev'



Jiri Pirko says:

====================
net: sched: get rid of cls_flower->egress_dev

Introduction of cls_flower->egress_dev was a workaround. Turned out
to be a bit ugly hack. So replace it with more generic and reusable
infrastructure.

This is a dependency of shared block introduction that will be send as
a follow-up patchsets group.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7c6a86b4 7578d7b4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1081,6 +1081,9 @@ int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,
int mlx5e_ethtool_flash_device(struct mlx5e_priv *priv,
			       struct ethtool_flash *flash);

int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type,
		   void *type_data);

/* mlx5e generic netdev management API */
struct net_device*
mlx5e_create_netdev(struct mlx5_core_dev *mdev, const struct mlx5e_profile *profile,
+2 −2
Original line number Diff line number Diff line
@@ -3108,7 +3108,7 @@ static int mlx5e_setup_tc_cls_flower(struct net_device *dev,
}
#endif

static int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type,
int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type,
		   void *type_data)
{
	switch (type) {
+21 −10
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include <linux/mlx5/fs.h>
#include <net/switchdev.h>
#include <net/pkt_cls.h>
#include <net/act_api.h>
#include <net/netevent.h>
#include <net/arp.h>

@@ -667,14 +668,6 @@ mlx5e_rep_setup_tc_cls_flower(struct net_device *dev,
	    cls_flower->common.chain_index)
		return -EOPNOTSUPP;

	if (cls_flower->egress_dev) {
		struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;

		dev = mlx5_eswitch_get_uplink_netdev(esw);
		return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER,
						     cls_flower);
	}

	switch (cls_flower->command) {
	case TC_CLSFLOWER_REPLACE:
		return mlx5e_configure_flower(priv, cls_flower);
@@ -698,6 +691,14 @@ static int mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type,
	}
}

static int mlx5e_rep_setup_tc_cb(enum tc_setup_type type, void *type_data,
				 void *cb_priv)
{
	struct net_device *dev = cb_priv;

	return mlx5e_setup_tc(dev, type, type_data);
}

bool mlx5e_is_uplink_rep(struct mlx5e_priv *priv)
{
	struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
@@ -1017,15 +1018,24 @@ mlx5e_vport_rep_load(struct mlx5_eswitch *esw, struct mlx5_eswitch_rep *rep)
		goto err_detach_netdev;
	}

	err = tc_setup_cb_egdev_register(netdev, mlx5e_rep_setup_tc_cb,
					 mlx5_eswitch_get_uplink_netdev(esw));
	if (err)
		goto err_neigh_cleanup;

	err = register_netdev(netdev);
	if (err) {
		pr_warn("Failed to register representor netdev for vport %d\n",
			rep->vport);
		goto err_neigh_cleanup;
		goto err_egdev_cleanup;
	}

	return 0;

err_egdev_cleanup:
	tc_setup_cb_egdev_unregister(netdev, mlx5e_rep_setup_tc_cb,
				     mlx5_eswitch_get_uplink_netdev(esw));

err_neigh_cleanup:
	mlx5e_rep_neigh_cleanup(rpriv);

@@ -1047,7 +1057,8 @@ mlx5e_vport_rep_unload(struct mlx5_eswitch *esw, struct mlx5_eswitch_rep *rep)
	void *ppriv = priv->ppriv;

	unregister_netdev(rep->netdev);

	tc_setup_cb_egdev_unregister(netdev, mlx5e_rep_setup_tc_cb,
				     mlx5_eswitch_get_uplink_netdev(esw));
	mlx5e_rep_neigh_cleanup(rpriv);
	mlx5e_detach_netdev(priv);
	mlx5e_destroy_netdev(priv);
+35 −2
Original line number Diff line number Diff line
@@ -93,8 +93,7 @@ struct tc_action_ops {
	int     (*walk)(struct net *, struct sk_buff *,
			struct netlink_callback *, int, const struct tc_action_ops *);
	void	(*stats_update)(struct tc_action *, u64, u32, u64);
	int	(*get_dev)(const struct tc_action *a, struct net *net,
			   struct net_device **mirred_dev);
	struct net_device *(*get_dev)(const struct tc_action *a);
};

struct tc_action_net {
@@ -175,4 +174,38 @@ static inline void tcf_action_stats_update(struct tc_action *a, u64 bytes,
#endif
}

typedef int tc_setup_cb_t(enum tc_setup_type type,
			  void *type_data, void *cb_priv);

#ifdef CONFIG_NET_CLS_ACT
int tc_setup_cb_egdev_register(const struct net_device *dev,
			       tc_setup_cb_t *cb, void *cb_priv);
void tc_setup_cb_egdev_unregister(const struct net_device *dev,
				  tc_setup_cb_t *cb, void *cb_priv);
int tc_setup_cb_egdev_call(const struct net_device *dev,
			   enum tc_setup_type type, void *type_data,
			   bool err_stop);
#else
static inline
int tc_setup_cb_egdev_register(const struct net_device *dev,
			       tc_setup_cb_t *cb, void *cb_priv)
{
	return 0;
}

static inline
void tc_setup_cb_egdev_unregister(const struct net_device *dev,
				  tc_setup_cb_t *cb, void *cb_priv)
{
}

static inline
int tc_setup_cb_egdev_call(const struct net_device *dev,
			   enum tc_setup_type type, void *type_data,
			   bool err_stop)
{
	return 0;
}
#endif

#endif
+3 −3
Original line number Diff line number Diff line
@@ -204,8 +204,6 @@ void tcf_exts_destroy(struct tcf_exts *exts);
void tcf_exts_change(struct tcf_exts *dst, struct tcf_exts *src);
int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts);
int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts);
int tcf_exts_get_dev(struct net_device *dev, struct tcf_exts *exts,
		     struct net_device **hw_dev);

/**
 * struct tcf_pkt_info - packet information
@@ -405,6 +403,9 @@ tcf_match_indev(struct sk_buff *skb, int ifindex)
}
#endif /* CONFIG_NET_CLS_IND */

int tc_setup_cb_call(struct tcf_exts *exts, enum tc_setup_type type,
		     void *type_data, bool err_stop);

struct tc_cls_common_offload {
	u32 chain_index;
	__be16 protocol;
@@ -514,7 +515,6 @@ struct tc_cls_flower_offload {
	struct fl_flow_key *mask;
	struct fl_flow_key *key;
	struct tcf_exts *exts;
	bool egress_dev;
};

enum tc_matchall_command {
Loading