Re: [RFC: vf-token 1/5] virpci: Define vf-token

2023-10-06 Thread Peter Krempa
On Thu, Oct 05, 2023 at 16:05:00 -0700, Vivek Kashyap wrote:
> Define the vf-token extension for PCI device
> 
> Signed-off-by: Vivek Kashyap 
> ---
>  src/util/virpci.h | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/src/util/virpci.h b/src/util/virpci.h
> index faca6cf6f9..b4e9e95d88 100644
> --- a/src/util/virpci.h
> +++ b/src/util/virpci.h
> @@ -50,7 +50,15 @@ struct _virZPCIDeviceAddress {
>  /* Don't forget to update virPCIDeviceAddressCopy if needed. */
>  };
>  
> +typedef struct _virPCIDeviceToken virPCIDeviceToken;
> +
> +struct _virPCIDeviceToken {
> +unsigned char uuid[VIR_UUID_BUFLEN];
> +bool isSet;
> +};
> +
>  #define VIR_PCI_DEVICE_ADDRESS_FMT "%04x:%02x:%02x.%d"
> +#define VIR_PCI_DEVICE_TOKEN_FMT 
> "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
>  
>  /* Represents format of PF's phys_port_name in switchdev mode:
>   * 'p%u' or 'p%us%u'. New line checked since value is read from sysfs file.
> @@ -65,6 +73,7 @@ struct _virPCIDeviceAddress {
>  virTristateSwitch multi;
>  int extFlags; /* enum virPCIDeviceAddressExtensionFlags */
>  virZPCIDeviceAddress zpci;
> +virPCIDeviceToken token;
>  /* Don't forget to update virPCIDeviceAddressCopy if needed. */
>  };
>  
> @@ -269,6 +278,8 @@ int virPCIDeviceAddressParse(char *address, 
> virPCIDeviceAddress *bdf);
>  
>  bool virZPCIDeviceAddressIsIncomplete(const virZPCIDeviceAddress *addr);
>  bool virZPCIDeviceAddressIsPresent(const virZPCIDeviceAddress *addr);
> +bool virPCIVFIOTokenIDIsPresent(const virPCIDeviceToken *token);
> +bool virDeviceExtensionIsPresent(const virPCIDeviceAddress *pci);

These function definitions should go into the patch that actually
implements the functions themselves.



[RFC: vf-token 1/5] virpci: Define vf-token

2023-10-06 Thread Vivek Kashyap
Define the vf-token extension for PCI device

Signed-off-by: Vivek Kashyap 
---
 src/util/virpci.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/src/util/virpci.h b/src/util/virpci.h
index faca6cf6f9..b4e9e95d88 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -50,7 +50,15 @@ struct _virZPCIDeviceAddress {
 /* Don't forget to update virPCIDeviceAddressCopy if needed. */
 };
 
+typedef struct _virPCIDeviceToken virPCIDeviceToken;
+
+struct _virPCIDeviceToken {
+unsigned char uuid[VIR_UUID_BUFLEN];
+bool isSet;
+};
+
 #define VIR_PCI_DEVICE_ADDRESS_FMT "%04x:%02x:%02x.%d"
+#define VIR_PCI_DEVICE_TOKEN_FMT 
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
 
 /* Represents format of PF's phys_port_name in switchdev mode:
  * 'p%u' or 'p%us%u'. New line checked since value is read from sysfs file.
@@ -65,6 +73,7 @@ struct _virPCIDeviceAddress {
 virTristateSwitch multi;
 int extFlags; /* enum virPCIDeviceAddressExtensionFlags */
 virZPCIDeviceAddress zpci;
+virPCIDeviceToken token;
 /* Don't forget to update virPCIDeviceAddressCopy if needed. */
 };
 
@@ -269,6 +278,8 @@ int virPCIDeviceAddressParse(char *address, 
virPCIDeviceAddress *bdf);
 
 bool virZPCIDeviceAddressIsIncomplete(const virZPCIDeviceAddress *addr);
 bool virZPCIDeviceAddressIsPresent(const virZPCIDeviceAddress *addr);
+bool virPCIVFIOTokenIDIsPresent(const virPCIDeviceToken *token);
+bool virDeviceExtensionIsPresent(const virPCIDeviceAddress *pci);
 
 int virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
  int pfNetDevIdx,
-- 
2.25.1