Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

sjur.brandeland@stericsson.com and committed by
David S. Miller
576f3cc7 4a695823

+6 -6
+6 -6
net/caif/chnl_net.c
··· 74 74 struct sk_buff *skb; 75 75 struct chnl_net *priv = container_of(layr, struct chnl_net, chnl); 76 76 int pktlen; 77 - int err = 0; 78 77 const u8 *ip_version; 79 78 u8 buf; 80 79 ··· 94 95 95 96 /* check the version of IP */ 96 97 ip_version = skb_header_pointer(skb, 0, 1, &buf); 97 - if (!ip_version) 98 - return -EINVAL; 98 + 99 99 switch (*ip_version >> 4) { 100 100 case 4: 101 101 skb->protocol = htons(ETH_P_IP); ··· 103 105 skb->protocol = htons(ETH_P_IPV6); 104 106 break; 105 107 default: 108 + priv->netdev->stats.rx_errors++; 106 109 return -EINVAL; 107 110 } 108 111 ··· 122 123 priv->netdev->stats.rx_packets++; 123 124 priv->netdev->stats.rx_bytes += pktlen; 124 125 125 - return err; 126 + return 0; 126 127 } 127 128 128 129 static int delete_device(struct chnl_net *dev) ··· 220 221 221 222 if (skb->len > priv->netdev->mtu) { 222 223 pr_warn("Size of skb exceeded MTU\n"); 224 + dev->stats.tx_errors++; 223 225 return -ENOSPC; 224 226 } 225 227 226 228 if (!priv->flowenabled) { 227 229 pr_debug("dropping packets flow off\n"); 230 + dev->stats.tx_dropped++; 228 231 return NETDEV_TX_BUSY; 229 232 } 230 233 ··· 241 240 /* Send the packet down the stack. */ 242 241 result = priv->chnl.dn->transmit(priv->chnl.dn, pkt); 243 242 if (result) { 244 - if (result == -EAGAIN) 245 - result = NETDEV_TX_BUSY; 243 + dev->stats.tx_dropped++; 246 244 return result; 247 245 } 248 246