hyperv/hn: Function rename.

- Minor style changes.
- Nuke unnecessary indirection.
- Nuke unapplied comment.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7827
This commit is contained in:
Sepherosa Ziehau 2016-09-12 05:28:50 +00:00
parent 1648ac5095
commit b5f59ae0e2
3 changed files with 21 additions and 40 deletions

View file

@ -61,7 +61,6 @@ static int hn_nvs_conn_chim(struct hn_softc *sc);
static int hn_nvs_conn_rxbuf(struct hn_softc *);
static int hn_nvs_disconn_chim(struct hn_softc *sc);
static int hn_nvs_disconn_rxbuf(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);
@ -521,45 +520,48 @@ hn_nvs_init(struct hn_softc *sc)
return (ENXIO);
}
static int
hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu)
int
hn_nvs_attach(struct hn_softc *sc, int mtu)
{
int ret;
int error;
/*
* Initialize NVS.
*/
ret = hn_nvs_init(sc);
if (ret != 0)
return (ret);
error = hn_nvs_init(sc);
if (error)
return (error);
if (sc->hn_nvs_ver >= HN_NVS_VERSION_2) {
/*
* Configure NDIS before initializing it.
*/
ret = hn_nvs_conf_ndis(sc, mtu);
if (ret != 0)
return (ret);
error = hn_nvs_conf_ndis(sc, mtu);
if (error)
return (error);
}
/*
* Initialize NDIS.
*/
ret = hn_nvs_init_ndis(sc);
if (ret != 0)
return (ret);
error = hn_nvs_init_ndis(sc);
if (error)
return (error);
/*
* Connect RXBUF.
*/
ret = hn_nvs_conn_rxbuf(sc);
if (ret != 0)
return (ret);
error = hn_nvs_conn_rxbuf(sc);
if (error)
return (error);
/*
* Connect chimney sending buffer.
*/
return hn_nvs_conn_chim(sc);
error = hn_nvs_conn_chim(sc);
if (error)
return (error);
return (0);
}
/*
@ -572,21 +574,6 @@ hv_nv_disconnect_from_vsp(struct hn_softc *sc)
hn_nvs_disconn_chim(sc);
}
/*
* Net VSC on device add
*
* Callback when the device belonging to this driver is added
*/
int
hv_nv_on_device_add(struct hn_softc *sc, int mtu)
{
/*
* Connect with the NetVsp
*/
return (hv_nv_connect_to_vsp(sc, mtu));
}
/*
* Net VSC on device remove
*/

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 mtu);
int hn_nvs_attach(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

@ -1025,13 +1025,7 @@ hv_rf_on_device_add(struct hn_softc *sc, void *additl_info,
int nchan = *nchan0;
int rxr_cnt;
/*
* Let the inner driver handle this first to create the netvsc channel
* NOTE! Once the channel is created, we may get a receive callback
* (hv_rf_on_receive()) before this call is completed.
* Note: Earlier code used a function pointer here.
*/
ret = hv_nv_on_device_add(sc, mtu);
ret = hn_nvs_attach(sc, mtu);
if (ret != 0)
return (ret);