@@ -508,7 +508,8 @@ static int bnx2fc_l2_rcv_thread(void *arg)
508
508
509
509
static void bnx2fc_recv_frame (struct sk_buff * skb )
510
510
{
511
- u32 fr_len ;
511
+ u64 crc_err ;
512
+ u32 fr_len , fr_crc ;
512
513
struct fc_lport * lport ;
513
514
struct fcoe_rcv_info * fr ;
514
515
struct fc_stats * stats ;
@@ -542,6 +543,11 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
542
543
skb_pull (skb , sizeof (struct fcoe_hdr ));
543
544
fr_len = skb -> len - sizeof (struct fcoe_crc_eof );
544
545
546
+ stats = per_cpu_ptr (lport -> stats , get_cpu ());
547
+ stats -> RxFrames ++ ;
548
+ stats -> RxWords += fr_len / FCOE_WORD_TO_BYTE ;
549
+ put_cpu ();
550
+
545
551
fp = (struct fc_frame * )skb ;
546
552
fc_frame_init (fp );
547
553
fr_dev (fp ) = lport ;
@@ -624,16 +630,15 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
624
630
return ;
625
631
}
626
632
627
- stats = per_cpu_ptr (lport -> stats , smp_processor_id ());
628
- stats -> RxFrames ++ ;
629
- stats -> RxWords += fr_len / FCOE_WORD_TO_BYTE ;
633
+ fr_crc = le32_to_cpu (fr_crc (fp ));
630
634
631
- if (le32_to_cpu (fr_crc (fp )) !=
632
- ~crc32 (~0 , skb -> data , fr_len )) {
633
- if (stats -> InvalidCRCCount < 5 )
635
+ if (unlikely (fr_crc != ~crc32 (~0 , skb -> data , fr_len ))) {
636
+ stats = per_cpu_ptr (lport -> stats , get_cpu ());
637
+ crc_err = (stats -> InvalidCRCCount ++ );
638
+ put_cpu ();
639
+ if (crc_err < 5 )
634
640
printk (KERN_WARNING PFX "dropping frame with "
635
641
"CRC error\n" );
636
- stats -> InvalidCRCCount ++ ;
637
642
kfree_skb (skb );
638
643
return ;
639
644
}
0 commit comments