mlx5: use tc_cls_can_offload_and_chain0()

Make use of tc_cls_can_offload_and_chain0() to set extack msg in case
ethtool tc offload flag is not set or chain unsupported.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jakub Kicinski 2018-01-25 14:00:47 -08:00 committed by David S. Miller
parent 2a84bbafc0
commit 9ab88e83fd
2 changed files with 2 additions and 8 deletions

View File

@ -2944,9 +2944,6 @@ static int mlx5e_setup_tc_mqprio(struct net_device *netdev,
static int mlx5e_setup_tc_cls_flower(struct mlx5e_priv *priv, static int mlx5e_setup_tc_cls_flower(struct mlx5e_priv *priv,
struct tc_cls_flower_offload *cls_flower) struct tc_cls_flower_offload *cls_flower)
{ {
if (cls_flower->common.chain_index)
return -EOPNOTSUPP;
switch (cls_flower->command) { switch (cls_flower->command) {
case TC_CLSFLOWER_REPLACE: case TC_CLSFLOWER_REPLACE:
return mlx5e_configure_flower(priv, cls_flower); return mlx5e_configure_flower(priv, cls_flower);
@ -2964,7 +2961,7 @@ int mlx5e_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
{ {
struct mlx5e_priv *priv = cb_priv; struct mlx5e_priv *priv = cb_priv;
if (!tc_can_offload(priv->netdev)) if (!tc_cls_can_offload_and_chain0(priv->netdev, type_data))
return -EOPNOTSUPP; return -EOPNOTSUPP;
switch (type) { switch (type) {

View File

@ -719,9 +719,6 @@ static int
mlx5e_rep_setup_tc_cls_flower(struct mlx5e_priv *priv, mlx5e_rep_setup_tc_cls_flower(struct mlx5e_priv *priv,
struct tc_cls_flower_offload *cls_flower) struct tc_cls_flower_offload *cls_flower)
{ {
if (cls_flower->common.chain_index)
return -EOPNOTSUPP;
switch (cls_flower->command) { switch (cls_flower->command) {
case TC_CLSFLOWER_REPLACE: case TC_CLSFLOWER_REPLACE:
return mlx5e_configure_flower(priv, cls_flower); return mlx5e_configure_flower(priv, cls_flower);
@ -739,7 +736,7 @@ static int mlx5e_rep_setup_tc_cb(enum tc_setup_type type, void *type_data,
{ {
struct mlx5e_priv *priv = cb_priv; struct mlx5e_priv *priv = cb_priv;
if (!tc_can_offload(priv->netdev)) if (!tc_cls_can_offload_and_chain0(priv->netdev, type_data))
return -EOPNOTSUPP; return -EOPNOTSUPP;
switch (type) { switch (type) {