@@ -119,28 +119,6 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
119
119
return segs ;
120
120
}
121
121
122
- /* Compute the whole skb csum in s/w and store it, then verify GRO csum
123
- * starting from gro_offset.
124
- */
125
- static __sum16 gro_skb_checksum (struct sk_buff * skb )
126
- {
127
- __sum16 sum ;
128
-
129
- skb -> csum = skb_checksum (skb , 0 , skb -> len , 0 );
130
- NAPI_GRO_CB (skb )-> csum = csum_sub (skb -> csum ,
131
- csum_partial (skb -> data , skb_gro_offset (skb ), 0 ));
132
- sum = csum_fold (NAPI_GRO_CB (skb )-> csum );
133
- if (unlikely (skb -> ip_summed == CHECKSUM_COMPLETE )) {
134
- if (unlikely (!sum ) && !skb -> csum_complete_sw )
135
- netdev_rx_csum_fault (skb -> dev );
136
- } else {
137
- skb -> ip_summed = CHECKSUM_COMPLETE ;
138
- skb -> csum_complete_sw = 1 ;
139
- }
140
-
141
- return sum ;
142
- }
143
-
144
122
static struct sk_buff * * gre_gro_receive (struct sk_buff * * head ,
145
123
struct sk_buff * skb )
146
124
{
@@ -192,22 +170,15 @@ static struct sk_buff **gre_gro_receive(struct sk_buff **head,
192
170
if (unlikely (!greh ))
193
171
goto out_unlock ;
194
172
}
195
- if (greh -> flags & GRE_CSUM ) { /* Need to verify GRE csum first */
196
- __sum16 csum = 0 ;
197
-
198
- if (skb -> ip_summed == CHECKSUM_COMPLETE )
199
- csum = csum_fold (NAPI_GRO_CB (skb )-> csum );
200
- /* Don't trust csum error calculated/reported by h/w */
201
- if (skb -> ip_summed == CHECKSUM_NONE || csum != 0 )
202
- csum = gro_skb_checksum (skb );
203
-
204
- /* GRE CSUM is the 1's complement of the 1's complement sum
205
- * of the GRE hdr plus payload so it should add up to 0xffff
206
- * (and 0 after csum_fold()) just like the IPv4 hdr csum.
207
- */
208
- if (csum )
173
+
174
+ /* Don't bother verifying checksum if we're going to flush anyway. */
175
+ if (greh -> flags & GRE_CSUM ) {
176
+ if (!NAPI_GRO_CB (skb )-> flush &&
177
+ skb_gro_checksum_simple_validate (skb ))
209
178
goto out_unlock ;
179
+ NAPI_GRO_CB (skb )-> encapsulation ++ ;
210
180
}
181
+
211
182
flush = 0 ;
212
183
213
184
for (p = * head ; p ; p = p -> next ) {
0 commit comments