Lines Matching refs:tkey
63 struct m_pedit_key *tkey) in pedit_parse_nopopt() argument
122 int pack_key(struct m_pedit_sel *_sel, struct m_pedit_key *tkey) in pack_key() argument
131 if (tkey->off % 4) { in pack_key()
136 sel->keys[hwm].val = tkey->val; in pack_key()
137 sel->keys[hwm].mask = tkey->mask; in pack_key()
138 sel->keys[hwm].off = tkey->off; in pack_key()
139 sel->keys[hwm].at = tkey->at; in pack_key()
140 sel->keys[hwm].offmask = tkey->offmask; in pack_key()
141 sel->keys[hwm].shift = tkey->shift; in pack_key()
144 keys_ex[hwm].htype = tkey->htype; in pack_key()
145 keys_ex[hwm].cmd = tkey->cmd; in pack_key()
147 if (tkey->htype != TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK || in pack_key()
148 tkey->cmd != TCA_PEDIT_KEY_EX_CMD_SET) { in pack_key()
160 struct m_pedit_key *tkey) in pack_key32() argument
162 if (tkey->off > (tkey->off & ~3)) { in pack_key32()
168 tkey->val = htonl(tkey->val & retain); in pack_key32()
169 tkey->mask = htonl(tkey->mask | ~retain); in pack_key32()
170 return pack_key(sel, tkey); in pack_key32()
174 struct m_pedit_key *tkey) in pack_key16() argument
179 if (tkey->val > 0xFFFF || tkey->mask > 0xFFFF) { in pack_key16()
184 ind = tkey->off & 3; in pack_key16()
192 tkey->val = htonl((tkey->val & retain) << stride); in pack_key16()
193 tkey->mask = htonl(((tkey->mask | ~retain) << stride) | m[ind]); in pack_key16()
195 tkey->off &= ~3; in pack_key16()
199 tkey->val, tkey->mask); in pack_key16()
200 return pack_key(sel, tkey); in pack_key16()
204 int pack_key8(__u32 retain, struct m_pedit_sel *sel, struct m_pedit_key *tkey) in pack_key8() argument
209 if (tkey->val > 0xFF || tkey->mask > 0xFF) { in pack_key8()
211 tkey->val, tkey->mask); in pack_key8()
215 ind = tkey->off & 3; in pack_key8()
218 tkey->val = htonl((tkey->val & retain) << stride); in pack_key8()
219 tkey->mask = htonl(((tkey->mask | ~retain) << stride) | m[ind]); in pack_key8()
221 tkey->off &= ~3; in pack_key8()
225 tkey->off, tkey->val, tkey->mask); in pack_key8()
226 return pack_key(sel, tkey); in pack_key8()
229 static int pack_mac(struct m_pedit_sel *sel, struct m_pedit_key *tkey, in pack_mac() argument
234 if (!(tkey->off & 0x3)) { in pack_mac()
235 tkey->mask = 0; in pack_mac()
236 tkey->val = ntohl(*((__u32 *)mac)); in pack_mac()
237 ret |= pack_key32(~0, sel, tkey); in pack_mac()
239 tkey->off += 4; in pack_mac()
240 tkey->mask = 0; in pack_mac()
241 tkey->val = ntohs(*((__u16 *)&mac[4])); in pack_mac()
242 ret |= pack_key16(~0, sel, tkey); in pack_mac()
243 } else if (!(tkey->off & 0x1)) { in pack_mac()
244 tkey->mask = 0; in pack_mac()
245 tkey->val = ntohs(*((__u16 *)mac)); in pack_mac()
246 ret |= pack_key16(~0, sel, tkey); in pack_mac()
248 tkey->off += 4; in pack_mac()
249 tkey->mask = 0; in pack_mac()
250 tkey->val = ntohl(*((__u32 *)(mac + 2))); in pack_mac()
251 ret |= pack_key32(~0, sel, tkey); in pack_mac()
261 static int pack_ipv6(struct m_pedit_sel *sel, struct m_pedit_key *tkey, in pack_ipv6() argument
267 if (tkey->off & 0x3) { in pack_ipv6()
274 tkey->mask = 0; in pack_ipv6()
275 tkey->val = ntohl(ipv6[i]); in pack_ipv6()
277 ret = pack_key32(~0, sel, tkey); in pack_ipv6()
281 tkey->off += 4; in pack_ipv6()
334 struct m_pedit_sel *sel, struct m_pedit_key *tkey) in parse_cmd() argument
350 argc, *argv, tkey->off, len); in parse_cmd()
362 tkey->cmd = TCA_PEDIT_KEY_EX_CMD_ADD; in parse_cmd()
364 if (!sel->extended && tkey->cmd) { in parse_cmd()
398 res = pack_mac(sel, tkey, (__u8 *)val); in parse_cmd()
403 res = pack_ipv6(sel, tkey, val); in parse_cmd()
407 tkey->val = *v; in parse_cmd()
408 tkey->mask = *m; in parse_cmd()
411 tkey->val = ntohl(tkey->val); in parse_cmd()
414 res = pack_key8(retain, sel, tkey); in parse_cmd()
418 res = pack_key16(retain, sel, tkey); in parse_cmd()
422 res = pack_key32(retain, sel, tkey); in parse_cmd()
430 argc, *argv, tkey->off, len); in parse_cmd()
438 struct m_pedit_key *tkey) in parse_offset() argument
451 tkey->off = off; in parse_offset()
489 tkey->at = atv; in parse_offset()
495 tkey->offmask = offmask; in parse_offset()
501 tkey->shift = shift; in parse_offset()
506 res = parse_cmd(&argc, &argv, len, TU32, retain, sel, tkey); in parse_offset()
515 struct m_pedit_key tkey = {}; in parse_munge() local
525 res = parse_offset(&argc, &argv, sel, &tkey); in parse_munge()
538 res = p->parse_peopt(&argc, &argv, sel, &tkey); in parse_munge()