Date: Mon, 12 Sep 2016 05:59:40 +0000 (UTC) From: Sepherosa Ziehau <sephe@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305729 - head/sys/dev/hyperv/netvsc Message-ID: <201609120559.u8C5xe06079228@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sephe Date: Mon Sep 12 05:59:39 2016 New Revision: 305729 URL: https://svnweb.freebsd.org/changeset/base/305729 Log: hyperv/hn: Reorganize RNDIS attach MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7830 Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Sep 12 05:37:44 2016 (r305728) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Sep 12 05:59:39 2016 (r305729) @@ -78,7 +78,6 @@ static void hv_rf_receive_data(struct hn static int hv_rf_query_device_mac(struct hn_softc *sc, uint8_t *eaddr); static int hv_rf_query_device_link_status(struct hn_softc *sc, uint32_t *link_status); -static int hv_rf_init_device(struct hn_softc *sc); static int hn_rndis_query(struct hn_softc *sc, uint32_t oid, const void *idata, size_t idlen, void *odata, size_t *odlen0); @@ -922,11 +921,8 @@ hn_rndis_set_rxfilter(struct hn_softc *s return (error); } -/* - * RNDIS filter init device - */ static int -hv_rf_init_device(struct hn_softc *sc) +hn_rndis_init(struct hn_softc *sc) { struct rndis_init_req *req; const struct rndis_init_comp *comp; @@ -1007,9 +1003,26 @@ hv_rf_halt_device(struct hn_softc *sc) return (0); } -/* - * RNDIS filter on device add - */ +static int +hn_rndis_attach(struct hn_softc *sc) +{ + int error; + + /* + * Initialize RNDIS. + */ + error = hn_rndis_init(sc); + if (error) + return (error); + + /* + * Configure NDIS offload settings. + * XXX no offloading, if error happened? + */ + hn_rndis_conf_offload(sc); + return (0); +} + int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int *nchan0, int mtu) @@ -1023,28 +1036,15 @@ hv_rf_on_device_add(struct hn_softc *sc, if (ret != 0) return (ret); - /* - * Initialize the rndis device - */ - - /* Send the rndis initialization message */ - ret = hv_rf_init_device(sc); - if (ret != 0) { - /* - * TODO: If rndis init failed, we will need to shut down - * the channel - */ - } + ret = hn_rndis_attach(sc); + if (ret != 0) + return (ret); /* Get the mac address */ ret = hv_rf_query_device_mac(sc, dev_info->mac_addr); if (ret != 0) { /* TODO: shut down rndis device and the channel */ } - - /* Configure NDIS offload settings */ - hn_rndis_conf_offload(sc); - hv_rf_query_device_link_status(sc, &dev_info->link_state); if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30 || nchan == 1) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609120559.u8C5xe06079228>