Skip to content

Commit 38140cc

Browse files
lulu-github-namemstsirkin
authored andcommitted
vhost_net: introduce set_config & get_config
This patch introduces set_config & get_config method which allows vhost_net set/get the config to backend Signed-off-by: Cindy Lu <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: Jason Wang <[email protected]>
1 parent 7a47169 commit 38140cc

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

hw/net/vhost_net-stub.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features)
5252
return features;
5353
}
5454

55+
int vhost_net_get_config(struct vhost_net *net, uint8_t *config,
56+
uint32_t config_len)
57+
{
58+
return 0;
59+
}
60+
int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
61+
uint32_t offset, uint32_t size, uint32_t flags)
62+
{
63+
return 0;
64+
}
65+
5566
void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
5667
{
5768
}

hw/net/vhost_net.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features)
110110
return vhost_get_features(&net->dev, vhost_net_get_feature_bits(net),
111111
features);
112112
}
113+
int vhost_net_get_config(struct vhost_net *net, uint8_t *config,
114+
uint32_t config_len)
115+
{
116+
return vhost_dev_get_config(&net->dev, config, config_len);
117+
}
118+
int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
119+
uint32_t offset, uint32_t size, uint32_t flags)
120+
{
121+
return vhost_dev_set_config(&net->dev, data, offset, size, flags);
122+
}
113123

114124
void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
115125
{

include/net/vhost_net.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ void vhost_net_cleanup(VHostNetState *net);
2828
uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features);
2929
void vhost_net_ack_features(VHostNetState *net, uint64_t features);
3030

31+
int vhost_net_get_config(struct vhost_net *net, uint8_t *config,
32+
uint32_t config_len);
33+
34+
int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
35+
uint32_t offset, uint32_t size, uint32_t flags);
3136
bool vhost_net_virtqueue_pending(VHostNetState *net, int n);
3237
void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
3338
int idx, bool mask);

0 commit comments

Comments
 (0)