mlx5e_rep: Convert ndo_setup_tc offloads to block callbacks
Benefit from the newly introduced block callback infrastructure and convert ndo_setup_tc calls for flower offloads to block callbacks. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6ea30f8a97
commit
855afa0932
|
@ -659,13 +659,10 @@ static int mlx5e_rep_get_phys_port_name(struct net_device *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mlx5e_rep_setup_tc_cls_flower(struct net_device *dev,
|
mlx5e_rep_setup_tc_cls_flower(struct mlx5e_priv *priv,
|
||||||
struct tc_cls_flower_offload *cls_flower)
|
struct tc_cls_flower_offload *cls_flower)
|
||||||
{
|
{
|
||||||
struct mlx5e_priv *priv = netdev_priv(dev);
|
if (cls_flower->common.chain_index)
|
||||||
|
|
||||||
if (!is_classid_clsact_ingress(cls_flower->common.classid) ||
|
|
||||||
cls_flower->common.chain_index)
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
switch (cls_flower->command) {
|
switch (cls_flower->command) {
|
||||||
|
@ -680,12 +677,47 @@ mlx5e_rep_setup_tc_cls_flower(struct net_device *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mlx5e_rep_setup_tc_cb(enum tc_setup_type type, void *type_data,
|
||||||
|
void *cb_priv)
|
||||||
|
{
|
||||||
|
struct mlx5e_priv *priv = cb_priv;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case TC_SETUP_CLSFLOWER:
|
||||||
|
return mlx5e_rep_setup_tc_cls_flower(priv, type_data);
|
||||||
|
default:
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mlx5e_rep_setup_tc_block(struct net_device *dev,
|
||||||
|
struct tc_block_offload *f)
|
||||||
|
{
|
||||||
|
struct mlx5e_priv *priv = netdev_priv(dev);
|
||||||
|
|
||||||
|
if (f->binder_type != TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS)
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
|
switch (f->command) {
|
||||||
|
case TC_BLOCK_BIND:
|
||||||
|
return tcf_block_cb_register(f->block, mlx5e_rep_setup_tc_cb,
|
||||||
|
priv, priv);
|
||||||
|
case TC_BLOCK_UNBIND:
|
||||||
|
tcf_block_cb_unregister(f->block, mlx5e_rep_setup_tc_cb, priv);
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type,
|
static int mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type,
|
||||||
void *type_data)
|
void *type_data)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TC_SETUP_CLSFLOWER:
|
case TC_SETUP_CLSFLOWER:
|
||||||
return mlx5e_rep_setup_tc_cls_flower(dev, type_data);
|
return 0; /* will be removed after conversion from ndo */
|
||||||
|
case TC_SETUP_BLOCK:
|
||||||
|
return mlx5e_rep_setup_tc_block(dev, type_data);
|
||||||
default:
|
default:
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue