Hi,

this is an iwx(4) port of the iwm(4) fix by Christian Erhardt
which I sent in a previous mail:
https://marc.info/?l=openbsd-tech&m=160733342209497&w=2

I don't have a iwx(4) card to test this, but the diff to iwm(4) is trivial.
ok?

Index: if_iwx.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_iwx.c,v
retrieving revision 1.46
diff -u -p -r1.46 if_iwx.c
--- if_iwx.c    22 Oct 2020 11:24:01 -0000      1.46
+++ if_iwx.c    7 Dec 2020 14:06:10 -0000
@@ -7141,7 +7141,6 @@ iwx_rx_pkt(struct iwx_softc *sc, struct 
        uint32_t offset = 0, nextoff = 0, nmpdu = 0, len;
        struct mbuf *m0, *m;
        const size_t minsz = sizeof(pkt->len_n_flags) + sizeof(pkt->hdr);
-       size_t remain = IWX_RBUF_SIZE;
        int qid, idx, code, handled = 1;
 
        bus_dmamap_sync(sc->sc_dmat, data->map, 0, IWX_RBUF_SIZE,
@@ -7178,7 +7177,7 @@ iwx_rx_pkt(struct iwx_softc *sc, struct 
                        break;
 
                case IWX_REPLY_RX_MPDU_CMD: {
-                       size_t maxlen = remain - minsz;
+                       size_t maxlen = IWX_RBUF_SIZE - offset - minsz;
                        nextoff = offset +
                            roundup(len, IWX_FH_RSCSR_FRAME_ALIGN);
                        nextpkt = (struct iwx_rx_packet *)
@@ -7206,11 +7205,6 @@ iwx_rx_pkt(struct iwx_softc *sc, struct 
                                m_adj(m, offset);
                                iwx_rx_mpdu_mq(sc, m, pkt->data, maxlen, ml);
                        }
-
-                       if (offset + minsz < remain)
-                               remain -= offset;
-                       else
-                               remain = minsz;
                        break;
                }
 

Reply via email to