summaryrefslogtreecommitdiff
path: root/drivers/vdpa
diff options
context:
space:
mode:
authorAlvaro Karsz <alvaro.karsz@solid-run.com>2023-04-09 15:02:42 +0300
committerMichael S. Tsirkin <mst@redhat.com>2023-04-21 10:02:35 +0300
commit5b250fac7c76b670dd1b28b67f1a91a1907bc117 (patch)
tree128053f329f4532d651f5077e9bdc9f9e095a502 /drivers/vdpa
parent51b6e6c1c8e382c50fe88a04e25d326ceff74f89 (diff)
downloadlinux-5b250fac7c76b670dd1b28b67f1a91a1907bc117.tar.xz
vdpa/snet: use likely/unlikely macros in hot functions
- kick callback: most likely that the VQ is ready. - interrupt handlers: most likely that the callback is not NULL. Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com> Message-Id: <20230409120242.3460074-1-alvaro.karsz@solid-run.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vdpa')
-rw-r--r--drivers/vdpa/solidrun/snet_main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/vdpa/solidrun/snet_main.c b/drivers/vdpa/solidrun/snet_main.c
index da14d437af33..cdcd84ce4f5a 100644
--- a/drivers/vdpa/solidrun/snet_main.c
+++ b/drivers/vdpa/solidrun/snet_main.c
@@ -39,7 +39,7 @@ static irqreturn_t snet_cfg_irq_hndlr(int irq, void *data)
{
struct snet *snet = data;
/* Call callback if any */
- if (snet->cb.callback)
+ if (likely(snet->cb.callback))
return snet->cb.callback(snet->cb.private);
return IRQ_HANDLED;
@@ -49,7 +49,7 @@ static irqreturn_t snet_vq_irq_hndlr(int irq, void *data)
{
struct snet_vq *vq = data;
/* Call callback if any */
- if (vq->cb.callback)
+ if (likely(vq->cb.callback))
return vq->cb.callback(vq->cb.private);
return IRQ_HANDLED;
@@ -106,7 +106,7 @@ static void snet_kick_vq(struct vdpa_device *vdev, u16 idx)
{
struct snet *snet = vdpa_to_snet(vdev);
/* not ready - ignore */
- if (!snet->vqs[idx]->ready)
+ if (unlikely(!snet->vqs[idx]->ready))
return;
iowrite32(SNET_KICK_VAL, snet->vqs[idx]->kick_ptr);