Skip to content

Commit

Permalink
Merge patch series "can: raw: random optimizations"
Browse files Browse the repository at this point in the history
Ziyang Xuan <william.xuanziyang@huawei.com> says:

Do some small optimizations for can_raw.

Link: https://lore.kernel.org/all/cover.1661584485.git.william.xuanziyang@huawei.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
Marc Kleine-Budde committed Sep 6, 2022
2 parents 318d823 + 170277c commit bcedce7
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions net/can/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,13 @@ static void raw_rcv(struct sk_buff *oskb, void *data)
/* eliminate multiple filter matches for the same skb */
if (this_cpu_ptr(ro->uniq)->skb == oskb &&
this_cpu_ptr(ro->uniq)->skbcnt == can_skb_prv(oskb)->skbcnt) {
if (ro->join_filters) {
this_cpu_inc(ro->uniq->join_rx_count);
/* drop frame until all enabled filters matched */
if (this_cpu_ptr(ro->uniq)->join_rx_count < ro->count)
return;
} else {
if (!ro->join_filters)
return;

this_cpu_inc(ro->uniq->join_rx_count);
/* drop frame until all enabled filters matched */
if (this_cpu_ptr(ro->uniq)->join_rx_count < ro->count)
return;
}
} else {
this_cpu_ptr(ro->uniq)->skb = oskb;
this_cpu_ptr(ro->uniq)->skbcnt = can_skb_prv(oskb)->skbcnt;
Expand Down Expand Up @@ -942,12 +941,20 @@ static __init int raw_module_init(void)

pr_info("can: raw protocol\n");

err = register_netdevice_notifier(&canraw_notifier);
if (err)
return err;

err = can_proto_register(&raw_can_proto);
if (err < 0)
if (err < 0) {
pr_err("can: registration of raw protocol failed\n");
else
register_netdevice_notifier(&canraw_notifier);
goto register_proto_failed;
}

return 0;

register_proto_failed:
unregister_netdevice_notifier(&canraw_notifier);
return err;
}

Expand Down

0 comments on commit bcedce7

Please sign in to comment.