This is an automated email from the ASF dual-hosted git repository. GUIDINGLI pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 966947655b30efaad203ad34a1359e216e29f6b8 Author: p-szafonimateusz <[email protected]> AuthorDate: Mon Jul 13 15:09:18 2026 +0200 drivers/vhost/vhost-can: keep the driver per CPU in BMP mode, enable CAN FD The other vhost drivers keep their struct vhost_driver per CPU in BMP mode, so that each CPU registers its own; vhost-can still has a single global one. Use DEFINE_PER_CPU_BMP() like them. vhost-can bridges CAN FD frames and sets CAN_RAW_FD_FRAMES on its socket, but nothing lets NET_CAN_CANFD be enabled, so the option is rejected and FD frames never reach the peer. Select NET_CAN_HAVE_CANFD. Signed-off-by: p-szafonimateusz <[email protected]> Signed-off-by: Bowen Wang <[email protected]> --- drivers/vhost/Kconfig | 1 + drivers/vhost/vhost-can.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig index 0edbb22549e..bfc6adf1760 100644 --- a/drivers/vhost/Kconfig +++ b/drivers/vhost/Kconfig @@ -172,6 +172,7 @@ config DRIVERS_VHOST_CAN default n select DRIVERS_VHOST select NETDEV_IFINDEX + select NET_CAN_HAVE_CANFD select NET_CAN_SOCK_OPTS ---help--- Enable the vhost CAN backend. It bridges a VirtIO CAN device diff --git a/drivers/vhost/vhost-can.c b/drivers/vhost/vhost-can.c index 97e26b2acfc..30535555bf7 100644 --- a/drivers/vhost/vhost-can.c +++ b/drivers/vhost/vhost-can.c @@ -38,6 +38,7 @@ #include <nuttx/kmalloc.h> #include <nuttx/net/net.h> #include <nuttx/net/netdev.h> +#include <nuttx/percpu.h> #include <nuttx/spinlock.h> #include <nuttx/vhost/vhost.h> #include <nuttx/virtio/virtio.h> @@ -105,12 +106,13 @@ static void vhost_can_remove(FAR struct vhost_device *hdev); * Private Data ****************************************************************************/ -static struct vhost_driver g_vhost_can_driver = +static DEFINE_PER_CPU_BMP(struct vhost_driver, g_vhost_can_driver) = { VIRTIO_ID_CAN, /* Device id */ vhost_can_probe, /* Probe */ vhost_can_remove, /* Remove */ }; +#define g_vhost_can_driver this_cpu_var_bmp(g_vhost_can_driver) /**************************************************************************** * Private Functions
