diff options
author | dexuan <dexuan@FreeBSD.org> | 2017-02-23 07:04:17 +0000 |
---|---|---|
committer | dexuan <dexuan@FreeBSD.org> | 2017-02-23 07:04:17 +0000 |
commit | eacb7ed261c8a649db8cba504d96d0f0aa0c7805 (patch) | |
tree | d653110b015e30846c3de0dd5b511e94d60e9bf9 /sys/dev/hyperv/netvsc/hn_nvs.c | |
parent | 801edb7982092c7fdc32ca79e679bc44e314d71f (diff) | |
download | FreeBSD-src-eacb7ed261c8a649db8cba504d96d0f0aa0c7805.zip FreeBSD-src-eacb7ed261c8a649db8cba504d96d0f0aa0c7805.tar.gz |
MFC: r312688
Approved by: sephe (mentor)
r312688
hyperv/hn: add the support for VF drivers (SR-IOV)
Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and
a VF NIC to work together (both NICs have the same MAC address), mainly to
support seamless live migration.
When the VF device becomes UP (or DOWN), the synthetic NIC driver needs
to switch the data path from the synthetic NIC to the VF (or the opposite).
Note: multicast/broadcast packets are still received through the synthetic
NIC and we need to inject the packets through the VF interface (if the VF is
UP), even if the synthetic NIC is DOWN (so we need to force the rxfilter
to be NDIS_PACKET_TYPE_PROMISCUOUS, when the VF is UP).
Reviewed by: sephe
Approved by: sephe (mentor)
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8964
Diffstat (limited to 'sys/dev/hyperv/netvsc/hn_nvs.c')
-rw-r--r-- | sys/dev/hyperv/netvsc/hn_nvs.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/dev/hyperv/netvsc/hn_nvs.c b/sys/dev/hyperv/netvsc/hn_nvs.c index aa61a33..b4e9b1a 100644 --- a/sys/dev/hyperv/netvsc/hn_nvs.c +++ b/sys/dev/hyperv/netvsc/hn_nvs.c @@ -500,6 +500,8 @@ hn_nvs_conf_ndis(struct hn_softc *sc, int mtu) conf.nvs_type = HN_NVS_TYPE_NDIS_CONF; conf.nvs_mtu = mtu; conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; + if (sc->hn_nvs_ver >= HN_NVS_VERSION_5) + conf.nvs_caps |= HN_NVS_NDIS_CONF_SRIOV; /* NOTE: No response. */ error = hn_nvs_req_send(sc, &conf, sizeof(conf)); @@ -719,3 +721,15 @@ hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, return hn_nvs_send_rndis_sglist(chan, HN_NVS_RNDIS_MTYPE_CTRL, sndc, gpa, gpa_cnt); } + +void +hn_nvs_set_datapath(struct hn_softc *sc, uint32_t path) +{ + struct hn_nvs_datapath dp; + + memset(&dp, 0, sizeof(dp)); + dp.nvs_type = HN_NVS_TYPE_SET_DATAPATH; + dp.nvs_active_path = path; + + hn_nvs_req_send(sc, &dp, sizeof(dp)); +} |