On Sat, Jul 11, 2020 at 12:28 AM Nicolas Chautru
<nicolas.chau...@intel.com> wrote:

[snip]

> +#define SYS_DIR "/sys/bus/pci/devices"
> +#define CUR_DIR "."
> +#define PREV_DIR ".."
> +
> +#define DRIVER_LINK  "driver"
> +#define DEVICE_FILE  "device"
> +#define VENDOR_FILE  "vendor"
> +#define BAR0_FILE    "resource0"
> +#define MAX_VFS_FILE "max_vfs"
> +
> +#define PCI_STR_SIZE 15
> +#define DEV_STR_SIZE 10
> +#define NULL_PAD     2
> +
> +/* Function Pointer for device specific configuration file */
> +typedef int (*configuration)(void *bar0addr, const char *arg_cfg_filename);
> +
> +typedef struct hw_device {
> +       const char *device_name;
> +       char *config_file;
> +       int vendor_id;
> +       int device_id;
> +       char pci_address[PCI_STR_SIZE];
> +       bool driver_found;
> +       configuration conf;
> +       char *num_vfs;
> +       int config_all;
> +} hw_device;
> +
> +static int
> +enable_vfs(const char *pci_addr, char *num_vfs)
> +{
> +       char maxvfspath[PATH_MAX];
> +       char fs_num_vfs[4] = {0, 0, 0, 0};
> +       int maxvfsfd;
> +
> +       snprintf(maxvfspath, sizeof(maxvfspath),
> +                       "%s/%s/%s", SYS_DIR, pci_addr, MAX_VFS_FILE);
> +       maxvfsfd = open(maxvfspath, O_RDWR | O_SYNC);

You should stop relying on igb_uio (reminder: it is going to move out
of the dpdk tree in 20.11) and use vfio vf token that got merged in
20.08.


-- 
David Marchand

Reply via email to