Skip to content

Commit

Permalink
r8152: calculate the dropped packets for rx
Browse files Browse the repository at this point in the history
Continue dealing with the remain rx packets, even though the allocation
of the skb fail. This could calculate the correct dropped packets.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
hayeswang authored and David S. Miller committed Mar 7, 2014
1 parent 0c3121f commit 5e2f748
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/usb/r8152.c
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@ static void rx_bottom(struct r8152 *tp)
skb = netdev_alloc_skb_ip_align(netdev, pkt_len);
if (!skb) {
stats->rx_dropped++;
break;
goto find_next_rx;
}
memcpy(skb->data, rx_data, pkt_len);
skb_put(skb, pkt_len);
Expand All @@ -1465,6 +1465,7 @@ static void rx_bottom(struct r8152 *tp)
stats->rx_packets++;
stats->rx_bytes += pkt_len;

find_next_rx:
rx_data = rx_agg_align(rx_data + pkt_len + CRC_SIZE);
rx_desc = (struct rx_desc *)rx_data;
len_used = (int)(rx_data - (u8 *)agg->head);
Expand Down

0 comments on commit 5e2f748

Please sign in to comment.