• Home
  • Raw
  • Download

Lines Matching refs:msg_head

152 static bool bcm_is_invalid_tv(struct bcm_msg_head *msg_head)  in bcm_is_invalid_tv()  argument
154 if ((msg_head->ival1.tv_sec < 0) || in bcm_is_invalid_tv()
155 (msg_head->ival1.tv_sec > BCM_TIMER_SEC_MAX) || in bcm_is_invalid_tv()
156 (msg_head->ival1.tv_usec < 0) || in bcm_is_invalid_tv()
157 (msg_head->ival1.tv_usec >= USEC_PER_SEC) || in bcm_is_invalid_tv()
158 (msg_head->ival2.tv_sec < 0) || in bcm_is_invalid_tv()
159 (msg_head->ival2.tv_sec > BCM_TIMER_SEC_MAX) || in bcm_is_invalid_tv()
160 (msg_head->ival2.tv_usec < 0) || in bcm_is_invalid_tv()
161 (msg_head->ival2.tv_usec >= USEC_PER_SEC)) in bcm_is_invalid_tv()
404 struct bcm_msg_head msg_head; in bcm_tx_timeout_handler() local
411 memset(&msg_head, 0, sizeof(msg_head)); in bcm_tx_timeout_handler()
412 msg_head.opcode = TX_EXPIRED; in bcm_tx_timeout_handler()
413 msg_head.flags = op->flags; in bcm_tx_timeout_handler()
414 msg_head.count = op->count; in bcm_tx_timeout_handler()
415 msg_head.ival1 = op->ival1; in bcm_tx_timeout_handler()
416 msg_head.ival2 = op->ival2; in bcm_tx_timeout_handler()
417 msg_head.can_id = op->can_id; in bcm_tx_timeout_handler()
418 msg_head.nframes = 0; in bcm_tx_timeout_handler()
420 bcm_send_to_user(op, &msg_head, NULL, 0); in bcm_tx_timeout_handler()
562 struct bcm_msg_head msg_head; in bcm_rx_timeout_handler() local
571 memset(&msg_head, 0, sizeof(msg_head)); in bcm_rx_timeout_handler()
572 msg_head.opcode = RX_TIMEOUT; in bcm_rx_timeout_handler()
573 msg_head.flags = op->flags; in bcm_rx_timeout_handler()
574 msg_head.count = op->count; in bcm_rx_timeout_handler()
575 msg_head.ival1 = op->ival1; in bcm_rx_timeout_handler()
576 msg_head.ival2 = op->ival2; in bcm_rx_timeout_handler()
577 msg_head.can_id = op->can_id; in bcm_rx_timeout_handler()
578 msg_head.nframes = 0; in bcm_rx_timeout_handler()
580 bcm_send_to_user(op, &msg_head, NULL, 0); in bcm_rx_timeout_handler()
831 static int bcm_read_op(struct list_head *ops, struct bcm_msg_head *msg_head, in bcm_read_op() argument
834 struct bcm_op *op = bcm_find_op(ops, msg_head, ifindex); in bcm_read_op()
840 msg_head->flags = op->flags; in bcm_read_op()
841 msg_head->count = op->count; in bcm_read_op()
842 msg_head->ival1 = op->ival1; in bcm_read_op()
843 msg_head->ival2 = op->ival2; in bcm_read_op()
844 msg_head->nframes = op->nframes; in bcm_read_op()
846 bcm_send_to_user(op, msg_head, op->frames, 0); in bcm_read_op()
854 static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, in bcm_tx_setup() argument
868 if (msg_head->nframes < 1 || msg_head->nframes > MAX_NFRAMES) in bcm_tx_setup()
872 if ((msg_head->flags & SETTIMER) && bcm_is_invalid_tv(msg_head)) in bcm_tx_setup()
876 op = bcm_find_op(&bo->tx_ops, msg_head, ifindex); in bcm_tx_setup()
885 if (msg_head->nframes > op->nframes) in bcm_tx_setup()
889 for (i = 0; i < msg_head->nframes; i++) { in bcm_tx_setup()
905 if (msg_head->flags & TX_CP_CAN_ID) { in bcm_tx_setup()
907 cf->can_id = msg_head->can_id; in bcm_tx_setup()
910 op->flags = msg_head->flags; in bcm_tx_setup()
919 op->can_id = msg_head->can_id; in bcm_tx_setup()
920 op->cfsiz = CFSIZ(msg_head->flags); in bcm_tx_setup()
921 op->flags = msg_head->flags; in bcm_tx_setup()
924 if (msg_head->nframes > 1) { in bcm_tx_setup()
925 op->frames = kmalloc_array(msg_head->nframes, in bcm_tx_setup()
935 for (i = 0; i < msg_head->nframes; i++) { in bcm_tx_setup()
955 if (msg_head->flags & TX_CP_CAN_ID) { in bcm_tx_setup()
957 cf->can_id = msg_head->can_id; in bcm_tx_setup()
982 if (op->nframes != msg_head->nframes) { in bcm_tx_setup()
983 op->nframes = msg_head->nframes; in bcm_tx_setup()
997 op->count = msg_head->count; in bcm_tx_setup()
998 op->ival1 = msg_head->ival1; in bcm_tx_setup()
999 op->ival2 = msg_head->ival2; in bcm_tx_setup()
1000 op->kt_ival1 = bcm_timeval_to_ktime(msg_head->ival1); in bcm_tx_setup()
1001 op->kt_ival2 = bcm_timeval_to_ktime(msg_head->ival2); in bcm_tx_setup()
1023 return msg_head->nframes * op->cfsiz + MHSIZ; in bcm_tx_setup()
1029 static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, in bcm_rx_setup() argument
1037 if ((msg_head->flags & RX_FILTER_ID) || (!(msg_head->nframes))) { in bcm_rx_setup()
1039 msg_head->flags |= RX_FILTER_ID; in bcm_rx_setup()
1041 msg_head->nframes = 0; in bcm_rx_setup()
1045 if (msg_head->nframes > MAX_NFRAMES + 1) in bcm_rx_setup()
1048 if ((msg_head->flags & RX_RTR_FRAME) && in bcm_rx_setup()
1049 ((msg_head->nframes != 1) || in bcm_rx_setup()
1050 (!(msg_head->can_id & CAN_RTR_FLAG)))) in bcm_rx_setup()
1054 if ((msg_head->flags & SETTIMER) && bcm_is_invalid_tv(msg_head)) in bcm_rx_setup()
1058 op = bcm_find_op(&bo->rx_ops, msg_head, ifindex); in bcm_rx_setup()
1067 if (msg_head->nframes > op->nframes) in bcm_rx_setup()
1070 if (msg_head->nframes) { in bcm_rx_setup()
1073 msg_head->nframes * op->cfsiz); in bcm_rx_setup()
1078 memset(op->last_frames, 0, msg_head->nframes * op->cfsiz); in bcm_rx_setup()
1081 op->nframes = msg_head->nframes; in bcm_rx_setup()
1082 op->flags = msg_head->flags; in bcm_rx_setup()
1093 op->can_id = msg_head->can_id; in bcm_rx_setup()
1094 op->nframes = msg_head->nframes; in bcm_rx_setup()
1095 op->cfsiz = CFSIZ(msg_head->flags); in bcm_rx_setup()
1096 op->flags = msg_head->flags; in bcm_rx_setup()
1098 if (msg_head->nframes > 1) { in bcm_rx_setup()
1100 op->frames = kmalloc_array(msg_head->nframes, in bcm_rx_setup()
1109 op->last_frames = kcalloc(msg_head->nframes, in bcm_rx_setup()
1123 if (msg_head->nframes) { in bcm_rx_setup()
1125 msg_head->nframes * op->cfsiz); in bcm_rx_setup()
1182 op->ival1 = msg_head->ival1; in bcm_rx_setup()
1183 op->ival2 = msg_head->ival2; in bcm_rx_setup()
1184 op->kt_ival1 = bcm_timeval_to_ktime(msg_head->ival1); in bcm_rx_setup()
1185 op->kt_ival2 = bcm_timeval_to_ktime(msg_head->ival2); in bcm_rx_setup()
1234 return msg_head->nframes * op->cfsiz + MHSIZ; in bcm_rx_setup()
1290 struct bcm_msg_head msg_head; in bcm_sendmsg() local
1302 ret = memcpy_from_msg((u8 *)&msg_head, msg, MHSIZ); in bcm_sendmsg()
1306 cfsiz = CFSIZ(msg_head.flags); in bcm_sendmsg()
1343 switch (msg_head.opcode) { in bcm_sendmsg()
1346 ret = bcm_tx_setup(&msg_head, msg, ifindex, sk); in bcm_sendmsg()
1350 ret = bcm_rx_setup(&msg_head, msg, ifindex, sk); in bcm_sendmsg()
1354 if (bcm_delete_tx_op(&bo->tx_ops, &msg_head, ifindex)) in bcm_sendmsg()
1361 if (bcm_delete_rx_op(&bo->rx_ops, &msg_head, ifindex)) in bcm_sendmsg()
1369 msg_head.opcode = TX_STATUS; in bcm_sendmsg()
1370 ret = bcm_read_op(&bo->tx_ops, &msg_head, ifindex); in bcm_sendmsg()
1375 msg_head.opcode = RX_STATUS; in bcm_sendmsg()
1376 ret = bcm_read_op(&bo->rx_ops, &msg_head, ifindex); in bcm_sendmsg()
1381 if ((msg_head.nframes != 1) || (size != cfsiz + MHSIZ)) in bcm_sendmsg()