Date: Fri, 26 Sep 2014 07:12:41 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272158 - head/sys/net Message-ID: <201409260712.s8Q7Cf8g088875@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Fri Sep 26 07:12:40 2014 New Revision: 272158 URL: http://svnweb.freebsd.org/changeset/base/272158 Log: Make lagg protocols detach methods returning void. Sponsored by: Netflix Sponsored by: Nginx, Inc. Modified: head/sys/net/ieee8023ad_lacp.c head/sys/net/ieee8023ad_lacp.h head/sys/net/if_lagg.c head/sys/net/if_lagg.h Modified: head/sys/net/ieee8023ad_lacp.c ============================================================================== --- head/sys/net/ieee8023ad_lacp.c Fri Sep 26 07:01:27 2014 (r272157) +++ head/sys/net/ieee8023ad_lacp.c Fri Sep 26 07:12:40 2014 (r272158) @@ -822,7 +822,7 @@ lacp_attach(struct lagg_softc *sc) return (0); } -int +void lacp_detach(struct lagg_softc *sc) { struct lacp_softc *lsc = LACP_SOFTC(sc); @@ -838,7 +838,6 @@ lacp_detach(struct lagg_softc *sc) LACP_LOCK_DESTROY(lsc); free(lsc, M_DEVBUF); - return (0); } void Modified: head/sys/net/ieee8023ad_lacp.h ============================================================================== --- head/sys/net/ieee8023ad_lacp.h Fri Sep 26 07:01:27 2014 (r272157) +++ head/sys/net/ieee8023ad_lacp.h Fri Sep 26 07:12:40 2014 (r272158) @@ -283,7 +283,7 @@ struct lacp_softc { struct mbuf *lacp_input(struct lagg_port *, struct mbuf *); struct lagg_port *lacp_select_tx_port(struct lagg_softc *, struct mbuf *); int lacp_attach(struct lagg_softc *); -int lacp_detach(struct lagg_softc *); +void lacp_detach(struct lagg_softc *); void lacp_init(struct lagg_softc *); void lacp_stop(struct lagg_softc *); int lacp_port_create(struct lagg_port *); Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Fri Sep 26 07:01:27 2014 (r272157) +++ head/sys/net/if_lagg.c Fri Sep 26 07:12:40 2014 (r272158) @@ -126,21 +126,19 @@ static int lagg_sysctl_active(SYSCTL_HAN /* Simple round robin */ static int lagg_rr_attach(struct lagg_softc *); -static int lagg_rr_detach(struct lagg_softc *); static int lagg_rr_start(struct lagg_softc *, struct mbuf *); static struct mbuf *lagg_rr_input(struct lagg_softc *, struct lagg_port *, struct mbuf *); /* Active failover */ static int lagg_fail_attach(struct lagg_softc *); -static int lagg_fail_detach(struct lagg_softc *); static int lagg_fail_start(struct lagg_softc *, struct mbuf *); static struct mbuf *lagg_fail_input(struct lagg_softc *, struct lagg_port *, struct mbuf *); /* Loadbalancing */ static int lagg_lb_attach(struct lagg_softc *); -static int lagg_lb_detach(struct lagg_softc *); +static void lagg_lb_detach(struct lagg_softc *); static int lagg_lb_port_create(struct lagg_port *); static void lagg_lb_port_destroy(struct lagg_port *); static int lagg_lb_start(struct lagg_softc *, struct mbuf *); @@ -150,14 +148,13 @@ static int lagg_lb_porttable(struct lagg /* Broadcast */ static int lagg_bcast_attach(struct lagg_softc *); -static int lagg_bcast_detach(struct lagg_softc *); static int lagg_bcast_start(struct lagg_softc *, struct mbuf *); static struct mbuf *lagg_bcast_input(struct lagg_softc *, struct lagg_port *, struct mbuf *); /* 802.3ad LACP */ static int lagg_lacp_attach(struct lagg_softc *); -static int lagg_lacp_detach(struct lagg_softc *); +static void lagg_lacp_detach(struct lagg_softc *); static int lagg_lacp_start(struct lagg_softc *, struct mbuf *); static struct mbuf *lagg_lacp_input(struct lagg_softc *, struct lagg_port *, struct mbuf *); @@ -1042,7 +1039,8 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd if (sc->sc_proto != LAGG_PROTO_NONE) { /* Reset protocol first in case detach unlocks */ sc->sc_proto = LAGG_PROTO_NONE; - error = sc->sc_detach(sc); + if (sc->sc_detach != NULL) + sc->sc_detach(sc); sc->sc_detach = NULL; sc->sc_start = NULL; sc->sc_input = NULL; @@ -1674,9 +1672,9 @@ lagg_enqueue(struct ifnet *ifp, struct m static int lagg_rr_attach(struct lagg_softc *sc) { - sc->sc_detach = lagg_rr_detach; sc->sc_start = lagg_rr_start; sc->sc_input = lagg_rr_input; + sc->sc_detach = NULL;; sc->sc_port_create = NULL; sc->sc_capabilities = IFCAP_LAGG_FULLDUPLEX; sc->sc_seq = 0; @@ -1685,12 +1683,6 @@ lagg_rr_attach(struct lagg_softc *sc) } static int -lagg_rr_detach(struct lagg_softc *sc) -{ - return (0); -} - -static int lagg_rr_start(struct lagg_softc *sc, struct mbuf *m) { struct lagg_port *lp; @@ -1733,12 +1725,12 @@ lagg_rr_input(struct lagg_softc *sc, str static int lagg_bcast_attach(struct lagg_softc *sc) { - sc->sc_detach = lagg_bcast_detach; sc->sc_start = lagg_bcast_start; sc->sc_input = lagg_bcast_input; sc->sc_port_create = NULL; sc->sc_port_destroy = NULL; sc->sc_linkstate = NULL; + sc->sc_detach = NULL; sc->sc_req = NULL; sc->sc_portreq = NULL; @@ -1746,12 +1738,6 @@ lagg_bcast_attach(struct lagg_softc *sc) } static int -lagg_bcast_detach(struct lagg_softc *sc) -{ - return (0); -} - -static int lagg_bcast_start(struct lagg_softc *sc, struct mbuf *m) { int active_ports = 0; @@ -1818,22 +1804,16 @@ lagg_bcast_input(struct lagg_softc *sc, static int lagg_fail_attach(struct lagg_softc *sc) { - sc->sc_detach = lagg_fail_detach; sc->sc_start = lagg_fail_start; sc->sc_input = lagg_fail_input; sc->sc_port_create = NULL; sc->sc_port_destroy = NULL; + sc->sc_detach = NULL; return (0); } static int -lagg_fail_detach(struct lagg_softc *sc) -{ - return (0); -} - -static int lagg_fail_start(struct lagg_softc *sc, struct mbuf *m) { struct lagg_port *lp; @@ -1905,13 +1885,14 @@ lagg_lb_attach(struct lagg_softc *sc) return (0); } -static int +static void lagg_lb_detach(struct lagg_softc *sc) { - struct lagg_lb *lb = (struct lagg_lb *)sc->sc_psc; + struct lagg_lb *lb; + + lb = (struct lagg_lb *)sc->sc_psc; if (lb != NULL) free(lb, M_DEVBUF); - return (0); } static int @@ -2020,21 +2001,18 @@ lagg_lacp_attach(struct lagg_softc *sc) return (error); } -static int +static void lagg_lacp_detach(struct lagg_softc *sc) { struct lagg_port *lp; - int error; SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) lacp_port_destroy(lp); /* unlocking is safe here */ LAGG_WUNLOCK(sc); - error = lacp_detach(sc); + lacp_detach(sc); LAGG_WLOCK(sc); - - return (error); } static void Modified: head/sys/net/if_lagg.h ============================================================================== --- head/sys/net/if_lagg.h Fri Sep 26 07:01:27 2014 (r272157) +++ head/sys/net/if_lagg.h Fri Sep 26 07:12:40 2014 (r272158) @@ -216,7 +216,7 @@ struct lagg_softc { the lladdr on */ /* lagg protocol callbacks */ - int (*sc_detach)(struct lagg_softc *); + void (*sc_detach)(struct lagg_softc *); int (*sc_start)(struct lagg_softc *, struct mbuf *); struct mbuf *(*sc_input)(struct lagg_softc *, struct lagg_port *, struct mbuf *);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409260712.s8Q7Cf8g088875>