hyperv/hn: Flatten RX filter configuration.
This paves way for more fixes. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8049
This commit is contained in:
parent
ec3eaa6fb0
commit
2f1f7f4527
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=306393
@ -265,7 +265,6 @@ struct hn_softc {
|
||||
/*
|
||||
* Externs
|
||||
*/
|
||||
extern int hv_promisc_mode;
|
||||
struct hn_send_ctx;
|
||||
|
||||
void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status);
|
||||
|
@ -205,8 +205,6 @@ struct hn_txdesc {
|
||||
* Globals
|
||||
*/
|
||||
|
||||
int hv_promisc_mode = 0; /* normal mode by default */
|
||||
|
||||
SYSCTL_NODE(_hw, OID_AUTO, hn, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL,
|
||||
"Hyper-V network interface");
|
||||
|
||||
@ -1779,7 +1777,7 @@ static void
|
||||
hn_stop(struct hn_softc *sc)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
int ret, i;
|
||||
int i;
|
||||
|
||||
HN_LOCK_ASSERT(sc);
|
||||
|
||||
@ -1795,7 +1793,8 @@ hn_stop(struct hn_softc *sc)
|
||||
|
||||
if_link_state_change(ifp, LINK_STATE_DOWN);
|
||||
|
||||
ret = hv_rf_on_close(sc);
|
||||
/* Disable RX by clearing RX filter. */
|
||||
hn_rndis_set_rxfilter(sc, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1870,9 +1869,8 @@ hn_init_locked(struct hn_softc *sc)
|
||||
return;
|
||||
}
|
||||
|
||||
hv_promisc_mode = 1;
|
||||
|
||||
ret = hv_rf_on_open(sc);
|
||||
/* TODO: add hn_rx_filter */
|
||||
ret = hn_rndis_set_rxfilter(sc, NDIS_PACKET_TYPE_PROMISCUOUS);
|
||||
if (ret != 0)
|
||||
return;
|
||||
|
||||
@ -3576,9 +3574,9 @@ hn_suspend(struct hn_softc *sc)
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable RX.
|
||||
* Disable RX by clearing RX filter.
|
||||
*/
|
||||
hv_rf_on_close(sc);
|
||||
hn_rndis_set_rxfilter(sc, 0);
|
||||
|
||||
/*
|
||||
* Give RNDIS enough time to flush all pending data packets.
|
||||
@ -3612,8 +3610,9 @@ hn_resume(struct hn_softc *sc)
|
||||
|
||||
/*
|
||||
* Re-enable RX.
|
||||
* TODO: add hn_rx_filter.
|
||||
*/
|
||||
hv_rf_on_open(sc);
|
||||
hn_rndis_set_rxfilter(sc, NDIS_PACKET_TYPE_PROMISCUOUS);
|
||||
|
||||
/*
|
||||
* Make sure to clear suspend status on "all" TX rings,
|
||||
|
@ -887,7 +887,7 @@ hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter)
|
||||
{
|
||||
int error;
|
||||
@ -1013,35 +1013,6 @@ hn_rndis_detach(struct hn_softc *sc)
|
||||
hn_rndis_halt(sc);
|
||||
}
|
||||
|
||||
/*
|
||||
* RNDIS filter on open
|
||||
*/
|
||||
int
|
||||
hv_rf_on_open(struct hn_softc *sc)
|
||||
{
|
||||
uint32_t filter;
|
||||
|
||||
/* XXX */
|
||||
if (hv_promisc_mode != 1) {
|
||||
filter = NDIS_PACKET_TYPE_BROADCAST |
|
||||
NDIS_PACKET_TYPE_ALL_MULTICAST |
|
||||
NDIS_PACKET_TYPE_DIRECTED;
|
||||
} else {
|
||||
filter = NDIS_PACKET_TYPE_PROMISCUOUS;
|
||||
}
|
||||
return (hn_rndis_set_rxfilter(sc, filter));
|
||||
}
|
||||
|
||||
/*
|
||||
* RNDIS filter on close
|
||||
*/
|
||||
int
|
||||
hv_rf_on_close(struct hn_softc *sc)
|
||||
{
|
||||
|
||||
return (hn_rndis_set_rxfilter(sc, 0));
|
||||
}
|
||||
|
||||
void
|
||||
hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr)
|
||||
{
|
||||
|
@ -43,8 +43,6 @@ struct hn_rx_ring;
|
||||
void hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr,
|
||||
const void *data, int dlen);
|
||||
void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr);
|
||||
int hv_rf_on_open(struct hn_softc *sc);
|
||||
int hv_rf_on_close(struct hn_softc *sc);
|
||||
|
||||
#endif /* __HV_RNDIS_FILTER_H__ */
|
||||
|
||||
|
@ -126,6 +126,8 @@ int hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt);
|
||||
int hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr);
|
||||
int hn_rndis_get_linkstatus(struct hn_softc *sc,
|
||||
uint32_t *link_status);
|
||||
/* filter: NDIS_PACKET_TYPE_ or 0. */
|
||||
int hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter);
|
||||
|
||||
int hn_nvs_attach(struct hn_softc *sc, int mtu);
|
||||
void hn_nvs_detach(struct hn_softc *sc);
|
||||
|
Loading…
Reference in New Issue
Block a user