vhost-net: Notify the backend about the host MTU
This patch provides a way for virtio-net to notify the backend about the host MTU set by the user. Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Aaron Conole <aconole@redhat.com> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
c5f048d8fb
commit
45a368ad4f
@ -51,6 +51,7 @@ static const int kernel_feature_bits[] = {
|
|||||||
VIRTIO_RING_F_EVENT_IDX,
|
VIRTIO_RING_F_EVENT_IDX,
|
||||||
VIRTIO_NET_F_MRG_RXBUF,
|
VIRTIO_NET_F_MRG_RXBUF,
|
||||||
VIRTIO_F_VERSION_1,
|
VIRTIO_F_VERSION_1,
|
||||||
|
VIRTIO_NET_F_MTU,
|
||||||
VHOST_INVALID_FEATURE_BIT
|
VHOST_INVALID_FEATURE_BIT
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -74,6 +75,7 @@ static const int user_feature_bits[] = {
|
|||||||
VIRTIO_NET_F_HOST_ECN,
|
VIRTIO_NET_F_HOST_ECN,
|
||||||
VIRTIO_NET_F_HOST_UFO,
|
VIRTIO_NET_F_HOST_UFO,
|
||||||
VIRTIO_NET_F_MRG_RXBUF,
|
VIRTIO_NET_F_MRG_RXBUF,
|
||||||
|
VIRTIO_NET_F_MTU,
|
||||||
|
|
||||||
/* This bit implies RARP isn't sent by QEMU out of band */
|
/* This bit implies RARP isn't sent by QEMU out of band */
|
||||||
VIRTIO_NET_F_GUEST_ANNOUNCE,
|
VIRTIO_NET_F_GUEST_ANNOUNCE,
|
||||||
@ -435,6 +437,17 @@ int vhost_set_vring_enable(NetClientState *nc, int enable)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu)
|
||||||
|
{
|
||||||
|
const VhostOps *vhost_ops = net->dev.vhost_ops;
|
||||||
|
|
||||||
|
if (!vhost_ops->vhost_net_set_mtu) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return vhost_ops->vhost_net_set_mtu(&net->dev, mtu);
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
uint64_t vhost_net_get_max_queues(VHostNetState *net)
|
uint64_t vhost_net_get_max_queues(VHostNetState *net)
|
||||||
{
|
{
|
||||||
@ -501,4 +514,9 @@ int vhost_set_vring_enable(NetClientState *nc, int enable)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,4 +35,6 @@ int vhost_set_vring_enable(NetClientState * nc, int enable);
|
|||||||
|
|
||||||
uint64_t vhost_net_get_acked_features(VHostNetState *net);
|
uint64_t vhost_net_get_acked_features(VHostNetState *net);
|
||||||
|
|
||||||
|
int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user