]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: sched: move the can_offload check from binding phase to rule insertion phase
authorJiri Pirko <jiri@mellanox.com>
Wed, 1 Nov 2017 10:47:39 +0000 (11:47 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 2 Nov 2017 07:10:39 +0000 (16:10 +0900)
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.

Reported-by: Alexander Duyck <alexander.duyck@gmail.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/netronome/nfp/bpf/main.c
drivers/net/ethernet/netronome/nfp/flower/offload.c
net/dsa/slave.c
net/sched/cls_api.c

index 5ce950629ce9c2b03a4781b12aa231d7f49e9f0d..c3dfaa5151aaaa1f86cd3a42aee104702eaab460 100644 (file)
@@ -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) {
index c1761ed5785e1ad0b98e8ebd9292295d5cdbf12d..b6aa7db9970520412e26dd3cfd7f3a24a222746a 100644 (file)
@@ -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) {
index 8fd41917c07ac6e855c9d8f1f907ee66f7fb3dc7..6f900ffe25cccaec30b3dfba70226ad08398900a 100644 (file)
@@ -2943,6 +2943,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);
index 38bd2e339e482c2f473db36a7f298976fcab2e69..507977994a03a338a3907af839f7e30209029f7b 100644 (file)
@@ -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);
index 560b208c048366313dcd649c4fd7088eb1337f3c..28ae00b3eb88abcbbc2368b0ff423e6464aad8da 100644 (file)
@@ -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);
index 0edb7065d811645bf2eca1197dd9ec18eb958bdf..2c43606c26b59871d2232ab14c816b10cb8bdc83 100644 (file)
@@ -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);
index 021926974da60a0edc599dafca3525a401df08c0..3f4be9556e56fe18fb15687091135106a3cabad7 100644 (file)
@@ -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,
index f15a186f6c871c6872c1a78e1a1212abbd3e1f1e..04424db24b80ce0831ad5caade363a1df9be3ff3 100644 (file)
@@ -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) ||
index c47753fdb55bf50a9698fdc4e6cfa658ec39bf3a..7c6cab176293b0ef6e2c610fe7557115a525c059 100644 (file)
@@ -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,
index 48b954a76b0d9bafa1e115fd09f5d4418acfc68e..9b75d0ac40929b549851faa941f3620f716bbe5b 100644 (file)
@@ -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);
index 2c03fcbc7188c6b42cb770764cef94d12a0b519f..15e3216ef25db5af3b493a7abc50539fd910107b 100644 (file)
@@ -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;