Discussion:
bwfm(4) PCI support
(too old to reply)
c***@sdf.org
2018-05-04 06:24:42 UTC
Permalink
Re-sending with patches as URLs to avoid hitting the spam filter...

Hi folks.

I'm new to network driver code. I've managed to get a working bwfm with
the mentioned patches, though I haven't done a full release build yet.
I've only tested an open network due to not having other choices, but I
will soon test WPA.
It seems to work for fetching files & pinging stuff.

Let me know what you think. I will commit this in a few days if nobody
objects.

http://coypu.sdf.org/0001-sync-with-openbsd-bwfm.patch
http://coypu.sdf.org/0002-add-bwfm-pci-support.-tested-on-BCM43602.patch
http://coypu.sdf.org/0003-Add-firmware-for-bwfm-pci.patch
http://coypu.sdf.org/0004-Update-bwfm-4-to-note-PCI-support-and-mention-jmcnei.patch


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Jared McNeill
2018-05-04 10:15:39 UTC
Permalink
Post by c***@sdf.org
http://coypu.sdf.org/0001-sync-with-openbsd-bwfm.patch
Two issues:

@@ -307,6 +313,12 @@ bwfm_start(struct ifnet *ifp)
continue;
}

+ if (sc->sc_bus_ops->bs_txcheck(sc)) {
+ IF_PREPEND(&ifp->if_snd, m);
+ ifp->if_flags |= IFF_OACTIVE;
+ break;
+ }
+
IFQ_DEQUEUE(&ifp->if_snd, m);
if (m == NULL)
break;

Remove the IF_PREPEND here. You only need to do that after dequeue. In
this case, m will always be NULL.

-

+int
+bwfm_usb_txcheck(struct bwfm_softc *bwfm)
+{
+ struct bwfm_usb_softc *sc = (void *)bwfm;
+
+ mutex_enter(&sc->sc_tx_lock);
+
+ if (TAILQ_EMPTY(&sc->sc_tx_free_list)) {
+ mutex_exit(&sc->sc_tx_lock);
+ return ENOBUFS;
+ }
+
+ return 0;
+}

Missing mutex_exit in the success path here.
Post by c***@sdf.org
http://coypu.sdf.org/0004-Update-bwfm-4-to-note-PCI-support-and-mention-jmcnei.patch
I wouldn't say I wrote the driver, only ported it. Also note
capitalization of my last name.

Cheers,
Jared

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Jason Thorpe
2018-05-04 13:43:21 UTC
Permalink
I’ll also take a look at this later today (I’ve also been working on bwfm, so want to compare changes to provide additional feedback).

(Sorry for the top-post.)

-- thorpej
Sent from my iPhone.
Post by Jared McNeill
Post by c***@sdf.org
http://coypu.sdf.org/0001-sync-with-openbsd-bwfm.patch
@@ -307,6 +313,12 @@ bwfm_start(struct ifnet *ifp)
continue;
}
+ if (sc->sc_bus_ops->bs_txcheck(sc)) {
+ IF_PREPEND(&ifp->if_snd, m);
+ ifp->if_flags |= IFF_OACTIVE;
+ break;
+ }
+
IFQ_DEQUEUE(&ifp->if_snd, m);
if (m == NULL)
break;
Remove the IF_PREPEND here. You only need to do that after dequeue. In this case, m will always be NULL.
-
+int
+bwfm_usb_txcheck(struct bwfm_softc *bwfm)
+{
+ struct bwfm_usb_softc *sc = (void *)bwfm;
+
+ mutex_enter(&sc->sc_tx_lock);
+
+ if (TAILQ_EMPTY(&sc->sc_tx_free_list)) {
+ mutex_exit(&sc->sc_tx_lock);
+ return ENOBUFS;
+ }
+
+ return 0;
+}
Missing mutex_exit in the success path here.
Post by c***@sdf.org
http://coypu.sdf.org/0004-Update-bwfm-4-to-note-PCI-support-and-mention-jmcnei.patch
I wouldn't say I wrote the driver, only ported it. Also note capitalization of my last name.
Cheers,
Jared
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
c***@sdf.org
2018-05-04 16:39:01 UTC
Permalink
Updated the patches (same URLs) for this. Thanks.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...