Commit 0eec32ff350348e635b3b8d87b989117ce045d25

Authored by Changli Gao
Committed by David S. Miller
1 parent 7abac68602

net_sched: act_csum: coding style cleanup

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 38 additions and 39 deletions Side-by-side Diff

net/sched/act_csum.c
... ... @@ -42,9 +42,9 @@
42 42 static DEFINE_RWLOCK(csum_lock);
43 43  
44 44 static struct tcf_hashinfo csum_hash_info = {
45   - .htab = tcf_csum_ht,
46   - .hmask = CSUM_TAB_MASK,
47   - .lock = &csum_lock,
  45 + .htab = tcf_csum_ht,
  46 + .hmask = CSUM_TAB_MASK,
  47 + .lock = &csum_lock,
48 48 };
49 49  
50 50 static const struct nla_policy csum_policy[TCA_CSUM_MAX + 1] = {
... ... @@ -73,7 +73,8 @@
73 73  
74 74 pc = tcf_hash_check(parm->index, a, bind, &csum_hash_info);
75 75 if (!pc) {
76   - pc = tcf_hash_create(parm->index, est, a, sizeof(*p), bind, &csum_idx_gen, &csum_hash_info);
  76 + pc = tcf_hash_create(parm->index, est, a, sizeof(*p), bind,
  77 + &csum_idx_gen, &csum_hash_info);
77 78 if (IS_ERR(pc))
78 79 return PTR_ERR(pc);
79 80 p = to_tcf_csum(pc);
... ... @@ -230,8 +231,9 @@
230 231 struct udphdr *udph;
231 232 u16 ul;
232 233  
233   - /* Support both UDP and UDPLITE checksum algorithms,
234   - * Don't use udph->len to get the real length without any protocol check,
  234 + /*
  235 + * Support both UDP and UDPLITE checksum algorithms, Don't use
  236 + * udph->len to get the real length without any protocol check,
235 237 * UDPLITE uses udph->len for another thing,
236 238 * Use iph->tot_len, or just ipl.
237 239 */
238 240  
... ... @@ -249,10 +251,8 @@
249 251 if (udplite) {
250 252 if (ul == 0)
251 253 skb->csum = csum_partial(udph, ipl - ihl, 0);
252   -
253 254 else if ((ul >= sizeof(*udph)) && (ul <= ipl - ihl))
254 255 skb->csum = csum_partial(udph, ul, 0);
255   -
256 256 else
257 257 goto ignore_obscure_skb;
258 258 } else {
... ... @@ -282,8 +282,9 @@
282 282 struct udphdr *udph;
283 283 u16 ul;
284 284  
285   - /* Support both UDP and UDPLITE checksum algorithms,
286   - * Don't use udph->len to get the real length without any protocol check,
  285 + /*
  286 + * Support both UDP and UDPLITE checksum algorithms, Don't use
  287 + * udph->len to get the real length without any protocol check,
287 288 * UDPLITE uses udph->len for another thing,
288 289 * Use ip6h->payload_len + sizeof(*ip6h) ... , or just ipl.
289 290 */
290 291  
291 292  
292 293  
293 294  
... ... @@ -340,32 +341,32 @@
340 341 switch (iph->frag_off & htons(IP_OFFSET) ? 0 : iph->protocol) {
341 342 case IPPROTO_ICMP:
342 343 if (update_flags & TCA_CSUM_UPDATE_FLAG_ICMP)
343   - if (!tcf_csum_ipv4_icmp(skb,
344   - iph->ihl * 4, ntohs(iph->tot_len)))
  344 + if (!tcf_csum_ipv4_icmp(skb, iph->ihl * 4,
  345 + ntohs(iph->tot_len)))
345 346 goto fail;
346 347 break;
347 348 case IPPROTO_IGMP:
348 349 if (update_flags & TCA_CSUM_UPDATE_FLAG_IGMP)
349   - if (!tcf_csum_ipv4_igmp(skb,
350   - iph->ihl * 4, ntohs(iph->tot_len)))
  350 + if (!tcf_csum_ipv4_igmp(skb, iph->ihl * 4,
  351 + ntohs(iph->tot_len)))
351 352 goto fail;
352 353 break;
353 354 case IPPROTO_TCP:
354 355 if (update_flags & TCA_CSUM_UPDATE_FLAG_TCP)
355   - if (!tcf_csum_ipv4_tcp(skb, iph,
356   - iph->ihl * 4, ntohs(iph->tot_len)))
  356 + if (!tcf_csum_ipv4_tcp(skb, iph, iph->ihl * 4,
  357 + ntohs(iph->tot_len)))
357 358 goto fail;
358 359 break;
359 360 case IPPROTO_UDP:
360 361 if (update_flags & TCA_CSUM_UPDATE_FLAG_UDP)
361   - if (!tcf_csum_ipv4_udp(skb, iph,
362   - iph->ihl * 4, ntohs(iph->tot_len), 0))
  362 + if (!tcf_csum_ipv4_udp(skb, iph, iph->ihl * 4,
  363 + ntohs(iph->tot_len), 0))
363 364 goto fail;
364 365 break;
365 366 case IPPROTO_UDPLITE:
366 367 if (update_flags & TCA_CSUM_UPDATE_FLAG_UDPLITE)
367   - if (!tcf_csum_ipv4_udp(skb, iph,
368   - iph->ihl * 4, ntohs(iph->tot_len), 1))
  368 + if (!tcf_csum_ipv4_udp(skb, iph, iph->ihl * 4,
  369 + ntohs(iph->tot_len), 1))
369 370 goto fail;
370 371 break;
371 372 }
... ... @@ -386,7 +387,7 @@
386 387 }
387 388  
388 389 static int tcf_csum_ipv6_hopopts(struct ipv6_opt_hdr *ip6xh,
389   - unsigned int ixhl, unsigned int *pl)
  390 + unsigned int ixhl, unsigned int *pl)
390 391 {
391 392 int off, len, optlen;
392 393 unsigned char *xh = (void *)ip6xh;
... ... @@ -395,8 +396,7 @@
395 396 len = ixhl - off;
396 397  
397 398 while (len > 1) {
398   - switch (xh[off])
399   - {
  399 + switch (xh[off]) {
400 400 case IPV6_TLV_PAD0:
401 401 optlen = 1;
402 402 break;
403 403  
... ... @@ -476,14 +476,14 @@
476 476 goto done;
477 477 case IPPROTO_UDP:
478 478 if (update_flags & TCA_CSUM_UPDATE_FLAG_UDP)
479   - if (!tcf_csum_ipv6_udp(skb, ip6h,
480   - hl, pl + sizeof(*ip6h), 0))
  479 + if (!tcf_csum_ipv6_udp(skb, ip6h, hl,
  480 + pl + sizeof(*ip6h), 0))
481 481 goto fail;
482 482 goto done;
483 483 case IPPROTO_UDPLITE:
484 484 if (update_flags & TCA_CSUM_UPDATE_FLAG_UDPLITE)
485   - if (!tcf_csum_ipv6_udp(skb, ip6h,
486   - hl, pl + sizeof(*ip6h), 1))
  485 + if (!tcf_csum_ipv6_udp(skb, ip6h, hl,
  486 + pl + sizeof(*ip6h), 1))
487 487 goto fail;
488 488 goto done;
489 489 default:
... ... @@ -544,7 +544,6 @@
544 544 struct tcf_csum *p = a->priv;
545 545 struct tc_csum opt = {
546 546 .update_flags = p->update_flags,
547   -
548 547 .index = p->tcf_index,
549 548 .action = p->tcf_action,
550 549 .refcnt = p->tcf_refcnt - ref,
... ... @@ -566,17 +565,17 @@
566 565 }
567 566  
568 567 static struct tc_action_ops act_csum_ops = {
569   - .kind = "csum",
570   - .hinfo = &csum_hash_info,
571   - .type = TCA_ACT_CSUM,
572   - .capab = TCA_CAP_NONE,
573   - .owner = THIS_MODULE,
574   - .act = tcf_csum,
575   - .dump = tcf_csum_dump,
576   - .cleanup = tcf_csum_cleanup,
577   - .lookup = tcf_hash_search,
578   - .init = tcf_csum_init,
579   - .walk = tcf_generic_walker
  568 + .kind = "csum",
  569 + .hinfo = &csum_hash_info,
  570 + .type = TCA_ACT_CSUM,
  571 + .capab = TCA_CAP_NONE,
  572 + .owner = THIS_MODULE,
  573 + .act = tcf_csum,
  574 + .dump = tcf_csum_dump,
  575 + .cleanup = tcf_csum_cleanup,
  576 + .lookup = tcf_hash_search,
  577 + .init = tcf_csum_init,
  578 + .walk = tcf_generic_walker
580 579 };
581 580  
582 581 MODULE_DESCRIPTION("Checksum updating actions");