Skip to content

Commit

Permalink
staging: most: add statistics for dropped packets
Browse files Browse the repository at this point in the history
This patch adds a counter for dropped packets. It needed for statistical
analysis.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Christian Gromm authored and Greg Kroah-Hartman committed Feb 8, 2016
1 parent 5adf5dc commit 1c55d30
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/staging/most/aim-network/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ static int aim_rx_data(struct mbo *mbo)
u32 len = mbo->processed_length;
struct sk_buff *skb;
struct net_device *dev;
unsigned int skb_len;

nd = get_net_dev_context(mbo->ifp);
if (!nd || !nd->channels_opened || nd->rx.ch_id != mbo->hdm_channel_id)
Expand Down Expand Up @@ -482,9 +483,13 @@ static int aim_rx_data(struct mbo *mbo)

memcpy(skb_put(skb, len), buf, len);
skb->protocol = eth_type_trans(skb, dev);
dev->stats.rx_packets++;
dev->stats.rx_bytes += skb->len;
netif_rx(skb);
skb_len = skb->len;
if (netif_rx(skb) == NET_RX_SUCCESS) {
dev->stats.rx_packets++;
dev->stats.rx_bytes += skb_len;
} else {
dev->stats.rx_dropped++;
}

out:
most_put_mbo(mbo);
Expand Down

0 comments on commit 1c55d30

Please sign in to comment.