hyperv/hn: Pass MTU around.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7808
This commit is contained in:
Sepherosa Ziehau 2016-09-08 06:42:30 +00:00
parent 021deece8f
commit a74e025394
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=305581
5 changed files with 13 additions and 13 deletions

View File

@ -61,7 +61,7 @@ static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc);
static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *);
static int hv_nv_destroy_send_buffer(struct hn_softc *sc);
static int hv_nv_destroy_rx_buffer(struct hn_softc *sc);
static int hv_nv_connect_to_vsp(struct hn_softc *sc);
static int hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu);
static void hn_nvs_sent_none(struct hn_send_ctx *sndc,
struct hn_softc *, struct vmbus_channel *chan,
const void *, int);
@ -526,10 +526,9 @@ hn_nvs_init(struct hn_softc *sc)
* Net VSC connect to VSP
*/
static int
hv_nv_connect_to_vsp(struct hn_softc *sc)
hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu)
{
int ret = 0;
struct ifnet *ifp = sc->hn_ifp;
struct hn_nvs_ndis_init ndis;
ret = hn_nvs_init(sc);
@ -541,7 +540,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc)
* This needs to be right after the NVSP init message per Haiyang
*/
if (sc->hn_nvs_ver >= HN_NVS_VERSION_2)
ret = hv_nv_send_ndis_config(sc, ifp->if_mtu);
ret = hv_nv_send_ndis_config(sc, mtu);
/*
* Initialize NDIS.
@ -583,13 +582,13 @@ hv_nv_disconnect_from_vsp(struct hn_softc *sc)
* Callback when the device belonging to this driver is added
*/
int
hv_nv_on_device_add(struct hn_softc *sc)
hv_nv_on_device_add(struct hn_softc *sc, int mtu)
{
/*
* Connect with the NetVsp
*/
return (hv_nv_connect_to_vsp(sc));
return (hv_nv_connect_to_vsp(sc, mtu));
}
/*

View File

@ -261,7 +261,7 @@ extern int hv_promisc_mode;
struct hn_send_ctx;
void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status);
int hv_nv_on_device_add(struct hn_softc *sc);
int hv_nv_on_device_add(struct hn_softc *sc, int mtu);
int hv_nv_on_device_remove(struct hn_softc *sc);
int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype,
struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt);

View File

@ -528,7 +528,6 @@ netvsc_attach(device_t dev)
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = hn_ioctl;
ifp->if_init = hn_ifinit;
/* needed by hv_rf_on_device_add() code */
ifp->if_mtu = ETHERMTU;
if (hn_use_if_start) {
int qdepth = hn_get_txswq_depth(&sc->hn_tx_ring[0]);
@ -565,7 +564,7 @@ netvsc_attach(device_t dev)
if (sc->hn_xact == NULL)
goto failed;
error = hv_rf_on_device_add(sc, &device_info, &ring_cnt);
error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, ETHERMTU);
if (error)
goto failed;
KASSERT(ring_cnt > 0 && ring_cnt <= sc->hn_rx_ring_inuse,
@ -1584,7 +1583,8 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
hn_chan_attach(sc, sc->hn_prichan); /* XXX check error */
ring_cnt = sc->hn_rx_ring_inuse;
error = hv_rf_on_device_add(sc, &device_info, &ring_cnt);
error = hv_rf_on_device_add(sc, &device_info, &ring_cnt,
ifr->ifr_mtu);
if (error) {
NV_LOCK(sc);
sc->temp_unusable = FALSE;

View File

@ -1012,7 +1012,7 @@ hv_rf_halt_device(struct hn_softc *sc)
*/
int
hv_rf_on_device_add(struct hn_softc *sc, void *additl_info,
int *nchan0)
int *nchan0, int mtu)
{
int ret;
netvsc_device_info *dev_info = (netvsc_device_info *)additl_info;
@ -1031,7 +1031,7 @@ hv_rf_on_device_add(struct hn_softc *sc, void *additl_info,
* (hv_rf_on_receive()) before this call is completed.
* Note: Earlier code used a function pointer here.
*/
ret = hv_nv_on_device_add(sc);
ret = hv_nv_on_device_add(sc, mtu);
if (ret != 0)
return (ret);

View File

@ -43,7 +43,8 @@ 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_device_add(struct hn_softc *sc, void *additl_info, int *nchan);
int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int *nchan,
int mtu);
int hv_rf_on_device_remove(struct hn_softc *sc);
int hv_rf_on_open(struct hn_softc *sc);
int hv_rf_on_close(struct hn_softc *sc);