Commit 5eb4dce3 authored by John Fastabend's avatar John Fastabend Committed by David S. Miller

net: relax setup_tc ndo op handle restriction

I added this check in setup_tc to multiple drivers,

 if (handle != TC_H_ROOT || tc->type != TC_SETUP_MQPRIO)

Unfortunately restricting to TC_H_ROOT like this breaks the old
instantiation of mqprio to setup a hardware qdisc. This patch
relaxes the test to only check the type to make it equivalent
to the check before I broke it. With this the old instantiation
continues to work.

A good smoke test is to setup mqprio with,

# tc qdisc add dev eth4 root mqprio num_tc 8 \
  map 0 1 2 3 4 5 6 7 \
  queues 0@0 1@1 2@2 3@3 4@4 5@5 6@6 7@7

Fixes: e4c6734e ("net: rework ndo tc op to consume additional qdisc handle paramete")
Reported-by: default avatarSingh Krishneil <krishneil.k.singh@intel.com>
Reported-by: default avatarJake Keller <jacob.e.keller@intel.com>
CC: Murali Karicheri <m-karicheri2@ti.com>
CC: Shradha Shah <sshah@solarflare.com>
CC: Or Gerlitz <ogerlitz@mellanox.com>
CC: Ariel Elior <ariel.elior@qlogic.com>
CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
CC: Bruce Allan <bruce.w.allan@intel.com>
CC: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: Don Skidmore <donald.c.skidmore@intel.com>
Signed-off-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 998fc1d0
...@@ -1632,7 +1632,7 @@ static int xgbe_setup_tc(struct net_device *netdev, u32 handle, __be16 proto, ...@@ -1632,7 +1632,7 @@ static int xgbe_setup_tc(struct net_device *netdev, u32 handle, __be16 proto,
struct xgbe_prv_data *pdata = netdev_priv(netdev); struct xgbe_prv_data *pdata = netdev_priv(netdev);
u8 tc; u8 tc;
if (handle != TC_H_ROOT || tc_to_netdev->type != TC_SETUP_MQPRIO) if (tc_to_netdev->type != TC_SETUP_MQPRIO)
return -EINVAL; return -EINVAL;
tc = tc_to_netdev->tc; tc = tc_to_netdev->tc;
......
...@@ -4275,7 +4275,7 @@ int bnx2x_setup_tc(struct net_device *dev, u8 num_tc) ...@@ -4275,7 +4275,7 @@ int bnx2x_setup_tc(struct net_device *dev, u8 num_tc)
int __bnx2x_setup_tc(struct net_device *dev, u32 handle, __be16 proto, int __bnx2x_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
struct tc_to_netdev *tc) struct tc_to_netdev *tc)
{ {
if (handle != TC_H_ROOT || tc->type != TC_SETUP_MQPRIO) if (tc->type != TC_SETUP_MQPRIO)
return -EINVAL; return -EINVAL;
return bnx2x_setup_tc(dev, tc->tc); return bnx2x_setup_tc(dev, tc->tc);
} }
......
...@@ -5447,7 +5447,7 @@ static int bnxt_setup_tc(struct net_device *dev, u32 handle, __be16 proto, ...@@ -5447,7 +5447,7 @@ static int bnxt_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
struct bnxt *bp = netdev_priv(dev); struct bnxt *bp = netdev_priv(dev);
u8 tc; u8 tc;
if (handle != TC_H_ROOT || ntc->type != TC_SETUP_MQPRIO) if (ntc->type != TC_SETUP_MQPRIO)
return -EINVAL; return -EINVAL;
tc = ntc->tc; tc = ntc->tc;
......
...@@ -1207,7 +1207,7 @@ int fm10k_setup_tc(struct net_device *dev, u8 tc) ...@@ -1207,7 +1207,7 @@ int fm10k_setup_tc(struct net_device *dev, u8 tc)
static int __fm10k_setup_tc(struct net_device *dev, u32 handle, __be16 proto, static int __fm10k_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
struct tc_to_netdev *tc) struct tc_to_netdev *tc)
{ {
if (handle != TC_H_ROOT || tc->type != TC_SETUP_MQPRIO) if (tc->type != TC_SETUP_MQPRIO)
return -EINVAL; return -EINVAL;
return fm10k_setup_tc(dev, tc->tc); return fm10k_setup_tc(dev, tc->tc);
......
...@@ -8419,7 +8419,7 @@ int __ixgbe_setup_tc(struct net_device *dev, u32 handle, __be16 proto, ...@@ -8419,7 +8419,7 @@ int __ixgbe_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
} }
} }
if (handle != TC_H_ROOT || tc->type != TC_SETUP_MQPRIO) if (tc->type != TC_SETUP_MQPRIO)
return -EINVAL; return -EINVAL;
return ixgbe_setup_tc(dev, tc->tc); return ixgbe_setup_tc(dev, tc->tc);
......
...@@ -73,7 +73,7 @@ int mlx4_en_setup_tc(struct net_device *dev, u8 up) ...@@ -73,7 +73,7 @@ int mlx4_en_setup_tc(struct net_device *dev, u8 up)
static int __mlx4_en_setup_tc(struct net_device *dev, u32 handle, __be16 proto, static int __mlx4_en_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
struct tc_to_netdev *tc) struct tc_to_netdev *tc)
{ {
if (handle != TC_H_ROOT || tc->type != TC_SETUP_MQPRIO) if (tc->type != TC_SETUP_MQPRIO)
return -EINVAL; return -EINVAL;
return mlx4_en_setup_tc(dev, tc->tc); return mlx4_en_setup_tc(dev, tc->tc);
......
...@@ -571,7 +571,7 @@ int efx_setup_tc(struct net_device *net_dev, u32 handle, __be16 proto, ...@@ -571,7 +571,7 @@ int efx_setup_tc(struct net_device *net_dev, u32 handle, __be16 proto,
unsigned tc, num_tc; unsigned tc, num_tc;
int rc; int rc;
if (handle != TC_H_ROOT || ntc->type != TC_SETUP_MQPRIO) if (ntc->type != TC_SETUP_MQPRIO)
return -EINVAL; return -EINVAL;
num_tc = ntc->tc; num_tc = ntc->tc;
......
...@@ -1860,7 +1860,7 @@ static int netcp_setup_tc(struct net_device *dev, u32 handle, __be16 proto, ...@@ -1860,7 +1860,7 @@ static int netcp_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
/* setup tc must be called under rtnl lock */ /* setup tc must be called under rtnl lock */
ASSERT_RTNL(); ASSERT_RTNL();
if (handle != TC_H_ROOT || tc->type != TC_SETUP_MQPRIO) if (tc->type != TC_SETUP_MQPRIO)
return -EINVAL; return -EINVAL;
/* Sanity-check the number of traffic classes requested */ /* Sanity-check the number of traffic classes requested */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment