\hypertarget{r12a__caps_8c_source}{}\doxysection{r12a\+\_\+caps.\+c}
\label{r12a__caps_8c_source}\index{dev/rtwn/rtl8812a/r12a\_caps.c@{dev/rtwn/rtl8812a/r12a\_caps.c}}
\mbox{\hyperlink{r12a__caps_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00002}00002 \textcolor{comment}{ * Copyright (c) 2016 Andriy Voskoboinyk <avos@FreeBSD.org>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00003}00003 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00004}00004 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00005}00005 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00006}00006 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00007}00007 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00008}00008 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00009}00009 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00010}00010 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00011}00011 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00012}00012 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00013}00013 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00014}00014 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00015}00015 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00016}00016 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00017}00017 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00018}00018 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00019}00019 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00020}00020 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00021}00021 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00022}00022 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00023}00023 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00024}00024 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00025}00025 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00026}00026 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00027}00027 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00028}\mbox{\hyperlink{r12a__caps_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00028}} \mbox{\hyperlink{r12a__caps_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00029}00029 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00030}00030 \textcolor{preprocessor}{\#include "{}opt\_wlan.h"{}}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00031}00031 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <sys/sockio.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/mbuf.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/socket.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/queue.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <sys/taskqueue.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <sys/bus.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <sys/endian.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <sys/linker.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00046}00046 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <net/if.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <net/if\_var.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <net/ethernet.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <net/if\_media.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00051}00051 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <net80211/ieee80211\_var.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00053}00053 \textcolor{preprocessor}{\#include <net80211/ieee80211\_radiotap.h>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00054}00054 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00055}00055 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{if__rtwnvar_8h}{dev/rtwn/if\_rtwnvar.h}}>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00056}00056 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{if__rtwn__rx_8h}{dev/rtwn/if\_rtwn\_rx.h}}>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00057}00057 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00058}00058 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{r12a_8h}{dev/rtwn/rtl8812a/r12a.h}}>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00059}00059 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{r12a__reg_8h}{dev/rtwn/rtl8812a/r12a\_reg.h}}>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00060}00060 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{r12a__var_8h}{dev/rtwn/rtl8812a/r12a\_var.h}}>}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00061}00061 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00062}00062 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00063}\mbox{\hyperlink{r12a_8h_af7fd7cd0af25b2a676691d16d92c812c}{00063}} \mbox{\hyperlink{r12a__caps_8c_af3c134a20ab19c2eba5d39aba6bdd2b6}{r12a\_ioctl\_net}}(\textcolor{keyword}{struct} ieee80211com *ic, u\_long cmd, \textcolor{keywordtype}{void} *data)}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00064}00064 \{}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00065}00065         \textcolor{keyword}{struct }\mbox{\hyperlink{structrtwn__softc}{rtwn\_softc}} *sc = ic-\/>ic\_softc;}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00066}00066         \textcolor{keyword}{struct }\mbox{\hyperlink{structr12a__softc}{r12a\_softc}} *rs = sc-\/>\mbox{\hyperlink{structrtwn__softc_a1fc52267a564938f36dba08768ee524b}{sc\_priv}};}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00067}00067         \textcolor{keyword}{struct }ifreq *ifr = (\textcolor{keyword}{struct }ifreq *)data;}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00068}00068         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00069}00069 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00070}00070         error = 0;}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00071}00071         \textcolor{keywordflow}{switch} (cmd) \{}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00072}00072         \textcolor{keywordflow}{case} SIOCSIFCAP:}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00073}00073         \{}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00074}00074                 \textcolor{keyword}{struct }ieee80211vap *vap;}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00075}00075                 \textcolor{keywordtype}{int} changed, rxmask;}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00076}00076 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00077}00077                 rxmask = ifr-\/>ifr\_reqcap \& (IFCAP\_RXCSUM | IFCAP\_RXCSUM\_IPV6);}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00078}00078 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00079}00079                 \mbox{\hyperlink{if__rtwnvar_8h_a225a1776288a71cc42e11049f9633d5a}{RTWN\_LOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00080}00080                 changed = 0;}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00081}00081                 \textcolor{keywordflow}{if} (!(rs-\/>\mbox{\hyperlink{structr12a__softc_a90fdf1e8ffb2be00aeb455aa9165d783}{rs\_flags}} \& \mbox{\hyperlink{r12a__var_8h_a2d647d12b011a66a746d71755ab13e6d}{R12A\_RXCKSUM\_EN}}) \string^}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00082}00082                     !(ifr-\/>ifr\_reqcap \& IFCAP\_RXCSUM)) \{}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00083}00083                         rs-\/>\mbox{\hyperlink{structr12a__softc_a90fdf1e8ffb2be00aeb455aa9165d783}{rs\_flags}} \string^= \mbox{\hyperlink{r12a__var_8h_a2d647d12b011a66a746d71755ab13e6d}{R12A\_RXCKSUM\_EN}};}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00084}00084                         changed = 1;}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00085}00085                 \}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00086}00086                 \textcolor{keywordflow}{if} (!(rs-\/>\mbox{\hyperlink{structr12a__softc_a90fdf1e8ffb2be00aeb455aa9165d783}{rs\_flags}} \& \mbox{\hyperlink{r12a__var_8h_acd2f58633b35dc27cb7e9d3d9e972809}{R12A\_RXCKSUM6\_EN}}) \string^}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00087}00087                     !(ifr-\/>ifr\_reqcap \& IFCAP\_RXCSUM\_IPV6)) \{}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00088}00088                         rs-\/>\mbox{\hyperlink{structr12a__softc_a90fdf1e8ffb2be00aeb455aa9165d783}{rs\_flags}} \string^= \mbox{\hyperlink{r12a__var_8h_acd2f58633b35dc27cb7e9d3d9e972809}{R12A\_RXCKSUM6\_EN}};}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00089}00089                         changed = 1;}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00090}00090                 \}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00091}00091                 \textcolor{keywordflow}{if} (changed) \{}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00092}00092                         \textcolor{keywordflow}{if} (rxmask == 0)}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00093}00093                                 sc-\/>\mbox{\hyperlink{structrtwn__softc_aac5fea16bdb8b03ae97184104ddb3187}{rcr}} \&= \string~R12A\_RCR\_TCP\_OFFLD\_EN;}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00094}00094                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00095}00095                                 sc-\/>\mbox{\hyperlink{structrtwn__softc_aac5fea16bdb8b03ae97184104ddb3187}{rcr}} |= \mbox{\hyperlink{r12a__reg_8h_af59d7401c1d83873c24c384ee1b9ce51}{R12A\_RCR\_TCP\_OFFLD\_EN}};}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00096}00096 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00097}00097                         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structrtwn__softc_aa141cf90dc5b1563913ece10d996ad7e}{sc\_flags}} \& \mbox{\hyperlink{if__rtwnvar_8h_a5d0cf23ecb12442c829e9a1e4e790cb1}{RTWN\_RUNNING}})}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00098}00098                                 \mbox{\hyperlink{if__rtwn__rx_8c_a05eb2168019e729375766b5c9797cbc9}{rtwn\_rxfilter\_set}}(sc);}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00099}00099                 \}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00100}00100                 \mbox{\hyperlink{if__rtwnvar_8h_a8c20a024317a3f45243ebf9146c4fbab}{RTWN\_UNLOCK}}(sc);}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00101}00101 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00102}00102                 IEEE80211\_LOCK(ic);     \textcolor{comment}{/* XXX */}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00103}00103                 TAILQ\_FOREACH(vap, \&ic-\/>ic\_vaps, iv\_next) \{}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00104}00104                         \textcolor{keyword}{struct }ifnet *ifp = vap-\/>iv\_ifp;}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00105}00105 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00106}00106                         ifp-\/>if\_capenable \&=}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00107}00107                             \string~(IFCAP\_RXCSUM | IFCAP\_RXCSUM\_IPV6);}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00108}00108                         ifp-\/>if\_capenable |= rxmask;}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00109}00109                 \}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00110}00110                 IEEE80211\_UNLOCK(ic);}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00111}00111                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00112}00112         \}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00113}00113         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00114}00114                 error = ENOTTY;         \textcolor{comment}{/* for net80211 */}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00115}00115                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00116}00116         \}}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00117}00117 }
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00118}00118         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{r12a__caps_8c_source_l00119}00119 \}}

\end{DoxyCode}
