svn commit: r344856 - stable/11/sys/dev/cxgbe/tom

John Baldwin jhb at FreeBSD.org
Wed Mar 6 22:13:55 UTC 2019


Author: jhb
Date: Wed Mar  6 22:13:53 2019
New Revision: 344856
URL: https://svnweb.freebsd.org/changeset/base/344856

Log:
  MFC 330882: 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.

Modified:
  stable/11/sys/dev/cxgbe/tom/t4_ddp.c
  stable/11/sys/dev/cxgbe/tom/t4_tom.c
  stable/11/sys/dev/cxgbe/tom/t4_tom.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/cxgbe/tom/t4_ddp.c
==============================================================================
--- stable/11/sys/dev/cxgbe/tom/t4_ddp.c	Wed Mar  6 22:11:45 2019	(r344855)
+++ stable/11/sys/dev/cxgbe/tom/t4_ddp.c	Wed Mar  6 22:13:53 2019	(r344856)
@@ -1944,7 +1944,7 @@ t4_aio_queue_ddp(struct socket *so, struct kaiocb *job
 	return (0);
 }
 
-int
+void
 t4_ddp_mod_load(void)
 {
 
@@ -1953,7 +1953,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: stable/11/sys/dev/cxgbe/tom/t4_tom.c
==============================================================================
--- stable/11/sys/dev/cxgbe/tom/t4_tom.c	Wed Mar  6 22:11:45 2019	(r344855)
+++ stable/11/sys/dev/cxgbe/tom/t4_tom.c	Wed Mar  6 22:13:53 2019	(r344856)
@@ -1162,7 +1162,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 */
@@ -1170,9 +1169,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)
@@ -1194,11 +1191,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: stable/11/sys/dev/cxgbe/tom/t4_tom.h
==============================================================================
--- stable/11/sys/dev/cxgbe/tom/t4_tom.h	Wed Mar  6 22:11:45 2019	(r344855)
+++ stable/11/sys/dev/cxgbe/tom/t4_tom.h	Wed Mar  6 22:13:53 2019	(r344856)
@@ -386,7 +386,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 *);


More information about the svn-src-stable mailing list