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>
This commit is contained in:
parent
4a695823b5
commit
576f3cc7fb
|
@ -74,7 +74,6 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
struct chnl_net *priv = container_of(layr, struct chnl_net, chnl);
|
struct chnl_net *priv = container_of(layr, struct chnl_net, chnl);
|
||||||
int pktlen;
|
int pktlen;
|
||||||
int err = 0;
|
|
||||||
const u8 *ip_version;
|
const u8 *ip_version;
|
||||||
u8 buf;
|
u8 buf;
|
||||||
|
|
||||||
|
@ -95,8 +94,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
|
||||||
|
|
||||||
/* check the version of IP */
|
/* check the version of IP */
|
||||||
ip_version = skb_header_pointer(skb, 0, 1, &buf);
|
ip_version = skb_header_pointer(skb, 0, 1, &buf);
|
||||||
if (!ip_version)
|
|
||||||
return -EINVAL;
|
|
||||||
switch (*ip_version >> 4) {
|
switch (*ip_version >> 4) {
|
||||||
case 4:
|
case 4:
|
||||||
skb->protocol = htons(ETH_P_IP);
|
skb->protocol = htons(ETH_P_IP);
|
||||||
|
@ -105,6 +103,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
|
||||||
skb->protocol = htons(ETH_P_IPV6);
|
skb->protocol = htons(ETH_P_IPV6);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
priv->netdev->stats.rx_errors++;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +122,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
|
||||||
priv->netdev->stats.rx_packets++;
|
priv->netdev->stats.rx_packets++;
|
||||||
priv->netdev->stats.rx_bytes += pktlen;
|
priv->netdev->stats.rx_bytes += pktlen;
|
||||||
|
|
||||||
return err;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int delete_device(struct chnl_net *dev)
|
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)
|
||||||
|
|
||||||
if (skb->len > priv->netdev->mtu) {
|
if (skb->len > priv->netdev->mtu) {
|
||||||
pr_warn("Size of skb exceeded MTU\n");
|
pr_warn("Size of skb exceeded MTU\n");
|
||||||
|
dev->stats.tx_errors++;
|
||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!priv->flowenabled) {
|
if (!priv->flowenabled) {
|
||||||
pr_debug("dropping packets flow off\n");
|
pr_debug("dropping packets flow off\n");
|
||||||
|
dev->stats.tx_dropped++;
|
||||||
return NETDEV_TX_BUSY;
|
return NETDEV_TX_BUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,8 +241,7 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
/* Send the packet down the stack. */
|
/* Send the packet down the stack. */
|
||||||
result = priv->chnl.dn->transmit(priv->chnl.dn, pkt);
|
result = priv->chnl.dn->transmit(priv->chnl.dn, pkt);
|
||||||
if (result) {
|
if (result) {
|
||||||
if (result == -EAGAIN)
|
dev->stats.tx_dropped++;
|
||||||
result = NETDEV_TX_BUSY;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue