Merge patch series "can: raw: random optimizations"
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>
This commit is contained in:
commit
bcedce7cf4
@ -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;
|
||||
@ -942,12 +941,20 @@ static __init int raw_module_init(void)
|
||||
|
||||
pr_info("can: raw protocol\n");
|
||||
|
||||
err = can_proto_register(&raw_can_proto);
|
||||
if (err < 0)
|
||||
pr_err("can: registration of raw protocol failed\n");
|
||||
else
|
||||
register_netdevice_notifier(&canraw_notifier);
|
||||
err = register_netdevice_notifier(&canraw_notifier);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = can_proto_register(&raw_can_proto);
|
||||
if (err < 0) {
|
||||
pr_err("can: registration of raw protocol failed\n");
|
||||
goto register_proto_failed;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
register_proto_failed:
|
||||
unregister_netdevice_notifier(&canraw_notifier);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user