svn commit: r312689 - head/sys/dev/hyperv/netvsc
Dexuan Cui
dexuan at FreeBSD.org
Tue Jan 24 09:25:44 UTC 2017
Author: dexuan
Date: Tue Jan 24 09:25:42 2017
New Revision: 312689
URL: https://svnweb.freebsd.org/changeset/base/312689
Log:
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)
MFC after: 2 weeks
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D9101
Modified:
head/sys/dev/hyperv/netvsc/if_hn.c
Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:24:14 2017 (r312688)
+++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:25:42 2017 (r312689)
@@ -301,6 +301,7 @@ static int hn_txagg_pkts_sysctl(SYSCTL
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 *);
@@ -1254,6 +1255,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.
@@ -3222,6 +3226,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;
More information about the svn-src-all
mailing list