Lines Matching refs:msg_head
349 struct bcm_msg_head msg_head;
357 msg_head.opcode = TX_EXPIRED;
358 msg_head.flags = op->flags;
359 msg_head.count = op->count;
360 msg_head.ival1 = op->ival1;
361 msg_head.ival2 = op->ival2;
362 msg_head.can_id = op->can_id;
363 msg_head.nframes = 0;
365 bcm_send_to_user(op, &msg_head, NULL, 0);
526 struct bcm_msg_head msg_head;
529 msg_head.opcode = RX_TIMEOUT;
530 msg_head.flags = op->flags;
531 msg_head.count = op->count;
532 msg_head.ival1 = op->ival1;
533 msg_head.ival2 = op->ival2;
534 msg_head.can_id = op->can_id;
535 msg_head.nframes = 0;
537 bcm_send_to_user(op, &msg_head, NULL, 0);
805 static int bcm_read_op(struct list_head *ops, struct bcm_msg_head *msg_head,
808 struct bcm_op *op = bcm_find_op(ops, msg_head->can_id, ifindex);
813 /* put current values into msg_head */
814 msg_head->flags = op->flags;
815 msg_head->count = op->count;
816 msg_head->ival1 = op->ival1;
817 msg_head->ival2 = op->ival2;
818 msg_head->nframes = op->nframes;
820 bcm_send_to_user(op, msg_head, op->frames, 0);
828 static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
841 if (msg_head->nframes < 1 || msg_head->nframes > MAX_NFRAMES)
845 op = bcm_find_op(&bo->tx_ops, msg_head->can_id, ifindex);
855 if (msg_head->nframes > op->nframes)
859 for (i = 0; i < msg_head->nframes; i++) {
869 if (msg_head->flags & TX_CP_CAN_ID) {
871 op->frames[i].can_id = msg_head->can_id;
882 op->can_id = msg_head->can_id;
885 if (msg_head->nframes > 1) {
886 op->frames = kmalloc(msg_head->nframes * CFSIZ,
895 for (i = 0; i < msg_head->nframes; i++) {
909 if (msg_head->flags & TX_CP_CAN_ID) {
911 op->frames[i].can_id = msg_head->can_id;
936 } /* if ((op = bcm_find_op(&bo->tx_ops, msg_head->can_id, ifindex))) */
938 if (op->nframes != msg_head->nframes) {
939 op->nframes = msg_head->nframes;
946 op->flags = msg_head->flags;
955 op->count = msg_head->count;
956 op->ival1 = msg_head->ival1;
957 op->ival2 = msg_head->ival2;
958 op->kt_ival1 = timeval_to_ktime(msg_head->ival1);
959 op->kt_ival2 = timeval_to_ktime(msg_head->ival2);
984 return msg_head->nframes * CFSIZ + MHSIZ;
990 static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
998 if ((msg_head->flags & RX_FILTER_ID) || (!(msg_head->nframes))) {
1000 msg_head->flags |= RX_FILTER_ID;
1002 msg_head->nframes = 0;
1006 if (msg_head->nframes > MAX_NFRAMES + 1)
1009 if ((msg_head->flags & RX_RTR_FRAME) &&
1010 ((msg_head->nframes != 1) ||
1011 (!(msg_head->can_id & CAN_RTR_FLAG))))
1015 op = bcm_find_op(&bo->rx_ops, msg_head->can_id, ifindex);
1024 if (msg_head->nframes > op->nframes)
1027 if (msg_head->nframes) {
1031 msg_head->nframes * CFSIZ);
1036 memset(op->last_frames, 0, msg_head->nframes * CFSIZ);
1039 op->nframes = msg_head->nframes;
1050 op->can_id = msg_head->can_id;
1051 op->nframes = msg_head->nframes;
1053 if (msg_head->nframes > 1) {
1055 op->frames = kmalloc(msg_head->nframes * CFSIZ,
1063 op->last_frames = kzalloc(msg_head->nframes * CFSIZ,
1076 if (msg_head->nframes) {
1078 msg_head->nframes * CFSIZ);
1114 } /* if ((op = bcm_find_op(&bo->rx_ops, msg_head->can_id, ifindex))) */
1117 op->flags = msg_head->flags;
1138 op->ival1 = msg_head->ival1;
1139 op->ival2 = msg_head->ival2;
1140 op->kt_ival1 = timeval_to_ktime(msg_head->ival1);
1141 op->kt_ival2 = timeval_to_ktime(msg_head->ival2);
1189 return msg_head->nframes * CFSIZ + MHSIZ;
1242 struct bcm_msg_head msg_head;
1283 ret = memcpy_fromiovec((u8 *)&msg_head, msg->msg_iov, MHSIZ);
1289 switch (msg_head.opcode) {
1292 ret = bcm_tx_setup(&msg_head, msg, ifindex, sk);
1296 ret = bcm_rx_setup(&msg_head, msg, ifindex, sk);
1300 if (bcm_delete_tx_op(&bo->tx_ops, msg_head.can_id, ifindex))
1307 if (bcm_delete_rx_op(&bo->rx_ops, msg_head.can_id, ifindex))
1314 /* reuse msg_head for the reply to TX_READ */
1315 msg_head.opcode = TX_STATUS;
1316 ret = bcm_read_op(&bo->tx_ops, &msg_head, ifindex);
1320 /* reuse msg_head for the reply to RX_READ */
1321 msg_head.opcode = RX_STATUS;
1322 ret = bcm_read_op(&bo->rx_ops, &msg_head, ifindex);
1327 if ((msg_head.nframes != 1) || (size != CFSIZ + MHSIZ))