Date: Mon, 12 Sep 2016 05:18:31 +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: r305725 - head/sys/dev/hyperv/netvsc Message-ID: <201609120518.u8C5IVFX060519@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sephe Date: Mon Sep 12 05:18:30 2016 New Revision: 305725 URL: https://svnweb.freebsd.org/changeset/base/305725 Log: hyperv/hn: Rename chimney sending buffer connect/disconnect functions. Minor cleanup and wording in error messages. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7825 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Sep 12 05:09:45 2016 (r305724) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Sep 12 05:18:30 2016 (r305725) @@ -57,9 +57,9 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper /* * Forward declarations */ -static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc); +static int hn_nvs_conn_chim(struct hn_softc *sc); static int hn_nvs_conn_rxbuf(struct hn_softc *); -static int hv_nv_destroy_send_buffer(struct hn_softc *sc); +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, @@ -231,11 +231,8 @@ cleanup: return (error); } -/* - * Net VSC initialize send buffer with net VSP - */ static int -hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc) +hn_nvs_conn_chim(struct hn_softc *sc) { struct vmbus_xact *xact = NULL; struct hn_nvs_chim_conn *chim; @@ -255,8 +252,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru sc->hn_chim_dma.hv_paddr, NETVSC_SEND_BUFFER_SIZE, &sc->hn_chim_gpadl); if (error) { - if_printf(sc->hn_ifp, "chimney sending buffer gpadl " - "connect failed: %d\n", error); + if_printf(sc->hn_ifp, "chim gpadl conn failed: %d\n", error); goto cleanup; } @@ -279,7 +275,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru resp = hn_nvs_xact_execute(sc, xact, chim, sizeof(*chim), &resp_len, HN_NVS_TYPE_CHIM_CONNRESP); if (resp == NULL) { - if_printf(sc->hn_ifp, "exec chim conn failed\n"); + if_printf(sc->hn_ifp, "exec nvs chim conn failed\n"); error = EIO; goto cleanup; } @@ -290,14 +286,14 @@ hv_nv_init_send_buffer_with_net_vsp(stru xact = NULL; if (status != HN_NVS_STATUS_OK) { - if_printf(sc->hn_ifp, "chim conn failed: %x\n", status); + if_printf(sc->hn_ifp, "nvs chim conn failed: %x\n", status); error = EIO; goto cleanup; } if (sectsz == 0) { if_printf(sc->hn_ifp, "zero chimney sending buffer " "section size\n"); - return 0; + return (0); } sc->hn_chim_szmax = sectsz; @@ -321,12 +317,12 @@ hv_nv_init_send_buffer_with_net_vsp(stru if_printf(sc->hn_ifp, "chimney sending buffer %d/%d\n", sc->hn_chim_szmax, sc->hn_chim_cnt); } - return 0; + return (0); cleanup: if (xact != NULL) vmbus_xact_put(xact); - hv_nv_destroy_send_buffer(sc); + hn_nvs_disconn_chim(sc); return (error); } @@ -371,13 +367,10 @@ hn_nvs_disconn_rxbuf(struct hn_softc *sc return (0); } -/* - * Net VSC destroy send buffer - */ static int -hv_nv_destroy_send_buffer(struct hn_softc *sc) +hn_nvs_disconn_chim(struct hn_softc *sc) { - int ret = 0; + int error; if (sc->hn_flags & HN_FLAG_CHIM_CONNECTED) { struct hn_nvs_chim_disconn disconn; @@ -390,25 +383,25 @@ hv_nv_destroy_send_buffer(struct hn_soft disconn.nvs_sig = HN_NVS_CHIM_SIG; /* NOTE: No response. */ - ret = hn_nvs_req_send(sc, &disconn, sizeof(disconn)); - if (ret != 0) { + error = hn_nvs_req_send(sc, &disconn, sizeof(disconn)); + if (error) { if_printf(sc->hn_ifp, - "send chim disconn failed: %d\n", ret); - return (ret); + "send nvs chim disconn failed: %d\n", error); + return (error); } sc->hn_flags &= ~HN_FLAG_CHIM_CONNECTED; } - + if (sc->hn_chim_gpadl != 0) { /* * Disconnect chimney sending buffer from primary channel. */ - ret = vmbus_chan_gpadl_disconnect(sc->hn_prichan, + error = vmbus_chan_gpadl_disconnect(sc->hn_prichan, sc->hn_chim_gpadl); - if (ret != 0) { + if (error) { if_printf(sc->hn_ifp, - "chim disconn failed: %d\n", ret); - return (ret); + "chim gpadl disconn failed: %d\n", error); + return (error); } sc->hn_chim_gpadl = 0; } @@ -417,8 +410,7 @@ hv_nv_destroy_send_buffer(struct hn_soft free(sc->hn_chim_bmap, M_NETVSC); sc->hn_chim_bmap = NULL; } - - return (ret); + return (0); } static int @@ -567,7 +559,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc /* * Connect chimney sending buffer. */ - return hv_nv_init_send_buffer_with_net_vsp(sc); + return hn_nvs_conn_chim(sc); } /* @@ -577,7 +569,7 @@ static void hv_nv_disconnect_from_vsp(struct hn_softc *sc) { hn_nvs_disconn_rxbuf(sc); - hv_nv_destroy_send_buffer(sc); + hn_nvs_disconn_chim(sc); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609120518.u8C5IVFX060519>