Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/if_hn.c
Show First 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | |||||
static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); | static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); | ||||
#endif | #endif | ||||
static int hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS); | static int hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS); | ||||
static int hn_txagg_size_sysctl(SYSCTL_HANDLER_ARGS); | static int hn_txagg_size_sysctl(SYSCTL_HANDLER_ARGS); | ||||
static int hn_txagg_pkts_sysctl(SYSCTL_HANDLER_ARGS); | static int hn_txagg_pkts_sysctl(SYSCTL_HANDLER_ARGS); | ||||
static int hn_txagg_pktmax_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_txagg_align_sysctl(SYSCTL_HANDLER_ARGS); | ||||
static int hn_polling_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_stop(struct hn_softc *, bool); | ||||
static void hn_init_locked(struct hn_softc *); | static void hn_init_locked(struct hn_softc *); | ||||
static int hn_chan_attach(struct hn_softc *, | static int hn_chan_attach(struct hn_softc *, | ||||
struct vmbus_channel *); | struct vmbus_channel *); | ||||
static void hn_chan_detach(struct hn_softc *, | static void hn_chan_detach(struct hn_softc *, | ||||
struct vmbus_channel *); | struct vmbus_channel *); | ||||
static int hn_attach_subchans(struct hn_softc *); | static int hn_attach_subchans(struct hn_softc *); | ||||
▲ Show 20 Lines • Show All 937 Lines • ▼ Show 20 Lines | SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "agg_pkts", | ||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, | ||||
hn_txagg_pkts_sysctl, "I", | hn_txagg_pkts_sysctl, "I", | ||||
"Packet transmission aggregation packets, " | "Packet transmission aggregation packets, " | ||||
"0 -- disable, -1 -- auto"); | "0 -- disable, -1 -- auto"); | ||||
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "polling", | SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "polling", | ||||
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, | ||||
hn_polling_sysctl, "I", | hn_polling_sysctl, "I", | ||||
"Polling frequency: [100,1000000], 0 disable polling"); | "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. | * Setup the ifmedia, which has been initialized earlier. | ||||
*/ | */ | ||||
ifmedia_add(&sc->hn_media, IFM_ETHER | IFM_AUTO, 0, NULL); | ifmedia_add(&sc->hn_media, IFM_ETHER | IFM_AUTO, 0, NULL); | ||||
ifmedia_set(&sc->hn_media, IFM_ETHER | IFM_AUTO); | ifmedia_set(&sc->hn_media, IFM_ETHER | IFM_AUTO); | ||||
/* XXX ifmedia_set really should do this for us */ | /* XXX ifmedia_set really should do this for us */ | ||||
sc->hn_media.ifm_media = sc->hn_media.ifm_cur->ifm_media; | sc->hn_media.ifm_media = sc->hn_media.ifm_cur->ifm_media; | ||||
▲ Show 20 Lines • Show All 1,949 Lines • ▼ Show 20 Lines | hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS) | ||||
char hash_str[128]; | char hash_str[128]; | ||||
uint32_t hash; | uint32_t hash; | ||||
HN_LOCK(sc); | HN_LOCK(sc); | ||||
hash = sc->hn_rss_hash; | hash = sc->hn_rss_hash; | ||||
HN_UNLOCK(sc); | HN_UNLOCK(sc); | ||||
snprintf(hash_str, sizeof(hash_str), "%b", hash, NDIS_HASH_BITS); | snprintf(hash_str, sizeof(hash_str), "%b", hash, NDIS_HASH_BITS); | ||||
return sysctl_handle_string(oidp, hash_str, sizeof(hash_str), req); | return sysctl_handle_string(oidp, hash_str, sizeof(hash_str), req); | ||||
} | |||||
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 | static int | ||||
hn_check_iplen(const struct mbuf *m, int hoff) | hn_check_iplen(const struct mbuf *m, int hoff) | ||||
{ | { | ||||
const struct ip *ip; | const struct ip *ip; | ||||
int len, iphlen, iplen; | int len, iphlen, iplen; | ||||
const struct tcphdr *th; | const struct tcphdr *th; | ||||
▲ Show 20 Lines • Show All 2,491 Lines • Show Last 20 Lines |