| 371 | } |
| 372 | |
| 373 | static int vnic_dev_cmd_proxy(struct vnic_dev *vdev, |
| 374 | enum vnic_devcmd_cmd proxy_cmd, enum vnic_devcmd_cmd cmd, |
| 375 | uint64_t *args, int nargs, int wait) |
| 376 | { |
| 377 | uint32_t status; |
| 378 | int err; |
| 379 | |
| 380 | /* |
| 381 | * Proxy command consumes 2 arguments. One for proxy index, |
| 382 | * the other is for command to be proxied |
| 383 | */ |
| 384 | if (nargs > VNIC_DEVCMD_NARGS - 2) { |
| 385 | pr_err("number of args %d exceeds the maximum\n", nargs); |
| 386 | return -EINVAL; |
| 387 | } |
| 388 | memset(vdev->args, 0, sizeof(vdev->args)); |
| 389 | |
| 390 | vdev->args[0] = vdev->proxy_index; |
| 391 | vdev->args[1] = cmd; |
| 392 | memcpy(&vdev->args[2], args, nargs * sizeof(args[0])); |
| 393 | |
| 394 | err = _vnic_dev_cmd(vdev, proxy_cmd, wait); |
| 395 | if (err) |
| 396 | return err; |
| 397 | |
| 398 | status = (uint32_t)vdev->args[0]; |
| 399 | if (status & STAT_ERROR) { |
| 400 | err = (int)vdev->args[1]; |
| 401 | if (err != ERR_ECMDUNKNOWN || |
| 402 | cmd != CMD_CAPABILITY) |
| 403 | pr_err("Error %d proxy devcmd %d\n", err, _CMD_N(cmd)); |
| 404 | return err; |
| 405 | } |
| 406 | |
| 407 | memcpy(args, &vdev->args[1], nargs * sizeof(args[0])); |
| 408 | |
| 409 | return 0; |
| 410 | } |
| 411 | |
| 412 | static int vnic_dev_cmd_no_proxy(struct vnic_dev *vdev, |
| 413 | enum vnic_devcmd_cmd cmd, uint64_t *args, int nargs, int wait) |
no test coverage detected