/* Free skb and update statistics */
dev_kfree_skb(skb);
- kni->stats.tx_bytes += len;
- kni->stats.tx_packets++;
+ dev->stats.tx_bytes += len;
+ dev->stats.tx_packets++;
return NETDEV_TX_OK;
drop:
/* Free skb and update statistics */
dev_kfree_skb(skb);
- kni->stats.tx_dropped++;
+ dev->stats.tx_dropped++;
return NETDEV_TX_OK;
}
skb = netdev_alloc_skb(dev, len);
if (!skb) {
/* Update statistics */
- kni->stats.rx_dropped++;
+ dev->stats.rx_dropped++;
continue;
}
netif_rx_ni(skb);
/* Update statistics */
- kni->stats.rx_bytes += len;
- kni->stats.rx_packets++;
+ dev->stats.rx_bytes += len;
+ dev->stats.rx_packets++;
}
/* Burst enqueue mbufs into free_q */
void *data_kva;
struct rte_kni_mbuf *alloc_kva;
void *alloc_data_kva;
+ struct net_device *dev = kni->net_dev;
/* Get the number of entries in rx_q */
num_rq = kni_fifo_count(kni->rx_q);
alloc_kva->pkt_len = len;
alloc_kva->data_len = len;
- kni->stats.tx_bytes += len;
- kni->stats.rx_bytes += len;
+ dev->stats.tx_bytes += len;
+ dev->stats.rx_bytes += len;
}
/* Burst enqueue mbufs into tx_q */
* Update statistic, and enqueue/dequeue failure is impossible,
* as all queues are checked at first.
*/
- kni->stats.tx_packets += num;
- kni->stats.rx_packets += num;
+ dev->stats.tx_packets += num;
+ dev->stats.rx_packets += num;
}
/*
/* Simulate real usage, allocate/copy skb twice */
skb = netdev_alloc_skb(dev, len);
if (skb == NULL) {
- kni->stats.rx_dropped++;
+ dev->stats.rx_dropped++;
continue;
}
skb->ip_summed = CHECKSUM_UNNECESSARY;
- kni->stats.rx_bytes += len;
- kni->stats.rx_packets++;
+ dev->stats.rx_bytes += len;
+ dev->stats.rx_packets++;
/* call tx interface */
kni_net_tx(skb, dev);
static void
kni_net_tx_timeout(struct net_device *dev)
{
- struct kni_dev *kni = netdev_priv(dev);
-
pr_debug("Transmit timeout at %ld, latency %ld\n", jiffies,
jiffies - dev_trans_start(dev));
- kni->stats.tx_errors++;
+ dev->stats.tx_errors++;
netif_wake_queue(dev);
}
wake_up_interruptible(&kni->wq);
}
-/*
- * Return statistics to the caller
- */
-static struct net_device_stats *
-kni_net_stats(struct net_device *dev)
-{
- struct kni_dev *kni = netdev_priv(dev);
-
- return &kni->stats;
-}
-
/*
* Fill the eth header
*/
.ndo_change_rx_flags = kni_net_set_promiscusity,
.ndo_start_xmit = kni_net_tx,
.ndo_change_mtu = kni_net_change_mtu,
- .ndo_get_stats = kni_net_stats,
.ndo_tx_timeout = kni_net_tx_timeout,
.ndo_set_mac_address = kni_net_set_mac,
#ifdef HAVE_CHANGE_CARRIER_CB