net: sched: block callbacks follow-up
Subsystems (12)
Jiri Pirko
maintainerv2 cover net: sched: block callbacks follow-up
From: Jiri Pirko <[email protected]>
This patchset does a bit of cleanup of leftovers after block callbacks patchset. The main part is patch 2, which restores the original handling of tc offload feature flag.
---v1->v2:
- rebased on top of current net-next (bnxt changes)
Jiri Pirko (4):
net: sched: remove unused tc_should_offload helper
net: sched: move the can_offload check from binding phase to rule
insertion phase
net: sched: remove tc_can_offload check from egdev call
net: sched: remove ndo_setup_tc check from tc_can_offload
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 2 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 3 +++ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 +++ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +++ drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 3 +++ drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 3 +++ drivers/net/ethernet/netronome/nfp/bpf/main.c | 3 +++ drivers/net/ethernet/netronome/nfp/flower/offload.c | 3 +++ include/net/pkt_cls.h | 13 +------------ net/dsa/slave.c | 3 +++ net/sched/cls_api.c | 4 ++-- 12 files changed, 29 insertions(+), 16 deletions(-)
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 1/4 net: sched: remove unused tc_should_offload helper
From: Jiri Pirko <[email protected]>
tc_should_offload is no longer used, remove it.
--- include/net/pkt_cls.h | 7 ------- 1 file changed, 7 deletions(-)
include/net/pkt_cls.h +0 -7
@@ -623,13 +623,6 @@ static inline bool tc_skip_hw(u32 flags)return (flags &TCA_CLS_FLAGS_SKIP_HW ) ? true : false; } -static inline bool tc_should_offload (const struct net_device *dev,u32 flags) -{ -if (tc_skip_hw (flags)) -return false; -return tc_can_offload (dev); -} -static inline bool tc_skip_sw (u32 flags) {return (flags &TCA_CLS_FLAGS_SKIP_SW ) ? true : false;
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 2/4 net: sched: move the can_offload check from binding phase to rule insertion phase
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
This restores the original behaviour before the block callbacks were introduced. Allow the drivers to do binding of block always, no matter if the NETIF_F_HW_TC feature is on or off. Move the check to the block callback which is called for rule insertion.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 2 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 3 +++ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 +++ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +++ drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 3 +++ drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 3 +++ drivers/net/ethernet/netronome/nfp/bpf/main.c | 3 +++ drivers/net/ethernet/netronome/nfp/flower/offload.c | 3 +++ net/dsa/slave.c | 3 +++ net/sched/cls_api.c | 2 +- 11 files changed, 27 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -7347,7 +7347,7 @@ static int bnxt_setup_tc_block_cb(enum tc_setup_type type, void *type_data, {struct bnxt *bp = cb_priv; -if (!bnxt_tc_flower_enabled (bp)) +if (!bnxt_tc_flower_enabled (bp) || !tc_can_offload (bp->dev))return -EOPNOTSUPP ;switch (type) {
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +1 -1
@@ -124,7 +124,7 @@ static int bnxt_vf_rep_setup_tc_block_cb(enum tc_setup_type type,struct bnxt *bp = vf_rep->bp;int vf_fid = bp->pf.vf[vf_rep->vf_idx].fw_fid; -if (!bnxt_tc_flower_enabled (vf_rep->bp)) +if (!bnxt_tc_flower_enabled (vf_rep->bp) || !tc_can_offload (bp->dev))return -EOPNOTSUPP ;switch (type) {
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +3 -0
@@ -2935,6 +2935,9 @@ static int cxgb_setup_tc_block_cb(enum tc_setup_type type, void *type_data,return -EINVAL ; } +if (!tc_can_offload (dev)) +return -EOPNOTSUPP ; +switch (type) {case TC_SETUP_CLSU32 :return cxgb_setup_tc_cls_u32 (dev, type_data);
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3 -0
@@ -9386,6 +9386,9 @@ static int ixgbe_setup_tc_block_cb(enum tc_setup_type type, void *type_data, {struct ixgbe_adapter *adapter = cb_priv; +if (!tc_can_offload (adapter->netdev)) +return -EOPNOTSUPP ; +switch (type) {case TC_SETUP_CLSU32 :return ixgbe_setup_tc_cls_u32 (adapter, type_data);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +3 -0
@@ -3106,6 +3106,9 @@ int mlx5e_setup_tc_block_cb(enum tc_setup_type type, void *type_data, {struct mlx5e_priv *priv = cb_priv; +if (!tc_can_offload (priv->netdev)) +return -EOPNOTSUPP ; +switch (type) {case TC_SETUP_CLSFLOWER :return mlx5e_setup_tc_cls_flower (priv, type_data);
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +3 -0
@@ -682,6 +682,9 @@ static int mlx5e_rep_setup_tc_cb(enum tc_setup_type type, void *type_data, {struct mlx5e_priv *priv = cb_priv; +if (!tc_can_offload (priv->netdev)) +return -EOPNOTSUPP ; +switch (type) {case TC_SETUP_CLSFLOWER :return mlx5e_rep_setup_tc_cls_flower (priv, type_data);
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +3 -0
@@ -1738,6 +1738,9 @@ static int mlxsw_sp_setup_tc_block_cb(enum tc_setup_type type, void *type_data, {struct mlxsw_sp_port *mlxsw_sp_port = cb_priv; +if (!tc_can_offload (mlxsw_sp_port->dev)) +return -EOPNOTSUPP ; +switch (type) {case TC_SETUP_CLSMATCHALL : return mlxsw_sp_setup_tc_cls_matchall(mlxsw_sp_port, type_data,
drivers/net/ethernet/netronome/nfp/bpf/main.c +3 -0
@@ -121,6 +121,9 @@ static int nfp_bpf_setup_tc_block_cb(enum tc_setup_type type,struct tc_cls_bpf_offload *cls_bpf = type_data;struct nfp_net *nn = cb_priv; +if (!tc_can_offload (nn->dp.netdev)) +return -EOPNOTSUPP ; +switch (type) {case TC_SETUP_CLSBPF : if (!nfp_net_ebpf_capable(nn) ||
drivers/net/ethernet/netronome/nfp/flower/offload.c +3 -0
@@ -470,6 +470,9 @@ static int nfp_flower_setup_tc_block_cb(enum tc_setup_type type, {struct nfp_net *nn = cb_priv; +if (!tc_can_offload (nn->dp.netdev)) +return -EOPNOTSUPP ; +switch (type) {case TC_SETUP_CLSFLOWER : return nfp_flower_repr_offload(nn->app, nn->port->netdev,
net/dsa/slave.c +3 -0
@@ -799,6 +799,9 @@ static int dsa_slave_setup_tc_block_cb(enum tc_setup_type type, void *type_data, {struct net_device *dev = cb_priv; +if (!tc_can_offload (dev)) +return -EOPNOTSUPP ; +switch (type) {case TC_SETUP_CLSMATCHALL :return dsa_slave_setup_tc_cls_matchall (dev, type_data, ingress);
net/sched/cls_api.c +1 -1
@@ -256,7 +256,7 @@ static void tcf_block_offload_cmd(struct tcf_block *block, struct Qdisc *q,struct net_device *dev = q->dev_queue->dev;struct tc_block_offload bo = {}; -if (!tc_can_offload (dev)) +if (!dev->netdev_ops->ndo_setup_tc)return ; bo.command = command; bo.binder_type = ei->binder_type;
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 3/4 net: sched: remove tc_can_offload check from egdev call
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Since the only user, mlx5 driver does the check in mlx5e_setup_tc_block_cb, no need to check here.
--- net/sched/cls_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/cls_api.c +1 -1
@@ -1226,7 +1226,7 @@ static int tc_exts_setup_cb_egdev_call(struct tcf_exts *exts,if (!a->ops->get_dev)continue ; dev = a->ops->get_dev (a); -if (!dev || !tc_can_offload (dev)) +if (!dev)continue ; ret =tc_setup_cb_egdev_call (dev, type, type_data, err_stop);if (ret <0 )
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 4/4 net: sched: remove ndo_setup_tc check from tc_can_offload
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Since tc_can_offload is always called from block callback or egdev callback, no need to check if ndo_setup_tc exists.
--- include/net/pkt_cls.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
include/net/pkt_cls.h +1 -5
@@ -611,11 +611,7 @@ struct tc_cls_u32_offload {static inline bool tc_can_offload (const struct net_device *dev) { -if (!(dev->features &NETIF_F_HW_TC )) -return false; -if (!dev->netdev_ops->ndo_setup_tc) -return false; -return true; +return dev->features &NETIF_F_HW_TC ; }static inline bool tc_skip_hw (u32 flags)
Signature · 1 line
2.9.5
Quoted 5 lines · Jiri Pirko
From: Jiri Pirko <[email protected]>
This patchset does a bit of cleanup of leftovers after block callbacks patchset. The main part is patch 2, which restores the original handling of tc offload feature flag.
David Miller
maintainerFrom: Jiri Pirko <[email protected]>
Date: Wed, 1 Nov 2017 11:47:37 +0100
Quoted 9 lines
From: Jiri Pirko <[email protected]>
This patchset does a bit of cleanup of leftovers after block callbacks patchset. The main part is patch 2, which restores the original handling of tc offload feature flag.
---
v1->v2:
- rebased on top of current net-next (bnxt changes)
Series applied, thanks Jiri.