]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sch_htb: Allow HTB priority parameter in offload mode
authorNaveen Mamindlapalli <naveenm@marvell.com>
Sat, 13 May 2023 08:51:36 +0000 (14:21 +0530)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 May 2023 08:31:07 +0000 (09:31 +0100)
The current implementation of HTB offload returns the EINVAL error
for unsupported parameters like prio and quantum. This patch removes
the error returning checks for 'prio' parameter and populates its
value to tc_htb_qopt_offload structure such that driver can use the
same.

Add prio parameter check in mlx5 driver, as mlx5 devices are not capable
of supporting the prio parameter when htb offload is used. Report error
if prio parameter is set to a non-default value.

Signed-off-by: Naveen Mamindlapalli <naveenm@marvell.com>
Co-developed-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/en/qos.c
include/net/pkt_cls.h
net/sched/sch_htb.c

index 2842195ee548adf5a464c2a1fd7429114360cb4e..1874c2f0587f414cc6450f2b87c341a32005e77d 100644 (file)
@@ -379,6 +379,12 @@ int mlx5e_htb_setup_tc(struct mlx5e_priv *priv, struct tc_htb_qopt_offload *htb_
        if (!htb && htb_qopt->command != TC_HTB_CREATE)
                return -EINVAL;
 
+       if (htb_qopt->prio) {
+               NL_SET_ERR_MSG_MOD(htb_qopt->extack,
+                                  "prio parameter is not supported by device with HTB offload enabled.");
+               return -EOPNOTSUPP;
+       }
+
        switch (htb_qopt->command) {
        case TC_HTB_CREATE:
                if (!mlx5_qos_is_supported(priv->mdev)) {
@@ -515,4 +521,3 @@ int mlx5e_mqprio_rl_get_node_hw_id(struct mlx5e_mqprio_rl *rl, int tc, u32 *hw_i
        *hw_id = rl->leaves_id[tc];
        return 0;
 }
-
index b3b5b0b62f161e4b0fde3ec035d886eff74a7cb6..a2ea45c7b53eb75d6e0c7e99190f0ebad967c976 100644 (file)
@@ -868,6 +868,7 @@ struct tc_htb_qopt_offload {
        u16 qid;
        u64 rate;
        u64 ceil;
+       u8 prio;
 };
 
 #define TC_HTB_CLASSID_ROOT U32_MAX
index 8aef7dd9fb88ea4ddf7d25d98001d9c6270190bd..325c29041c7d696fe7ee72c7335720ed812330a4 100644 (file)
@@ -1814,10 +1814,6 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
                        NL_SET_ERR_MSG(extack, "HTB offload doesn't support the quantum parameter");
                        goto failure;
                }
-               if (hopt->prio) {
-                       NL_SET_ERR_MSG(extack, "HTB offload doesn't support the prio parameter");
-                       goto failure;
-               }
        }
 
        /* Keeping backward compatible with rate_table based iproute2 tc */
@@ -1913,6 +1909,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
                                        TC_HTB_CLASSID_ROOT,
                                .rate = max_t(u64, hopt->rate.rate, rate64),
                                .ceil = max_t(u64, hopt->ceil.rate, ceil64),
+                               .prio = hopt->prio,
                                .extack = extack,
                        };
                        err = htb_offload(dev, &offload_opt);
@@ -1933,6 +1930,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
                                        TC_H_MIN(parent->common.classid),
                                .rate = max_t(u64, hopt->rate.rate, rate64),
                                .ceil = max_t(u64, hopt->ceil.rate, ceil64),
+                               .prio = hopt->prio,
                                .extack = extack,
                        };
                        err = htb_offload(dev, &offload_opt);
@@ -2018,6 +2016,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
                                .classid = cl->common.classid,
                                .rate = max_t(u64, hopt->rate.rate, rate64),
                                .ceil = max_t(u64, hopt->ceil.rate, ceil64),
+                               .prio = hopt->prio,
                                .extack = extack,
                        };
                        err = htb_offload(dev, &offload_opt);