aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/loopback.c
diff options
context:
space:
mode:
authorChuck Ebbert <76306.1226@compuserve.com>2005-07-02 21:28:21 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-07-31 01:06:10 -0400
commitd2ae1d2ff9282ca061b6f5244eee4c28ee2b3ffa (patch)
tree12bc14f038ed644faa6299912453f2784f755315 /drivers/net/loopback.c
parent2f761478a2b436efa23659b4d5c826e53b11f91a (diff)
[PATCH] loopback: #ifdef the TSO code
This patch #ifdefs the TSO code in the loopback driver. Saves ~800 bytes of text on i386 and avoids a conditional in the fast path. Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/loopback.c')
-rw-r--r--drivers/net/loopback.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index b33111e21313..c1e3cee8ec33 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -68,6 +68,7 @@ static DEFINE_PER_CPU(struct net_device_stats, loopback_stats);
68 * of largesending device modulo TCP checksum, which is ignored for loopback. 68 * of largesending device modulo TCP checksum, which is ignored for loopback.
69 */ 69 */
70 70
71#ifdef LOOPBACK_TSO
71static void emulate_large_send_offload(struct sk_buff *skb) 72static void emulate_large_send_offload(struct sk_buff *skb)
72{ 73{
73 struct iphdr *iph = skb->nh.iph; 74 struct iphdr *iph = skb->nh.iph;
@@ -119,6 +120,7 @@ static void emulate_large_send_offload(struct sk_buff *skb)
119 120
120 dev_kfree_skb(skb); 121 dev_kfree_skb(skb);
121} 122}
123#endif /* LOOPBACK_TSO */
122 124
123/* 125/*
124 * The higher levels take care of making this non-reentrant (it's 126 * The higher levels take care of making this non-reentrant (it's
@@ -136,6 +138,7 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
136 skb->ip_summed = CHECKSUM_UNNECESSARY; 138 skb->ip_summed = CHECKSUM_UNNECESSARY;
137#endif 139#endif
138 140
141#ifdef LOOPBACK_TSO
139 if (skb_shinfo(skb)->tso_size) { 142 if (skb_shinfo(skb)->tso_size) {
140 BUG_ON(skb->protocol != htons(ETH_P_IP)); 143 BUG_ON(skb->protocol != htons(ETH_P_IP));
141 BUG_ON(skb->nh.iph->protocol != IPPROTO_TCP); 144 BUG_ON(skb->nh.iph->protocol != IPPROTO_TCP);
@@ -143,7 +146,7 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
143 emulate_large_send_offload(skb); 146 emulate_large_send_offload(skb);
144 return 0; 147 return 0;
145 } 148 }
146 149#endif
147 dev->last_rx = jiffies; 150 dev->last_rx = jiffies;
148 151
149 lb_stats = &per_cpu(loopback_stats, get_cpu()); 152 lb_stats = &per_cpu(loopback_stats, get_cpu());
@@ -209,6 +212,9 @@ struct net_device loopback_dev = {
209 .rebuild_header = eth_rebuild_header, 212 .rebuild_header = eth_rebuild_header,
210 .flags = IFF_LOOPBACK, 213 .flags = IFF_LOOPBACK,
211 .features = NETIF_F_SG|NETIF_F_FRAGLIST 214 .features = NETIF_F_SG|NETIF_F_FRAGLIST
215#ifdef LOOPBACK_TSO
216 |NETIF_F_TSO
217#endif
212 |NETIF_F_NO_CSUM|NETIF_F_HIGHDMA 218 |NETIF_F_NO_CSUM|NETIF_F_HIGHDMA
213 |NETIF_F_LLTX, 219 |NETIF_F_LLTX,
214 .ethtool_ops = &loopback_ethtool_ops, 220 .ethtool_ops = &loopback_ethtool_ops,