Lines Matching refs:mod

99 					  struct cf_mod *mod);
133 struct cf_mod mod; member
154 struct cf_mod *mod) { op ; }
156 MODFUNC(mod_and_id, cf->can_id &= mod->modframe.and.can_id)
157 MODFUNC(mod_and_len, cf->len &= mod->modframe.and.len)
158 MODFUNC(mod_and_flags, cf->flags &= mod->modframe.and.flags)
159 MODFUNC(mod_and_data, *(u64 *)cf->data &= *(u64 *)mod->modframe.and.data)
160 MODFUNC(mod_or_id, cf->can_id |= mod->modframe.or.can_id)
161 MODFUNC(mod_or_len, cf->len |= mod->modframe.or.len)
162 MODFUNC(mod_or_flags, cf->flags |= mod->modframe.or.flags)
163 MODFUNC(mod_or_data, *(u64 *)cf->data |= *(u64 *)mod->modframe.or.data)
164 MODFUNC(mod_xor_id, cf->can_id ^= mod->modframe.xor.can_id)
165 MODFUNC(mod_xor_len, cf->len ^= mod->modframe.xor.len)
166 MODFUNC(mod_xor_flags, cf->flags ^= mod->modframe.xor.flags)
167 MODFUNC(mod_xor_data, *(u64 *)cf->data ^= *(u64 *)mod->modframe.xor.data)
168 MODFUNC(mod_set_id, cf->can_id = mod->modframe.set.can_id)
169 MODFUNC(mod_set_len, cf->len = mod->modframe.set.len)
170 MODFUNC(mod_set_flags, cf->flags = mod->modframe.set.flags)
171 MODFUNC(mod_set_data, *(u64 *)cf->data = *(u64 *)mod->modframe.set.data)
173 static void mod_and_fddata(struct canfd_frame *cf, struct cf_mod *mod) in mod_and_fddata() argument
178 *(u64 *)(cf->data + i) &= *(u64 *)(mod->modframe.and.data + i); in mod_and_fddata()
181 static void mod_or_fddata(struct canfd_frame *cf, struct cf_mod *mod) in mod_or_fddata() argument
186 *(u64 *)(cf->data + i) |= *(u64 *)(mod->modframe.or.data + i); in mod_or_fddata()
189 static void mod_xor_fddata(struct canfd_frame *cf, struct cf_mod *mod) in mod_xor_fddata() argument
194 *(u64 *)(cf->data + i) ^= *(u64 *)(mod->modframe.xor.data + i); in mod_xor_fddata()
197 static void mod_set_fddata(struct canfd_frame *cf, struct cf_mod *mod) in mod_set_fddata() argument
199 memcpy(cf->data, mod->modframe.set.data, CANFD_MAX_DLEN); in mod_set_fddata()
237 static void mod_and_ccdlc(struct canfd_frame *cf, struct cf_mod *mod) in mod_and_ccdlc() argument
240 mod_and_len(cf, mod); in mod_and_ccdlc()
244 static void mod_or_ccdlc(struct canfd_frame *cf, struct cf_mod *mod) in mod_or_ccdlc() argument
247 mod_or_len(cf, mod); in mod_or_ccdlc()
251 static void mod_xor_ccdlc(struct canfd_frame *cf, struct cf_mod *mod) in mod_xor_ccdlc() argument
254 mod_xor_len(cf, mod); in mod_xor_ccdlc()
258 static void mod_set_ccdlc(struct canfd_frame *cf, struct cf_mod *mod) in mod_set_ccdlc() argument
260 mod_set_len(cf, mod); in mod_set_ccdlc()
509 if (gwj->mod.modfunc[0]) in can_can_gw_rcv()
532 while (modidx < MAX_MODFUNCTIONS && gwj->mod.modfunc[modidx]) in can_can_gw_rcv()
533 (*gwj->mod.modfunc[modidx++])(cf, &gwj->mod); in can_can_gw_rcv()
549 if (gwj->mod.csumfunc.crc8) in can_can_gw_rcv()
550 (*gwj->mod.csumfunc.crc8)(cf, &gwj->mod.csum.crc8); in can_can_gw_rcv()
552 if (gwj->mod.csumfunc.xor) in can_can_gw_rcv()
553 (*gwj->mod.csumfunc.xor)(cf, &gwj->mod.csum.xor); in can_can_gw_rcv()
650 if (gwj->mod.modtype.and) { in cgw_put_job()
651 memcpy(&mb.cf, &gwj->mod.modframe.and, sizeof(mb.cf)); in cgw_put_job()
652 mb.modtype = gwj->mod.modtype.and; in cgw_put_job()
657 if (gwj->mod.modtype.or) { in cgw_put_job()
658 memcpy(&mb.cf, &gwj->mod.modframe.or, sizeof(mb.cf)); in cgw_put_job()
659 mb.modtype = gwj->mod.modtype.or; in cgw_put_job()
664 if (gwj->mod.modtype.xor) { in cgw_put_job()
665 memcpy(&mb.cf, &gwj->mod.modframe.xor, sizeof(mb.cf)); in cgw_put_job()
666 mb.modtype = gwj->mod.modtype.xor; in cgw_put_job()
671 if (gwj->mod.modtype.set) { in cgw_put_job()
672 memcpy(&mb.cf, &gwj->mod.modframe.set, sizeof(mb.cf)); in cgw_put_job()
673 mb.modtype = gwj->mod.modtype.set; in cgw_put_job()
680 if (gwj->mod.modtype.and) { in cgw_put_job()
681 memcpy(&mb.cf, &gwj->mod.modframe.and, sizeof(mb.cf)); in cgw_put_job()
682 mb.modtype = gwj->mod.modtype.and; in cgw_put_job()
687 if (gwj->mod.modtype.or) { in cgw_put_job()
688 memcpy(&mb.cf, &gwj->mod.modframe.or, sizeof(mb.cf)); in cgw_put_job()
689 mb.modtype = gwj->mod.modtype.or; in cgw_put_job()
694 if (gwj->mod.modtype.xor) { in cgw_put_job()
695 memcpy(&mb.cf, &gwj->mod.modframe.xor, sizeof(mb.cf)); in cgw_put_job()
696 mb.modtype = gwj->mod.modtype.xor; in cgw_put_job()
701 if (gwj->mod.modtype.set) { in cgw_put_job()
702 memcpy(&mb.cf, &gwj->mod.modframe.set, sizeof(mb.cf)); in cgw_put_job()
703 mb.modtype = gwj->mod.modtype.set; in cgw_put_job()
709 if (gwj->mod.uid) { in cgw_put_job()
710 if (nla_put_u32(skb, CGW_MOD_UID, gwj->mod.uid) < 0) in cgw_put_job()
714 if (gwj->mod.csumfunc.crc8) { in cgw_put_job()
716 &gwj->mod.csum.crc8) < 0) in cgw_put_job()
720 if (gwj->mod.csumfunc.xor) { in cgw_put_job()
722 &gwj->mod.csum.xor) < 0) in cgw_put_job()
794 static int cgw_parse_attr(struct nlmsghdr *nlh, struct cf_mod *mod, in cgw_parse_attr() argument
803 memset(mod, 0, sizeof(*mod)); in cgw_parse_attr()
824 canfdframecpy(&mod->modframe.and, &mb.cf); in cgw_parse_attr()
825 mod->modtype.and = mb.modtype; in cgw_parse_attr()
828 mod->modfunc[modidx++] = mod_and_id; in cgw_parse_attr()
831 mod->modfunc[modidx++] = mod_and_len; in cgw_parse_attr()
834 mod->modfunc[modidx++] = mod_and_flags; in cgw_parse_attr()
837 mod->modfunc[modidx++] = mod_and_fddata; in cgw_parse_attr()
843 canfdframecpy(&mod->modframe.or, &mb.cf); in cgw_parse_attr()
844 mod->modtype.or = mb.modtype; in cgw_parse_attr()
847 mod->modfunc[modidx++] = mod_or_id; in cgw_parse_attr()
850 mod->modfunc[modidx++] = mod_or_len; in cgw_parse_attr()
853 mod->modfunc[modidx++] = mod_or_flags; in cgw_parse_attr()
856 mod->modfunc[modidx++] = mod_or_fddata; in cgw_parse_attr()
862 canfdframecpy(&mod->modframe.xor, &mb.cf); in cgw_parse_attr()
863 mod->modtype.xor = mb.modtype; in cgw_parse_attr()
866 mod->modfunc[modidx++] = mod_xor_id; in cgw_parse_attr()
869 mod->modfunc[modidx++] = mod_xor_len; in cgw_parse_attr()
872 mod->modfunc[modidx++] = mod_xor_flags; in cgw_parse_attr()
875 mod->modfunc[modidx++] = mod_xor_fddata; in cgw_parse_attr()
881 canfdframecpy(&mod->modframe.set, &mb.cf); in cgw_parse_attr()
882 mod->modtype.set = mb.modtype; in cgw_parse_attr()
885 mod->modfunc[modidx++] = mod_set_id; in cgw_parse_attr()
888 mod->modfunc[modidx++] = mod_set_len; in cgw_parse_attr()
891 mod->modfunc[modidx++] = mod_set_flags; in cgw_parse_attr()
894 mod->modfunc[modidx++] = mod_set_fddata; in cgw_parse_attr()
902 canframecpy(&mod->modframe.and, &mb.cf); in cgw_parse_attr()
903 mod->modtype.and = mb.modtype; in cgw_parse_attr()
906 mod->modfunc[modidx++] = mod_and_id; in cgw_parse_attr()
909 mod->modfunc[modidx++] = mod_and_ccdlc; in cgw_parse_attr()
912 mod->modfunc[modidx++] = mod_and_data; in cgw_parse_attr()
918 canframecpy(&mod->modframe.or, &mb.cf); in cgw_parse_attr()
919 mod->modtype.or = mb.modtype; in cgw_parse_attr()
922 mod->modfunc[modidx++] = mod_or_id; in cgw_parse_attr()
925 mod->modfunc[modidx++] = mod_or_ccdlc; in cgw_parse_attr()
928 mod->modfunc[modidx++] = mod_or_data; in cgw_parse_attr()
934 canframecpy(&mod->modframe.xor, &mb.cf); in cgw_parse_attr()
935 mod->modtype.xor = mb.modtype; in cgw_parse_attr()
938 mod->modfunc[modidx++] = mod_xor_id; in cgw_parse_attr()
941 mod->modfunc[modidx++] = mod_xor_ccdlc; in cgw_parse_attr()
944 mod->modfunc[modidx++] = mod_xor_data; in cgw_parse_attr()
950 canframecpy(&mod->modframe.set, &mb.cf); in cgw_parse_attr()
951 mod->modtype.set = mb.modtype; in cgw_parse_attr()
954 mod->modfunc[modidx++] = mod_set_id; in cgw_parse_attr()
957 mod->modfunc[modidx++] = mod_set_ccdlc; in cgw_parse_attr()
960 mod->modfunc[modidx++] = mod_set_data; in cgw_parse_attr()
974 nla_memcpy(&mod->csum.crc8, tb[CGW_CS_CRC8], in cgw_parse_attr()
982 mod->csumfunc.crc8 = cgw_csum_crc8_rel; in cgw_parse_attr()
984 mod->csumfunc.crc8 = cgw_csum_crc8_pos; in cgw_parse_attr()
986 mod->csumfunc.crc8 = cgw_csum_crc8_neg; in cgw_parse_attr()
997 nla_memcpy(&mod->csum.xor, tb[CGW_CS_XOR], in cgw_parse_attr()
1005 mod->csumfunc.xor = cgw_csum_xor_rel; in cgw_parse_attr()
1007 mod->csumfunc.xor = cgw_csum_xor_pos; in cgw_parse_attr()
1009 mod->csumfunc.xor = cgw_csum_xor_neg; in cgw_parse_attr()
1013 nla_memcpy(&mod->uid, tb[CGW_MOD_UID], sizeof(u32)); in cgw_parse_attr()
1056 struct cf_mod mod; in cgw_create_job() local
1075 err = cgw_parse_attr(nlh, &mod, CGW_TYPE_CAN_CAN, &ccgw, &limhops); in cgw_create_job()
1079 if (mod.uid) { in cgw_create_job()
1084 if (gwj->mod.uid != mod.uid) in cgw_create_job()
1093 memcpy(&gwj->mod, &mod, sizeof(mod)); in cgw_create_job()
1115 memcpy(&gwj->mod, &mod, sizeof(mod)); in cgw_create_job()
1170 struct cf_mod mod; in cgw_remove_job() local
1189 err = cgw_parse_attr(nlh, &mod, CGW_TYPE_CAN_CAN, &ccgw, &limhops); in cgw_remove_job()
1212 if (gwj->mod.uid || mod.uid) { in cgw_remove_job()
1213 if (gwj->mod.uid != mod.uid) in cgw_remove_job()
1217 if (memcmp(&gwj->mod, &mod, sizeof(mod))) in cgw_remove_job()