Lines Matching refs:op
175 struct bcm_op *op; in bcm_proc_show() local
184 list_for_each_entry(op, &bo->rx_ops, list) { in bcm_proc_show()
189 if (!op->frames_abs) in bcm_proc_show()
192 seq_printf(m, "rx_op: %03X %-5s ", op->can_id, in bcm_proc_show()
193 bcm_proc_getifname(net, ifname, op->ifindex)); in bcm_proc_show()
195 if (op->flags & CAN_FD_FRAME) in bcm_proc_show()
196 seq_printf(m, "(%u)", op->nframes); in bcm_proc_show()
198 seq_printf(m, "[%u]", op->nframes); in bcm_proc_show()
200 seq_printf(m, "%c ", (op->flags & RX_CHECK_DLC) ? 'd' : ' '); in bcm_proc_show()
202 if (op->kt_ival1) in bcm_proc_show()
204 (long long)ktime_to_us(op->kt_ival1)); in bcm_proc_show()
206 if (op->kt_ival2) in bcm_proc_show()
208 (long long)ktime_to_us(op->kt_ival2)); in bcm_proc_show()
211 op->frames_filtered, op->frames_abs); in bcm_proc_show()
213 reduction = 100 - (op->frames_filtered * 100) / op->frames_abs; in bcm_proc_show()
219 list_for_each_entry(op, &bo->tx_ops, list) { in bcm_proc_show()
221 seq_printf(m, "tx_op: %03X %s ", op->can_id, in bcm_proc_show()
222 bcm_proc_getifname(net, ifname, op->ifindex)); in bcm_proc_show()
224 if (op->flags & CAN_FD_FRAME) in bcm_proc_show()
225 seq_printf(m, "(%u) ", op->nframes); in bcm_proc_show()
227 seq_printf(m, "[%u] ", op->nframes); in bcm_proc_show()
229 if (op->kt_ival1) in bcm_proc_show()
231 (long long)ktime_to_us(op->kt_ival1)); in bcm_proc_show()
233 if (op->kt_ival2) in bcm_proc_show()
235 (long long)ktime_to_us(op->kt_ival2)); in bcm_proc_show()
237 seq_printf(m, "# sent %ld\n", op->frames_abs); in bcm_proc_show()
248 static void bcm_can_tx(struct bcm_op *op) in bcm_can_tx() argument
252 struct canfd_frame *cf = op->frames + op->cfsiz * op->currframe; in bcm_can_tx()
255 if (!op->ifindex) in bcm_can_tx()
258 dev = dev_get_by_index(sock_net(op->sk), op->ifindex); in bcm_can_tx()
264 skb = alloc_skb(op->cfsiz + sizeof(struct can_skb_priv), gfp_any()); in bcm_can_tx()
272 skb_put_data(skb, cf, op->cfsiz); in bcm_can_tx()
276 can_skb_set_owner(skb, op->sk); in bcm_can_tx()
280 op->currframe++; in bcm_can_tx()
281 op->frames_abs++; in bcm_can_tx()
284 if (op->currframe >= op->nframes) in bcm_can_tx()
285 op->currframe = 0; in bcm_can_tx()
294 static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head, in bcm_send_to_user() argument
300 struct sock *sk = op->sk; in bcm_send_to_user()
301 unsigned int datalen = head->nframes * op->cfsiz; in bcm_send_to_user()
328 skb->tstamp = op->rx_stamp; in bcm_send_to_user()
342 addr->can_ifindex = op->rx_ifindex; in bcm_send_to_user()
354 static void bcm_tx_start_timer(struct bcm_op *op) in bcm_tx_start_timer() argument
356 if (op->kt_ival1 && op->count) in bcm_tx_start_timer()
357 hrtimer_start(&op->timer, in bcm_tx_start_timer()
358 ktime_add(ktime_get(), op->kt_ival1), in bcm_tx_start_timer()
360 else if (op->kt_ival2) in bcm_tx_start_timer()
361 hrtimer_start(&op->timer, in bcm_tx_start_timer()
362 ktime_add(ktime_get(), op->kt_ival2), in bcm_tx_start_timer()
368 struct bcm_op *op = (struct bcm_op *)data; in bcm_tx_timeout_tsklet() local
371 if (op->kt_ival1 && (op->count > 0)) { in bcm_tx_timeout_tsklet()
373 op->count--; in bcm_tx_timeout_tsklet()
374 if (!op->count && (op->flags & TX_COUNTEVT)) { in bcm_tx_timeout_tsklet()
378 msg_head.flags = op->flags; in bcm_tx_timeout_tsklet()
379 msg_head.count = op->count; in bcm_tx_timeout_tsklet()
380 msg_head.ival1 = op->ival1; in bcm_tx_timeout_tsklet()
381 msg_head.ival2 = op->ival2; in bcm_tx_timeout_tsklet()
382 msg_head.can_id = op->can_id; in bcm_tx_timeout_tsklet()
385 bcm_send_to_user(op, &msg_head, NULL, 0); in bcm_tx_timeout_tsklet()
387 bcm_can_tx(op); in bcm_tx_timeout_tsklet()
389 } else if (op->kt_ival2) in bcm_tx_timeout_tsklet()
390 bcm_can_tx(op); in bcm_tx_timeout_tsklet()
392 bcm_tx_start_timer(op); in bcm_tx_timeout_tsklet()
400 struct bcm_op *op = container_of(hrtimer, struct bcm_op, timer); in bcm_tx_timeout_handler() local
402 tasklet_schedule(&op->tsklet); in bcm_tx_timeout_handler()
410 static void bcm_rx_changed(struct bcm_op *op, struct canfd_frame *data) in bcm_rx_changed() argument
415 op->frames_filtered++; in bcm_rx_changed()
418 if (op->frames_filtered > ULONG_MAX/100) in bcm_rx_changed()
419 op->frames_filtered = op->frames_abs = 0; in bcm_rx_changed()
425 head.flags = op->flags; in bcm_rx_changed()
426 head.count = op->count; in bcm_rx_changed()
427 head.ival1 = op->ival1; in bcm_rx_changed()
428 head.ival2 = op->ival2; in bcm_rx_changed()
429 head.can_id = op->can_id; in bcm_rx_changed()
432 bcm_send_to_user(op, &head, data, 1); in bcm_rx_changed()
440 static void bcm_rx_update_and_send(struct bcm_op *op, in bcm_rx_update_and_send() argument
444 memcpy(lastdata, rxdata, op->cfsiz); in bcm_rx_update_and_send()
450 if (!op->kt_ival2) { in bcm_rx_update_and_send()
452 bcm_rx_changed(op, lastdata); in bcm_rx_update_and_send()
457 if (hrtimer_active(&op->thrtimer)) in bcm_rx_update_and_send()
461 if (!op->kt_lastmsg) in bcm_rx_update_and_send()
465 if (ktime_us_delta(ktime_get(), op->kt_lastmsg) < in bcm_rx_update_and_send()
466 ktime_to_us(op->kt_ival2)) { in bcm_rx_update_and_send()
468 hrtimer_start(&op->thrtimer, in bcm_rx_update_and_send()
469 ktime_add(op->kt_lastmsg, op->kt_ival2), in bcm_rx_update_and_send()
476 bcm_rx_changed(op, lastdata); in bcm_rx_update_and_send()
477 op->kt_lastmsg = ktime_get(); in bcm_rx_update_and_send()
484 static void bcm_rx_cmp_to_index(struct bcm_op *op, unsigned int index, in bcm_rx_cmp_to_index() argument
487 struct canfd_frame *cf = op->frames + op->cfsiz * index; in bcm_rx_cmp_to_index()
488 struct canfd_frame *lcf = op->last_frames + op->cfsiz * index; in bcm_rx_cmp_to_index()
498 bcm_rx_update_and_send(op, lcf, rxdata); in bcm_rx_cmp_to_index()
506 bcm_rx_update_and_send(op, lcf, rxdata); in bcm_rx_cmp_to_index()
511 if (op->flags & RX_CHECK_DLC) { in bcm_rx_cmp_to_index()
514 bcm_rx_update_and_send(op, lcf, rxdata); in bcm_rx_cmp_to_index()
523 static void bcm_rx_starttimer(struct bcm_op *op) in bcm_rx_starttimer() argument
525 if (op->flags & RX_NO_AUTOTIMER) in bcm_rx_starttimer()
528 if (op->kt_ival1) in bcm_rx_starttimer()
529 hrtimer_start(&op->timer, op->kt_ival1, HRTIMER_MODE_REL); in bcm_rx_starttimer()
534 struct bcm_op *op = (struct bcm_op *)data; in bcm_rx_timeout_tsklet() local
539 msg_head.flags = op->flags; in bcm_rx_timeout_tsklet()
540 msg_head.count = op->count; in bcm_rx_timeout_tsklet()
541 msg_head.ival1 = op->ival1; in bcm_rx_timeout_tsklet()
542 msg_head.ival2 = op->ival2; in bcm_rx_timeout_tsklet()
543 msg_head.can_id = op->can_id; in bcm_rx_timeout_tsklet()
546 bcm_send_to_user(op, &msg_head, NULL, 0); in bcm_rx_timeout_tsklet()
554 struct bcm_op *op = container_of(hrtimer, struct bcm_op, timer); in bcm_rx_timeout_handler() local
557 tasklet_hi_schedule(&op->tsklet); in bcm_rx_timeout_handler()
562 if ((op->flags & RX_ANNOUNCE_RESUME) && op->last_frames) { in bcm_rx_timeout_handler()
564 memset(op->last_frames, 0, op->nframes * op->cfsiz); in bcm_rx_timeout_handler()
573 static inline int bcm_rx_do_flush(struct bcm_op *op, int update, in bcm_rx_do_flush() argument
576 struct canfd_frame *lcf = op->last_frames + op->cfsiz * index; in bcm_rx_do_flush()
578 if ((op->last_frames) && (lcf->flags & RX_THR)) { in bcm_rx_do_flush()
580 bcm_rx_changed(op, lcf); in bcm_rx_do_flush()
592 static int bcm_rx_thr_flush(struct bcm_op *op, int update) in bcm_rx_thr_flush() argument
596 if (op->nframes > 1) { in bcm_rx_thr_flush()
600 for (i = 1; i < op->nframes; i++) in bcm_rx_thr_flush()
601 updated += bcm_rx_do_flush(op, update, i); in bcm_rx_thr_flush()
605 updated += bcm_rx_do_flush(op, update, 0); in bcm_rx_thr_flush()
613 struct bcm_op *op = (struct bcm_op *)data; in bcm_rx_thr_tsklet() local
616 bcm_rx_thr_flush(op, 1); in bcm_rx_thr_tsklet()
625 struct bcm_op *op = container_of(hrtimer, struct bcm_op, thrtimer); in bcm_rx_thr_handler() local
627 tasklet_schedule(&op->thrtsklet); in bcm_rx_thr_handler()
629 if (bcm_rx_thr_flush(op, 0)) { in bcm_rx_thr_handler()
630 hrtimer_forward(hrtimer, ktime_get(), op->kt_ival2); in bcm_rx_thr_handler()
634 op->kt_lastmsg = 0; in bcm_rx_thr_handler()
644 struct bcm_op *op = (struct bcm_op *)data; in bcm_rx_handler() local
648 if (op->can_id != rxframe->can_id) in bcm_rx_handler()
652 if (skb->len != op->cfsiz) in bcm_rx_handler()
656 hrtimer_cancel(&op->timer); in bcm_rx_handler()
659 op->rx_stamp = skb->tstamp; in bcm_rx_handler()
661 op->rx_ifindex = skb->dev->ifindex; in bcm_rx_handler()
663 op->frames_abs++; in bcm_rx_handler()
665 if (op->flags & RX_RTR_FRAME) { in bcm_rx_handler()
667 bcm_can_tx(op); in bcm_rx_handler()
671 if (op->flags & RX_FILTER_ID) { in bcm_rx_handler()
673 bcm_rx_update_and_send(op, op->last_frames, rxframe); in bcm_rx_handler()
677 if (op->nframes == 1) { in bcm_rx_handler()
679 bcm_rx_cmp_to_index(op, 0, rxframe); in bcm_rx_handler()
683 if (op->nframes > 1) { in bcm_rx_handler()
692 for (i = 1; i < op->nframes; i++) { in bcm_rx_handler()
693 if ((get_u64(op->frames, 0) & get_u64(rxframe, 0)) == in bcm_rx_handler()
694 (get_u64(op->frames, 0) & in bcm_rx_handler()
695 get_u64(op->frames + op->cfsiz * i, 0))) { in bcm_rx_handler()
696 bcm_rx_cmp_to_index(op, i, rxframe); in bcm_rx_handler()
703 bcm_rx_starttimer(op); in bcm_rx_handler()
712 struct bcm_op *op; in bcm_find_op() local
714 list_for_each_entry(op, ops, list) { in bcm_find_op()
715 if ((op->can_id == mh->can_id) && (op->ifindex == ifindex) && in bcm_find_op()
716 (op->flags & CAN_FD_FRAME) == (mh->flags & CAN_FD_FRAME)) in bcm_find_op()
717 return op; in bcm_find_op()
723 static void bcm_remove_op(struct bcm_op *op) in bcm_remove_op() argument
725 if (op->tsklet.func) { in bcm_remove_op()
726 while (test_bit(TASKLET_STATE_SCHED, &op->tsklet.state) || in bcm_remove_op()
727 test_bit(TASKLET_STATE_RUN, &op->tsklet.state) || in bcm_remove_op()
728 hrtimer_active(&op->timer)) { in bcm_remove_op()
729 hrtimer_cancel(&op->timer); in bcm_remove_op()
730 tasklet_kill(&op->tsklet); in bcm_remove_op()
734 if (op->thrtsklet.func) { in bcm_remove_op()
735 while (test_bit(TASKLET_STATE_SCHED, &op->thrtsklet.state) || in bcm_remove_op()
736 test_bit(TASKLET_STATE_RUN, &op->thrtsklet.state) || in bcm_remove_op()
737 hrtimer_active(&op->thrtimer)) { in bcm_remove_op()
738 hrtimer_cancel(&op->thrtimer); in bcm_remove_op()
739 tasklet_kill(&op->thrtsklet); in bcm_remove_op()
743 if ((op->frames) && (op->frames != &op->sframe)) in bcm_remove_op()
744 kfree(op->frames); in bcm_remove_op()
746 if ((op->last_frames) && (op->last_frames != &op->last_sframe)) in bcm_remove_op()
747 kfree(op->last_frames); in bcm_remove_op()
749 kfree(op); in bcm_remove_op()
752 static void bcm_rx_unreg(struct net_device *dev, struct bcm_op *op) in bcm_rx_unreg() argument
754 if (op->rx_reg_dev == dev) { in bcm_rx_unreg()
755 can_rx_unregister(dev_net(dev), dev, op->can_id, in bcm_rx_unreg()
756 REGMASK(op->can_id), bcm_rx_handler, op); in bcm_rx_unreg()
759 op->rx_reg_dev = NULL; in bcm_rx_unreg()
762 "mismatch %p %p\n", op->rx_reg_dev, dev); in bcm_rx_unreg()
771 struct bcm_op *op, *n; in bcm_delete_rx_op() local
773 list_for_each_entry_safe(op, n, ops, list) { in bcm_delete_rx_op()
774 if ((op->can_id == mh->can_id) && (op->ifindex == ifindex) && in bcm_delete_rx_op()
775 (op->flags & CAN_FD_FRAME) == (mh->flags & CAN_FD_FRAME)) { in bcm_delete_rx_op()
782 if (op->ifindex) { in bcm_delete_rx_op()
788 if (op->rx_reg_dev) { in bcm_delete_rx_op()
791 dev = dev_get_by_index(sock_net(op->sk), in bcm_delete_rx_op()
792 op->ifindex); in bcm_delete_rx_op()
794 bcm_rx_unreg(dev, op); in bcm_delete_rx_op()
799 can_rx_unregister(sock_net(op->sk), NULL, in bcm_delete_rx_op()
800 op->can_id, in bcm_delete_rx_op()
801 REGMASK(op->can_id), in bcm_delete_rx_op()
802 bcm_rx_handler, op); in bcm_delete_rx_op()
804 list_del(&op->list); in bcm_delete_rx_op()
805 bcm_remove_op(op); in bcm_delete_rx_op()
819 struct bcm_op *op, *n; in bcm_delete_tx_op() local
821 list_for_each_entry_safe(op, n, ops, list) { in bcm_delete_tx_op()
822 if ((op->can_id == mh->can_id) && (op->ifindex == ifindex) && in bcm_delete_tx_op()
823 (op->flags & CAN_FD_FRAME) == (mh->flags & CAN_FD_FRAME)) { in bcm_delete_tx_op()
824 list_del(&op->list); in bcm_delete_tx_op()
825 bcm_remove_op(op); in bcm_delete_tx_op()
839 struct bcm_op *op = bcm_find_op(ops, msg_head, ifindex); in bcm_read_op() local
841 if (!op) in bcm_read_op()
845 msg_head->flags = op->flags; in bcm_read_op()
846 msg_head->count = op->count; in bcm_read_op()
847 msg_head->ival1 = op->ival1; in bcm_read_op()
848 msg_head->ival2 = op->ival2; in bcm_read_op()
849 msg_head->nframes = op->nframes; in bcm_read_op()
851 bcm_send_to_user(op, msg_head, op->frames, 0); in bcm_read_op()
863 struct bcm_op *op; in bcm_tx_setup() local
877 op = bcm_find_op(&bo->tx_ops, msg_head, ifindex); in bcm_tx_setup()
878 if (op) { in bcm_tx_setup()
886 if (msg_head->nframes > op->nframes) in bcm_tx_setup()
892 cf = op->frames + op->cfsiz * i; in bcm_tx_setup()
893 err = memcpy_from_msg((u8 *)cf, msg, op->cfsiz); in bcm_tx_setup()
895 if (op->flags & CAN_FD_FRAME) { in bcm_tx_setup()
911 op->flags = msg_head->flags; in bcm_tx_setup()
916 op = kzalloc(OPSIZ, GFP_KERNEL); in bcm_tx_setup()
917 if (!op) in bcm_tx_setup()
920 op->can_id = msg_head->can_id; in bcm_tx_setup()
921 op->cfsiz = CFSIZ(msg_head->flags); in bcm_tx_setup()
922 op->flags = msg_head->flags; in bcm_tx_setup()
926 op->frames = kmalloc_array(msg_head->nframes, in bcm_tx_setup()
927 op->cfsiz, in bcm_tx_setup()
929 if (!op->frames) { in bcm_tx_setup()
930 kfree(op); in bcm_tx_setup()
934 op->frames = &op->sframe; in bcm_tx_setup()
938 cf = op->frames + op->cfsiz * i; in bcm_tx_setup()
939 err = memcpy_from_msg((u8 *)cf, msg, op->cfsiz); in bcm_tx_setup()
941 if (op->flags & CAN_FD_FRAME) { in bcm_tx_setup()
950 if (op->frames != &op->sframe) in bcm_tx_setup()
951 kfree(op->frames); in bcm_tx_setup()
952 kfree(op); in bcm_tx_setup()
963 op->last_frames = NULL; in bcm_tx_setup()
966 op->sk = sk; in bcm_tx_setup()
967 op->ifindex = ifindex; in bcm_tx_setup()
970 hrtimer_init(&op->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in bcm_tx_setup()
971 op->timer.function = bcm_tx_timeout_handler; in bcm_tx_setup()
974 tasklet_init(&op->tsklet, bcm_tx_timeout_tsklet, in bcm_tx_setup()
975 (unsigned long) op); in bcm_tx_setup()
978 hrtimer_init(&op->thrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in bcm_tx_setup()
981 list_add(&op->list, &bo->tx_ops); in bcm_tx_setup()
985 if (op->nframes != msg_head->nframes) { in bcm_tx_setup()
986 op->nframes = msg_head->nframes; in bcm_tx_setup()
988 op->currframe = 0; in bcm_tx_setup()
993 if (op->flags & TX_RESET_MULTI_IDX) { in bcm_tx_setup()
995 op->currframe = 0; in bcm_tx_setup()
998 if (op->flags & SETTIMER) { in bcm_tx_setup()
1000 op->count = msg_head->count; in bcm_tx_setup()
1001 op->ival1 = msg_head->ival1; in bcm_tx_setup()
1002 op->ival2 = msg_head->ival2; in bcm_tx_setup()
1003 op->kt_ival1 = bcm_timeval_to_ktime(msg_head->ival1); in bcm_tx_setup()
1004 op->kt_ival2 = bcm_timeval_to_ktime(msg_head->ival2); in bcm_tx_setup()
1007 if (!op->kt_ival1 && !op->kt_ival2) in bcm_tx_setup()
1008 hrtimer_cancel(&op->timer); in bcm_tx_setup()
1011 if (op->flags & STARTTIMER) { in bcm_tx_setup()
1012 hrtimer_cancel(&op->timer); in bcm_tx_setup()
1014 op->flags |= TX_ANNOUNCE; in bcm_tx_setup()
1017 if (op->flags & TX_ANNOUNCE) { in bcm_tx_setup()
1018 bcm_can_tx(op); in bcm_tx_setup()
1019 if (op->count) in bcm_tx_setup()
1020 op->count--; in bcm_tx_setup()
1023 if (op->flags & STARTTIMER) in bcm_tx_setup()
1024 bcm_tx_start_timer(op); in bcm_tx_setup()
1026 return msg_head->nframes * op->cfsiz + MHSIZ; in bcm_tx_setup()
1036 struct bcm_op *op; in bcm_rx_setup() local
1057 op = bcm_find_op(&bo->rx_ops, msg_head, ifindex); in bcm_rx_setup()
1058 if (op) { in bcm_rx_setup()
1066 if (msg_head->nframes > op->nframes) in bcm_rx_setup()
1071 err = memcpy_from_msg(op->frames, msg, in bcm_rx_setup()
1072 msg_head->nframes * op->cfsiz); in bcm_rx_setup()
1077 memset(op->last_frames, 0, msg_head->nframes * op->cfsiz); in bcm_rx_setup()
1080 op->nframes = msg_head->nframes; in bcm_rx_setup()
1081 op->flags = msg_head->flags; in bcm_rx_setup()
1088 op = kzalloc(OPSIZ, GFP_KERNEL); in bcm_rx_setup()
1089 if (!op) in bcm_rx_setup()
1092 op->can_id = msg_head->can_id; in bcm_rx_setup()
1093 op->nframes = msg_head->nframes; in bcm_rx_setup()
1094 op->cfsiz = CFSIZ(msg_head->flags); in bcm_rx_setup()
1095 op->flags = msg_head->flags; in bcm_rx_setup()
1099 op->frames = kmalloc_array(msg_head->nframes, in bcm_rx_setup()
1100 op->cfsiz, in bcm_rx_setup()
1102 if (!op->frames) { in bcm_rx_setup()
1103 kfree(op); in bcm_rx_setup()
1108 op->last_frames = kcalloc(msg_head->nframes, in bcm_rx_setup()
1109 op->cfsiz, in bcm_rx_setup()
1111 if (!op->last_frames) { in bcm_rx_setup()
1112 kfree(op->frames); in bcm_rx_setup()
1113 kfree(op); in bcm_rx_setup()
1118 op->frames = &op->sframe; in bcm_rx_setup()
1119 op->last_frames = &op->last_sframe; in bcm_rx_setup()
1123 err = memcpy_from_msg(op->frames, msg, in bcm_rx_setup()
1124 msg_head->nframes * op->cfsiz); in bcm_rx_setup()
1126 if (op->frames != &op->sframe) in bcm_rx_setup()
1127 kfree(op->frames); in bcm_rx_setup()
1128 if (op->last_frames != &op->last_sframe) in bcm_rx_setup()
1129 kfree(op->last_frames); in bcm_rx_setup()
1130 kfree(op); in bcm_rx_setup()
1136 op->sk = sk; in bcm_rx_setup()
1137 op->ifindex = ifindex; in bcm_rx_setup()
1140 op->rx_ifindex = ifindex; in bcm_rx_setup()
1143 hrtimer_init(&op->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in bcm_rx_setup()
1144 op->timer.function = bcm_rx_timeout_handler; in bcm_rx_setup()
1147 tasklet_init(&op->tsklet, bcm_rx_timeout_tsklet, in bcm_rx_setup()
1148 (unsigned long) op); in bcm_rx_setup()
1150 hrtimer_init(&op->thrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in bcm_rx_setup()
1151 op->thrtimer.function = bcm_rx_thr_handler; in bcm_rx_setup()
1154 tasklet_init(&op->thrtsklet, bcm_rx_thr_tsklet, in bcm_rx_setup()
1155 (unsigned long) op); in bcm_rx_setup()
1158 list_add(&op->list, &bo->rx_ops); in bcm_rx_setup()
1167 if (op->flags & RX_RTR_FRAME) { in bcm_rx_setup()
1168 struct canfd_frame *frame0 = op->frames; in bcm_rx_setup()
1171 hrtimer_cancel(&op->thrtimer); in bcm_rx_setup()
1172 hrtimer_cancel(&op->timer); in bcm_rx_setup()
1179 if ((op->flags & TX_CP_CAN_ID) || in bcm_rx_setup()
1180 (frame0->can_id == op->can_id)) in bcm_rx_setup()
1181 frame0->can_id = op->can_id & ~CAN_RTR_FLAG; in bcm_rx_setup()
1184 if (op->flags & SETTIMER) { in bcm_rx_setup()
1187 op->ival1 = msg_head->ival1; in bcm_rx_setup()
1188 op->ival2 = msg_head->ival2; in bcm_rx_setup()
1189 op->kt_ival1 = bcm_timeval_to_ktime(msg_head->ival1); in bcm_rx_setup()
1190 op->kt_ival2 = bcm_timeval_to_ktime(msg_head->ival2); in bcm_rx_setup()
1193 if (!op->kt_ival1) in bcm_rx_setup()
1194 hrtimer_cancel(&op->timer); in bcm_rx_setup()
1200 op->kt_lastmsg = 0; in bcm_rx_setup()
1201 hrtimer_cancel(&op->thrtimer); in bcm_rx_setup()
1202 bcm_rx_thr_flush(op, 1); in bcm_rx_setup()
1205 if ((op->flags & STARTTIMER) && op->kt_ival1) in bcm_rx_setup()
1206 hrtimer_start(&op->timer, op->kt_ival1, in bcm_rx_setup()
1218 op->can_id, in bcm_rx_setup()
1219 REGMASK(op->can_id), in bcm_rx_setup()
1220 bcm_rx_handler, op, in bcm_rx_setup()
1223 op->rx_reg_dev = dev; in bcm_rx_setup()
1228 err = can_rx_register(sock_net(sk), NULL, op->can_id, in bcm_rx_setup()
1229 REGMASK(op->can_id), in bcm_rx_setup()
1230 bcm_rx_handler, op, "bcm", sk); in bcm_rx_setup()
1233 list_del(&op->list); in bcm_rx_setup()
1234 bcm_remove_op(op); in bcm_rx_setup()
1239 return msg_head->nframes * op->cfsiz + MHSIZ; in bcm_rx_setup()
1411 struct bcm_op *op; in bcm_notifier() local
1426 list_for_each_entry(op, &bo->rx_ops, list) in bcm_notifier()
1427 if (op->rx_reg_dev == dev) in bcm_notifier()
1428 bcm_rx_unreg(dev, op); in bcm_notifier()
1488 struct bcm_op *op, *next; in bcm_release() local
1502 list_for_each_entry_safe(op, next, &bo->tx_ops, list) in bcm_release()
1503 bcm_remove_op(op); in bcm_release()
1505 list_for_each_entry_safe(op, next, &bo->rx_ops, list) { in bcm_release()
1510 if (op->ifindex) { in bcm_release()
1516 if (op->rx_reg_dev) { in bcm_release()
1519 dev = dev_get_by_index(net, op->ifindex); in bcm_release()
1521 bcm_rx_unreg(dev, op); in bcm_release()
1526 can_rx_unregister(net, NULL, op->can_id, in bcm_release()
1527 REGMASK(op->can_id), in bcm_release()
1528 bcm_rx_handler, op); in bcm_release()
1530 bcm_remove_op(op); in bcm_release()