light_vringh.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. #ifndef _LIGHT_VRINGH_H
  3. #define _LIGHT_VRINGH_H
  4. #include <linux/vringh.h>
  5. #include <linux/virtio_config.h>
  6. #include <linux/virtio.h>
  7. #include <linux/netdevice.h>
  8. #include "../vhost/vhost.h"
  9. #define CNT_MASK 0x1F
  10. #define LIGHT_MAX_VRINGS 32
  11. struct light_vring {
  12. struct vring vr;
  13. void *va;
  14. int len;
  15. };
  16. struct light_vringh {
  17. struct light_vring vring;
  18. struct vringh vrh;
  19. struct vringh_kiov riov;
  20. struct vringh_kiov wiov;
  21. u16 head;
  22. struct mutex vr_mutex;
  23. struct light_vdev *vdev;
  24. };
  25. struct light_vdev {
  26. int virtio_id;
  27. struct device dev;
  28. struct device *device;
  29. wait_queue_head_t waitq;
  30. unsigned long out_bytes;
  31. unsigned long in_bytes;
  32. unsigned long out_bytes_dma;
  33. unsigned long in_bytes_dma;
  34. struct mutex mutex;
  35. spinlock_t lock;
  36. int wakeup;
  37. volatile unsigned char __iomem *frontend_intr_reg;
  38. volatile unsigned char __iomem *backend_intr_reg;
  39. u32 enable_intr;
  40. u32 clear_intr;
  41. int irq;
  42. #ifdef CONFIG_LIGHT_NET
  43. struct napi_struct napi;
  44. #endif
  45. struct work_struct work;
  46. struct dma_chan *dma_ch[2];
  47. struct list_head list;
  48. struct task_struct *task;
  49. #ifdef CONFIG_LIGHT_BLK
  50. struct vhost_virtqueue vqs[1];
  51. struct vhost_dev vhost_dev;
  52. struct block_device *this_bdev;
  53. #endif
  54. void *priv;
  55. int vq_num;
  56. int index;
  57. void (*kick)(void *);
  58. void (*notify)(struct light_vdev *);
  59. struct light_vringh vvr[LIGHT_MAX_VRINGS];
  60. };
  61. #endif