Hyper-V: hn: add switch to turn on and off RSC
Currently RSC offloading is enabled by default.
With this new change rsc will be disabled by default.
By using sysctl we can enable and disable it.
Reviewed by: whu
Signed-off-by: Souradeep Chakrabarti <schakrabarti@microsoft.com>
Fixes: a491581f3f
Enable vSwitch RSC support in hn netvsc driver
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D34507
This commit is contained in:
parent
734782a781
commit
80c3eb7bc6
@ -579,6 +579,12 @@ hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data, size_t dlen)
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
hn_rndis_reconf_offload(struct hn_softc *sc, int mtu)
|
||||
{
|
||||
return(hn_rndis_conf_offload(sc, mtu));
|
||||
}
|
||||
|
||||
static int
|
||||
hn_rndis_conf_offload(struct hn_softc *sc, int mtu)
|
||||
{
|
||||
@ -725,7 +731,8 @@ hn_rndis_conf_offload(struct hn_softc *sc, int mtu)
|
||||
|
||||
/* RSC offload */
|
||||
if (hwcaps.ndis_hdr.ndis_rev >= NDIS_OFFLOAD_PARAMS_REV_3) {
|
||||
if (hwcaps.ndis_rsc.ndis_ip4 && hwcaps.ndis_rsc.ndis_ip6) {
|
||||
if (hwcaps.ndis_rsc.ndis_ip4 && hwcaps.ndis_rsc.ndis_ip6 &&
|
||||
sc->hn_rsc_ctrl) {
|
||||
params.ndis_rsc_ip4 = NDIS_OFFLOAD_RSC_ON;
|
||||
params.ndis_rsc_ip6 = NDIS_OFFLOAD_RSC_ON;
|
||||
} else {
|
||||
|
@ -46,5 +46,6 @@ int hn_rndis_get_mtu(struct hn_softc *sc, uint32_t *mtu);
|
||||
int hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter);
|
||||
void hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data,
|
||||
int dlen);
|
||||
int hn_rndis_reconf_offload(struct hn_softc *sc, int mtu);
|
||||
|
||||
#endif /* !_HN_RNDIS_H_ */
|
||||
|
@ -454,6 +454,8 @@ static void hn_start_txeof(struct hn_tx_ring *);
|
||||
static void hn_start_txeof_taskfunc(void *, int);
|
||||
#endif
|
||||
|
||||
static int hn_rsc_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
|
||||
SYSCTL_NODE(_hw, OID_AUTO, hn, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL,
|
||||
"Hyper-V network interface");
|
||||
|
||||
@ -2370,6 +2372,10 @@ hn_attach(device_t dev)
|
||||
"Accurate BPF for transparent VF");
|
||||
}
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rsc_switch",
|
||||
CTLTYPE_UINT | CTLFLAG_RW, sc, 0, hn_rsc_sysctl, "A",
|
||||
"switch to rsc");
|
||||
|
||||
/*
|
||||
* Setup the ifmedia, which has been initialized earlier.
|
||||
*/
|
||||
@ -4567,6 +4573,30 @@ hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
return sysctl_handle_string(oidp, filter_str, sizeof(filter_str), req);
|
||||
}
|
||||
|
||||
static int
|
||||
hn_rsc_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct hn_softc *sc = arg1;
|
||||
uint32_t mtu;
|
||||
int error;
|
||||
HN_LOCK(sc);
|
||||
error = hn_rndis_get_mtu(sc, &mtu);
|
||||
if (error) {
|
||||
if_printf(sc->hn_ifp, "failed to get mtu\n");
|
||||
goto back;
|
||||
}
|
||||
error = SYSCTL_OUT(req, &(sc->hn_rsc_ctrl), sizeof(sc->hn_rsc_ctrl));
|
||||
if (error || req->newptr == NULL)
|
||||
goto back;
|
||||
|
||||
error = SYSCTL_IN(req, &(sc->hn_rsc_ctrl), sizeof(sc->hn_rsc_ctrl));
|
||||
if (error)
|
||||
goto back;
|
||||
error = hn_rndis_reconf_offload(sc, mtu);
|
||||
back:
|
||||
HN_UNLOCK(sc);
|
||||
return (error);
|
||||
}
|
||||
#ifndef RSS
|
||||
|
||||
static int
|
||||
|
@ -282,6 +282,11 @@ struct hn_softc {
|
||||
u_int hn_saved_tsomax;
|
||||
u_int hn_saved_tsosegcnt;
|
||||
u_int hn_saved_tsosegsz;
|
||||
|
||||
/*
|
||||
* RSC switch, default off
|
||||
*/
|
||||
u_int hn_rsc_ctrl;
|
||||
};
|
||||
|
||||
#define HN_FLAG_RXBUF_CONNECTED 0x0001
|
||||
|
Loading…
Reference in New Issue
Block a user