diff options
author | Mike Marciniszyn <mike.marciniszyn@intel.com> | 2014-03-07 08:40:55 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-03-17 19:16:51 -0400 |
commit | 7d7632add8dd99f68b21546efff08a5a162de184 (patch) | |
tree | 297e7ae3fd16e09386fefa6687281c53b3ca5549 /drivers/infiniband/hw/qib/qib_init.c | |
parent | 1ed88dd7d0b361e677b2690f573e5c274bb25c87 (diff) |
IB/qib: Modify software pma counters to use percpu variables
The counters, unicast_xmit, unicast_rcv, multicast_xmit, multicast_rcv
are now maintained as percpu variables.
The mad code is modified to add a z_ latch so that the percpu counters
monotonically increase with appropriate adjustments in the reset,
read logic to maintain the z_ latch.
This patch also corrects the fact the unitcast_xmit wasn't handled
at all for UC and RC QPs.
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw/qib/qib_init.c')
-rw-r--r-- | drivers/infiniband/hw/qib/qib_init.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c index 6d2629990cb3..7fbf466704ab 100644 --- a/drivers/infiniband/hw/qib/qib_init.c +++ b/drivers/infiniband/hw/qib/qib_init.c | |||
@@ -233,7 +233,7 @@ struct qib_ctxtdata *qib_create_ctxtdata(struct qib_pportdata *ppd, u32 ctxt, | |||
233 | /* | 233 | /* |
234 | * Common code for initializing the physical port structure. | 234 | * Common code for initializing the physical port structure. |
235 | */ | 235 | */ |
236 | void qib_init_pportdata(struct qib_pportdata *ppd, struct qib_devdata *dd, | 236 | int qib_init_pportdata(struct qib_pportdata *ppd, struct qib_devdata *dd, |
237 | u8 hw_pidx, u8 port) | 237 | u8 hw_pidx, u8 port) |
238 | { | 238 | { |
239 | int size; | 239 | int size; |
@@ -243,6 +243,7 @@ void qib_init_pportdata(struct qib_pportdata *ppd, struct qib_devdata *dd, | |||
243 | 243 | ||
244 | spin_lock_init(&ppd->sdma_lock); | 244 | spin_lock_init(&ppd->sdma_lock); |
245 | spin_lock_init(&ppd->lflags_lock); | 245 | spin_lock_init(&ppd->lflags_lock); |
246 | spin_lock_init(&ppd->cc_shadow_lock); | ||
246 | init_waitqueue_head(&ppd->state_wait); | 247 | init_waitqueue_head(&ppd->state_wait); |
247 | 248 | ||
248 | init_timer(&ppd->symerr_clear_timer); | 249 | init_timer(&ppd->symerr_clear_timer); |
@@ -250,8 +251,10 @@ void qib_init_pportdata(struct qib_pportdata *ppd, struct qib_devdata *dd, | |||
250 | ppd->symerr_clear_timer.data = (unsigned long)ppd; | 251 | ppd->symerr_clear_timer.data = (unsigned long)ppd; |
251 | 252 | ||
252 | ppd->qib_wq = NULL; | 253 | ppd->qib_wq = NULL; |
253 | 254 | ppd->ibport_data.pmastats = | |
254 | spin_lock_init(&ppd->cc_shadow_lock); | 255 | alloc_percpu(struct qib_pma_counters); |
256 | if (!ppd->ibport_data.pmastats) | ||
257 | return -ENOMEM; | ||
255 | 258 | ||
256 | if (qib_cc_table_size < IB_CCT_MIN_ENTRIES) | 259 | if (qib_cc_table_size < IB_CCT_MIN_ENTRIES) |
257 | goto bail; | 260 | goto bail; |
@@ -299,7 +302,7 @@ void qib_init_pportdata(struct qib_pportdata *ppd, struct qib_devdata *dd, | |||
299 | goto bail_3; | 302 | goto bail_3; |
300 | } | 303 | } |
301 | 304 | ||
302 | return; | 305 | return 0; |
303 | 306 | ||
304 | bail_3: | 307 | bail_3: |
305 | kfree(ppd->ccti_entries_shadow); | 308 | kfree(ppd->ccti_entries_shadow); |
@@ -313,7 +316,7 @@ bail_1: | |||
313 | bail: | 316 | bail: |
314 | /* User is intentionally disabling the congestion control agent */ | 317 | /* User is intentionally disabling the congestion control agent */ |
315 | if (!qib_cc_table_size) | 318 | if (!qib_cc_table_size) |
316 | return; | 319 | return 0; |
317 | 320 | ||
318 | if (qib_cc_table_size < IB_CCT_MIN_ENTRIES) { | 321 | if (qib_cc_table_size < IB_CCT_MIN_ENTRIES) { |
319 | qib_cc_table_size = 0; | 322 | qib_cc_table_size = 0; |
@@ -324,7 +327,7 @@ bail: | |||
324 | 327 | ||
325 | qib_dev_err(dd, "Congestion Control Agent disabled for port %d\n", | 328 | qib_dev_err(dd, "Congestion Control Agent disabled for port %d\n", |
326 | port); | 329 | port); |
327 | return; | 330 | return 0; |
328 | } | 331 | } |
329 | 332 | ||
330 | static int init_pioavailregs(struct qib_devdata *dd) | 333 | static int init_pioavailregs(struct qib_devdata *dd) |
@@ -635,6 +638,12 @@ wq_error: | |||
635 | return -ENOMEM; | 638 | return -ENOMEM; |
636 | } | 639 | } |
637 | 640 | ||
641 | static void qib_free_pportdata(struct qib_pportdata *ppd) | ||
642 | { | ||
643 | free_percpu(ppd->ibport_data.pmastats); | ||
644 | ppd->ibport_data.pmastats = NULL; | ||
645 | } | ||
646 | |||
638 | /** | 647 | /** |
639 | * qib_init - do the actual initialization sequence on the chip | 648 | * qib_init - do the actual initialization sequence on the chip |
640 | * @dd: the qlogic_ib device | 649 | * @dd: the qlogic_ib device |
@@ -922,6 +931,7 @@ static void qib_shutdown_device(struct qib_devdata *dd) | |||
922 | destroy_workqueue(ppd->qib_wq); | 931 | destroy_workqueue(ppd->qib_wq); |
923 | ppd->qib_wq = NULL; | 932 | ppd->qib_wq = NULL; |
924 | } | 933 | } |
934 | qib_free_pportdata(ppd); | ||
925 | } | 935 | } |
926 | 936 | ||
927 | qib_update_eeprom_log(dd); | 937 | qib_update_eeprom_log(dd); |