@@ -71,9 +71,6 @@ DEFINE_PER_CPU(struct fcoe_percpu_s, fcoe_percpu);
7171/* Function Prototyes */
7272static int fcoe_check_wait_queue (struct fc_lport * );
7373static void fcoe_recv_flogi (struct fcoe_softc * , struct fc_frame * , u8 * );
74- #ifdef CONFIG_HOTPLUG_CPU
75- static int fcoe_cpu_callback (struct notifier_block * , ulong , void * );
76- #endif /* CONFIG_HOTPLUG_CPU */
7774static int fcoe_device_notification (struct notifier_block * , ulong , void * );
7875static void fcoe_dev_setup (void );
7976static void fcoe_dev_cleanup (void );
@@ -83,87 +80,6 @@ static struct notifier_block fcoe_notifier = {
8380 .notifier_call = fcoe_device_notification ,
8481};
8582
86-
87- #ifdef CONFIG_HOTPLUG_CPU
88- static struct notifier_block fcoe_cpu_notifier = {
89- .notifier_call = fcoe_cpu_callback ,
90- };
91-
92- /**
93- * fcoe_create_percpu_data() - creates the associated cpu data
94- * @cpu: index for the cpu where fcoe cpu data will be created
95- *
96- * create percpu stats block, from cpu add notifier
97- *
98- * Returns: none
99- */
100- static void fcoe_create_percpu_data (unsigned int cpu )
101- {
102- struct fc_lport * lp ;
103- struct fcoe_softc * fc ;
104-
105- write_lock_bh (& fcoe_hostlist_lock );
106- list_for_each_entry (fc , & fcoe_hostlist , list ) {
107- lp = fc -> lp ;
108- if (lp -> dev_stats [cpu ] == NULL )
109- lp -> dev_stats [cpu ] =
110- kzalloc (sizeof (struct fcoe_dev_stats ),
111- GFP_KERNEL );
112- }
113- write_unlock_bh (& fcoe_hostlist_lock );
114- }
115-
116- /**
117- * fcoe_destroy_percpu_data() - destroys the associated cpu data
118- * @cpu: index for the cpu where fcoe cpu data will destroyed
119- *
120- * destroy percpu stats block called by cpu add/remove notifier
121- *
122- * Retuns: none
123- */
124- static void fcoe_destroy_percpu_data (unsigned int cpu )
125- {
126- struct fc_lport * lp ;
127- struct fcoe_softc * fc ;
128-
129- write_lock_bh (& fcoe_hostlist_lock );
130- list_for_each_entry (fc , & fcoe_hostlist , list ) {
131- lp = fc -> lp ;
132- kfree (lp -> dev_stats [cpu ]);
133- lp -> dev_stats [cpu ] = NULL ;
134- }
135- write_unlock_bh (& fcoe_hostlist_lock );
136- }
137-
138- /**
139- * fcoe_cpu_callback() - fcoe cpu hotplug event callback
140- * @nfb: callback data block
141- * @action: event triggering the callback
142- * @hcpu: index for the cpu of this event
143- *
144- * this creates or destroys per cpu data for fcoe
145- *
146- * Returns NOTIFY_OK always.
147- */
148- static int fcoe_cpu_callback (struct notifier_block * nfb , unsigned long action ,
149- void * hcpu )
150- {
151- unsigned int cpu = (unsigned long )hcpu ;
152-
153- switch (action ) {
154- case CPU_ONLINE :
155- fcoe_create_percpu_data (cpu );
156- break ;
157- case CPU_DEAD :
158- fcoe_destroy_percpu_data (cpu );
159- break ;
160- default :
161- break ;
162- }
163- return NOTIFY_OK ;
164- }
165- #endif /* CONFIG_HOTPLUG_CPU */
166-
16783/**
16884 * fcoe_rcv() - this is the fcoe receive function called by NET_RX_SOFTIRQ
16985 * @skb: the receive skb
@@ -181,7 +97,6 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *dev,
18197 struct fc_lport * lp ;
18298 struct fcoe_rcv_info * fr ;
18399 struct fcoe_softc * fc ;
184- struct fcoe_dev_stats * stats ;
185100 struct fc_frame_header * fh ;
186101 struct fcoe_percpu_s * fps ;
187102 unsigned short oxid ;
@@ -252,13 +167,7 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *dev,
252167
253168 return 0 ;
254169err :
255- #ifdef CONFIG_SMP
256- stats = lp -> dev_stats [smp_processor_id ()];
257- #else
258- stats = lp -> dev_stats [0 ];
259- #endif
260- if (stats )
261- stats -> ErrorFrames ++ ;
170+ fc_lport_get_stats (lp )-> ErrorFrames ++ ;
262171
263172err2 :
264173 kfree_skb (skb );
@@ -495,11 +404,9 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
495404 }
496405#endif
497406 /* update tx stats: regardless if LLD fails */
498- stats = lp -> dev_stats [smp_processor_id ()];
499- if (stats ) {
500- stats -> TxFrames ++ ;
501- stats -> TxWords += wlen ;
502- }
407+ stats = fc_lport_get_stats (lp );
408+ stats -> TxFrames ++ ;
409+ stats -> TxWords += wlen ;
503410
504411 /* send down to lld */
505412 fr_dev (fp ) = lp ;
@@ -565,8 +472,6 @@ int fcoe_percpu_receive_thread(void *arg)
565472 continue ;
566473 }
567474
568- stats = lp -> dev_stats [smp_processor_id ()];
569-
570475 if (unlikely (debug_fcoe )) {
571476 FC_DBG ("skb_info: len:%d data_len:%d head:%p data:%p "
572477 "tail:%p end:%p sum:%d dev:%s" ,
@@ -593,24 +498,25 @@ int fcoe_percpu_receive_thread(void *arg)
593498 hp = (struct fcoe_hdr * ) skb_network_header (skb );
594499 fh = (struct fc_frame_header * ) skb_transport_header (skb );
595500
501+ stats = fc_lport_get_stats (lp );
596502 if (unlikely (FC_FCOE_DECAPS_VER (hp ) != FC_FCOE_VER )) {
597- if (stats ) {
598- if (stats -> ErrorFrames < 5 )
599- FC_DBG ("unknown FCoE version %x" ,
600- FC_FCOE_DECAPS_VER (hp ));
601- stats -> ErrorFrames ++ ;
602- }
503+ if (stats -> ErrorFrames < 5 )
504+ printk (KERN_WARNING "FCoE version "
505+ "mismatch: The frame has "
506+ "version %x, but the "
507+ "initiator supports version "
508+ "%x\n" , FC_FCOE_DECAPS_VER (hp ),
509+ FC_FCOE_VER );
510+ stats -> ErrorFrames ++ ;
603511 kfree_skb (skb );
604512 continue ;
605513 }
606514
607515 skb_pull (skb , sizeof (struct fcoe_hdr ));
608516 fr_len = skb -> len - sizeof (struct fcoe_crc_eof );
609517
610- if (stats ) {
611- stats -> RxFrames ++ ;
612- stats -> RxWords += fr_len / FCOE_WORD_TO_BYTE ;
613- }
518+ stats -> RxFrames ++ ;
519+ stats -> RxWords += fr_len / FCOE_WORD_TO_BYTE ;
614520
615521 fp = (struct fc_frame * )skb ;
616522 fc_frame_init (fp );
@@ -885,9 +791,8 @@ static int fcoe_device_notification(struct notifier_block *notifier,
885791 if (new_link_up )
886792 fc_linkup (lp );
887793 else {
888- stats = lp -> dev_stats [smp_processor_id ()];
889- if (stats )
890- stats -> LinkFailureCount ++ ;
794+ stats = fc_lport_get_stats (lp );
795+ stats -> LinkFailureCount ++ ;
891796 fc_linkdown (lp );
892797 fcoe_clean_pending_queue (lp );
893798 }
@@ -1371,10 +1276,6 @@ static int __init fcoe_init(void)
13711276 INIT_LIST_HEAD (& fcoe_hostlist );
13721277 rwlock_init (& fcoe_hostlist_lock );
13731278
1374- #ifdef CONFIG_HOTPLUG_CPU
1375- register_cpu_notifier (& fcoe_cpu_notifier );
1376- #endif /* CONFIG_HOTPLUG_CPU */
1377-
13781279 for_each_possible_cpu (cpu ) {
13791280 p = & per_cpu (fcoe_percpu , cpu );
13801281 skb_queue_head_init (& p -> fcoe_rx_list );
@@ -1430,17 +1331,9 @@ static void __exit fcoe_exit(void)
14301331 struct fcoe_percpu_s * p ;
14311332 struct sk_buff * skb ;
14321333
1433- /*
1434- * Stop all call back interfaces
1435- */
1436- #ifdef CONFIG_HOTPLUG_CPU
1437- unregister_cpu_notifier (& fcoe_cpu_notifier );
1438- #endif /* CONFIG_HOTPLUG_CPU */
14391334 fcoe_dev_cleanup ();
14401335
1441- /*
1442- * stop timer
1443- */
1336+ /* Stop the timer */
14441337 del_timer_sync (& fcoe_timer );
14451338
14461339 /* releases the associated fcoe transport for each lport */
0 commit comments