@@ -1707,11 +1707,13 @@ int dfl_fpga_cdev_config_ports_vf(struct dfl_fpga_cdev *cdev, int num_vfs)
mutex_lock(&cdev->lock);
/*
- * can't turn multiple ports into 1 VF device, only 1 port for 1 VF
- * device, so if released port number doesn't match VF device number,
- * then reject the request with -EINVAL error code.
+ * In the OFS legacy model, it can't turn multiple ports into 1 VF
+ * device, because only 1 port conneced to 1 VF device, so if released
+ * port number doesn't match VF device number, then reject the request
+ * with -EINVAL error code.
*/
- if (cdev->released_port_num != num_vfs) {
+ if ((dfl_has_port_connected_afu(cdev) &&
+ cdev->released_port_num != num_vfs)) {
ret = -EINVAL;
goto done;
}
@@ -471,6 +471,8 @@ void dfl_fpga_enum_info_free(struct dfl_fpga_enum_info *info);
#define DFL_PORT_CONNECT_BITS MAX_DFL_FPGA_PORT_NUM
#define DFL_FEAT_PORT_CONNECT_MASK ((1UL << (DFL_PORT_CONNECT_BITS)) - 1)
+#define dfl_has_port_connected_afu(cdev) ((cdev)->flags & DFL_FEAT_PORT_CONNECT_MASK)
+
/**
* struct dfl_fpga_cdev - container device of DFL based FPGA
*