loopback.c (8a517c514d5893602cf85c1b4c47afbbc04d2198) loopback.c (61357325f377889a1daffa14962d705dc814dd0e)
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Pseudo-driver for the loopback interface.
7 *
8 * Version: @(#)loopback.c 1.0.4b 08/16/93

--- 55 unchanged lines hidden (view full) ---

64 unsigned long bytes;
65 unsigned long drops;
66};
67
68/*
69 * The higher levels take care of making this non-reentrant (it's
70 * called with bh's disabled).
71 */
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Pseudo-driver for the loopback interface.
7 *
8 * Version: @(#)loopback.c 1.0.4b 08/16/93

--- 55 unchanged lines hidden (view full) ---

64 unsigned long bytes;
65 unsigned long drops;
66};
67
68/*
69 * The higher levels take care of making this non-reentrant (it's
70 * called with bh's disabled).
71 */
72static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
72static netdev_tx_t loopback_xmit(struct sk_buff *skb,
73 struct net_device *dev)
73{
74 struct pcpu_lstats *pcpu_lstats, *lb_stats;
75 int len;
76
77 skb_orphan(skb);
78
79 skb->protocol = eth_type_trans(skb, dev);
80
81 /* it's OK to use per_cpu_ptr() because BHs are off */
82 pcpu_lstats = dev->ml_priv;
83 lb_stats = per_cpu_ptr(pcpu_lstats, smp_processor_id());
84
85 len = skb->len;
86 if (likely(netif_rx(skb) == NET_RX_SUCCESS)) {
87 lb_stats->bytes += len;
88 lb_stats->packets++;
89 } else
90 lb_stats->drops++;
91
74{
75 struct pcpu_lstats *pcpu_lstats, *lb_stats;
76 int len;
77
78 skb_orphan(skb);
79
80 skb->protocol = eth_type_trans(skb, dev);
81
82 /* it's OK to use per_cpu_ptr() because BHs are off */
83 pcpu_lstats = dev->ml_priv;
84 lb_stats = per_cpu_ptr(pcpu_lstats, smp_processor_id());
85
86 len = skb->len;
87 if (likely(netif_rx(skb) == NET_RX_SUCCESS)) {
88 lb_stats->bytes += len;
89 lb_stats->packets++;
90 } else
91 lb_stats->drops++;
92
92 return 0;
93 return NETDEV_TX_OK;
93}
94
95static struct net_device_stats *loopback_get_stats(struct net_device *dev)
96{
97 const struct pcpu_lstats *pcpu_lstats;
98 struct net_device_stats *stats = &dev->stats;
99 unsigned long bytes = 0;
100 unsigned long packets = 0;

--- 125 unchanged lines hidden ---
94}
95
96static struct net_device_stats *loopback_get_stats(struct net_device *dev)
97{
98 const struct pcpu_lstats *pcpu_lstats;
99 struct net_device_stats *stats = &dev->stats;
100 unsigned long bytes = 0;
101 unsigned long packets = 0;

--- 125 unchanged lines hidden ---