xref: /freebsd/sys/dev/rtwn/rtl8192e/r92e_rx.c (revision 5f4c09dd85bff675e0ca63c55ea3c517e0fddfcc)
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 #include "opt_wlan.h"
21 
22 #include <sys/param.h>
23 #include <sys/lock.h>
24 #include <sys/mutex.h>
25 #include <sys/mbuf.h>
26 #include <sys/kernel.h>
27 #include <sys/socket.h>
28 #include <sys/systm.h>
29 #include <sys/malloc.h>
30 #include <sys/queue.h>
31 #include <sys/taskqueue.h>
32 #include <sys/bus.h>
33 #include <sys/endian.h>
34 #include <sys/linker.h>
35 
36 #include <net/if.h>
37 #include <net/ethernet.h>
38 #include <net/if_media.h>
39 
40 #include <net80211/ieee80211_var.h>
41 #include <net80211/ieee80211_radiotap.h>
42 #include <net80211/ieee80211_ratectl.h>
43 
44 #include <dev/rtwn/if_rtwnreg.h>
45 #include <dev/rtwn/if_rtwnvar.h>
46 
47 #include <dev/rtwn/if_rtwn_debug.h>
48 #include <dev/rtwn/if_rtwn_ridx.h>
49 
50 #include <dev/rtwn/rtl8188e/r88e.h>
51 #include <dev/rtwn/rtl8192e/r92e.h>
52 
53 #include <dev/rtwn/rtl8192c/r92c_rx_desc.h>
54 #include <dev/rtwn/rtl8812a/r12a_fw_cmd.h>
55 
56 #ifndef RTWN_WITHOUT_UCODE
57 void
58 r92e_handle_c2h_report(struct rtwn_softc *sc, uint8_t *buf, int len)
59 {
60 
61 	/* Skip Rx descriptor. */
62 	buf += sizeof(struct r92c_rx_stat);
63 	len -= sizeof(struct r92c_rx_stat);
64 
65 	if (len < 2) {
66 		device_printf(sc->sc_dev, "C2H report too short (len %d)\n",
67 		    len);
68 		return;
69 	}
70 	len -= 2;
71 
72 	switch (buf[0]) {       /* command id */
73 	case R12A_C2H_TX_REPORT:
74 		/* NOTREACHED */
75 		KASSERT(0, ("use handle_tx_report() instead of %s\n",
76 		    __func__));
77 		break;
78 	}
79 }
80 #else
81 void
82 r92e_handle_c2h_report(struct rtwn_softc *sc, uint8_t *buf, int len)
83 {
84 
85 	/* Should not happen. */
86 	device_printf(sc->sc_dev, "%s: called\n", __func__);
87 }
88 #endif
89 
90 int8_t
91 r92e_get_rssi_cck(struct rtwn_softc *sc, void *physt)
92 {
93 
94 	return (10 + r88e_get_rssi_cck(sc, physt));
95 }
96