diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/loopback.c | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 46e87cc87251..489d53be2f5d 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -64,68 +64,6 @@ struct pcpu_lstats { | |||
64 | unsigned long bytes; | 64 | unsigned long bytes; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | /* KISS: just allocate small chunks and copy bits. | ||
68 | * | ||
69 | * So, in fact, this is documentation, explaining what we expect | ||
70 | * of largesending device modulo TCP checksum, which is ignored for loopback. | ||
71 | */ | ||
72 | |||
73 | #ifdef LOOPBACK_TSO | ||
74 | static void emulate_large_send_offload(struct sk_buff *skb) | ||
75 | { | ||
76 | struct iphdr *iph = ip_hdr(skb); | ||
77 | struct tcphdr *th = (struct tcphdr *)(skb_network_header(skb) + | ||
78 | (iph->ihl * 4)); | ||
79 | unsigned int doffset = (iph->ihl + th->doff) * 4; | ||
80 | unsigned int mtu = skb_shinfo(skb)->gso_size + doffset; | ||
81 | unsigned int offset = 0; | ||
82 | u32 seq = ntohl(th->seq); | ||
83 | u16 id = ntohs(iph->id); | ||
84 | |||
85 | while (offset + doffset < skb->len) { | ||
86 | unsigned int frag_size = min(mtu, skb->len - offset) - doffset; | ||
87 | struct sk_buff *nskb = alloc_skb(mtu + 32, GFP_ATOMIC); | ||
88 | |||
89 | if (!nskb) | ||
90 | break; | ||
91 | skb_reserve(nskb, 32); | ||
92 | skb_set_mac_header(nskb, -ETH_HLEN); | ||
93 | skb_reset_network_header(nskb); | ||
94 | iph = ip_hdr(nskb); | ||
95 | skb_copy_to_linear_data(nskb, skb_network_header(skb), | ||
96 | doffset); | ||
97 | if (skb_copy_bits(skb, | ||
98 | doffset + offset, | ||
99 | nskb->data + doffset, | ||
100 | frag_size)) | ||
101 | BUG(); | ||
102 | skb_put(nskb, doffset + frag_size); | ||
103 | nskb->ip_summed = CHECKSUM_UNNECESSARY; | ||
104 | nskb->dev = skb->dev; | ||
105 | nskb->priority = skb->priority; | ||
106 | nskb->protocol = skb->protocol; | ||
107 | nskb->dst = dst_clone(skb->dst); | ||
108 | memcpy(nskb->cb, skb->cb, sizeof(skb->cb)); | ||
109 | nskb->pkt_type = skb->pkt_type; | ||
110 | |||
111 | th = (struct tcphdr *)(skb_network_header(nskb) + iph->ihl * 4); | ||
112 | iph->tot_len = htons(frag_size + doffset); | ||
113 | iph->id = htons(id); | ||
114 | iph->check = 0; | ||
115 | iph->check = ip_fast_csum((unsigned char *) iph, iph->ihl); | ||
116 | th->seq = htonl(seq); | ||
117 | if (offset + doffset + frag_size < skb->len) | ||
118 | th->fin = th->psh = 0; | ||
119 | netif_rx(nskb); | ||
120 | offset += frag_size; | ||
121 | seq += frag_size; | ||
122 | id++; | ||
123 | } | ||
124 | |||
125 | dev_kfree_skb(skb); | ||
126 | } | ||
127 | #endif /* LOOPBACK_TSO */ | ||
128 | |||
129 | /* | 67 | /* |
130 | * The higher levels take care of making this non-reentrant (it's | 68 | * The higher levels take care of making this non-reentrant (it's |
131 | * called with bh's disabled). | 69 | * called with bh's disabled). |