diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-09-14 13:54:12 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-09-14 13:54:12 -0400 |
| commit | 02c1be3d0c308c8a817bd3cc47fd75c843bf1a46 (patch) | |
| tree | ab381685a8d03590de2245f3cdc3bc5a117f0afd | |
| parent | 8ac19f0d90f7de0e78b08770ba2eabd29ad2cb9e (diff) | |
| parent | 3cc5ba1938eea0de372a41d1687c8030049c5e8f (diff) | |
Merge tag 'ntb-3.17' of git://github.com/jonmason/ntb
Pull ntb driver bugfixes from Jon Mason:
"NTB driver fixes for queue spread and buffer alignment. Also, update
to MAINTAINERS to reflect new e-mail address"
* tag 'ntb-3.17' of git://github.com/jonmason/ntb:
ntb: Add alignment check to meet hardware requirement
MAINTAINERS: update NTB info
NTB: correct the spread of queues over mw's
| -rw-r--r-- | MAINTAINERS | 3 | ||||
| -rw-r--r-- | drivers/ntb/ntb_transport.c | 17 |
2 files changed, 17 insertions, 3 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 97e92d9dc470..809ecd680d88 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -6424,7 +6424,8 @@ F: Documentation/scsi/NinjaSCSI.txt | |||
| 6424 | F: drivers/scsi/nsp32* | 6424 | F: drivers/scsi/nsp32* |
| 6425 | 6425 | ||
| 6426 | NTB DRIVER | 6426 | NTB DRIVER |
| 6427 | M: Jon Mason <jon.mason@intel.com> | 6427 | M: Jon Mason <jdmason@kudzu.us> |
| 6428 | M: Dave Jiang <dave.jiang@intel.com> | ||
| 6428 | S: Supported | 6429 | S: Supported |
| 6429 | W: https://github.com/jonmason/ntb/wiki | 6430 | W: https://github.com/jonmason/ntb/wiki |
| 6430 | T: git git://github.com/jonmason/ntb.git | 6431 | T: git git://github.com/jonmason/ntb.git |
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index 9dd63b822025..e9bf2f47b61a 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c | |||
| @@ -510,7 +510,7 @@ static void ntb_transport_setup_qp_mw(struct ntb_transport *nt, | |||
| 510 | 510 | ||
| 511 | WARN_ON(nt->mw[mw_num].virt_addr == NULL); | 511 | WARN_ON(nt->mw[mw_num].virt_addr == NULL); |
| 512 | 512 | ||
| 513 | if (nt->max_qps % mw_max && mw_num < nt->max_qps % mw_max) | 513 | if (nt->max_qps % mw_max && mw_num + 1 < nt->max_qps / mw_max) |
| 514 | num_qps_mw = nt->max_qps / mw_max + 1; | 514 | num_qps_mw = nt->max_qps / mw_max + 1; |
| 515 | else | 515 | else |
| 516 | num_qps_mw = nt->max_qps / mw_max; | 516 | num_qps_mw = nt->max_qps / mw_max; |
| @@ -576,6 +576,19 @@ static int ntb_set_mw(struct ntb_transport *nt, int num_mw, unsigned int size) | |||
| 576 | return -ENOMEM; | 576 | return -ENOMEM; |
| 577 | } | 577 | } |
| 578 | 578 | ||
| 579 | /* | ||
| 580 | * we must ensure that the memory address allocated is BAR size | ||
| 581 | * aligned in order for the XLAT register to take the value. This | ||
| 582 | * is a requirement of the hardware. It is recommended to setup CMA | ||
| 583 | * for BAR sizes equal or greater than 4MB. | ||
| 584 | */ | ||
| 585 | if (!IS_ALIGNED(mw->dma_addr, mw->size)) { | ||
| 586 | dev_err(&pdev->dev, "DMA memory %pad not aligned to BAR size\n", | ||
| 587 | &mw->dma_addr); | ||
| 588 | ntb_free_mw(nt, num_mw); | ||
| 589 | return -ENOMEM; | ||
| 590 | } | ||
| 591 | |||
| 579 | /* Notify HW the memory location of the receive buffer */ | 592 | /* Notify HW the memory location of the receive buffer */ |
| 580 | ntb_set_mw_addr(nt->ndev, num_mw, mw->dma_addr); | 593 | ntb_set_mw_addr(nt->ndev, num_mw, mw->dma_addr); |
| 581 | 594 | ||
| @@ -856,7 +869,7 @@ static int ntb_transport_init_queue(struct ntb_transport *nt, | |||
| 856 | qp->client_ready = NTB_LINK_DOWN; | 869 | qp->client_ready = NTB_LINK_DOWN; |
| 857 | qp->event_handler = NULL; | 870 | qp->event_handler = NULL; |
| 858 | 871 | ||
| 859 | if (nt->max_qps % mw_max && mw_num < nt->max_qps % mw_max) | 872 | if (nt->max_qps % mw_max && mw_num + 1 < nt->max_qps / mw_max) |
| 860 | num_qps_mw = nt->max_qps / mw_max + 1; | 873 | num_qps_mw = nt->max_qps / mw_max + 1; |
| 861 | else | 874 | else |
| 862 | num_qps_mw = nt->max_qps / mw_max; | 875 | num_qps_mw = nt->max_qps / mw_max; |
