2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

netdev-afxdp: Fix use of unconfigured device.

In case of failure of 'xsk_configure_all()', 'n_rxq' and 'xdpmode'
will remain in a new state. This will result in successful
reconfiguration (immediate return, because configuration is already
applied) if 'netdev_reconfigure()' will be called again.

Same issue was fixed previously for netdev-dpdk using 'dev->started'
flag in commit:
606f665072 ("netdev-dpdk: Don't use PMD driver if not configured successfully")

Let's use similar approach with checking the 'dev->xsks' which only
exists if configuration was successful.

Additionally implemented 'netdev_afxdp_construct()' function to
explicitly initialize all the specific fields and request the
reconfiguration.

CC: William Tu <u9012063@gmail.com>
Fixes: 0de1b42596 ("netdev-afxdp: add new netdev type for AF_XDP.")
Acked-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
This commit is contained in:
Ilya Maximets
2019-07-22 09:05:20 -04:00
parent 91a38e891d
commit f627cf1dd9
4 changed files with 33 additions and 3 deletions

View File

@@ -906,7 +906,7 @@ netdev_linux_common_construct(struct netdev *netdev_)
}
/* Creates system and internal devices. */
static int
int
netdev_linux_construct(struct netdev *netdev_)
{
struct netdev_linux *netdev = netdev_linux_cast(netdev_);
@@ -3290,7 +3290,7 @@ const struct netdev_class netdev_afxdp_class = {
NETDEV_LINUX_CLASS_COMMON,
.type = "afxdp",
.is_pmd = true,
.construct = netdev_linux_construct,
.construct = netdev_afxdp_construct,
.destruct = netdev_afxdp_destruct,
.get_stats = netdev_afxdp_get_stats,
.get_status = netdev_linux_get_status,