|
|
@@ -258,6 +258,25 @@ static void queue_eapol(const unsigned char *p, unsigned int len)
|
|
|
W.eapq_head = (W.eapq_head + 1) % EAPOLQ_SLOTS;
|
|
|
}
|
|
|
|
|
|
+/* First few data-path drops go to serial/netmon with the reason and the
|
|
|
+ * firmware RX status (decrypt result in bits 8..10, MIC_OK bit 6). */
|
|
|
+static void rx_drop(const char *why, const unsigned char *f,
|
|
|
+ unsigned int status)
|
|
|
+{
|
|
|
+ W.rx_dropped++;
|
|
|
+ if (W.rx_dropped > 12)
|
|
|
+ return;
|
|
|
+ serial_puts(SERIAL_COM1, "wifi: rx drop ");
|
|
|
+ serial_puts(SERIAL_COM1, why);
|
|
|
+ serial_puts(SERIAL_COM1, " fc ");
|
|
|
+ serial_puthex(SERIAL_COM1, f[0] | (f[1] << 8));
|
|
|
+ serial_puts(SERIAL_COM1, " da ");
|
|
|
+ serial_puthex(SERIAL_COM1, (f[4] << 8) | f[5]);
|
|
|
+ serial_puts(SERIAL_COM1, " status ");
|
|
|
+ serial_puthex(SERIAL_COM1, status);
|
|
|
+ serial_puts(SERIAL_COM1, "\n");
|
|
|
+}
|
|
|
+
|
|
|
static void rx_data(const unsigned char *f, unsigned int len,
|
|
|
unsigned int status)
|
|
|
{
|
|
|
@@ -278,7 +297,7 @@ static void rx_data(const unsigned char *f, unsigned int len,
|
|
|
if (prot) {
|
|
|
if ((status & IWL_RX_SEC_MSK) != IWL_RX_SEC_CCM ||
|
|
|
!(status & IWL_RX_MIC_OK)) {
|
|
|
- W.rx_dropped++;
|
|
|
+ rx_drop("not decrypted", f, status);
|
|
|
return;
|
|
|
}
|
|
|
hdr += 8; /* CCMP header */
|
|
|
@@ -286,8 +305,10 @@ static void rx_data(const unsigned char *f, unsigned int len,
|
|
|
return;
|
|
|
len -= 8; /* MIC */
|
|
|
}
|
|
|
- if (len < hdr + 8 || !meq(f + hdr, snap, 6))
|
|
|
+ if (len < hdr + 8 || !meq(f + hdr, snap, 6)) {
|
|
|
+ rx_drop("no LLC/SNAP", f, status);
|
|
|
return;
|
|
|
+ }
|
|
|
type = (f[hdr + 6] << 8) | f[hdr + 7];
|
|
|
p = f + hdr + 8;
|
|
|
plen = len - hdr - 8;
|
|
|
@@ -297,12 +318,13 @@ static void rx_data(const unsigned char *f, unsigned int len,
|
|
|
}
|
|
|
/* Before the keys are in, or unprotected after: drop. */
|
|
|
if (W.state != SYS_WIFI_ST_LINK || (W.protect && !prot)) {
|
|
|
- W.rx_dropped++;
|
|
|
+ rx_drop(W.state != SYS_WIFI_ST_LINK ? "port closed"
|
|
|
+ : "unprotected", f, status);
|
|
|
return;
|
|
|
}
|
|
|
if (plen + 14 > RXQ_FRAME ||
|
|
|
((W.rxq_head + 1) % RXQ_SLOTS) == W.rxq_tail) {
|
|
|
- W.rx_dropped++;
|
|
|
+ rx_drop("queue full", f, status);
|
|
|
return;
|
|
|
}
|
|
|
s = &W.rxq[W.rxq_head];
|
|
|
@@ -437,6 +459,7 @@ static int do_connect(const struct sys_wifi_connect *c)
|
|
|
W.pn = 0;
|
|
|
W.eapq_head = W.eapq_tail = 0;
|
|
|
W.rxq_head = W.rxq_tail = 0;
|
|
|
+ W.rx_dropped = 0;
|
|
|
|
|
|
if (iwl_mvm_prepare_connect(c->bssid, c->channel, W.cur.beacon_int) < 0) {
|
|
|
W.detail = "firmware connect setup failed";
|