if (!ipa_status_format_packet(status->opcode))
return true;
- if (!status->pkt_len)
- return true;
+
endpoint_id = u8_get_bits(status->endp_dst_idx,
IPA_STATUS_DST_IDX_FMASK);
if (endpoint_id != endpoint->endpoint_id)
while (resid) {
const struct ipa_status *status = data;
+ u32 length;
u32 align;
u32 len;
}
/* Skip over status packets that lack packet data */
- if (ipa_endpoint_status_skip(endpoint, status)) {
+ length = le16_to_cpu(status->pkt_len);
+ if (!length || ipa_endpoint_status_skip(endpoint, status)) {
data += sizeof(*status);
resid -= sizeof(*status);
continue;
* computed checksum information will be appended.
*/
align = endpoint->config.rx.pad_align ? : 1;
- len = le16_to_cpu(status->pkt_len);
- len = sizeof(*status) + ALIGN(len, align);
+ len = sizeof(*status) + ALIGN(length, align);
if (endpoint->config.checksum)
len += sizeof(struct rmnet_map_dl_csum_trailer);
if (!ipa_endpoint_status_drop(endpoint, status)) {
void *data2;
u32 extra;
- u32 len2;
/* Client receives only packet data (no status) */
data2 = data + sizeof(*status);
- len2 = le16_to_cpu(status->pkt_len);
/* Have the true size reflect the extra unused space in
* the original receive buffer. Distribute the "cost"
* buffer.
*/
extra = DIV_ROUND_CLOSEST(unused * len, total_len);
- ipa_endpoint_skb_copy(endpoint, data2, len2, extra);
+ ipa_endpoint_skb_copy(endpoint, data2, length, extra);
}
/* Consume status and the full packet it describes */