Apart from the virtio status, there should be also a network related
status for link status management, current implementation mixes up these
two statuses.
One issue caused by this mixup is when virtio-user running in server mode
and vhost as a client connects to it, a RARP packet will be generated by
virtio-user due to VIRTIO_NET_S_ANNOUNCE bit is detected in the "status"
in interrupt handler.
VIRTIO_NET_S_LINK_UP and VIRTIO_NET_S_ANNOUNCE should be managed by a
separated field. This patch adds a "net_status" field for this purpose.
Fixes:
e9efa4d93821 ("net/virtio-user: add new virtual PCI driver")
Cc: stable@dpdk.org
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
* (Vhost-user only)
*/
uint8_t status;
* (Vhost-user only)
*/
uint8_t status;
uint16_t port_id;
uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
char path[PATH_MAX];
uint16_t port_id;
uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
char path[PATH_MAX];
}
r = recv(dev->vhostfd, buf, 128, MSG_PEEK);
if (r == 0 || (r < 0 && errno != EAGAIN)) {
}
r = recv(dev->vhostfd, buf, 128, MSG_PEEK);
if (r == 0 || (r < 0 && errno != EAGAIN)) {
- dev->status &= (~VIRTIO_NET_S_LINK_UP);
+ dev->net_status &= (~VIRTIO_NET_S_LINK_UP);
PMD_DRV_LOG(ERR, "virtio-user port %u is down",
hw->port_id);
PMD_DRV_LOG(ERR, "virtio-user port %u is down",
hw->port_id);
virtio_user_delayed_handler,
(void *)hw);
} else {
virtio_user_delayed_handler,
(void *)hw);
} else {
- dev->status |= VIRTIO_NET_S_LINK_UP;
+ dev->net_status |= VIRTIO_NET_S_LINK_UP;
}
if (fcntl(dev->vhostfd, F_SETFL,
flags & ~O_NONBLOCK) == -1) {
}
if (fcntl(dev->vhostfd, F_SETFL,
flags & ~O_NONBLOCK) == -1) {
return;
}
} else if (dev->is_server) {
return;
}
} else if (dev->is_server) {
- dev->status &= (~VIRTIO_NET_S_LINK_UP);
+ dev->net_status &= (~VIRTIO_NET_S_LINK_UP);
if (virtio_user_server_reconnect(dev) >= 0)
if (virtio_user_server_reconnect(dev) >= 0)
- dev->status |= VIRTIO_NET_S_LINK_UP;
+ dev->net_status |= VIRTIO_NET_S_LINK_UP;
- *(uint16_t *)dst = dev->status;
+ *(uint16_t *)dst = dev->net_status;
}
if (offset == offsetof(struct virtio_net_config, max_virtqueue_pairs))
}
if (offset == offsetof(struct virtio_net_config, max_virtqueue_pairs))