* [PATCH net-next v3 1/5] net/sched: sch_htb: use extack on errors messages
2023-04-20 16:49 [PATCH net-next v3 0/5] net/sched: cleanup parsing prints in htb and qfq Pedro Tammela
@ 2023-04-20 16:49 ` Pedro Tammela
2023-04-20 16:49 ` [PATCH net-next v3 2/5] net/sched: sch_qfq: " Pedro Tammela
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Pedro Tammela @ 2023-04-20 16:49 UTC (permalink / raw)
To: netdev
Cc: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni,
simon.horman, Pedro Tammela
Some error messages are still being printed to dmesg.
Since extack is available, provide error messages there.
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
---
net/sched/sch_htb.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 92f2975b6a82..8aef7dd9fb88 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1786,7 +1786,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
goto failure;
err = nla_parse_nested_deprecated(tb, TCA_HTB_MAX, opt, htb_policy,
- NULL);
+ extack);
if (err < 0)
goto failure;
@@ -1858,7 +1858,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
/* check maximal depth */
if (parent && parent->parent && parent->parent->level < 2) {
- pr_err("htb: tree is too deep\n");
+ NL_SET_ERR_MSG_MOD(extack, "tree is too deep");
goto failure;
}
err = -ENOBUFS;
@@ -1917,8 +1917,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
};
err = htb_offload(dev, &offload_opt);
if (err) {
- pr_err("htb: TC_HTB_LEAF_ALLOC_QUEUE failed with err = %d\n",
- err);
+ NL_SET_ERR_MSG_WEAK(extack,
+ "Failed to offload TC_HTB_LEAF_ALLOC_QUEUE");
goto err_kill_estimator;
}
dev_queue = netdev_get_tx_queue(dev, offload_opt.qid);
@@ -1937,8 +1937,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
};
err = htb_offload(dev, &offload_opt);
if (err) {
- pr_err("htb: TC_HTB_LEAF_TO_INNER failed with err = %d\n",
- err);
+ NL_SET_ERR_MSG_WEAK(extack,
+ "Failed to offload TC_HTB_LEAF_TO_INNER");
htb_graft_helper(dev_queue, old_q);
goto err_kill_estimator;
}
@@ -2067,8 +2067,9 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
qdisc_put(parent_qdisc);
if (warn)
- pr_warn("HTB: quantum of class %X is %s. Consider r2q change.\n",
- cl->common.classid, (warn == -1 ? "small" : "big"));
+ NL_SET_ERR_MSG_FMT_MOD(extack,
+ "quantum of class %X is %s. Consider r2q change.",
+ cl->common.classid, (warn == -1 ? "small" : "big"));
qdisc_class_hash_grow(sch, &q->clhash);
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH net-next v3 2/5] net/sched: sch_qfq: use extack on errors messages
2023-04-20 16:49 [PATCH net-next v3 0/5] net/sched: cleanup parsing prints in htb and qfq Pedro Tammela
2023-04-20 16:49 ` [PATCH net-next v3 1/5] net/sched: sch_htb: use extack on errors messages Pedro Tammela
@ 2023-04-20 16:49 ` Pedro Tammela
2023-04-20 16:49 ` [PATCH net-next v3 3/5] net/sched: sch_qfq: refactor parsing of netlink parameters Pedro Tammela
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Pedro Tammela @ 2023-04-20 16:49 UTC (permalink / raw)
To: netdev
Cc: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni,
simon.horman, Pedro Tammela
Some error messages are still being printed to dmesg.
Since extack is available, provide error messages there.
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
---
net/sched/sch_qfq.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
index cf5ebe43b3b4..323609cfbc67 100644
--- a/net/sched/sch_qfq.c
+++ b/net/sched/sch_qfq.c
@@ -402,8 +402,8 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
int err;
int delta_w;
- if (tca[TCA_OPTIONS] == NULL) {
- pr_notice("qfq: no options\n");
+ if (NL_REQ_ATTR_CHECK(extack, NULL, tca, TCA_OPTIONS)) {
+ NL_SET_ERR_MSG_MOD(extack, "missing options");
return -EINVAL;
}
@@ -441,8 +441,9 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
delta_w = weight - (cl ? cl->agg->class_weight : 0);
if (q->wsum + delta_w > QFQ_MAX_WSUM) {
- pr_notice("qfq: total weight out of range (%d + %u)\n",
- delta_w, q->wsum);
+ NL_SET_ERR_MSG_FMT_MOD(extack,
+ "total weight out of range (%d + %u)\n",
+ delta_w, q->wsum);
return -EINVAL;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH net-next v3 3/5] net/sched: sch_qfq: refactor parsing of netlink parameters
2023-04-20 16:49 [PATCH net-next v3 0/5] net/sched: cleanup parsing prints in htb and qfq Pedro Tammela
2023-04-20 16:49 ` [PATCH net-next v3 1/5] net/sched: sch_htb: use extack on errors messages Pedro Tammela
2023-04-20 16:49 ` [PATCH net-next v3 2/5] net/sched: sch_qfq: " Pedro Tammela
@ 2023-04-20 16:49 ` Pedro Tammela
2023-04-20 16:49 ` [PATCH net-next v3 4/5] selftests: tc-testing: add more tests for sch_qfq Pedro Tammela
2023-04-20 16:49 ` [PATCH net-next v3 5/5] net/sched: sch_qfq: BITify two bound definitions Pedro Tammela
4 siblings, 0 replies; 10+ messages in thread
From: Pedro Tammela @ 2023-04-20 16:49 UTC (permalink / raw)
To: netdev
Cc: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni,
simon.horman, Pedro Tammela
Two parameters can be transformed into netlink policies and
validated while parsing the netlink message.
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
---
net/sched/sch_qfq.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
index 323609cfbc67..dfd9a99e6257 100644
--- a/net/sched/sch_qfq.c
+++ b/net/sched/sch_qfq.c
@@ -113,6 +113,7 @@
#define QFQ_MTU_SHIFT 16 /* to support TSO/GSO */
#define QFQ_MIN_LMAX 512 /* see qfq_slot_insert */
+#define QFQ_MAX_LMAX (1UL << QFQ_MTU_SHIFT)
#define QFQ_MAX_AGG_CLASSES 8 /* max num classes per aggregate allowed */
@@ -214,9 +215,14 @@ static struct qfq_class *qfq_find_class(struct Qdisc *sch, u32 classid)
return container_of(clc, struct qfq_class, common);
}
+static struct netlink_range_validation lmax_range = {
+ .min = QFQ_MIN_LMAX,
+ .max = QFQ_MAX_LMAX,
+};
+
static const struct nla_policy qfq_policy[TCA_QFQ_MAX + 1] = {
- [TCA_QFQ_WEIGHT] = { .type = NLA_U32 },
- [TCA_QFQ_LMAX] = { .type = NLA_U32 },
+ [TCA_QFQ_WEIGHT] = NLA_POLICY_RANGE(NLA_U32, 1, QFQ_MAX_WEIGHT),
+ [TCA_QFQ_LMAX] = NLA_POLICY_FULL_RANGE(NLA_U32, &lmax_range),
};
/*
@@ -408,26 +414,18 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
}
err = nla_parse_nested_deprecated(tb, TCA_QFQ_MAX, tca[TCA_OPTIONS],
- qfq_policy, NULL);
+ qfq_policy, extack);
if (err < 0)
return err;
- if (tb[TCA_QFQ_WEIGHT]) {
+ if (tb[TCA_QFQ_WEIGHT])
weight = nla_get_u32(tb[TCA_QFQ_WEIGHT]);
- if (!weight || weight > (1UL << QFQ_MAX_WSHIFT)) {
- pr_notice("qfq: invalid weight %u\n", weight);
- return -EINVAL;
- }
- } else
+ else
weight = 1;
- if (tb[TCA_QFQ_LMAX]) {
+ if (tb[TCA_QFQ_LMAX])
lmax = nla_get_u32(tb[TCA_QFQ_LMAX]);
- if (lmax < QFQ_MIN_LMAX || lmax > (1UL << QFQ_MTU_SHIFT)) {
- pr_notice("qfq: invalid max length %u\n", lmax);
- return -EINVAL;
- }
- } else
+ else
lmax = psched_mtu(qdisc_dev(sch));
inv_w = ONE_FP / weight;
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH net-next v3 4/5] selftests: tc-testing: add more tests for sch_qfq
2023-04-20 16:49 [PATCH net-next v3 0/5] net/sched: cleanup parsing prints in htb and qfq Pedro Tammela
` (2 preceding siblings ...)
2023-04-20 16:49 ` [PATCH net-next v3 3/5] net/sched: sch_qfq: refactor parsing of netlink parameters Pedro Tammela
@ 2023-04-20 16:49 ` Pedro Tammela
2023-04-20 16:49 ` [PATCH net-next v3 5/5] net/sched: sch_qfq: BITify two bound definitions Pedro Tammela
4 siblings, 0 replies; 10+ messages in thread
From: Pedro Tammela @ 2023-04-20 16:49 UTC (permalink / raw)
To: netdev
Cc: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni,
simon.horman, Pedro Tammela
The QFQ qdisc class has parameter bounds that are not being
checked for correctness.
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
---
.../tc-testing/tc-tests/qdiscs/qfq.json | 72 +++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json
index 330f1a25e0ab..147899a868d3 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json
@@ -46,6 +46,30 @@
"$IP link del dev $DUMMY type dummy"
]
},
+ {
+ "id": "d364",
+ "name": "Test QFQ with max class weight setting",
+ "category": [
+ "qdisc",
+ "qfq"
+ ],
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ "$IP link add dev $DUMMY type dummy || /bin/true",
+ "$TC qdisc add dev $DUMMY handle 1: root qfq"
+ ],
+ "cmdUnderTest": "$TC class add dev $DUMMY parent 1: classid 1:1 qfq weight 9999",
+ "expExitCode": "2",
+ "verifyCmd": "$TC class show dev $DUMMY",
+ "matchPattern": "class qfq 1:1 root weight 9999 maxpkt",
+ "matchCount": "0",
+ "teardown": [
+ "$TC qdisc del dev $DUMMY handle 1: root",
+ "$IP link del dev $DUMMY type dummy"
+ ]
+ },
{
"id": "8452",
"name": "Create QFQ with class maxpkt setting",
@@ -70,6 +94,54 @@
"$IP link del dev $DUMMY type dummy"
]
},
+ {
+ "id": "22df",
+ "name": "Test QFQ class maxpkt setting lower bound",
+ "category": [
+ "qdisc",
+ "qfq"
+ ],
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ "$IP link add dev $DUMMY type dummy || /bin/true",
+ "$TC qdisc add dev $DUMMY handle 1: root qfq"
+ ],
+ "cmdUnderTest": "$TC class add dev $DUMMY parent 1: classid 1:1 qfq maxpkt 128",
+ "expExitCode": "2",
+ "verifyCmd": "$TC class show dev $DUMMY",
+ "matchPattern": "class qfq 1:1 root weight 1 maxpkt 128",
+ "matchCount": "0",
+ "teardown": [
+ "$TC qdisc del dev $DUMMY handle 1: root",
+ "$IP link del dev $DUMMY type dummy"
+ ]
+ },
+ {
+ "id": "92ee",
+ "name": "Test QFQ class maxpkt setting upper bound",
+ "category": [
+ "qdisc",
+ "qfq"
+ ],
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ "$IP link add dev $DUMMY type dummy || /bin/true",
+ "$TC qdisc add dev $DUMMY handle 1: root qfq"
+ ],
+ "cmdUnderTest": "$TC class add dev $DUMMY parent 1: classid 1:1 qfq maxpkt 99999",
+ "expExitCode": "2",
+ "verifyCmd": "$TC class show dev $DUMMY",
+ "matchPattern": "class qfq 1:1 root weight 1 maxpkt 99999",
+ "matchCount": "0",
+ "teardown": [
+ "$TC qdisc del dev $DUMMY handle 1: root",
+ "$IP link del dev $DUMMY type dummy"
+ ]
+ },
{
"id": "d920",
"name": "Create QFQ with multiple class setting",
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH net-next v3 5/5] net/sched: sch_qfq: BITify two bound definitions
2023-04-20 16:49 [PATCH net-next v3 0/5] net/sched: cleanup parsing prints in htb and qfq Pedro Tammela
` (3 preceding siblings ...)
2023-04-20 16:49 ` [PATCH net-next v3 4/5] selftests: tc-testing: add more tests for sch_qfq Pedro Tammela
@ 2023-04-20 16:49 ` Pedro Tammela
2023-04-21 9:10 ` Simon Horman
2023-04-21 9:17 ` Eric Dumazet
4 siblings, 2 replies; 10+ messages in thread
From: Pedro Tammela @ 2023-04-20 16:49 UTC (permalink / raw)
To: netdev
Cc: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni,
simon.horman, Pedro Tammela
For the sake of readability, change these two definitions to BIT()
macros.
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
---
net/sched/sch_qfq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
index dfd9a99e6257..4b9cc8a46e2a 100644
--- a/net/sched/sch_qfq.c
+++ b/net/sched/sch_qfq.c
@@ -105,7 +105,7 @@
#define QFQ_MAX_INDEX 24
#define QFQ_MAX_WSHIFT 10
-#define QFQ_MAX_WEIGHT (1<<QFQ_MAX_WSHIFT) /* see qfq_slot_insert */
+#define QFQ_MAX_WEIGHT BIT(QFQ_MAX_WSHIFT) /* see qfq_slot_insert */
#define QFQ_MAX_WSUM (64*QFQ_MAX_WEIGHT)
#define FRAC_BITS 30 /* fixed point arithmetic */
@@ -113,7 +113,7 @@
#define QFQ_MTU_SHIFT 16 /* to support TSO/GSO */
#define QFQ_MIN_LMAX 512 /* see qfq_slot_insert */
-#define QFQ_MAX_LMAX (1UL << QFQ_MTU_SHIFT)
+#define QFQ_MAX_LMAX BIT(QFQ_MTU_SHIFT)
#define QFQ_MAX_AGG_CLASSES 8 /* max num classes per aggregate allowed */
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH net-next v3 5/5] net/sched: sch_qfq: BITify two bound definitions
2023-04-20 16:49 ` [PATCH net-next v3 5/5] net/sched: sch_qfq: BITify two bound definitions Pedro Tammela
@ 2023-04-21 9:10 ` Simon Horman
2023-04-21 9:17 ` Eric Dumazet
1 sibling, 0 replies; 10+ messages in thread
From: Simon Horman @ 2023-04-21 9:10 UTC (permalink / raw)
To: Pedro Tammela
Cc: netdev, jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni
On Thu, Apr 20, 2023 at 01:49:28PM -0300, Pedro Tammela wrote:
> For the sake of readability, change these two definitions to BIT()
> macros.
>
> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next v3 5/5] net/sched: sch_qfq: BITify two bound definitions
2023-04-20 16:49 ` [PATCH net-next v3 5/5] net/sched: sch_qfq: BITify two bound definitions Pedro Tammela
2023-04-21 9:10 ` Simon Horman
@ 2023-04-21 9:17 ` Eric Dumazet
2023-04-21 9:30 ` Simon Horman
1 sibling, 1 reply; 10+ messages in thread
From: Eric Dumazet @ 2023-04-21 9:17 UTC (permalink / raw)
To: Pedro Tammela
Cc: netdev, jhs, xiyou.wangcong, jiri, davem, kuba, pabeni,
simon.horman
On Thu, Apr 20, 2023 at 6:50 PM Pedro Tammela <pctammela@mojatatu.com> wrote:
>
> For the sake of readability, change these two definitions to BIT()
> macros.
>
> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
> ---
> net/sched/sch_qfq.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
> index dfd9a99e6257..4b9cc8a46e2a 100644
> --- a/net/sched/sch_qfq.c
> +++ b/net/sched/sch_qfq.c
> @@ -105,7 +105,7 @@
> #define QFQ_MAX_INDEX 24
> #define QFQ_MAX_WSHIFT 10
>
> -#define QFQ_MAX_WEIGHT (1<<QFQ_MAX_WSHIFT) /* see qfq_slot_insert */
> +#define QFQ_MAX_WEIGHT BIT(QFQ_MAX_WSHIFT) /* see qfq_slot_insert */
I am not sure I find BIT(X) more readable in this context.
Say MAX_WEIGHT was 0xF000, should we then use
#define MAX_WEIGHT (BIT(15) | BIT(14) |BIT(13) | BIT(12))
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next v3 5/5] net/sched: sch_qfq: BITify two bound definitions
2023-04-21 9:17 ` Eric Dumazet
@ 2023-04-21 9:30 ` Simon Horman
2023-04-21 14:31 ` Pedro Tammela
0 siblings, 1 reply; 10+ messages in thread
From: Simon Horman @ 2023-04-21 9:30 UTC (permalink / raw)
To: Eric Dumazet
Cc: Pedro Tammela, netdev, jhs, xiyou.wangcong, jiri, davem, kuba,
pabeni
On Fri, Apr 21, 2023 at 11:17:23AM +0200, Eric Dumazet wrote:
> On Thu, Apr 20, 2023 at 6:50 PM Pedro Tammela <pctammela@mojatatu.com> wrote:
> >
> > For the sake of readability, change these two definitions to BIT()
> > macros.
> >
> > Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
> > Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
> > ---
> > net/sched/sch_qfq.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
> > index dfd9a99e6257..4b9cc8a46e2a 100644
> > --- a/net/sched/sch_qfq.c
> > +++ b/net/sched/sch_qfq.c
> > @@ -105,7 +105,7 @@
> > #define QFQ_MAX_INDEX 24
> > #define QFQ_MAX_WSHIFT 10
> >
> > -#define QFQ_MAX_WEIGHT (1<<QFQ_MAX_WSHIFT) /* see qfq_slot_insert */
> > +#define QFQ_MAX_WEIGHT BIT(QFQ_MAX_WSHIFT) /* see qfq_slot_insert */
>
> I am not sure I find BIT(X) more readable in this context.
>
> Say MAX_WEIGHT was 0xF000, should we then use
>
> #define MAX_WEIGHT (BIT(15) | BIT(14) |BIT(13) | BIT(12))
Thanks Eric,
I think this is my mistake for suggesting this change.
I agree BIT() is not so good here after all.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next v3 5/5] net/sched: sch_qfq: BITify two bound definitions
2023-04-21 9:30 ` Simon Horman
@ 2023-04-21 14:31 ` Pedro Tammela
0 siblings, 0 replies; 10+ messages in thread
From: Pedro Tammela @ 2023-04-21 14:31 UTC (permalink / raw)
To: Simon Horman, Eric Dumazet
Cc: netdev, jhs, xiyou.wangcong, jiri, davem, kuba, pabeni
On 21/04/2023 06:30, Simon Horman wrote:
> On Fri, Apr 21, 2023 at 11:17:23AM +0200, Eric Dumazet wrote:
>> On Thu, Apr 20, 2023 at 6:50 PM Pedro Tammela <pctammela@mojatatu.com> wrote:
>>>
>>> For the sake of readability, change these two definitions to BIT()
>>> macros.
>>>
>>> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
>>> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
>>> ---
>>> net/sched/sch_qfq.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
>>> index dfd9a99e6257..4b9cc8a46e2a 100644
>>> --- a/net/sched/sch_qfq.c
>>> +++ b/net/sched/sch_qfq.c
>>> @@ -105,7 +105,7 @@
>>> #define QFQ_MAX_INDEX 24
>>> #define QFQ_MAX_WSHIFT 10
>>>
>>> -#define QFQ_MAX_WEIGHT (1<<QFQ_MAX_WSHIFT) /* see qfq_slot_insert */
>>> +#define QFQ_MAX_WEIGHT BIT(QFQ_MAX_WSHIFT) /* see qfq_slot_insert */
>>
>> I am not sure I find BIT(X) more readable in this context.
>>
>> Say MAX_WEIGHT was 0xF000, should we then use
>>
>> #define MAX_WEIGHT (BIT(15) | BIT(14) |BIT(13) | BIT(12))
>
> Thanks Eric,
>
> I think this is my mistake for suggesting this change.
> I agree BIT() is not so good here after all.
Fair enough,
Will remove it and repost.
Thanks for the reviews.
^ permalink raw reply [flat|nested] 10+ messages in thread