Skip to content

Commit 90fea5a

Browse files
jasowangmstsirkin
authored andcommitted
vdpa: device feature provisioning
This patch allows the device features to be provisioned through netlink. A new attribute is introduced to allow the userspace to pass a 64bit device features during device adding. This provides several advantages: - Allow to provision a subset of the features to ease the cross vendor live migration. - Better debug-ability for vDPA framework and parent. Reviewed-by: Eli Cohen <elic@nvidia.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20220927074810.28627-2-jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent 4959aeb commit 90fea5a

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

drivers/vdpa/vdpa.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,11 @@ static int vdpa_nl_cmd_dev_add_set_doit(struct sk_buff *skb, struct genl_info *i
600600
}
601601
config.mask |= BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MAX_VQP);
602602
}
603+
if (nl_attrs[VDPA_ATTR_DEV_FEATURES]) {
604+
config.device_features =
605+
nla_get_u64(nl_attrs[VDPA_ATTR_DEV_FEATURES]);
606+
config.mask |= BIT_ULL(VDPA_ATTR_DEV_FEATURES);
607+
}
603608

604609
/* Skip checking capability if user didn't prefer to configure any
605610
* device networking attributes. It is likely that user might have used

include/linux/vdpa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ struct vdpa_iova_range {
104104
};
105105

106106
struct vdpa_dev_set_config {
107+
u64 device_features;
107108
struct {
108109
u8 mac[ETH_ALEN];
109110
u16 mtu;

include/uapi/linux/vdpa.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ enum vdpa_attr {
5252
VDPA_ATTR_DEV_VENDOR_ATTR_NAME, /* string */
5353
VDPA_ATTR_DEV_VENDOR_ATTR_VALUE, /* u64 */
5454

55+
VDPA_ATTR_DEV_FEATURES, /* u64 */
56+
5557
/* new attributes must be added above here */
5658
VDPA_ATTR_MAX,
5759
};

0 commit comments

Comments
 (0)