#include <linux/tracepoint.h>
TRACE_EVENT(in_packet,
- TP_PROTO(const struct amdtp_stream *s, u32 cycles, u32 cip_header[2], unsigned int payload_quadlets, unsigned int index),
- TP_ARGS(s, cycles, cip_header, payload_quadlets, index),
+ TP_PROTO(const struct amdtp_stream *s, u32 cycles, u32 cip_header[2], unsigned int payload_length, unsigned int index),
+ TP_ARGS(s, cycles, cip_header, payload_length, index),
TP_STRUCT__entry(
__field(unsigned int, second)
__field(unsigned int, cycle)
__entry->dest = fw_parent_device(s->unit)->card->node_id;
__entry->cip_header0 = cip_header[0];
__entry->cip_header1 = cip_header[1];
- __entry->payload_quadlets = payload_quadlets;
+ __entry->payload_quadlets = payload_length / 4;
__entry->packet_index = s->packet_index;
__entry->irq = !!in_interrupt();
__entry->index = index;
amdtp_stream_get_max_payload(s));
}
-static int handle_out_packet(struct amdtp_stream *s, unsigned int cycle,
+static int handle_out_packet(struct amdtp_stream *s,
+ unsigned int payload_length, unsigned int cycle,
unsigned int index)
{
__be32 *buffer;
unsigned int syt;
unsigned int data_blocks;
- unsigned int payload_length;
unsigned int pcm_frames;
struct snd_pcm_substream *pcm;
}
static int handle_in_packet(struct amdtp_stream *s,
- unsigned int payload_quadlets, unsigned int cycle,
+ unsigned int payload_length, unsigned int cycle,
unsigned int index)
{
__be32 *buffer;
cip_header[0] = be32_to_cpu(buffer[0]);
cip_header[1] = be32_to_cpu(buffer[1]);
- trace_in_packet(s, cycle, cip_header, payload_quadlets, index);
+ trace_in_packet(s, cycle, cip_header, payload_length, index);
/*
* This module supports 'Two-quadlet CIP header with SYT field'.
/* Calculate data blocks */
fdf = (cip_header[1] & CIP_FDF_MASK) >> CIP_FDF_SHIFT;
- if (payload_quadlets < 3 ||
+ if (payload_length < 12 ||
(fmt == CIP_FMT_AM && fdf == AMDTP_FDF_NO_DATA)) {
data_blocks = 0;
} else {
if (s->flags & CIP_WRONG_DBS)
data_block_quadlets = s->data_block_quadlets;
- data_blocks = (payload_quadlets - 2) / data_block_quadlets;
+ data_blocks = (payload_length / 4 - 2) /
+ data_block_quadlets;
}
/* Check data block counter continuity */
for (i = 0; i < packets; ++i) {
cycle = increment_cycle_count(cycle, 1);
- if (handle_out_packet(s, cycle, i) < 0) {
+ if (handle_out_packet(s, 0, cycle, i) < 0) {
s->packet_index = -1;
amdtp_stream_pcm_abort(s);
return;
{
struct amdtp_stream *s = private_data;
unsigned int i, packets;
- unsigned int payload_quadlets, max_payload_quadlets;
+ unsigned int payload_length, max_payload_length;
__be32 *headers = header;
u32 cycle;
cycle = decrement_cycle_count(cycle, packets);
/* For buffer-over-run prevention. */
- max_payload_quadlets = amdtp_stream_get_max_payload(s) / 4;
+ max_payload_length = amdtp_stream_get_max_payload(s);
for (i = 0; i < packets; i++) {
cycle = increment_cycle_count(cycle, 1);
/* The number of quadlets in this packet */
- payload_quadlets =
- (be32_to_cpu(headers[i]) >> ISO_DATA_LENGTH_SHIFT) / 4;
- if (payload_quadlets > max_payload_quadlets) {
+ payload_length =
+ (be32_to_cpu(headers[i]) >> ISO_DATA_LENGTH_SHIFT);
+ if (payload_length > max_payload_length) {
dev_err(&s->unit->device,
- "Detect jumbo payload: %02x %02x\n",
- payload_quadlets, max_payload_quadlets);
+ "Detect jumbo payload: %04x %04x\n",
+ payload_length, max_payload_length);
break;
}
- if (handle_in_packet(s, payload_quadlets, cycle, i) < 0)
+ if (handle_in_packet(s, payload_length, cycle, i) < 0)
break;
}