* [dpdk-dev] [PATCH v2] bus/pci: use device driver name instead of handler type
@ 2018-10-25 10:49 Alejandro Lucero
2018-10-26 14:03 ` Burakov, Anatoly
0 siblings, 1 reply; 4+ messages in thread
From: Alejandro Lucero @ 2018-10-25 10:49 UTC (permalink / raw)
To: dev
Invoking the right pci read/write functions is based on interrupt
handler type. However, this is not configured for secondary processes
precluding to use those functions.
This patch fixes the issue using the driver name the device is bound
to instead.
Fixes: 632b2d1deeed ("eal: provide functions to access PCI config")
v2:
- Use #ifdef for VFIO functions
Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
drivers/bus/pci/linux/pci.c | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 5cf78d7..59a2086 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -673,23 +673,21 @@ enum rte_iova_mode
int rte_pci_read_config(const struct rte_pci_device *device,
void *buf, size_t len, off_t offset)
{
+ char devname[RTE_DEV_NAME_MAX_LEN] = {0};
const struct rte_intr_handle *intr_handle = &device->intr_handle;
- switch (intr_handle->type) {
- case RTE_INTR_HANDLE_UIO:
- case RTE_INTR_HANDLE_UIO_INTX:
+ switch (device->kdrv) {
+ case RTE_KDRV_IGB_UIO:
return pci_uio_read_config(intr_handle, buf, len, offset);
-
#ifdef VFIO_PRESENT
- case RTE_INTR_HANDLE_VFIO_MSIX:
- case RTE_INTR_HANDLE_VFIO_MSI:
- case RTE_INTR_HANDLE_VFIO_LEGACY:
+ case RTE_KDRV_VFIO:
return pci_vfio_read_config(intr_handle, buf, len, offset);
#endif
default:
+ rte_pci_device_name(&device->addr, devname,
+ RTE_DEV_NAME_MAX_LEN);
RTE_LOG(ERR, EAL,
- "Unknown handle type of fd %d\n",
- intr_handle->fd);
+ "Unknown driver type for %s\n", devname);
return -1;
}
}
@@ -698,23 +696,21 @@ int rte_pci_read_config(const struct rte_pci_device *device,
int rte_pci_write_config(const struct rte_pci_device *device,
const void *buf, size_t len, off_t offset)
{
+ char devname[RTE_DEV_NAME_MAX_LEN] = {0};
const struct rte_intr_handle *intr_handle = &device->intr_handle;
- switch (intr_handle->type) {
- case RTE_INTR_HANDLE_UIO:
- case RTE_INTR_HANDLE_UIO_INTX:
+ switch (device->kdrv) {
+ case RTE_KDRV_IGB_UIO:
return pci_uio_write_config(intr_handle, buf, len, offset);
-
#ifdef VFIO_PRESENT
- case RTE_INTR_HANDLE_VFIO_MSIX:
- case RTE_INTR_HANDLE_VFIO_MSI:
- case RTE_INTR_HANDLE_VFIO_LEGACY:
+ case RTE_KDRV_VFIO:
return pci_vfio_write_config(intr_handle, buf, len, offset);
#endif
default:
+ rte_pci_device_name(&device->addr, devname,
+ RTE_DEV_NAME_MAX_LEN);
RTE_LOG(ERR, EAL,
- "Unknown handle type of fd %d\n",
- intr_handle->fd);
+ "Unknown driver type for %s\n", devname);
return -1;
}
}
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] bus/pci: use device driver name instead of handler type
2018-10-25 10:49 [dpdk-dev] [PATCH v2] bus/pci: use device driver name instead of handler type Alejandro Lucero
@ 2018-10-26 14:03 ` Burakov, Anatoly
2018-10-29 0:05 ` Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Burakov, Anatoly @ 2018-10-26 14:03 UTC (permalink / raw)
To: Alejandro Lucero, dev
On 25-Oct-18 11:49 AM, Alejandro Lucero wrote:
> Invoking the right pci read/write functions is based on interrupt
> handler type. However, this is not configured for secondary processes
> precluding to use those functions.
>
> This patch fixes the issue using the driver name the device is bound
> to instead.
>
> Fixes: 632b2d1deeed ("eal: provide functions to access PCI config")
>
> v2:
> - Use #ifdef for VFIO functions
>
> Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
> ---
> drivers/bus/pci/linux/pci.c | 32 ++++++++++++++------------------
> 1 file changed, 14 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
> index 5cf78d7..59a2086 100644
> --- a/drivers/bus/pci/linux/pci.c
> +++ b/drivers/bus/pci/linux/pci.c
> @@ -673,23 +673,21 @@ enum rte_iova_mode
> int rte_pci_read_config(const struct rte_pci_device *device,
> void *buf, size_t len, off_t offset)
> {
> + char devname[RTE_DEV_NAME_MAX_LEN] = {0};
Probably "" instead of {0} is better. Same in other case.
Otherwise, LGTM
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> const struct rte_intr_handle *intr_handle = &device->intr_handle;
>
> - switch (intr_handle->type) {
> - case RTE_INTR_HANDLE_UIO:
> - case RTE_INTR_HANDLE_UIO_INTX:
> + switch (device->kdrv) {
> + case RTE_KDRV_IGB_UIO:
> return pci_uio_read_config(intr_handle, buf, len, offset);
> -
> #ifdef VFIO_PRESENT
> - case RTE_INTR_HANDLE_VFIO_MSIX:
> - case RTE_INTR_HANDLE_VFIO_MSI:
> - case RTE_INTR_HANDLE_VFIO_LEGACY:
> + case RTE_KDRV_VFIO:
> return pci_vfio_read_config(intr_handle, buf, len, offset);
> #endif
> default:
> + rte_pci_device_name(&device->addr, devname,
> + RTE_DEV_NAME_MAX_LEN);
> RTE_LOG(ERR, EAL,
> - "Unknown handle type of fd %d\n",
> - intr_handle->fd);
> + "Unknown driver type for %s\n", devname);
> return -1;
> }
> }
> @@ -698,23 +696,21 @@ int rte_pci_read_config(const struct rte_pci_device *device,
> int rte_pci_write_config(const struct rte_pci_device *device,
> const void *buf, size_t len, off_t offset)
> {
> + char devname[RTE_DEV_NAME_MAX_LEN] = {0};
> const struct rte_intr_handle *intr_handle = &device->intr_handle;
>
> - switch (intr_handle->type) {
> - case RTE_INTR_HANDLE_UIO:
> - case RTE_INTR_HANDLE_UIO_INTX:
> + switch (device->kdrv) {
> + case RTE_KDRV_IGB_UIO:
> return pci_uio_write_config(intr_handle, buf, len, offset);
> -
> #ifdef VFIO_PRESENT
> - case RTE_INTR_HANDLE_VFIO_MSIX:
> - case RTE_INTR_HANDLE_VFIO_MSI:
> - case RTE_INTR_HANDLE_VFIO_LEGACY:
> + case RTE_KDRV_VFIO:
> return pci_vfio_write_config(intr_handle, buf, len, offset);
> #endif
> default:
> + rte_pci_device_name(&device->addr, devname,
> + RTE_DEV_NAME_MAX_LEN);
> RTE_LOG(ERR, EAL,
> - "Unknown handle type of fd %d\n",
> - intr_handle->fd);
> + "Unknown driver type for %s\n", devname);
> return -1;
> }
> }
>
--
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] bus/pci: use device driver name instead of handler type
2018-10-26 14:03 ` Burakov, Anatoly
@ 2018-10-29 0:05 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2018-10-29 0:05 UTC (permalink / raw)
To: Alejandro Lucero; +Cc: dev, Burakov, Anatoly
26/10/2018 16:03, Burakov, Anatoly:
> On 25-Oct-18 11:49 AM, Alejandro Lucero wrote:
> > Invoking the right pci read/write functions is based on interrupt
> > handler type. However, this is not configured for secondary processes
> > precluding to use those functions.
> >
> > This patch fixes the issue using the driver name the device is bound
> > to instead.
> >
> > Fixes: 632b2d1deeed ("eal: provide functions to access PCI config")
> >
> > v2:
> > - Use #ifdef for VFIO functions
> >
> > Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
> > ---
> > drivers/bus/pci/linux/pci.c | 32 ++++++++++++++------------------
> > 1 file changed, 14 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
> > index 5cf78d7..59a2086 100644
> > --- a/drivers/bus/pci/linux/pci.c
> > +++ b/drivers/bus/pci/linux/pci.c
> > @@ -673,23 +673,21 @@ enum rte_iova_mode
> > int rte_pci_read_config(const struct rte_pci_device *device,
> > void *buf, size_t len, off_t offset)
> > {
> > + char devname[RTE_DEV_NAME_MAX_LEN] = {0};
>
> Probably "" instead of {0} is better. Same in other case.
>
> Otherwise, LGTM
>
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Applied with above change, thanks.
Title fixed: bus/pci: compare kernel driver instead of interrupt handler
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH v2] bus/pci: use device driver name instead of handler type
@ 2018-10-25 10:48 Alejandro Lucero
0 siblings, 0 replies; 4+ messages in thread
From: Alejandro Lucero @ 2018-10-25 10:48 UTC (permalink / raw)
To: dev
Invoking the right pci read/write functions is based on interrupt
handler type. However, this is not configured for secondary processes
precluding to use those functions.
This patch fixes the issue using the driver name the device is bound
to instead.
Fixes: 632b2d1deeed ("eal: provide functions to access PCI config")
v2:
- Use #ifdef for VFIO functions
Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
drivers/bus/pci/linux/pci.c | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 145cb1091..952c92cfe 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -673,23 +673,21 @@ rte_pci_get_iommu_class(void)
int rte_pci_read_config(const struct rte_pci_device *device,
void *buf, size_t len, off_t offset)
{
+ char devname[RTE_DEV_NAME_MAX_LEN] = {0};
const struct rte_intr_handle *intr_handle = &device->intr_handle;
- switch (intr_handle->type) {
- case RTE_INTR_HANDLE_UIO:
- case RTE_INTR_HANDLE_UIO_INTX:
+ switch (device->kdrv) {
+ case RTE_KDRV_IGB_UIO:
return pci_uio_read_config(intr_handle, buf, len, offset);
-
#ifdef VFIO_PRESENT
- case RTE_INTR_HANDLE_VFIO_MSIX:
- case RTE_INTR_HANDLE_VFIO_MSI:
- case RTE_INTR_HANDLE_VFIO_LEGACY:
+ case RTE_KDRV_VFIO:
return pci_vfio_read_config(intr_handle, buf, len, offset);
#endif
default:
+ rte_pci_device_name(&device->addr, devname,
+ RTE_DEV_NAME_MAX_LEN);
RTE_LOG(ERR, EAL,
- "Unknown handle type of fd %d\n",
- intr_handle->fd);
+ "Unknown driver type for %s\n", devname);
return -1;
}
}
@@ -698,23 +696,21 @@ int rte_pci_read_config(const struct rte_pci_device *device,
int rte_pci_write_config(const struct rte_pci_device *device,
const void *buf, size_t len, off_t offset)
{
+ char devname[RTE_DEV_NAME_MAX_LEN] = {0};
const struct rte_intr_handle *intr_handle = &device->intr_handle;
- switch (intr_handle->type) {
- case RTE_INTR_HANDLE_UIO:
- case RTE_INTR_HANDLE_UIO_INTX:
+ switch (device->kdrv) {
+ case RTE_KDRV_IGB_UIO:
return pci_uio_write_config(intr_handle, buf, len, offset);
-
#ifdef VFIO_PRESENT
- case RTE_INTR_HANDLE_VFIO_MSIX:
- case RTE_INTR_HANDLE_VFIO_MSI:
- case RTE_INTR_HANDLE_VFIO_LEGACY:
+ case RTE_KDRV_VFIO:
return pci_vfio_write_config(intr_handle, buf, len, offset);
#endif
default:
+ rte_pci_device_name(&device->addr, devname,
+ RTE_DEV_NAME_MAX_LEN);
RTE_LOG(ERR, EAL,
- "Unknown handle type of fd %d\n",
- intr_handle->fd);
+ "Unknown driver type for %s\n", devname);
return -1;
}
}
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-29 0:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-25 10:49 [dpdk-dev] [PATCH v2] bus/pci: use device driver name instead of handler type Alejandro Lucero
2018-10-26 14:03 ` Burakov, Anatoly
2018-10-29 0:05 ` Thomas Monjalon
-- strict thread matches above, loose matches on Subject: below --
2018-10-25 10:48 Alejandro Lucero
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).