host-drivers/base-driver/vca/vop/vop_common.c
static int common_dev_init_mode(struct vop_dev_common *cdev)
{
	struct vop_device *vdev = cdev->vdev;
	u8 *features;
	u8 *features_peer;
	struct vca_device_desc *desc = cdev->dd_self;
	struct vca_device_desc *desc_peer = cdev->dd_peer;
	unsigned int bits, bits_peer;
	int ret = 0;
	bool use_dma = false;
#ifdef VIRTIO_NET_F_OFFSET_RXBUF
	const u8 test_bit = VIRTIO_NET_F_OFFSET_RXBUF;
#else /* VIRTIO_NET_F_OFFSET_RXBUF */
	const u8 test_bit = __VIRTIO_NET_F_OFFSET_RXBUF;
	dev_warn(&vdev->dev, "%s Transfer mode: Feature VIRTIO_NET_F_OFFSET_RXBUF "
		    "not implemented in kernel\n", __func__);
#pragma message "Feature VIRTIO_NET_F_OFFSET_RXBUF not implemented in kernel"
#endif /* VIRTIO_NET_F_OFFSET_RXBUF */

	features = vca_vq_features(desc) + desc->feature_len;
	bits = min_t(unsigned, desc->feature_len, sizeof(unsigned long)) * 8;
	features_peer = vca_vq_features(desc_peer) + desc_peer->feature_len;
	bits_peer = min_t(unsigned, desc_peer->feature_len, sizeof(unsigned long)) * 8;

	cdev->feature_desc_alignment = VOP_CHECK_FEATURE(features_peer, bits_peer,
						test_bit);

#ifdef USE_DMA
	cdev->write_in_thread = !cdev->feature_desc_alignment;
	use_dma = true;
#else /* USE_DMA */
#pragma message "Transfer mode MEMCPY is a development feature only!"
	cdev->write_in_thread = true;
	use_dma = false;
#endif /* USE_DMA */

	dev_info(&vdev->dev, "%s Transfer mode: %s%s%s\n", __func__,
			use_dma?"DMA":"memcpy",
			cdev->feature_desc_alignment? " with feature fix alignment":
			" with intermediate buffer",
			cdev->write_in_thread? ", write in thread":"");
	return ret;
}
/*
 * common_dev_init_mode - Configure transfer mode, depending of active features.
 *
 * @cdev - dev_common structure
 *
 */
Configure transfer mode, depending of active features.
@cdev - dev_common structure
Configure transfer mode depending of active features . @cdev - dev_common structure
static int common_dev_init_mode(struct vop_dev_common *cdev)
{
	struct vop_device *vdev = cdev->vdev;
	u8 *features;
	u8 *features_peer;
	struct vca_device_desc *desc = cdev->dd_self;
	struct vca_device_desc *desc_peer = cdev->dd_peer;
	unsigned int bits, bits_peer;
	int ret = 0;
	bool use_dma = false;
#ifdef VIRTIO_NET_F_OFFSET_RXBUF
	const u8 test_bit = VIRTIO_NET_F_OFFSET_RXBUF;
#else 
	const u8 test_bit = __VIRTIO_NET_F_OFFSET_RXBUF;
	dev_warn(&vdev->dev, "%s Transfer mode: Feature VIRTIO_NET_F_OFFSET_RXBUF "
		    "not implemented in kernel\n", __func__);
#pragma message "Feature VIRTIO_NET_F_OFFSET_RXBUF not implemented in kernel"
#endif 
	features = vca_vq_features(desc) + desc->feature_len;
	bits = min_t(unsigned, desc->feature_len, sizeof(unsigned long)) * 8;
	features_peer = vca_vq_features(desc_peer) + desc_peer->feature_len;
	bits_peer = min_t(unsigned, desc_peer->feature_len, sizeof(unsigned long)) * 8;
	cdev->feature_desc_alignment = VOP_CHECK_FEATURE(features_peer, bits_peer,
						test_bit);
#ifdef USE_DMA
	cdev->write_in_thread = !cdev->feature_desc_alignment;
	use_dma = true;
#else 
#pragma message "Transfer mode MEMCPY is a development feature only!"
	cdev->write_in_thread = true;
	use_dma = false;
#endif 
	dev_info(&vdev->dev, "%s Transfer mode: %s%s%s\n", __func__,
			use_dma?"DMA":"memcpy",
			cdev->feature_desc_alignment? " with feature fix alignment":
			" with intermediate buffer",
			cdev->write_in_thread? ", write in thread":"");
	return ret;
}
static int common_dev_init_mode ( struct vop_dev_common * cdev ) { struct vop_device * vdev = cdev -> vdev ; u8 * features ; u8 * features_peer ; struct vca_device_desc * desc = cdev -> dd_self ; struct vca_device_desc * desc_peer = cdev -> dd_peer ; unsigned int bits , bits_peer ; int ret = 0 ; bool use_dma = false ; #ifdef VIRTIO_NET_F_OFFSET_RXBUF const u8 test_bit = VIRTIO_NET_F_OFFSET_RXBUF ; #else const u8 test_bit = __VIRTIO_NET_F_OFFSET_RXBUF ; dev_warn ( & vdev -> dev , " " " \n " , __func__ ) ; #pragma  message "Feature VIRTIO_NET_F_OFFSET_RXBUF not implemented in kernel" #endif features = vca_vq_features ( desc ) + desc -> feature_len ; bits = min_t ( unsigned , desc -> feature_len , sizeof ( unsigned long ) ) * 8 ; features_peer = vca_vq_features ( desc_peer ) + desc_peer -> feature_len ; bits_peer = min_t ( unsigned , desc_peer -> feature_len , sizeof ( unsigned long ) ) * 8 ; cdev -> feature_desc_alignment = VOP_CHECK_FEATURE ( features_peer , bits_peer , test_bit ) ; #ifdef USE_DMA cdev -> write_in_thread = ! cdev -> feature_desc_alignment ; use_dma = true ; #else #pragma  message "Transfer mode MEMCPY is a development feature only!" cdev -> write_in_thread = true ; use_dma = false ; #endif dev_info ( & vdev -> dev , " \n " , __func__ , use_dma ? " " : " " , cdev -> feature_desc_alignment ? " " : " " , cdev -> write_in_thread ? " " : " " ) ; return ret ; }
common_dev_init_mode - Configure transfer mode, depending of active features.
common_dev_init_mode - Configure transfer mode depending of active features .
/* VIRTIO_NET_F_OFFSET_RXBUF */ /* VIRTIO_NET_F_OFFSET_RXBUF */ /* USE_DMA */ /* USE_DMA */