* [PATCH 05/16] megaraid: clean up unnecessary MSI/MSI-X capability find
@ 2013-08-08 13:07 Yijing Wang
2013-08-16 6:10 ` Saxena, Sumit
0 siblings, 1 reply; 3+ messages in thread
From: Yijing Wang @ 2013-08-08 13:07 UTC (permalink / raw)
To: James E.J. Bottomley
Cc: Hanjun Guo, jiang.liu, Yijing Wang, Neela Syam Kolli, linux-scsi
PCI core will initialize device MSI/MSI-X capability in
pci_msi_init_pci_dev(). So device driver should use
pci_dev->msi_cap/msix_cap to determine whether the device
support MSI/MSI-X instead of using
pci_find_capability(pci_dev, PCI_CAP_ID_MSI/MSIX).
Access to PCIe device config space again will consume more time.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Cc: Neela Syam Kolli <megaraidlinux@lsi.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: linux-scsi@vger.kernel.org
---
drivers/scsi/megaraid/megaraid_sas_base.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 0177295..ad8fc44 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4072,21 +4072,20 @@ fail_set_dma_mask:
static int megasas_probe_one(struct pci_dev *pdev,
const struct pci_device_id *id)
{
- int rval, pos, i, j;
+ int rval, i, j;
struct Scsi_Host *host;
struct megasas_instance *instance;
u16 control = 0;
/* Reset MSI-X in the kdump kernel */
if (reset_devices) {
- pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
- if (pos) {
- pci_read_config_word(pdev, pos + PCI_MSIX_FLAGS,
+ if (pdev->msix_cap) {
+ pci_read_config_word(pdev, pdev->msix_cap + PCI_MSIX_FLAGS,
&control);
if (control & PCI_MSIX_FLAGS_ENABLE) {
dev_info(&pdev->dev, "resetting MSI-X\n");
pci_write_config_word(pdev,
- pos + PCI_MSIX_FLAGS,
+ pdev->msix_cap + PCI_MSIX_FLAGS,
control &
~PCI_MSIX_FLAGS_ENABLE);
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [PATCH 05/16] megaraid: clean up unnecessary MSI/MSI-X capability find
2013-08-08 13:07 [PATCH 05/16] megaraid: clean up unnecessary MSI/MSI-X capability find Yijing Wang
@ 2013-08-16 6:10 ` Saxena, Sumit
2013-08-26 1:40 ` Yijing Wang
0 siblings, 1 reply; 3+ messages in thread
From: Saxena, Sumit @ 2013-08-16 6:10 UTC (permalink / raw)
To: Yijing Wang, James E.J. Bottomley
Cc: Hanjun Guo, jiang.liu@huawei.com, DL-MegaRAID Linux,
linux-scsi@vger.kernel.org
>-----Original Message-----
>From: Yijing Wang [mailto:wangyijing@huawei.com]
>Sent: Thursday, August 08, 2013 6:38 PM
>To: James E.J. Bottomley
>Cc: Hanjun Guo; jiang.liu@huawei.com; Yijing Wang; DL-MegaRAID Linux;
>linux-scsi@vger.kernel.org
>Subject: [PATCH 05/16] megaraid: clean up unnecessary MSI/MSI-X
>capability find
>
>PCI core will initialize device MSI/MSI-X capability in
>pci_msi_init_pci_dev(). So device driver should use pci_dev-
>>msi_cap/msix_cap to determine whether the device support MSI/MSI-X
>instead of using pci_find_capability(pci_dev, PCI_CAP_ID_MSI/MSIX).
>Access to PCIe device config space again will consume more time.
>
>Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>Cc: Neela Syam Kolli <megaraidlinux@lsi.com>
>Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
>Cc: linux-scsi@vger.kernel.org
>---
> drivers/scsi/megaraid/megaraid_sas_base.c | 9 ++++-----
> 1 files changed, 4 insertions(+), 5 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index 0177295..ad8fc44 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -4072,21 +4072,20 @@ fail_set_dma_mask:
> static int megasas_probe_one(struct pci_dev *pdev,
> const struct pci_device_id *id) {
>- int rval, pos, i, j;
>+ int rval, i, j;
> struct Scsi_Host *host;
> struct megasas_instance *instance;
> u16 control = 0;
>
> /* Reset MSI-X in the kdump kernel */
> if (reset_devices) {
>- pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
>- if (pos) {
>- pci_read_config_word(pdev, pos + PCI_MSIX_FLAGS,
>+ if (pdev->msix_cap) {
>+ pci_read_config_word(pdev, pdev->msix_cap +
>PCI_MSIX_FLAGS,
> &control);
> if (control & PCI_MSIX_FLAGS_ENABLE) {
> dev_info(&pdev->dev, "resetting MSI-X\n");
> pci_write_config_word(pdev,
>- pos + PCI_MSIX_FLAGS,
>+ pdev->msix_cap +
>PCI_MSIX_FLAGS,
> control &
> ~PCI_MSIX_FLAGS_ENABLE);
> }
>--
>1.7.1
>
>
Acked-by: Sumit Saxena <sumit.saxena@lsi.com>
Sumit
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 05/16] megaraid: clean up unnecessary MSI/MSI-X capability find
2013-08-16 6:10 ` Saxena, Sumit
@ 2013-08-26 1:40 ` Yijing Wang
0 siblings, 0 replies; 3+ messages in thread
From: Yijing Wang @ 2013-08-26 1:40 UTC (permalink / raw)
To: James E.J. Bottomley
Cc: Saxena, Sumit, DL-MegaRAID Linux, linux-scsi@vger.kernel.org
>> PCI_MSIX_FLAGS,
>> control &
>> ~PCI_MSIX_FLAGS_ENABLE);
>> }
>> --
>> 1.7.1
>>
>>
> Acked-by: Sumit Saxena <sumit.saxena@lsi.com>
Hi James,
Can you merge this patch?
Thanks!
Yijing.
>
>
--
Thanks!
Yijing
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-26 1:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-08 13:07 [PATCH 05/16] megaraid: clean up unnecessary MSI/MSI-X capability find Yijing Wang
2013-08-16 6:10 ` Saxena, Sumit
2013-08-26 1:40 ` Yijing Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox