diff options
author | sjur.brandeland@stericsson.com <sjur.brandeland@stericsson.com> | 2012-02-02 23:36:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-02-04 16:06:27 -0500 |
commit | 576f3cc7fb94a22df2ced8dcba7d48ff42f8e745 (patch) | |
tree | fc3a7f3837a1730e1bd872eb0c6e307e7ccceb3c /net/caif | |
parent | 4a695823b580124c3ab750d8d528f7c6522628c3 (diff) |
caif: Add drop count for caif_net device.
Count dropped packets in CAIF Netdevice.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/caif')
-rw-r--r-- | net/caif/chnl_net.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c index 865690948bbc..a751d9b263ed 100644 --- a/net/caif/chnl_net.c +++ b/net/caif/chnl_net.c | |||
@@ -74,7 +74,6 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt) | |||
74 | struct sk_buff *skb; | 74 | struct sk_buff *skb; |
75 | struct chnl_net *priv = container_of(layr, struct chnl_net, chnl); | 75 | struct chnl_net *priv = container_of(layr, struct chnl_net, chnl); |
76 | int pktlen; | 76 | int pktlen; |
77 | int err = 0; | ||
78 | const u8 *ip_version; | 77 | const u8 *ip_version; |
79 | u8 buf; | 78 | u8 buf; |
80 | 79 | ||
@@ -95,8 +94,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt) | |||
95 | 94 | ||
96 | /* check the version of IP */ | 95 | /* check the version of IP */ |
97 | ip_version = skb_header_pointer(skb, 0, 1, &buf); | 96 | ip_version = skb_header_pointer(skb, 0, 1, &buf); |
98 | if (!ip_version) | 97 | |
99 | return -EINVAL; | ||
100 | switch (*ip_version >> 4) { | 98 | switch (*ip_version >> 4) { |
101 | case 4: | 99 | case 4: |
102 | skb->protocol = htons(ETH_P_IP); | 100 | skb->protocol = htons(ETH_P_IP); |
@@ -105,6 +103,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt) | |||
105 | skb->protocol = htons(ETH_P_IPV6); | 103 | skb->protocol = htons(ETH_P_IPV6); |
106 | break; | 104 | break; |
107 | default: | 105 | default: |
106 | priv->netdev->stats.rx_errors++; | ||
108 | return -EINVAL; | 107 | return -EINVAL; |
109 | } | 108 | } |
110 | 109 | ||
@@ -123,7 +122,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt) | |||
123 | priv->netdev->stats.rx_packets++; | 122 | priv->netdev->stats.rx_packets++; |
124 | priv->netdev->stats.rx_bytes += pktlen; | 123 | priv->netdev->stats.rx_bytes += pktlen; |
125 | 124 | ||
126 | return err; | 125 | return 0; |
127 | } | 126 | } |
128 | 127 | ||
129 | static int delete_device(struct chnl_net *dev) | 128 | static int delete_device(struct chnl_net *dev) |
@@ -221,11 +220,13 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
221 | 220 | ||
222 | if (skb->len > priv->netdev->mtu) { | 221 | if (skb->len > priv->netdev->mtu) { |
223 | pr_warn("Size of skb exceeded MTU\n"); | 222 | pr_warn("Size of skb exceeded MTU\n"); |
223 | dev->stats.tx_errors++; | ||
224 | return -ENOSPC; | 224 | return -ENOSPC; |
225 | } | 225 | } |
226 | 226 | ||
227 | if (!priv->flowenabled) { | 227 | if (!priv->flowenabled) { |
228 | pr_debug("dropping packets flow off\n"); | 228 | pr_debug("dropping packets flow off\n"); |
229 | dev->stats.tx_dropped++; | ||
229 | return NETDEV_TX_BUSY; | 230 | return NETDEV_TX_BUSY; |
230 | } | 231 | } |
231 | 232 | ||
@@ -240,8 +241,7 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
240 | /* Send the packet down the stack. */ | 241 | /* Send the packet down the stack. */ |
241 | result = priv->chnl.dn->transmit(priv->chnl.dn, pkt); | 242 | result = priv->chnl.dn->transmit(priv->chnl.dn, pkt); |
242 | if (result) { | 243 | if (result) { |
243 | if (result == -EAGAIN) | 244 | dev->stats.tx_dropped++; |
244 | result = NETDEV_TX_BUSY; | ||
245 | return result; | 245 | return result; |
246 | } | 246 | } |
247 | 247 | ||