Lines Matching defs:packet
15 * @ctx: packet context to decode
16 * @packet: expected packet
17 * @new_ctx: expected new packet context
18 * @ctx_unchanged: the packet context must not change
24 struct intel_pt_pkt packet;
173 static int dump_packet(struct intel_pt_pkt *packet, u8 *bytes, int len)
183 ret = intel_pt_pkt_desc(packet, desc, INTEL_PT_PKT_DESC_MAX);
197 dump_packet(&d->packet, d->bytes, d->len);
200 static int fail(struct test_data *d, struct intel_pt_pkt *packet, int len,
209 if (packet->type != d->packet.type)
211 d->packet.type, packet->type);
213 if (packet->count != d->packet.count)
215 d->packet.count, packet->count);
217 if (packet->payload != d->packet.payload)
219 (unsigned long long)d->packet.payload,
220 (unsigned long long)packet->payload);
223 pr_debug("Expected packet context: %d Decoded packet context %d\n",
229 static int test_ctx_unchanged(struct test_data *d, struct intel_pt_pkt *packet,
234 intel_pt_upd_pkt_ctx(packet, &ctx);
247 struct intel_pt_pkt packet;
251 memset(&packet, 0xff, sizeof(packet));
253 /* Decode a packet */
254 ret = intel_pt_get_packet(d->bytes, d->len, &packet, &ctx);
261 /* Some packets must always leave the packet context unchanged */
265 err = test_ctx_unchanged(d, &packet, INTEL_PT_NO_CTX);
268 err = test_ctx_unchanged(d, &packet, INTEL_PT_BLK_4_CTX);
271 err = test_ctx_unchanged(d, &packet, INTEL_PT_BLK_8_CTX);
277 if (ret != d->len || packet.type != d->packet.type ||
278 packet.count != d->packet.count ||
279 packet.payload != d->packet.payload || ctx != d->new_ctx)
280 return fail(d, &packet, ret, ctx);
283 ret = dump_packet(&d->packet, d->bytes, d->len);
289 * This test feeds byte sequences to the Intel PT packet decoder and checks the
290 * results. Changes to the packet context are also checked.