[v2,3/4] pci: add req handler field to generic pci device

Message ID 1538316988-128382-4-git-send-email-jia.guo@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Enable hotplug in vfio |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Guo, Jia Sept. 30, 2018, 2:16 p.m. UTC
  There are some extended interrupt types in vfio pci device except from the
existing interrupts, such as err and req notifier, they could be useful for
device error monitoring. And these corresponding interrupt handler is
different from the other interrupt handler that register in PMDs, so a new
interrupt handler should be added. This patch will add specific req handler
in generic pci device.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
v2->v1:
no change
---
 drivers/bus/pci/rte_bus_pci.h | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Andrew Rybchenko Oct. 1, 2018, 9:46 a.m. UTC | #1
On 9/30/18 5:16 PM, Jeff Guo wrote:
> There are some extended interrupt types in vfio pci device except from the
> existing interrupts, such as err and req notifier, they could be useful for
> device error monitoring. And these corresponding interrupt handler is
> different from the other interrupt handler that register in PMDs, so a new
> interrupt handler should be added. This patch will add specific req handler
> in generic pci device.
>
> Signed-off-by: Jeff Guo <jia.guo@intel.com>
> ---
> v2->v1:
> no change
> ---
>   drivers/bus/pci/rte_bus_pci.h | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
> index 0d1955f..c45a820 100644
> --- a/drivers/bus/pci/rte_bus_pci.h
> +++ b/drivers/bus/pci/rte_bus_pci.h
> @@ -66,6 +66,7 @@ struct rte_pci_device {
>   	uint16_t max_vfs;                   /**< sriov enable if not zero */
>   	enum rte_kernel_driver kdrv;        /**< Kernel driver passthrough */
>   	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
> +	struct rte_intr_handle req_notifier_handler;/**< Req notifier handle */

It is uninitialized now everywhere the structure is used. In the best case
it is initialized with zeros (if the structure is memset or partly 
initialized
on declaration) and zero FD is a valid file descriptor. Is it OK?

>   };
>   
>   /**
  
Guo, Jia Oct. 2, 2018, 6:32 a.m. UTC | #2
On 10/1/2018 5:46 PM, Andrew Rybchenko wrote:
> On 9/30/18 5:16 PM, Jeff Guo wrote:
>> There are some extended interrupt types in vfio pci device except from the
>> existing interrupts, such as err and req notifier, they could be useful for
>> device error monitoring. And these corresponding interrupt handler is
>> different from the other interrupt handler that register in PMDs, so a new
>> interrupt handler should be added. This patch will add specific req handler
>> in generic pci device.
>>
>> Signed-off-by: Jeff Guo<jia.guo@intel.com>
>> ---
>> v2->v1:
>> no change
>> ---
>>   drivers/bus/pci/rte_bus_pci.h | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
>> index 0d1955f..c45a820 100644
>> --- a/drivers/bus/pci/rte_bus_pci.h
>> +++ b/drivers/bus/pci/rte_bus_pci.h
>> @@ -66,6 +66,7 @@ struct rte_pci_device {
>>   	uint16_t max_vfs;                   /**< sriov enable if not zero */
>>   	enum rte_kernel_driver kdrv;        /**< Kernel driver passthrough */
>>   	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
>> +	struct rte_intr_handle req_notifier_handler;/**< Req notifier handle */
>
> It is uninitialized now everywhere the structure is used. In the best case
> it is initialized with zeros (if the structure is memset or partly 
> initialized
> on declaration) and zero FD is a valid file descriptor. Is it OK?
>

The fd should be initialized as -1 as the structure of rte_intr_handler.


>>   };
>>   
>>   /**
>
  

Patch

diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 0d1955f..c45a820 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -66,6 +66,7 @@  struct rte_pci_device {
 	uint16_t max_vfs;                   /**< sriov enable if not zero */
 	enum rte_kernel_driver kdrv;        /**< Kernel driver passthrough */
 	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
+	struct rte_intr_handle req_notifier_handler;/**< Req notifier handle */
 };
 
 /**