Skip to content

Commit 5b250fa

Browse files
Alvaro-Karszmstsirkin
authored andcommitted
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>
1 parent 51b6e6c commit 5b250fa

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/vdpa/solidrun/snet_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static irqreturn_t snet_cfg_irq_hndlr(int irq, void *data)
3939
{
4040
struct snet *snet = data;
4141
/* Call callback if any */
42-
if (snet->cb.callback)
42+
if (likely(snet->cb.callback))
4343
return snet->cb.callback(snet->cb.private);
4444

4545
return IRQ_HANDLED;
@@ -49,7 +49,7 @@ static irqreturn_t snet_vq_irq_hndlr(int irq, void *data)
4949
{
5050
struct snet_vq *vq = data;
5151
/* Call callback if any */
52-
if (vq->cb.callback)
52+
if (likely(vq->cb.callback))
5353
return vq->cb.callback(vq->cb.private);
5454

5555
return IRQ_HANDLED;
@@ -106,7 +106,7 @@ static void snet_kick_vq(struct vdpa_device *vdev, u16 idx)
106106
{
107107
struct snet *snet = vdpa_to_snet(vdev);
108108
/* not ready - ignore */
109-
if (!snet->vqs[idx]->ready)
109+
if (unlikely(!snet->vqs[idx]->ready))
110110
return;
111111

112112
iowrite32(SNET_KICK_VAL, snet->vqs[idx]->kick_ptr);

0 commit comments

Comments
 (0)