netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net/sched: sch_mqprio: use netlink payload helpers
@ 2023-04-04 20:34 Pedro Tammela
  2023-04-05 16:04 ` Simon Horman
  2023-04-06  1:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Pedro Tammela @ 2023-04-04 20:34 UTC (permalink / raw)
  To: netdev
  Cc: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni,
	Pedro Tammela

For the sake of readability, use the netlink payload helpers from
the 'nla_get_*()' family to parse the attributes.

tdc results:
1..5
ok 1 9903 - Add mqprio Qdisc to multi-queue device (8 queues)
ok 2 453a - Delete nonexistent mqprio Qdisc
ok 3 5292 - Delete mqprio Qdisc twice
ok 4 45a9 - Add mqprio Qdisc to single-queue device
ok 5 2ba9 - Show mqprio class

Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
---
 net/sched/sch_mqprio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c
index 48ed87b91086..fdd6a6575a54 100644
--- a/net/sched/sch_mqprio.c
+++ b/net/sched/sch_mqprio.c
@@ -178,12 +178,12 @@ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt,
 
 	if (tb[TCA_MQPRIO_MODE]) {
 		priv->flags |= TC_MQPRIO_F_MODE;
-		priv->mode = *(u16 *)nla_data(tb[TCA_MQPRIO_MODE]);
+		priv->mode = nla_get_u16(tb[TCA_MQPRIO_MODE]);
 	}
 
 	if (tb[TCA_MQPRIO_SHAPER]) {
 		priv->flags |= TC_MQPRIO_F_SHAPER;
-		priv->shaper = *(u16 *)nla_data(tb[TCA_MQPRIO_SHAPER]);
+		priv->shaper = nla_get_u16(tb[TCA_MQPRIO_SHAPER]);
 	}
 
 	if (tb[TCA_MQPRIO_MIN_RATE64]) {
@@ -196,7 +196,7 @@ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt,
 				return -EINVAL;
 			if (i >= qopt->num_tc)
 				break;
-			priv->min_rate[i] = *(u64 *)nla_data(attr);
+			priv->min_rate[i] = nla_get_u64(attr);
 			i++;
 		}
 		priv->flags |= TC_MQPRIO_F_MIN_RATE;
@@ -212,7 +212,7 @@ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt,
 				return -EINVAL;
 			if (i >= qopt->num_tc)
 				break;
-			priv->max_rate[i] = *(u64 *)nla_data(attr);
+			priv->max_rate[i] = nla_get_u64(attr);
 			i++;
 		}
 		priv->flags |= TC_MQPRIO_F_MAX_RATE;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net/sched: sch_mqprio: use netlink payload helpers
  2023-04-04 20:34 [PATCH net-next] net/sched: sch_mqprio: use netlink payload helpers Pedro Tammela
@ 2023-04-05 16:04 ` Simon Horman
  2023-04-06  1:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-04-05 16:04 UTC (permalink / raw)
  To: Pedro Tammela
  Cc: netdev, jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni

On Tue, Apr 04, 2023 at 05:34:49PM -0300, Pedro Tammela wrote:
> For the sake of readability, use the netlink payload helpers from
> the 'nla_get_*()' family to parse the attributes.
> 
> tdc results:
> 1..5
> ok 1 9903 - Add mqprio Qdisc to multi-queue device (8 queues)
> ok 2 453a - Delete nonexistent mqprio Qdisc
> ok 3 5292 - Delete mqprio Qdisc twice
> ok 4 45a9 - Add mqprio Qdisc to single-queue device
> ok 5 2ba9 - Show mqprio class
> 
> 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] 3+ messages in thread

* Re: [PATCH net-next] net/sched: sch_mqprio: use netlink payload helpers
  2023-04-04 20:34 [PATCH net-next] net/sched: sch_mqprio: use netlink payload helpers Pedro Tammela
  2023-04-05 16:04 ` Simon Horman
@ 2023-04-06  1:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-04-06  1:20 UTC (permalink / raw)
  To: Pedro Tammela
  Cc: netdev, jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue,  4 Apr 2023 17:34:49 -0300 you wrote:
> For the sake of readability, use the netlink payload helpers from
> the 'nla_get_*()' family to parse the attributes.
> 
> tdc results:
> 1..5
> ok 1 9903 - Add mqprio Qdisc to multi-queue device (8 queues)
> ok 2 453a - Delete nonexistent mqprio Qdisc
> ok 3 5292 - Delete mqprio Qdisc twice
> ok 4 45a9 - Add mqprio Qdisc to single-queue device
> ok 5 2ba9 - Show mqprio class
> 
> [...]

Here is the summary with links:
  - [net-next] net/sched: sch_mqprio: use netlink payload helpers
    https://git.kernel.org/netdev/net-next/c/8b0f256530d9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-06  1:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-04 20:34 [PATCH net-next] net/sched: sch_mqprio: use netlink payload helpers Pedro Tammela
2023-04-05 16:04 ` Simon Horman
2023-04-06  1:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).