Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vdpa/snet: implement the resume vDPA callback

The callback sends a resume command to the DPU through
the control mechanism.

Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
Message-Id: <20230502131048.61134-1-alvaro.karsz@solid-run.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>

authored by

Alvaro Karsz and committed by
Michael S. Tsirkin
ef9da01c 47b60ec7

+22
+6
drivers/vdpa/solidrun/snet_ctrl.c
··· 16 16 SNET_CTRL_OP_DESTROY = 1, 17 17 SNET_CTRL_OP_READ_VQ_STATE, 18 18 SNET_CTRL_OP_SUSPEND, 19 + SNET_CTRL_OP_RESUME, 19 20 }; 20 21 21 22 #define SNET_CTRL_TIMEOUT 2000000 ··· 328 327 int snet_suspend_dev(struct snet *snet) 329 328 { 330 329 return snet_send_ctrl_msg(snet, SNET_CTRL_OP_SUSPEND, 0); 330 + } 331 + 332 + int snet_resume_dev(struct snet *snet) 333 + { 334 + return snet_send_ctrl_msg(snet, SNET_CTRL_OP_RESUME, 0); 331 335 }
+15
drivers/vdpa/solidrun/snet_main.c
··· 509 509 return ret; 510 510 } 511 511 512 + static int snet_resume(struct vdpa_device *vdev) 513 + { 514 + struct snet *snet = vdpa_to_snet(vdev); 515 + int ret; 516 + 517 + ret = snet_resume_dev(snet); 518 + if (ret) 519 + SNET_ERR(snet->pdev, "SNET[%u] resume failed, err: %d\n", snet->sid, ret); 520 + else 521 + SNET_DBG(snet->pdev, "Resume SNET[%u] device\n", snet->sid); 522 + 523 + return ret; 524 + } 525 + 512 526 static const struct vdpa_config_ops snet_config_ops = { 513 527 .set_vq_address = snet_set_vq_address, 514 528 .set_vq_num = snet_set_vq_num, ··· 550 536 .get_config = snet_get_config, 551 537 .set_config = snet_set_config, 552 538 .suspend = snet_suspend, 539 + .resume = snet_resume, 553 540 }; 554 541 555 542 static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)
+1
drivers/vdpa/solidrun/snet_vdpa.h
··· 204 204 int snet_destroy_dev(struct snet *snet); 205 205 int snet_read_vq_state(struct snet *snet, u16 idx, struct vdpa_vq_state *state); 206 206 int snet_suspend_dev(struct snet *snet); 207 + int snet_resume_dev(struct snet *snet); 207 208 208 209 #endif //_SNET_VDPA_H_