Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB/qib: Convert qp_stats debugfs interface to use new iterator API

Continue porting copy/paste code into rdmavt from qib.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>

authored by

Mike Marciniszyn and committed by
Doug Ledford
557fafe1 e5c197ac

+16 -63
+7 -11
drivers/infiniband/hw/qib/qib_debugfs.c
··· 1 - #ifdef CONFIG_DEBUG_FS 2 1 /* 3 - * Copyright (c) 2013 Intel Corporation. All rights reserved. 2 + * Copyright (c) 2013 - 2017 Intel Corporation. All rights reserved. 4 3 * 5 4 * This software is available to you under a choice of one of two 6 5 * licenses. You may choose to be licensed under the terms of the GNU ··· 190 191 static void *_qp_stats_seq_start(struct seq_file *s, loff_t *pos) 191 192 __acquires(RCU) 192 193 { 193 - struct qib_qp_iter *iter; 194 + struct rvt_qp_iter *iter; 194 195 loff_t n = *pos; 195 196 196 - iter = qib_qp_iter_init(s->private); 197 + iter = rvt_qp_iter_init(s->private, 0, NULL); 197 198 198 199 /* stop calls rcu_read_unlock */ 199 200 rcu_read_lock(); ··· 202 203 return NULL; 203 204 204 205 do { 205 - if (qib_qp_iter_next(iter)) { 206 + if (rvt_qp_iter_next(iter)) { 206 207 kfree(iter); 207 208 return NULL; 208 209 } ··· 215 216 loff_t *pos) 216 217 __must_hold(RCU) 217 218 { 218 - struct qib_qp_iter *iter = iter_ptr; 219 + struct rvt_qp_iter *iter = iter_ptr; 219 220 220 221 (*pos)++; 221 222 222 - if (qib_qp_iter_next(iter)) { 223 + if (rvt_qp_iter_next(iter)) { 223 224 kfree(iter); 224 225 return NULL; 225 226 } ··· 235 236 236 237 static int _qp_stats_seq_show(struct seq_file *s, void *iter_ptr) 237 238 { 238 - struct qib_qp_iter *iter = iter_ptr; 239 + struct rvt_qp_iter *iter = iter_ptr; 239 240 240 241 if (!iter) 241 242 return 0; ··· 283 284 debugfs_remove_recursive(qib_dbg_root); 284 285 qib_dbg_root = NULL; 285 286 } 286 - 287 - #endif 288 -
+7 -44
drivers/infiniband/hw/qib/qib_qp.c
··· 1 1 /* 2 - * Copyright (c) 2012, 2013 Intel Corporation. All rights reserved. 2 + * Copyright (c) 2012 - 2017 Intel Corporation. All rights reserved. 3 3 * Copyright (c) 2006 - 2012 QLogic Corporation. * All rights reserved. 4 4 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 5 5 * ··· 415 415 416 416 #ifdef CONFIG_DEBUG_FS 417 417 418 - struct qib_qp_iter { 419 - struct qib_ibdev *dev; 420 - struct rvt_qp *qp; 421 - int n; 422 - }; 423 - 424 - struct qib_qp_iter *qib_qp_iter_init(struct qib_ibdev *dev) 425 - { 426 - struct qib_qp_iter *iter; 427 - 428 - iter = kzalloc(sizeof(*iter), GFP_KERNEL); 429 - if (!iter) 430 - return NULL; 431 - 432 - iter->dev = dev; 433 - 434 - return iter; 435 - } 436 - 437 - int qib_qp_iter_next(struct qib_qp_iter *iter) 438 - { 439 - struct qib_ibdev *dev = iter->dev; 440 - int n = iter->n; 441 - int ret = 1; 442 - struct rvt_qp *pqp = iter->qp; 443 - struct rvt_qp *qp; 444 - 445 - for (; n < dev->rdi.qp_dev->qp_table_size; n++) { 446 - if (pqp) 447 - qp = rcu_dereference(pqp->next); 448 - else 449 - qp = rcu_dereference(dev->rdi.qp_dev->qp_table[n]); 450 - pqp = qp; 451 - if (qp) { 452 - iter->qp = qp; 453 - iter->n = n; 454 - return 0; 455 - } 456 - } 457 - return ret; 458 - } 459 - 460 418 static const char * const qp_type_str[] = { 461 419 "SMI", "GSI", "RC", "UC", "UD", 462 420 }; 463 421 464 - void qib_qp_iter_print(struct seq_file *s, struct qib_qp_iter *iter) 422 + /** 423 + * qib_qp_iter_print - print information to seq_file 424 + * @s - the seq_file 425 + * @iter - the iterator 426 + */ 427 + void qib_qp_iter_print(struct seq_file *s, struct rvt_qp_iter *iter) 465 428 { 466 429 struct rvt_swqe *wqe; 467 430 struct rvt_qp *qp = iter->qp;
+2 -8
drivers/infiniband/hw/qib/qib_verbs.h
··· 1 1 /* 2 - * Copyright (c) 2012, 2013 Intel Corporation. All rights reserved. 2 + * Copyright (c) 2012 - 2017 Intel Corporation. All rights reserved. 3 3 * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. 4 4 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 5 5 * ··· 282 282 void qib_restart_rc(struct rvt_qp *qp, u32 psn, int wait); 283 283 #ifdef CONFIG_DEBUG_FS 284 284 285 - struct qib_qp_iter; 286 - 287 - struct qib_qp_iter *qib_qp_iter_init(struct qib_ibdev *dev); 288 - 289 - int qib_qp_iter_next(struct qib_qp_iter *iter); 290 - 291 - void qib_qp_iter_print(struct seq_file *s, struct qib_qp_iter *iter); 285 + void qib_qp_iter_print(struct seq_file *s, struct rvt_qp_iter *iter); 292 286 293 287 #endif 294 288