static const efx_virtio_ops_t __efx_virtio_rhead_ops = {
rhead_virtio_qstart, /* evo_virtio_qstart */
rhead_virtio_qstop, /* evo_virtio_qstop */
+ rhead_virtio_get_doorbell_offset, /* evo_get_doorbell_offset */
+ rhead_virtio_get_features, /* evo_get_features */
+ rhead_virtio_verify_features, /* evo_verify_features */
};
#endif /* EFSYS_OPT_RIVERHEAD */
}
}
+ __checkReturn efx_rc_t
+efx_virtio_get_doorbell_offset(
+ __in efx_virtio_vq_t *evvp,
+ __out uint32_t *offsetp)
+{
+ efx_nic_t *enp;
+ const efx_virtio_ops_t *evop;
+ efx_rc_t rc;
+
+ if ((evvp == NULL) || (offsetp == NULL)) {
+ rc = EINVAL;
+ goto fail1;
+ }
+
+ enp = evvp->evv_enp;
+ evop = enp->en_evop;
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_VIRTIO);
+
+ if (evop == NULL) {
+ rc = ENOTSUP;
+ goto fail2;
+ }
+
+ if ((rc = evop->evo_get_doorbell_offset(evvp, offsetp)) != 0)
+ goto fail3;
+
+ return (0);
+
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_virtio_get_features(
+ __in efx_nic_t *enp,
+ __in efx_virtio_device_type_t type,
+ __out uint64_t *featuresp)
+{
+ const efx_virtio_ops_t *evop = enp->en_evop;
+ efx_rc_t rc;
+
+ if (featuresp == NULL) {
+ rc = EINVAL;
+ goto fail1;
+ }
+
+ if (type >= EFX_VIRTIO_DEVICE_NTYPES) {
+ rc = EINVAL;
+ goto fail2;
+ }
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_VIRTIO);
+
+ if (evop == NULL) {
+ rc = ENOTSUP;
+ goto fail3;
+ }
+
+ if ((rc = evop->evo_get_features(enp, type, featuresp)) != 0)
+ goto fail4;
+
+ return (0);
+
+fail4:
+ EFSYS_PROBE(fail4);
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_virtio_verify_features(
+ __in efx_nic_t *enp,
+ __in efx_virtio_device_type_t type,
+ __in uint64_t features)
+{
+ const efx_virtio_ops_t *evop = enp->en_evop;
+ efx_rc_t rc;
+
+ if (type >= EFX_VIRTIO_DEVICE_NTYPES) {
+ rc = EINVAL;
+ goto fail1;
+ }
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_VIRTIO);
+
+ if (evop == NULL) {
+ rc = ENOTSUP;
+ goto fail2;
+ }
+
+ if ((rc = evop->evo_verify_features(enp, type, features)) != 0)
+ goto fail3;
+
+ return (0);
+
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
#endif /* EFSYS_OPT_VIRTIO */