aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_eeprom.c10
-rw-r--r--drivers/infiniband/hw/ipath/ipath_intr.c18
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ruc.c14
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c4
4 files changed, 29 insertions, 17 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_eeprom.c b/drivers/infiniband/hw/ipath/ipath_eeprom.c
index bcfa3ccb555f..e7c25dbbcdc9 100644
--- a/drivers/infiniband/hw/ipath/ipath_eeprom.c
+++ b/drivers/infiniband/hw/ipath/ipath_eeprom.c
@@ -538,7 +538,15 @@ static u8 flash_csum(struct ipath_flash *ifp, int adjust)
538 u8 *ip = (u8 *) ifp; 538 u8 *ip = (u8 *) ifp;
539 u8 csum = 0, len; 539 u8 csum = 0, len;
540 540
541 for (len = 0; len < ifp->if_length; len++) 541 /*
542 * Limit length checksummed to max length of actual data.
543 * Checksum of erased eeprom will still be bad, but we avoid
544 * reading past the end of the buffer we were passed.
545 */
546 len = ifp->if_length;
547 if (len > sizeof(struct ipath_flash))
548 len = sizeof(struct ipath_flash);
549 while (len--)
542 csum += *ip++; 550 csum += *ip++;
543 csum -= ifp->if_csum; 551 csum -= ifp->if_csum;
544 csum = ~csum; 552 csum = ~csum;
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c
index 6a5dd5cd773d..c61f9da2964a 100644
--- a/drivers/infiniband/hw/ipath/ipath_intr.c
+++ b/drivers/infiniband/hw/ipath/ipath_intr.c
@@ -453,7 +453,7 @@ skip_ibchange:
453} 453}
454 454
455static void handle_supp_msgs(struct ipath_devdata *dd, 455static void handle_supp_msgs(struct ipath_devdata *dd,
456 unsigned supp_msgs, char msg[512]) 456 unsigned supp_msgs, char *msg, int msgsz)
457{ 457{
458 /* 458 /*
459 * Print the message unless it's ibc status change only, which 459 * Print the message unless it's ibc status change only, which
@@ -461,9 +461,9 @@ static void handle_supp_msgs(struct ipath_devdata *dd,
461 */ 461 */
462 if (dd->ipath_lasterror & ~INFINIPATH_E_IBSTATUSCHANGED) { 462 if (dd->ipath_lasterror & ~INFINIPATH_E_IBSTATUSCHANGED) {
463 int iserr; 463 int iserr;
464 iserr = ipath_decode_err(msg, sizeof msg, 464 iserr = ipath_decode_err(msg, msgsz,
465 dd->ipath_lasterror & 465 dd->ipath_lasterror &
466 ~INFINIPATH_E_IBSTATUSCHANGED); 466 ~INFINIPATH_E_IBSTATUSCHANGED);
467 if (dd->ipath_lasterror & 467 if (dd->ipath_lasterror &
468 ~(INFINIPATH_E_RRCVEGRFULL | 468 ~(INFINIPATH_E_RRCVEGRFULL |
469 INFINIPATH_E_RRCVHDRFULL | INFINIPATH_E_PKTERRS)) 469 INFINIPATH_E_RRCVHDRFULL | INFINIPATH_E_PKTERRS))
@@ -492,8 +492,8 @@ static void handle_supp_msgs(struct ipath_devdata *dd,
492} 492}
493 493
494static unsigned handle_frequent_errors(struct ipath_devdata *dd, 494static unsigned handle_frequent_errors(struct ipath_devdata *dd,
495 ipath_err_t errs, char msg[512], 495 ipath_err_t errs, char *msg,
496 int *noprint) 496 int msgsz, int *noprint)
497{ 497{
498 unsigned long nc; 498 unsigned long nc;
499 static unsigned long nextmsg_time; 499 static unsigned long nextmsg_time;
@@ -512,7 +512,7 @@ static unsigned handle_frequent_errors(struct ipath_devdata *dd,
512 nextmsg_time = nc + HZ * 3; 512 nextmsg_time = nc + HZ * 3;
513 } 513 }
514 else if (supp_msgs) { 514 else if (supp_msgs) {
515 handle_supp_msgs(dd, supp_msgs, msg); 515 handle_supp_msgs(dd, supp_msgs, msg, msgsz);
516 supp_msgs = 0; 516 supp_msgs = 0;
517 nmsgs = 0; 517 nmsgs = 0;
518 } 518 }
@@ -525,14 +525,14 @@ static unsigned handle_frequent_errors(struct ipath_devdata *dd,
525 525
526static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs) 526static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
527{ 527{
528 char msg[512]; 528 char msg[128];
529 u64 ignore_this_time = 0; 529 u64 ignore_this_time = 0;
530 int i, iserr = 0; 530 int i, iserr = 0;
531 int chkerrpkts = 0, noprint = 0; 531 int chkerrpkts = 0, noprint = 0;
532 unsigned supp_msgs; 532 unsigned supp_msgs;
533 int log_idx; 533 int log_idx;
534 534
535 supp_msgs = handle_frequent_errors(dd, errs, msg, &noprint); 535 supp_msgs = handle_frequent_errors(dd, errs, msg, sizeof msg, &noprint);
536 536
537 /* don't report errors that are masked */ 537 /* don't report errors that are masked */
538 errs &= ~dd->ipath_maskederrs; 538 errs &= ~dd->ipath_maskederrs;
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c
index 4b6b7ee8e5c1..54c61a972de2 100644
--- a/drivers/infiniband/hw/ipath/ipath_ruc.c
+++ b/drivers/infiniband/hw/ipath/ipath_ruc.c
@@ -630,11 +630,8 @@ bail:;
630void ipath_send_complete(struct ipath_qp *qp, struct ipath_swqe *wqe, 630void ipath_send_complete(struct ipath_qp *qp, struct ipath_swqe *wqe,
631 enum ib_wc_status status) 631 enum ib_wc_status status)
632{ 632{
633 u32 last = qp->s_last; 633 unsigned long flags;
634 634 u32 last;
635 if (++last == qp->s_size)
636 last = 0;
637 qp->s_last = last;
638 635
639 /* See ch. 11.2.4.1 and 10.7.3.1 */ 636 /* See ch. 11.2.4.1 and 10.7.3.1 */
640 if (!(qp->s_flags & IPATH_S_SIGNAL_REQ_WR) || 637 if (!(qp->s_flags & IPATH_S_SIGNAL_REQ_WR) ||
@@ -658,4 +655,11 @@ void ipath_send_complete(struct ipath_qp *qp, struct ipath_swqe *wqe,
658 wc.port_num = 0; 655 wc.port_num = 0;
659 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 0); 656 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 0);
660 } 657 }
658
659 spin_lock_irqsave(&qp->s_lock, flags);
660 last = qp->s_last;
661 if (++last >= qp->s_size)
662 last = 0;
663 qp->s_last = last;
664 spin_unlock_irqrestore(&qp->s_lock, flags);
661} 665}
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 6b3322486b5e..8cba9c532e64 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1282,7 +1282,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1282 int size; 1282 int size;
1283 int i; 1283 int i;
1284 1284
1285 spin_lock_irqsave(&qp->rq.lock, flags); 1285 spin_lock_irqsave(&qp->sq.lock, flags);
1286 1286
1287 ind = qp->sq.head; 1287 ind = qp->sq.head;
1288 1288
@@ -1448,7 +1448,7 @@ out:
1448 (qp->sq.wqe_cnt - 1)); 1448 (qp->sq.wqe_cnt - 1));
1449 } 1449 }
1450 1450
1451 spin_unlock_irqrestore(&qp->rq.lock, flags); 1451 spin_unlock_irqrestore(&qp->sq.lock, flags);
1452 1452
1453 return err; 1453 return err;
1454} 1454}