xref: /freebsd/sys/dev/rtwn/rtl8192e/r92e_rx.c (revision 6829dae12bb055451fa467da4589c43bd03b1e64)
1 /*-
2  * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
3  * Copyright (c) 2014, 2017 Kevin Lo <kevlo@FreeBSD.org>
4  * Copyright (c) 2015-2016 Andriy Voskoboinyk <avos@FreeBSD.org>
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #include <sys/cdefs.h>
20 __FBSDID("$FreeBSD$");
21 
22 #include "opt_wlan.h"
23 
24 #include <sys/param.h>
25 #include <sys/lock.h>
26 #include <sys/mutex.h>
27 #include <sys/mbuf.h>
28 #include <sys/kernel.h>
29 #include <sys/socket.h>
30 #include <sys/systm.h>
31 #include <sys/malloc.h>
32 #include <sys/queue.h>
33 #include <sys/taskqueue.h>
34 #include <sys/bus.h>
35 #include <sys/endian.h>
36 #include <sys/linker.h>
37 
38 #include <net/if.h>
39 #include <net/ethernet.h>
40 #include <net/if_media.h>
41 
42 #include <net80211/ieee80211_var.h>
43 #include <net80211/ieee80211_radiotap.h>
44 #include <net80211/ieee80211_ratectl.h>
45 
46 #include <dev/rtwn/if_rtwnreg.h>
47 #include <dev/rtwn/if_rtwnvar.h>
48 
49 #include <dev/rtwn/if_rtwn_debug.h>
50 #include <dev/rtwn/if_rtwn_ridx.h>
51 
52 #include <dev/rtwn/rtl8188e/r88e.h>
53 #include <dev/rtwn/rtl8192e/r92e.h>
54 
55 #include <dev/rtwn/rtl8192c/r92c_rx_desc.h>
56 #include <dev/rtwn/rtl8812a/r12a_fw_cmd.h>
57 
58 #ifndef RTWN_WITHOUT_UCODE
59 void
60 r92e_handle_c2h_report(struct rtwn_softc *sc, uint8_t *buf, int len)
61 {
62 
63 	/* Skip Rx descriptor. */
64 	buf += sizeof(struct r92c_rx_stat);
65 	len -= sizeof(struct r92c_rx_stat);
66 
67 	if (len < 2) {
68 		device_printf(sc->sc_dev, "C2H report too short (len %d)\n",
69 		    len);
70 		return;
71 	}
72 	len -= 2;
73 
74 	switch (buf[0]) {       /* command id */
75 	case R12A_C2H_TX_REPORT:
76 		/* NOTREACHED */
77 		KASSERT(0, ("use handle_tx_report() instead of %s\n",
78 		    __func__));
79 		break;
80 	}
81 }
82 #else
83 void
84 r92e_handle_c2h_report(struct rtwn_softc *sc, uint8_t *buf, int len)
85 {
86 
87 	/* Should not happen. */
88 	device_printf(sc->sc_dev, "%s: called\n", __func__);
89 }
90 #endif
91 
92 int8_t
93 r92e_get_rssi_cck(struct rtwn_softc *sc, void *physt)
94 {
95 
96 	return (10 + r88e_get_rssi_cck(sc, physt));
97 }
98