Lines Matching refs:sel

117 static int pack_key(struct tc_u32_sel *sel, __u32 key, __u32 mask,  in pack_key()  argument
121 int hwm = sel->nkeys; in pack_key()
126 if (sel->keys[i].off == off && sel->keys[i].offmask == offmask) { in pack_key()
127 __u32 intersect = mask & sel->keys[i].mask; in pack_key()
129 if ((key ^ sel->keys[i].val) & intersect) in pack_key()
131 sel->keys[i].val |= key; in pack_key()
132 sel->keys[i].mask |= mask; in pack_key()
141 sel->keys[hwm].val = key; in pack_key()
142 sel->keys[hwm].mask = mask; in pack_key()
143 sel->keys[hwm].off = off; in pack_key()
144 sel->keys[hwm].offmask = offmask; in pack_key()
145 sel->nkeys++; in pack_key()
149 static int pack_key32(struct tc_u32_sel *sel, __u32 key, __u32 mask, in pack_key32() argument
154 return pack_key(sel, key, mask, off, offmask); in pack_key32()
157 static int pack_key16(struct tc_u32_sel *sel, __u32 key, __u32 mask, in pack_key16() argument
171 return pack_key(sel, key, mask, off, offmask); in pack_key16()
174 static int pack_key8(struct tc_u32_sel *sel, __u32 key, __u32 mask, int off, int offmask) in pack_key8() argument
193 return pack_key(sel, key, mask, off, offmask); in pack_key8()
226 static int parse_u32(int *argc_p, char ***argv_p, struct tc_u32_sel *sel, in parse_u32() argument
252 res = pack_key32(sel, key, mask, off, offmask); in parse_u32()
258 static int parse_u16(int *argc_p, char ***argv_p, struct tc_u32_sel *sel, in parse_u16() argument
283 res = pack_key16(sel, key, mask, off, offmask); in parse_u16()
289 static int parse_u8(int *argc_p, char ***argv_p, struct tc_u32_sel *sel, in parse_u8() argument
318 res = pack_key8(sel, key, mask, off, offmask); in parse_u8()
324 static int parse_ip_addr(int *argc_p, char ***argv_p, struct tc_u32_sel *sel, in parse_ip_addr() argument
350 if (pack_key(sel, addr.data[0], mask, off, offmask) < 0) in parse_ip_addr()
360 struct tc_u32_sel *sel, int off) in parse_ip6_addr() argument
387 res = pack_key(sel, addr.data[i / 32], in parse_ip6_addr()
393 res = pack_key(sel, addr.data[i / 32], in parse_ip6_addr()
406 static int parse_ip6_class(int *argc_p, char ***argv_p, struct tc_u32_sel *sel) in parse_ip6_class() argument
435 res = pack_key(sel, key, mask, off, offmask); in parse_ip6_class()
445 struct tc_u32_sel *sel, int off) in parse_ether_addr() argument
473 res = pack_key8(sel, addr[i], 0xFF, off + i, offmask); in parse_ether_addr()
483 static int parse_ip(int *argc_p, char ***argv_p, struct tc_u32_sel *sel) in parse_ip() argument
494 res = parse_ip_addr(&argc, &argv, sel, 12); in parse_ip()
497 res = parse_ip_addr(&argc, &argv, sel, 16); in parse_ip()
502 res = parse_u8(&argc, &argv, sel, 1, 0); in parse_ip()
505 res = parse_u8(&argc, &argv, sel, 0, 0); in parse_ip()
508 res = parse_u8(&argc, &argv, sel, 9, 0); in parse_ip()
511 res = pack_key16(sel, 0, 0x3FFF, 6, 0); in parse_ip()
514 res = pack_key16(sel, 0x2000, 0x3FFF, 6, 0); in parse_ip()
517 res = pack_key16(sel, 0x4000, 0x4000, 6, 0); in parse_ip()
520 res = pack_key16(sel, 0x2000, 0x2000, 6, 0); in parse_ip()
523 res = parse_u16(&argc, &argv, sel, 22, 0); in parse_ip()
526 res = parse_u16(&argc, &argv, sel, 20, 0); in parse_ip()
529 res = parse_u8(&argc, &argv, sel, 20, 0); in parse_ip()
532 res = parse_u8(&argc, &argv, sel, 21, 0); in parse_ip()
541 static int parse_ip6(int *argc_p, char ***argv_p, struct tc_u32_sel *sel) in parse_ip6() argument
552 res = parse_ip6_addr(&argc, &argv, sel, 8); in parse_ip6()
555 res = parse_ip6_addr(&argc, &argv, sel, 24); in parse_ip6()
558 res = parse_ip6_class(&argc, &argv, sel); in parse_ip6()
561 res = parse_u8(&argc, &argv, sel, 6, 0); in parse_ip6()
564 res = parse_u32(&argc, &argv, sel, 0, 0); in parse_ip6()
567 res = parse_u16(&argc, &argv, sel, 42, 0); in parse_ip6()
570 res = parse_u16(&argc, &argv, sel, 40, 0); in parse_ip6()
573 res = parse_u8(&argc, &argv, sel, 40, 0); in parse_ip6()
576 res = parse_u8(&argc, &argv, sel, 41, 1); in parse_ip6()
585 static int parse_ether(int *argc_p, char ***argv_p, struct tc_u32_sel *sel) in parse_ether() argument
596 res = parse_ether_addr(&argc, &argv, sel, -8); in parse_ether()
599 res = parse_ether_addr(&argc, &argv, sel, -14); in parse_ether()
611 static int parse_udp(int *argc_p, char ***argv_p, struct tc_u32_sel *sel) in parse_udp() argument
622 res = parse_u16(&argc, &argv, sel, 0, -1); in parse_udp()
625 res = parse_u16(&argc, &argv, sel, 2, -1); in parse_udp()
635 static int parse_icmp(int *argc_p, char ***argv_p, struct tc_u32_sel *sel) in parse_icmp() argument
646 res = parse_u8(&argc, &argv, sel, 0, -1); in parse_icmp()
649 res = parse_u8(&argc, &argv, sel, 1, -1); in parse_icmp()
694 struct tc_u32_sel *sel, struct nlmsghdr *n) in parse_selector() argument
705 res = parse_u32(&argc, &argv, sel, 0, 0); in parse_selector()
708 res = parse_u16(&argc, &argv, sel, 0, 0); in parse_selector()
711 res = parse_u8(&argc, &argv, sel, 0, 0); in parse_selector()
714 res = parse_ip(&argc, &argv, sel); in parse_selector()
717 res = parse_ip6(&argc, &argv, sel); in parse_selector()
720 res = parse_udp(&argc, &argv, sel); in parse_selector()
723 res = parse_tcp(&argc, &argv, sel); in parse_selector()
726 res = parse_icmp(&argc, &argv, sel); in parse_selector()
732 res = parse_ether(&argc, &argv, sel); in parse_selector()
741 static int parse_offset(int *argc_p, char ***argv_p, struct tc_u32_sel *sel) in parse_offset() argument
752 sel->off = off; in parse_offset()
753 sel->flags |= TC_U32_OFFSET; in parse_offset()
759 sel->offoff = off; in parse_offset()
764 sel->flags |= TC_U32_VAROFFSET; in parse_offset()
770 sel->offmask = htons(mask); in parse_offset()
771 sel->flags |= TC_U32_VAROFFSET; in parse_offset()
777 sel->offshift = shift; in parse_offset()
778 sel->flags |= TC_U32_VAROFFSET; in parse_offset()
780 sel->flags |= TC_U32_EAT; in parse_offset()
792 static int parse_hashkey(int *argc_p, char ***argv_p, struct tc_u32_sel *sel) in parse_hashkey() argument
803 sel->hmask = htonl(mask); in parse_hashkey()
811 sel->hoff = num; in parse_hashkey()
977 struct tc_u32_sel sel; in u32_parse_opt() member
979 } sel; in u32_parse_opt() local
987 memset(&sel, 0, sizeof(sel)); in u32_parse_opt()
1003 if (parse_selector(&argc, &argv, &sel.sel, n)) { in u32_parse_opt()
1011 if (parse_offset(&argc, &argv, &sel.sel)) { in u32_parse_opt()
1018 if (parse_hashkey(&argc, &argv, &sel.sel)) { in u32_parse_opt()
1032 sel.sel.flags |= TC_U32_TERMINAL; in u32_parse_opt()
1081 struct tc_u32_sel sel; in u32_parse_opt() member
1086 if (parse_selector(&argc, &argv, &sel2.sel, n)) { in u32_parse_opt()
1090 if (sel2.sel.nkeys != 1) { in u32_parse_opt()
1104 hash = sel2.sel.keys[0].val & sel2.sel.keys[0].mask; in u32_parse_opt()
1152 sel.sel.flags |= TC_U32_TERMINAL; in u32_parse_opt()
1165 addattr_l(n, MAX_MSG, TCA_U32_SEL, &sel, in u32_parse_opt()
1166 sizeof(sel.sel) + sel.sel.nkeys * sizeof(struct tc_u32_key)); in u32_parse_opt()
1175 struct tc_u32_sel *sel = NULL; in u32_print_opt() local
1192 if (RTA_PAYLOAD(tb[TCA_U32_SEL]) < sizeof(*sel)) in u32_print_opt()
1195 sel = RTA_DATA(tb[TCA_U32_SEL]); in u32_print_opt()
1210 !sel || !(sel->flags & TC_U32_TERMINAL) ? "*" : "", in u32_print_opt()
1212 } else if (sel && sel->flags & TC_U32_TERMINAL) { in u32_print_opt()
1229 if (sel && show_stats && NULL != pf) in u32_print_opt()
1244 if (sel) { in u32_print_opt()
1245 if (sel->nkeys) { in u32_print_opt()
1247 for (i=0; i<sel->nkeys; i++) { in u32_print_opt()
1248 show_keys(f, sel->keys + i); in u32_print_opt()
1255 if (sel->flags & (TC_U32_VAROFFSET | TC_U32_OFFSET)) { in u32_print_opt()
1257 if (sel->flags & TC_U32_VAROFFSET) in u32_print_opt()
1259 ntohs(sel->offmask), in u32_print_opt()
1260 sel->offshift, sel->offoff); in u32_print_opt()
1261 if (sel->off) in u32_print_opt()
1262 fprintf(f, "plus %d ", sel->off); in u32_print_opt()
1264 if (sel->flags & TC_U32_EAT) in u32_print_opt()
1267 if (sel->hmask) { in u32_print_opt()
1269 (unsigned int)htonl(sel->hmask), sel->hoff); in u32_print_opt()