diff options
author | dexuan <dexuan@FreeBSD.org> | 2017-02-23 07:07:21 +0000 |
---|---|---|
committer | dexuan <dexuan@FreeBSD.org> | 2017-02-23 07:07:21 +0000 |
commit | d20dd8b36e7a565be7bfbb22aade51c8ffd753e9 (patch) | |
tree | 13c33e48ffdd19884b0feb91e36f393895356c47 | |
parent | eacb7ed261c8a649db8cba504d96d0f0aa0c7805 (diff) | |
download | FreeBSD-src-d20dd8b36e7a565be7bfbb22aade51c8ffd753e9.zip FreeBSD-src-d20dd8b36e7a565be7bfbb22aade51c8ffd753e9.tar.gz |
MFC r312689, r312690
Approved by: sephe (mentor)
r312689
hyperv/hn: add a sysctl name for the VF interface
This makes it easier for the userland script to find the releated
VF interface.
Reviewed by: sephe
Approved by: sephe (mentor)
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D9101
r312690
hyperv/hn: add devctl_notify for VF_UP/DOWN events
Reviewed by: sephe
Approved by: sephe (mentor)
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D9102
-rw-r--r-- | sys/dev/hyperv/netvsc/if_hn.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index b5a1da4..8e99eef 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -294,6 +294,7 @@ static int hn_txagg_pkts_sysctl(SYSCTL_HANDLER_ARGS); static int hn_txagg_pktmax_sysctl(SYSCTL_HANDLER_ARGS); static int hn_txagg_align_sysctl(SYSCTL_HANDLER_ARGS); static int hn_polling_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS); static void hn_stop(struct hn_softc *, bool); static void hn_init_locked(struct hn_softc *); @@ -982,6 +983,9 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf) hn_resume_mgmt(sc); } + devctl_notify("HYPERV_NIC_VF", if_name(hn_ifp), + vf ? "VF_UP" : "VF_DOWN", NULL); + if (bootverbose) if_printf(hn_ifp, "Data path is switched %s %s\n", vf ? "to" : "from", if_name(ifp)); @@ -1232,6 +1236,9 @@ hn_attach(device_t dev) CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, hn_polling_sysctl, "I", "Polling frequency: [100,1000000], 0 disable polling"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_vf_sysctl, "A", "Virtual Function's name"); /* * Setup the ifmedia, which has been initialized earlier. @@ -3205,6 +3212,22 @@ hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS) } static int +hn_vf_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char vf_name[128]; + struct ifnet *vf; + + HN_LOCK(sc); + vf_name[0] = '\0'; + vf = sc->hn_rx_ring[0].hn_vf; + if (vf != NULL) + snprintf(vf_name, sizeof(vf_name), "%s", if_name(vf)); + HN_UNLOCK(sc); + return sysctl_handle_string(oidp, vf_name, sizeof(vf_name), req); +} + +static int hn_check_iplen(const struct mbuf *m, int hoff) { const struct ip *ip; |