Ricardo CaƱuelo
2022-Aug-04 10:59 UTC
[PATCH v2 1/2] virtio: kerneldocs fixes and enhancements
Fix variable names in some htmldocs, naming in others.
Add htmldocs for struct vring_desc and vring_interrupt.
Signed-off-by: Ricardo Ca?uelo <ricardo.canuelo at collabora.com>
---
drivers/virtio/virtio_ring.c | 8 ++++++++
include/linux/virtio.h | 6 +++---
include/linux/virtio_config.h | 6 +++---
include/uapi/linux/virtio_ring.h | 16 +++++++++++-----
4 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index a5ec724c01d8..e2091345c5c2 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -2147,6 +2147,14 @@ static inline bool more_used(const struct vring_virtqueue
*vq)
return vq->packed_ring ? more_used_packed(vq) : more_used_split(vq);
}
+/**
+ * vring_interrupt - notify a virtqueue on an interrupt
+ * @irq: the IRQ number
+ * @_vq: the struct virtqueue to notify
+ *
+ * Calls the callback function of @_vq to process the virtqueue
+ * notification.
+ */
irqreturn_t vring_interrupt(int irq, void *_vq)
{
struct vring_virtqueue *vq = to_vvq(_vq);
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index d8fdf170637c..fd8440e85933 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -11,7 +11,7 @@
#include <linux/gfp.h>
/**
- * virtqueue - a queue to register buffers for sending or receiving.
+ * struct virtqueue - a queue to register buffers for sending or receiving.
* @list: the chain of virtqueues for this device
* @callback: the function to call when buffers are consumed (can be NULL).
* @name: the name of this virtqueue (mainly for debugging)
@@ -90,7 +90,7 @@ dma_addr_t virtqueue_get_avail_addr(struct virtqueue *vq);
dma_addr_t virtqueue_get_used_addr(struct virtqueue *vq);
/**
- * virtio_device - representation of a device using virtio
+ * struct virtio_device - representation of a device using virtio
* @index: unique position on the virtio bus
* @failed: saved value for VIRTIO_CONFIG_S_FAILED bit (for restore)
* @config_enabled: configuration change reporting enabled
@@ -146,7 +146,7 @@ size_t virtio_max_dma_size(struct virtio_device *vdev);
list_for_each_entry(vq, &vdev->vqs, list)
/**
- * virtio_driver - operations for a virtio I/O driver
+ * struct virtio_driver - operations for a virtio I/O driver
* @driver: underlying device driver (populate name and owner).
* @id_table: the ids serviced by this driver.
* @feature_table: an array of feature numbers supported by this driver.
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index b47c2e7ed0ee..997801018ae4 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -225,7 +225,7 @@ int virtio_find_vqs_ctx(struct virtio_device *vdev, unsigned
nvqs,
/**
* virtio_synchronize_cbs - synchronize with virtqueue callbacks
- * @vdev: the device
+ * @dev: the device
*/
static inline
void virtio_synchronize_cbs(struct virtio_device *dev)
@@ -244,7 +244,7 @@ void virtio_synchronize_cbs(struct virtio_device *dev)
/**
* virtio_device_ready - enable vq use in probe function
- * @vdev: the device
+ * @dev: the device
*
* Driver must call this to use vqs in the probe function.
*
@@ -292,7 +292,7 @@ const char *virtio_bus_name(struct virtio_device *vdev)
/**
* virtqueue_set_affinity - setting affinity for a virtqueue
* @vq: the virtqueue
- * @cpu: the cpu no.
+ * @cpu_mask: the cpu mask
*
* Pay attention the function are best-effort: the affinity hint may not be set
* due to config support, irq type and sharing.
diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h
index 476d3e5c0fe7..f8c20d3de8da 100644
--- a/include/uapi/linux/virtio_ring.h
+++ b/include/uapi/linux/virtio_ring.h
@@ -93,15 +93,21 @@
#define VRING_USED_ALIGN_SIZE 4
#define VRING_DESC_ALIGN_SIZE 16
-/* Virtio ring descriptors: 16 bytes. These can chain together via
"next". */
+/**
+ * struct vring_desc - Virtio ring descriptors,
+ * 16 bytes long. These can chain together via @next.
+ *
+ * @addr: buffer address (guest-physical)
+ * @len: buffer length
+ * @flags: descriptor flags
+ * @next: index of the next descriptor in the chain,
+ * if the VRING_DESC_F_NEXT flag is set. We chain unused
+ * descriptors via this, too.
+ */
struct vring_desc {
- /* Address (guest-physical). */
__virtio64 addr;
- /* Length. */
__virtio32 len;
- /* The flags as indicated above. */
__virtio16 flags;
- /* We chain unused descriptors via this, too */
__virtio16 next;
};
--
2.25.1
Cornelia Huck
2022-Aug-08 12:14 UTC
[PATCH v2 1/2] virtio: kerneldocs fixes and enhancements
On Thu, Aug 04 2022, Ricardo Ca?uelo <ricardo.canuelo at collabora.com> wrote:> Fix variable names in some htmldocs, naming in others. > Add htmldocs for struct vring_desc and vring_interrupt.Isn't that "kerneldoc"? But maybe I'm a bit behind on the current terminology.> > Signed-off-by: Ricardo Ca?uelo <ricardo.canuelo at collabora.com> > --- > drivers/virtio/virtio_ring.c | 8 ++++++++ > include/linux/virtio.h | 6 +++--- > include/linux/virtio_config.h | 6 +++--- > include/uapi/linux/virtio_ring.h | 16 +++++++++++----- > 4 files changed, 25 insertions(+), 11 deletions(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index a5ec724c01d8..e2091345c5c2 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -2147,6 +2147,14 @@ static inline bool more_used(const struct vring_virtqueue *vq) > return vq->packed_ring ? more_used_packed(vq) : more_used_split(vq); > } > > +/** > + * vring_interrupt - notify a virtqueue on an interrupt > + * @irq: the IRQ numberThis is being ignored, however. Append "(ignored)"? (I think it is only there so that this function can be used as an irq_handler_t.)> + * @_vq: the struct virtqueue to notify > + * > + * Calls the callback function of @_vq to process the virtqueue > + * notification. > + */ > irqreturn_t vring_interrupt(int irq, void *_vq) > { > struct vring_virtqueue *vq = to_vvq(_vq);(...)> diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h > index b47c2e7ed0ee..997801018ae4 100644 > --- a/include/linux/virtio_config.h > +++ b/include/linux/virtio_config.h > @@ -225,7 +225,7 @@ int virtio_find_vqs_ctx(struct virtio_device *vdev, unsigned nvqs, > > /** > * virtio_synchronize_cbs - synchronize with virtqueue callbacks > - * @vdev: the device > + * @dev: the deviceAs you're touching this anyway: maybe s/device/virtio device/ ?> */ > static inline > void virtio_synchronize_cbs(struct virtio_device *dev) > @@ -244,7 +244,7 @@ void virtio_synchronize_cbs(struct virtio_device *dev) > > /** > * virtio_device_ready - enable vq use in probe function > - * @vdev: the device > + * @dev: the deviceSame here.> * > * Driver must call this to use vqs in the probe function. > *