Date: Tue, 13 Mar 2018 21:42:38 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r330882 - head/sys/dev/cxgbe/tom Message-ID: <201803132142.w2DLgc2F070077@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Tue Mar 13 21:42:38 2018 New Revision: 330882 URL: https://svnweb.freebsd.org/changeset/base/330882 Log: Simplify error handling in t4_tom.ko module loading. - Change t4_ddp_mod_load() to return void instead of always returning success. This avoids having to pretend to have proper support for unloading when only part of t4_tom_mod_load() has run. - If t4_register_uld() fails, don't invoke t4_tom_mod_unload() directly. The module handling code in the kernel invokes MOD_UNLOAD on a module whose MOD_LOAD fails with an error already. Reviewed by: np (part of a larger patch) MFC after: 1 month Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_ddp.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Tue Mar 13 20:54:18 2018 (r330881) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Tue Mar 13 21:42:38 2018 (r330882) @@ -1939,7 +1939,7 @@ t4_aio_queue_ddp(struct socket *so, struct kaiocb *job return (0); } -int +void t4_ddp_mod_load(void) { @@ -1948,7 +1948,6 @@ t4_ddp_mod_load(void) TAILQ_INIT(&ddp_orphan_pagesets); mtx_init(&ddp_orphan_pagesets_lock, "ddp orphans", NULL, MTX_DEF); TASK_INIT(&ddp_orphan_task, 0, ddp_free_orphan_pagesets, NULL); - return (0); } void Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Tue Mar 13 20:54:18 2018 (r330881) +++ head/sys/dev/cxgbe/tom/t4_tom.c Tue Mar 13 21:42:38 2018 (r330882) @@ -1170,7 +1170,6 @@ t4_aio_queue_tom(struct socket *so, struct kaiocb *job static int t4_tom_mod_load(void) { - int rc; struct protosw *tcp_protosw, *tcp6_protosw; /* CPL handlers */ @@ -1178,9 +1177,7 @@ t4_tom_mod_load(void) t4_init_listen_cpl_handlers(); t4_init_cpl_io_handlers(); - rc = t4_ddp_mod_load(); - if (rc != 0) - return (rc); + t4_ddp_mod_load(); tcp_protosw = pffindproto(PF_INET, IPPROTO_TCP, SOCK_STREAM); if (tcp_protosw == NULL) @@ -1202,11 +1199,7 @@ t4_tom_mod_load(void) ifaddr_evhandler = EVENTHANDLER_REGISTER(ifaddr_event, t4_tom_ifaddr_event, NULL, EVENTHANDLER_PRI_ANY); - rc = t4_register_uld(&tom_uld_info); - if (rc != 0) - t4_tom_mod_unload(); - - return (rc); + return (t4_register_uld(&tom_uld_info)); } static void Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Tue Mar 13 20:54:18 2018 (r330881) +++ head/sys/dev/cxgbe/tom/t4_tom.h Tue Mar 13 21:42:38 2018 (r330882) @@ -389,7 +389,7 @@ void t4_free_page_pods(struct ppod_reservation *); int t4_soreceive_ddp(struct socket *, struct sockaddr **, struct uio *, struct mbuf **, struct mbuf **, int *); int t4_aio_queue_ddp(struct socket *, struct kaiocb *); -int t4_ddp_mod_load(void); +void t4_ddp_mod_load(void); void t4_ddp_mod_unload(void); void ddp_assert_empty(struct toepcb *); void ddp_init_toep(struct toepcb *);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803132142.w2DLgc2F070077>