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()
656 if (gwj->mod.modtype.and) { in cgw_put_job()
657 memcpy(&mb.cf, &gwj->mod.modframe.and, sizeof(mb.cf)); in cgw_put_job()
658 mb.modtype = gwj->mod.modtype.and; in cgw_put_job()
663 if (gwj->mod.modtype.or) { in cgw_put_job()
664 memcpy(&mb.cf, &gwj->mod.modframe.or, sizeof(mb.cf)); in cgw_put_job()
665 mb.modtype = gwj->mod.modtype.or; in cgw_put_job()
670 if (gwj->mod.modtype.xor) { in cgw_put_job()
671 memcpy(&mb.cf, &gwj->mod.modframe.xor, sizeof(mb.cf)); in cgw_put_job()
672 mb.modtype = gwj->mod.modtype.xor; in cgw_put_job()
677 if (gwj->mod.modtype.set) { in cgw_put_job()
678 memcpy(&mb.cf, &gwj->mod.modframe.set, sizeof(mb.cf)); in cgw_put_job()
679 mb.modtype = gwj->mod.modtype.set; in cgw_put_job()
686 if (gwj->mod.modtype.and) { in cgw_put_job()
687 memcpy(&mb.cf, &gwj->mod.modframe.and, sizeof(mb.cf)); in cgw_put_job()
688 mb.modtype = gwj->mod.modtype.and; in cgw_put_job()
693 if (gwj->mod.modtype.or) { in cgw_put_job()
694 memcpy(&mb.cf, &gwj->mod.modframe.or, sizeof(mb.cf)); in cgw_put_job()
695 mb.modtype = gwj->mod.modtype.or; in cgw_put_job()
700 if (gwj->mod.modtype.xor) { in cgw_put_job()
701 memcpy(&mb.cf, &gwj->mod.modframe.xor, sizeof(mb.cf)); in cgw_put_job()
702 mb.modtype = gwj->mod.modtype.xor; in cgw_put_job()
707 if (gwj->mod.modtype.set) { in cgw_put_job()
708 memcpy(&mb.cf, &gwj->mod.modframe.set, sizeof(mb.cf)); in cgw_put_job()
709 mb.modtype = gwj->mod.modtype.set; in cgw_put_job()
715 if (gwj->mod.uid) { in cgw_put_job()
716 if (nla_put_u32(skb, CGW_MOD_UID, gwj->mod.uid) < 0) in cgw_put_job()
720 if (gwj->mod.csumfunc.crc8) { in cgw_put_job()
722 &gwj->mod.csum.crc8) < 0) in cgw_put_job()
726 if (gwj->mod.csumfunc.xor) { in cgw_put_job()
728 &gwj->mod.csum.xor) < 0) in cgw_put_job()
800 static int cgw_parse_attr(struct nlmsghdr *nlh, struct cf_mod *mod, in cgw_parse_attr() argument
809 memset(mod, 0, sizeof(*mod)); in cgw_parse_attr()
830 canfdframecpy(&mod->modframe.and, &mb.cf); in cgw_parse_attr()
831 mod->modtype.and = mb.modtype; in cgw_parse_attr()
834 mod->modfunc[modidx++] = mod_and_id; in cgw_parse_attr()
837 mod->modfunc[modidx++] = mod_and_len; in cgw_parse_attr()
840 mod->modfunc[modidx++] = mod_and_flags; in cgw_parse_attr()
843 mod->modfunc[modidx++] = mod_and_fddata; in cgw_parse_attr()
849 canfdframecpy(&mod->modframe.or, &mb.cf); in cgw_parse_attr()
850 mod->modtype.or = mb.modtype; in cgw_parse_attr()
853 mod->modfunc[modidx++] = mod_or_id; in cgw_parse_attr()
856 mod->modfunc[modidx++] = mod_or_len; in cgw_parse_attr()
859 mod->modfunc[modidx++] = mod_or_flags; in cgw_parse_attr()
862 mod->modfunc[modidx++] = mod_or_fddata; in cgw_parse_attr()
868 canfdframecpy(&mod->modframe.xor, &mb.cf); in cgw_parse_attr()
869 mod->modtype.xor = mb.modtype; in cgw_parse_attr()
872 mod->modfunc[modidx++] = mod_xor_id; in cgw_parse_attr()
875 mod->modfunc[modidx++] = mod_xor_len; in cgw_parse_attr()
878 mod->modfunc[modidx++] = mod_xor_flags; in cgw_parse_attr()
881 mod->modfunc[modidx++] = mod_xor_fddata; in cgw_parse_attr()
887 canfdframecpy(&mod->modframe.set, &mb.cf); in cgw_parse_attr()
888 mod->modtype.set = mb.modtype; in cgw_parse_attr()
891 mod->modfunc[modidx++] = mod_set_id; in cgw_parse_attr()
894 mod->modfunc[modidx++] = mod_set_len; in cgw_parse_attr()
897 mod->modfunc[modidx++] = mod_set_flags; in cgw_parse_attr()
900 mod->modfunc[modidx++] = mod_set_fddata; in cgw_parse_attr()
908 canframecpy(&mod->modframe.and, &mb.cf); in cgw_parse_attr()
909 mod->modtype.and = mb.modtype; in cgw_parse_attr()
912 mod->modfunc[modidx++] = mod_and_id; in cgw_parse_attr()
915 mod->modfunc[modidx++] = mod_and_ccdlc; in cgw_parse_attr()
918 mod->modfunc[modidx++] = mod_and_data; in cgw_parse_attr()
924 canframecpy(&mod->modframe.or, &mb.cf); in cgw_parse_attr()
925 mod->modtype.or = mb.modtype; in cgw_parse_attr()
928 mod->modfunc[modidx++] = mod_or_id; in cgw_parse_attr()
931 mod->modfunc[modidx++] = mod_or_ccdlc; in cgw_parse_attr()
934 mod->modfunc[modidx++] = mod_or_data; in cgw_parse_attr()
940 canframecpy(&mod->modframe.xor, &mb.cf); in cgw_parse_attr()
941 mod->modtype.xor = mb.modtype; in cgw_parse_attr()
944 mod->modfunc[modidx++] = mod_xor_id; in cgw_parse_attr()
947 mod->modfunc[modidx++] = mod_xor_ccdlc; in cgw_parse_attr()
950 mod->modfunc[modidx++] = mod_xor_data; in cgw_parse_attr()
956 canframecpy(&mod->modframe.set, &mb.cf); in cgw_parse_attr()
957 mod->modtype.set = mb.modtype; in cgw_parse_attr()
960 mod->modfunc[modidx++] = mod_set_id; in cgw_parse_attr()
963 mod->modfunc[modidx++] = mod_set_ccdlc; in cgw_parse_attr()
966 mod->modfunc[modidx++] = mod_set_data; in cgw_parse_attr()
980 nla_memcpy(&mod->csum.crc8, tb[CGW_CS_CRC8], in cgw_parse_attr()
988 mod->csumfunc.crc8 = cgw_csum_crc8_rel; in cgw_parse_attr()
990 mod->csumfunc.crc8 = cgw_csum_crc8_pos; in cgw_parse_attr()
992 mod->csumfunc.crc8 = cgw_csum_crc8_neg; in cgw_parse_attr()
1003 nla_memcpy(&mod->csum.xor, tb[CGW_CS_XOR], in cgw_parse_attr()
1011 mod->csumfunc.xor = cgw_csum_xor_rel; in cgw_parse_attr()
1013 mod->csumfunc.xor = cgw_csum_xor_pos; in cgw_parse_attr()
1015 mod->csumfunc.xor = cgw_csum_xor_neg; in cgw_parse_attr()
1019 nla_memcpy(&mod->uid, tb[CGW_MOD_UID], sizeof(u32)); in cgw_parse_attr()
1062 struct cf_mod mod; in cgw_create_job() local
1081 err = cgw_parse_attr(nlh, &mod, CGW_TYPE_CAN_CAN, &ccgw, &limhops); in cgw_create_job()
1085 if (mod.uid) { in cgw_create_job()
1090 if (gwj->mod.uid != mod.uid) in cgw_create_job()
1099 memcpy(&gwj->mod, &mod, sizeof(mod)); in cgw_create_job()
1121 memcpy(&gwj->mod, &mod, sizeof(mod)); in cgw_create_job()
1182 struct cf_mod mod; in cgw_remove_job() local
1201 err = cgw_parse_attr(nlh, &mod, CGW_TYPE_CAN_CAN, &ccgw, &limhops); in cgw_remove_job()
1224 if (gwj->mod.uid || mod.uid) { in cgw_remove_job()
1225 if (gwj->mod.uid != mod.uid) in cgw_remove_job()
1229 if (memcmp(&gwj->mod, &mod, sizeof(mod))) in cgw_remove_job()