Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/sdmmc Continue parsing frames after empty payload.



details:   https://anonhg.NetBSD.org/src/rev/270f054f6b01
branches:  trunk
changeset: 1015898:270f054f6b01
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Tue Nov 03 09:26:41 2020 +0000

description:
Continue parsing frames after empty payload.
Add diagnostic messages.

diffstat:

 sys/dev/sdmmc/if_bwfm_sdio.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r 0a48931f309d -r 270f054f6b01 sys/dev/sdmmc/if_bwfm_sdio.c
--- a/sys/dev/sdmmc/if_bwfm_sdio.c      Tue Nov 03 08:41:30 2020 +0000
+++ b/sys/dev/sdmmc/if_bwfm_sdio.c      Tue Nov 03 09:26:41 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_sdio.c,v 1.23 2020/07/22 17:23:12 riastradh Exp $ */
+/* $NetBSD: if_bwfm_sdio.c,v 1.24 2020/11/03 09:26:41 mlelstv Exp $ */
 /* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -1478,6 +1478,8 @@
                DPRINTF(("%s: hostint 0x%" PRIx32 "\n", DEVNAME(sc), hostint));
                bwfm_sdio_dev_write(sc, SDPCMD_TOSBMAILBOX,
                    SDPCMD_TOSBMAILBOX_INT_ACK);
+               if (hostint & SDPCMD_TOHOSTMAILBOXDATA_FWHALT)
+                       printf("%s: firmware halted\n", DEVNAME(sc));
                if (hostint & SDPCMD_TOHOSTMAILBOXDATA_NAKHANDLED)
                        sc->sc_rxskip = false;
                if (hostint & SDPCMD_TOHOSTMAILBOXDATA_DEVREADY ||
@@ -1726,6 +1728,8 @@
 
                flen = hwhdr->frmlen - (sizeof(*hwhdr) + sizeof(*swhdr));
                if (flen == 0) {
+                       DPRINTF(("%s: empty payload (frmlen=%u)\n",
+                           DEVNAME(sc), hwhdr->frmlen));
                        nextlen = swhdr->nextlen << 4;
                        continue;
                }
@@ -1794,11 +1798,10 @@
                        }
                        m_adj(m, hoff);
                        /* don't pass empty packet to stack */
-                       if (m->m_len == 0) {
+                       if (m->m_len > 0)
+                               bwfm_rx(&sc->sc_sc, m);
+                       else
                                m_freem(m);
-                               break;
-                       }
-                       bwfm_rx(&sc->sc_sc, m);
                        nextlen = swhdr->nextlen << 4;
                        break;
                case BWFM_SDIO_SWHDR_CHANNEL_GLOM:



Home | Main Index | Thread Index | Old Index