Bug 210799 - if_bwi broken after upgrade from 9 to 10
Summary: if_bwi broken after upgrade from 9 to 10
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: 10.3-RELEASE
Hardware: powerpc Any
: --- Affects Only Me
Assignee: freebsd-wireless (Nobody)
URL:
Keywords: patch, regression
Depends on:
Blocks:
 
Reported: 2016-07-03 20:16 UTC by josla972
Modified: 2018-12-18 22:35 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description josla972 2016-07-03 20:16:44 UTC
After I upgraded from FreeBSD 9.0 to 10.3-RELEASE on my Mac Mini G4, I found that "kldload if_bwi" would make the system unstable, and if I included it to be loaded in loader.conf, I could not even boot. This used to work just fine.

Digging through the commits the bwi folder of the git clone of freebsd, I found the issue:

commit ad311f67aaa6771c007f5046d032924146784a23
Author: mav <mav@FreeBSD.org>
Date:   Tue Apr 21 11:27:50 2015 +0000


    MFC r280347: Remove MAXBSIZE use from drivers where it has nothing to do.
    
    In some cases limits are just not needed, in others -- DFLTPHYS is the
    right constant to use instead.

diff --git a/sys/dev/bwi/if_bwi.c b/sys/dev/bwi/if_bwi.c
index 911e49e..6ce433c1 100644
--- a/sys/dev/bwi/if_bwi.c
+++ b/sys/dev/bwi/if_bwi.c
@@ -1915,7 +1915,7 @@ bwi_dma_alloc(struct bwi_softc *sc)
                               lowaddr,                 /* lowaddr */
                               BUS_SPACE_MAXADDR,       /* highaddr */
                               NULL, NULL,              /* filter, filterarg */
-                              MAXBSIZE,                /* maxsize */
+                              BUS_SPACE_MAXSIZE,       /* maxsize */
                               BUS_SPACE_UNRESTRICTED,  /* nsegments */
                               BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
                               BUS_DMA_ALLOCNOW,        /* flags */



Reverting this commit made the system stable, if_bwi started working, and I could boot again.
Comment 1 Adrian Chadd freebsd_committer freebsd_triage 2016-07-03 22:42:03 UTC
* Can you try bwn on -HEAD and see if it works? I fixed a whole bunch of issues and I'd like to move things ot use it.

* Is this okay:

Index: sys/dev/bwi/if_bwi.c
===================================================================
--- sys/dev/bwi/if_bwi.c	(revision 302306)
+++ sys/dev/bwi/if_bwi.c	(working copy)
@@ -1899,7 +1899,7 @@
 			       lowaddr,			/* lowaddr */
 			       BUS_SPACE_MAXADDR,	/* highaddr */
 			       NULL, NULL,		/* filter, filterarg */
-			       BUS_SPACE_MAXSIZE,	/* maxsize */
+			       65536,			/* maxsize */
 			       BUS_SPACE_UNRESTRICTED,	/* nsegments */
 			       BUS_SPACE_MAXSIZE_32BIT,	/* maxsegsize */
 			       0,			/* flags */
Comment 2 josla972 2016-07-04 20:01:06 UTC
I guess you mean bwi and not bwn? I am not sure if I can build the HEAD version of the module and run it on my 10.3-RELEASE system, but if that it possible I could give it a go.

Regarding your patch submission, if you are asking me, I would personally prefer a define with a proper name. If MAXBSIZE is a no-go, then perhaps DFLTPHYS is better as suggested by mav.
Comment 3 Adrian Chadd freebsd_committer freebsd_triage 2016-07-04 20:03:01 UTC
Yeah, but those defines are to do with physical IO for disks, not for various network cards.
Comment 4 josla972 2016-07-04 20:23:32 UTC
65536 is better than the current (broken) state.

I think we should ask mav since he seems to have a strong opinion on define names ;).
Comment 5 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-07-04 21:28:15 UTC
Hi!

Try to apply fix from r283636 (there was similar issue with ndis(4)).
Comment 6 Andriy Voskoboinyk freebsd_committer freebsd_triage 2018-12-18 22:35:47 UTC
Looks like it's fixed in base r283636.