/* * Atheros CARL9170 driver * * 802.11 & command trap routines * * Copyright 2008, Johannes Berg <[email protected]> * Copyright 2009, 2010, Christian Lamparter <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING. If not, see * http://www.gnu.org/licenses/. * * This file incorporates work covered by the following copyright and * permission notice: * Copyright (c) 2007-2008 Atheros Communications, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <linux/slab.h> #include <linux/module.h> #include <linux/etherdevice.h> #include <linux/crc32.h> #include <net/mac80211.h> #include "carl9170.h" #include "hw.h" #include "cmd.h" static void carl9170_dbg_message(struct ar9170 *ar, const char *buf, u32 len) { … } static void carl9170_handle_ps(struct ar9170 *ar, struct carl9170_rsp *rsp) { … } static int carl9170_check_sequence(struct ar9170 *ar, unsigned int seq) { … } static void carl9170_cmd_callback(struct ar9170 *ar, u32 len, void *buffer) { … } void carl9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len) { … } static int carl9170_rx_mac_status(struct ar9170 *ar, struct ar9170_rx_head *head, struct ar9170_rx_macstatus *mac, struct ieee80211_rx_status *status) { … } static void carl9170_rx_phy_status(struct ar9170 *ar, struct ar9170_rx_phystatus *phy, struct ieee80211_rx_status *status) { … } static struct sk_buff *carl9170_rx_copy_data(u8 *buf, int len) { … } static u8 *carl9170_find_ie(u8 *data, unsigned int len, u8 ie) { … } /* * NOTE: * * The firmware is in charge of waking up the device just before * the AP is expected to transmit the next beacon. * * This leaves the driver with the important task of deciding when * to set the PHY back to bed again. */ static void carl9170_ps_beacon(struct ar9170 *ar, void *data, unsigned int len) { … } static void carl9170_ba_check(struct ar9170 *ar, void *data, unsigned int len) { … } static bool carl9170_ampdu_check(struct ar9170 *ar, u8 *buf, u8 ms, struct ieee80211_rx_status *rx_status) { … } static int carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len, struct ieee80211_rx_status *status) { … } /* * If the frame alignment is right (or the kernel has * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS), and there * is only a single MPDU in the USB frame, then we could * submit to mac80211 the SKB directly. However, since * there may be multiple packets in one SKB in stream * mode, and we need to observe the proper ordering, * this is non-trivial. */ static void carl9170_rx_untie_data(struct ar9170 *ar, u8 *buf, int len) { … } static void carl9170_rx_untie_cmds(struct ar9170 *ar, const u8 *respbuf, const unsigned int resplen) { … } static void __carl9170_rx(struct ar9170 *ar, u8 *buf, unsigned int len) { … } static void carl9170_rx_stream(struct ar9170 *ar, void *buf, unsigned int len) { … } void carl9170_rx(struct ar9170 *ar, void *buf, unsigned int len) { … }