Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dfef948e authored by David S. Miller's avatar David S. Miller
Browse files
parents ea31ba35 c85e9d77
Loading
Loading
Loading
Loading
+21 −24
Original line number Original line Diff line number Diff line
@@ -121,6 +121,14 @@ static struct fwentry firmwares[] = {
	[BOARD_505A] = { "atmel_at76c505a-rfmd2958.bin" },
	[BOARD_505A] = { "atmel_at76c505a-rfmd2958.bin" },
	[BOARD_505AMX] = { "atmel_at76c505amx-rfmd.bin" },
	[BOARD_505AMX] = { "atmel_at76c505amx-rfmd.bin" },
};
};
MODULE_FIRMWARE("atmel_at76c503-i3861.bin");
MODULE_FIRMWARE("atmel_at76c503-i3863.bin");
MODULE_FIRMWARE("atmel_at76c503-rfmd.bin");
MODULE_FIRMWARE("atmel_at76c503-rfmd-acc.bin");
MODULE_FIRMWARE("atmel_at76c505-rfmd.bin");
MODULE_FIRMWARE("atmel_at76c505-rfmd2958.bin");
MODULE_FIRMWARE("atmel_at76c505a-rfmd2958.bin");
MODULE_FIRMWARE("atmel_at76c505amx-rfmd.bin");


#define USB_DEVICE_DATA(__ops)	.driver_info = (kernel_ulong_t)(__ops)
#define USB_DEVICE_DATA(__ops)	.driver_info = (kernel_ulong_t)(__ops)


@@ -524,20 +532,6 @@ static char *hex2str(void *buf, int len)
	return ret;
	return ret;
}
}


#define MAC2STR_BUFFERS 4

static inline char *mac2str(u8 *mac)
{
	static atomic_t a = ATOMIC_INIT(0);
	static char bufs[MAC2STR_BUFFERS][6 * 3];
	char *str;

	str = bufs[atomic_inc_return(&a) & (MAC2STR_BUFFERS - 1)];
	sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x",
		mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
	return str;
}

/* LED trigger */
/* LED trigger */
static int tx_activity;
static int tx_activity;
static void at76_ledtrig_tx_timerfunc(unsigned long data);
static void at76_ledtrig_tx_timerfunc(unsigned long data);
@@ -973,13 +967,13 @@ static void at76_dump_mib_mac_addr(struct at76_priv *priv)
		goto exit;
		goto exit;
	}
	}


	at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: mac_addr %s res 0x%x 0x%x",
	at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: mac_addr %pM res 0x%x 0x%x",
		 wiphy_name(priv->hw->wiphy),
		 wiphy_name(priv->hw->wiphy),
		 mac2str(m->mac_addr), m->res[0], m->res[1]);
		 m->mac_addr, m->res[0], m->res[1]);
	for (i = 0; i < ARRAY_SIZE(m->group_addr); i++)
	for (i = 0; i < ARRAY_SIZE(m->group_addr); i++)
		at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: group addr %d: %s, "
		at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: group addr %d: %pM, "
			 "status %d", wiphy_name(priv->hw->wiphy), i,
			 "status %d", wiphy_name(priv->hw->wiphy), i,
			 mac2str(m->group_addr[i]), m->group_addr_status[i]);
			 m->group_addr[i], m->group_addr_status[i]);
exit:
exit:
	kfree(m);
	kfree(m);
}
}
@@ -1042,7 +1036,7 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv)
	at76_dbg(DBG_MIB, "%s: MIB MAC_MGMT: beacon_period %d CFP_max_duration "
	at76_dbg(DBG_MIB, "%s: MIB MAC_MGMT: beacon_period %d CFP_max_duration "
		 "%d medium_occupancy_limit %d station_id 0x%x ATIM_window %d "
		 "%d medium_occupancy_limit %d station_id 0x%x ATIM_window %d "
		 "CFP_mode %d privacy_opt_impl %d DTIM_period %d CFP_period %d "
		 "CFP_mode %d privacy_opt_impl %d DTIM_period %d CFP_period %d "
		 "current_bssid %s current_essid %s current_bss_type %d "
		 "current_bssid %pM current_essid %s current_bss_type %d "
		 "pm_mode %d ibss_change %d res %d "
		 "pm_mode %d ibss_change %d res %d "
		 "multi_domain_capability_implemented %d "
		 "multi_domain_capability_implemented %d "
		 "international_roaming %d country_string %.3s",
		 "international_roaming %d country_string %.3s",
@@ -1051,7 +1045,7 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv)
		 le16_to_cpu(m->medium_occupancy_limit),
		 le16_to_cpu(m->medium_occupancy_limit),
		 le16_to_cpu(m->station_id), le16_to_cpu(m->ATIM_window),
		 le16_to_cpu(m->station_id), le16_to_cpu(m->ATIM_window),
		 m->CFP_mode, m->privacy_option_implemented, m->DTIM_period,
		 m->CFP_mode, m->privacy_option_implemented, m->DTIM_period,
		 m->CFP_period, mac2str(m->current_bssid),
		 m->CFP_period, m->current_bssid,
		 hex2str(m->current_essid, IW_ESSID_MAX_SIZE),
		 hex2str(m->current_essid, IW_ESSID_MAX_SIZE),
		 m->current_bss_type, m->power_mgmt_mode, m->ibss_change,
		 m->current_bss_type, m->power_mgmt_mode, m->ibss_change,
		 m->res, m->multi_domain_capability_implemented,
		 m->res, m->multi_domain_capability_implemented,
@@ -1080,7 +1074,7 @@ static void at76_dump_mib_mac(struct at76_priv *priv)
		 "cwmin %d cwmax %d short_retry_time %d long_retry_time %d "
		 "cwmin %d cwmax %d short_retry_time %d long_retry_time %d "
		 "scan_type %d scan_channel %d probe_delay %u "
		 "scan_type %d scan_channel %d probe_delay %u "
		 "min_channel_time %d max_channel_time %d listen_int %d "
		 "min_channel_time %d max_channel_time %d listen_int %d "
		 "desired_ssid %s desired_bssid %s desired_bsstype %d",
		 "desired_ssid %s desired_bssid %pM desired_bsstype %d",
		 wiphy_name(priv->hw->wiphy),
		 wiphy_name(priv->hw->wiphy),
		 le32_to_cpu(m->max_tx_msdu_lifetime),
		 le32_to_cpu(m->max_tx_msdu_lifetime),
		 le32_to_cpu(m->max_rx_lifetime),
		 le32_to_cpu(m->max_rx_lifetime),
@@ -1092,7 +1086,7 @@ static void at76_dump_mib_mac(struct at76_priv *priv)
		 le16_to_cpu(m->max_channel_time),
		 le16_to_cpu(m->max_channel_time),
		 le16_to_cpu(m->listen_interval),
		 le16_to_cpu(m->listen_interval),
		 hex2str(m->desired_ssid, IW_ESSID_MAX_SIZE),
		 hex2str(m->desired_ssid, IW_ESSID_MAX_SIZE),
		 mac2str(m->desired_bssid), m->desired_bsstype);
		 m->desired_bssid, m->desired_bsstype);
exit:
exit:
	kfree(m);
	kfree(m);
}
}
@@ -1194,6 +1188,9 @@ static int at76_start_monitor(struct at76_priv *priv)
	scan.channel = priv->channel;
	scan.channel = priv->channel;
	scan.scan_type = SCAN_TYPE_PASSIVE;
	scan.scan_type = SCAN_TYPE_PASSIVE;
	scan.international_scan = 0;
	scan.international_scan = 0;
	scan.min_channel_time = cpu_to_le16(priv->scan_min_time);
	scan.max_channel_time = cpu_to_le16(priv->scan_max_time);
	scan.probe_delay = cpu_to_le16(0);


	ret = at76_set_card_command(priv->udev, CMD_SCAN, &scan, sizeof(scan));
	ret = at76_set_card_command(priv->udev, CMD_SCAN, &scan, sizeof(scan));
	if (ret >= 0)
	if (ret >= 0)
@@ -2284,9 +2281,9 @@ static int at76_init_new_device(struct at76_priv *priv,


	priv->mac80211_registered = 1;
	priv->mac80211_registered = 1;


	printk(KERN_INFO "%s: USB %s, MAC %s, firmware %d.%d.%d-%d\n",
	printk(KERN_INFO "%s: USB %s, MAC %pM, firmware %d.%d.%d-%d\n",
	       wiphy_name(priv->hw->wiphy),
	       wiphy_name(priv->hw->wiphy),
	       dev_name(&interface->dev), mac2str(priv->mac_addr),
	       dev_name(&interface->dev), priv->mac_addr,
	       priv->fw_version.major, priv->fw_version.minor,
	       priv->fw_version.major, priv->fw_version.minor,
	       priv->fw_version.patch, priv->fw_version.build);
	       priv->fw_version.patch, priv->fw_version.build);
	printk(KERN_INFO "%s: regulatory domain 0x%02x: %s\n",
	printk(KERN_INFO "%s: regulatory domain 0x%02x: %s\n",
+28 −0
Original line number Original line Diff line number Diff line
@@ -21,8 +21,28 @@
#include <linux/if_ether.h>
#include <linux/if_ether.h>
#include <net/mac80211.h>
#include <net/mac80211.h>


/*
 * The key cache is used for h/w cipher state and also for
 * tracking station state such as the current tx antenna.
 * We also setup a mapping table between key cache slot indices
 * and station state to short-circuit node lookups on rx.
 * Different parts have different size key caches.  We handle
 * up to ATH_KEYMAX entries (could dynamically allocate state).
 */
#define	ATH_KEYMAX	        128     /* max key cache size we handle */

static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};


struct ath_ani {
	bool caldone;
	int16_t noise_floor;
	unsigned int longcal_timer;
	unsigned int shortcal_timer;
	unsigned int resetcal_timer;
	unsigned int checkani_timer;
	struct timer_list timer;
};

enum ath_device_state {
enum ath_device_state {
	ATH_HW_UNAVAILABLE,
	ATH_HW_UNAVAILABLE,
	ATH_HW_INITIALIZED,
	ATH_HW_INITIALIZED,
@@ -66,6 +86,8 @@ struct ath_common {
	int debug_mask;
	int debug_mask;
	enum ath_device_state state;
	enum ath_device_state state;


	struct ath_ani ani;

	u16 cachelsz;
	u16 cachelsz;
	u16 curaid;
	u16 curaid;
	u8 macaddr[ETH_ALEN];
	u8 macaddr[ETH_ALEN];
@@ -75,6 +97,12 @@ struct ath_common {
	u8 tx_chainmask;
	u8 tx_chainmask;
	u8 rx_chainmask;
	u8 rx_chainmask;


	u32 rx_bufsize;

	u32 keymax;
	DECLARE_BITMAP(keymap, ATH_KEYMAX);
	u8 splitmic;

	struct ath_regulatory regulatory;
	struct ath_regulatory regulatory;
	const struct ath_ops *ops;
	const struct ath_ops *ops;
	const struct ath_bus_ops *bus_ops;
	const struct ath_bus_ops *bus_ops;
+21 −11
Original line number Original line Diff line number Diff line
@@ -323,10 +323,13 @@ static inline void ath5k_txbuf_free(struct ath5k_softc *sc,
static inline void ath5k_rxbuf_free(struct ath5k_softc *sc,
static inline void ath5k_rxbuf_free(struct ath5k_softc *sc,
				struct ath5k_buf *bf)
				struct ath5k_buf *bf)
{
{
	struct ath5k_hw *ah = sc->ah;
	struct ath_common *common = ath5k_hw_common(ah);

	BUG_ON(!bf);
	BUG_ON(!bf);
	if (!bf->skb)
	if (!bf->skb)
		return;
		return;
	pci_unmap_single(sc->pdev, bf->skbaddr, sc->rxbufsize,
	pci_unmap_single(sc->pdev, bf->skbaddr, common->rx_bufsize,
			PCI_DMA_FROMDEVICE);
			PCI_DMA_FROMDEVICE);
	dev_kfree_skb_any(bf->skb);
	dev_kfree_skb_any(bf->skb);
	bf->skb = NULL;
	bf->skb = NULL;
@@ -1181,17 +1184,18 @@ struct sk_buff *ath5k_rx_skb_alloc(struct ath5k_softc *sc, dma_addr_t *skb_addr)
	 * fake physical layer header at the start.
	 * fake physical layer header at the start.
	 */
	 */
	skb = ath_rxbuf_alloc(common,
	skb = ath_rxbuf_alloc(common,
			      sc->rxbufsize + common->cachelsz - 1,
			      common->rx_bufsize,
			      GFP_ATOMIC);
			      GFP_ATOMIC);


	if (!skb) {
	if (!skb) {
		ATH5K_ERR(sc, "can't alloc skbuff of size %u\n",
		ATH5K_ERR(sc, "can't alloc skbuff of size %u\n",
				sc->rxbufsize + common->cachelsz - 1);
				common->rx_bufsize);
		return NULL;
		return NULL;
	}
	}


	*skb_addr = pci_map_single(sc->pdev,
	*skb_addr = pci_map_single(sc->pdev,
		skb->data, sc->rxbufsize, PCI_DMA_FROMDEVICE);
				   skb->data, common->rx_bufsize,
				   PCI_DMA_FROMDEVICE);
	if (unlikely(pci_dma_mapping_error(sc->pdev, *skb_addr))) {
	if (unlikely(pci_dma_mapping_error(sc->pdev, *skb_addr))) {
		ATH5K_ERR(sc, "%s: DMA mapping failed\n", __func__);
		ATH5K_ERR(sc, "%s: DMA mapping failed\n", __func__);
		dev_kfree_skb(skb);
		dev_kfree_skb(skb);
@@ -1631,10 +1635,10 @@ ath5k_rx_start(struct ath5k_softc *sc)
	struct ath5k_buf *bf;
	struct ath5k_buf *bf;
	int ret;
	int ret;


	sc->rxbufsize = roundup(IEEE80211_MAX_LEN, common->cachelsz);
	common->rx_bufsize = roundup(IEEE80211_MAX_LEN, common->cachelsz);


	ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "cachelsz %u rxbufsize %u\n",
	ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "cachelsz %u rx_bufsize %u\n",
		common->cachelsz, sc->rxbufsize);
		  common->cachelsz, common->rx_bufsize);


	spin_lock_bh(&sc->rxbuflock);
	spin_lock_bh(&sc->rxbuflock);
	sc->rxlink = NULL;
	sc->rxlink = NULL;
@@ -1679,6 +1683,8 @@ static unsigned int
ath5k_rx_decrypted(struct ath5k_softc *sc, struct ath5k_desc *ds,
ath5k_rx_decrypted(struct ath5k_softc *sc, struct ath5k_desc *ds,
		struct sk_buff *skb, struct ath5k_rx_status *rs)
		struct sk_buff *skb, struct ath5k_rx_status *rs)
{
{
	struct ath5k_hw *ah = sc->ah;
	struct ath_common *common = ath5k_hw_common(ah);
	struct ieee80211_hdr *hdr = (void *)skb->data;
	struct ieee80211_hdr *hdr = (void *)skb->data;
	unsigned int keyix, hlen;
	unsigned int keyix, hlen;


@@ -1695,7 +1701,7 @@ ath5k_rx_decrypted(struct ath5k_softc *sc, struct ath5k_desc *ds,
	    skb->len >= hlen + 4) {
	    skb->len >= hlen + 4) {
		keyix = skb->data[hlen + 3] >> 6;
		keyix = skb->data[hlen + 3] >> 6;


		if (test_bit(keyix, sc->keymap))
		if (test_bit(keyix, common->keymap))
			return RX_FLAG_DECRYPTED;
			return RX_FLAG_DECRYPTED;
	}
	}


@@ -1769,6 +1775,8 @@ ath5k_tasklet_rx(unsigned long data)
	struct sk_buff *skb, *next_skb;
	struct sk_buff *skb, *next_skb;
	dma_addr_t next_skb_addr;
	dma_addr_t next_skb_addr;
	struct ath5k_softc *sc = (void *)data;
	struct ath5k_softc *sc = (void *)data;
	struct ath5k_hw *ah = sc->ah;
	struct ath_common *common = ath5k_hw_common(ah);
	struct ath5k_buf *bf;
	struct ath5k_buf *bf;
	struct ath5k_desc *ds;
	struct ath5k_desc *ds;
	int ret;
	int ret;
@@ -1846,7 +1854,7 @@ ath5k_tasklet_rx(unsigned long data)
		if (!next_skb)
		if (!next_skb)
			goto next;
			goto next;


		pci_unmap_single(sc->pdev, bf->skbaddr, sc->rxbufsize,
		pci_unmap_single(sc->pdev, bf->skbaddr, common->rx_bufsize,
				PCI_DMA_FROMDEVICE);
				PCI_DMA_FROMDEVICE);
		skb_put(skb, rs.rs_datalen);
		skb_put(skb, rs.rs_datalen);


@@ -3032,6 +3040,8 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
	      struct ieee80211_key_conf *key)
	      struct ieee80211_key_conf *key)
{
{
	struct ath5k_softc *sc = hw->priv;
	struct ath5k_softc *sc = hw->priv;
	struct ath5k_hw *ah = sc->ah;
	struct ath_common *common = ath5k_hw_common(ah);
	int ret = 0;
	int ret = 0;


	if (modparam_nohwcrypt)
	if (modparam_nohwcrypt)
@@ -3064,14 +3074,14 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
			ATH5K_ERR(sc, "can't set the key\n");
			ATH5K_ERR(sc, "can't set the key\n");
			goto unlock;
			goto unlock;
		}
		}
		__set_bit(key->keyidx, sc->keymap);
		__set_bit(key->keyidx, common->keymap);
		key->hw_key_idx = key->keyidx;
		key->hw_key_idx = key->keyidx;
		key->flags |= (IEEE80211_KEY_FLAG_GENERATE_IV |
		key->flags |= (IEEE80211_KEY_FLAG_GENERATE_IV |
			       IEEE80211_KEY_FLAG_GENERATE_MMIC);
			       IEEE80211_KEY_FLAG_GENERATE_MMIC);
		break;
		break;
	case DISABLE_KEY:
	case DISABLE_KEY:
		ath5k_hw_reset_key(sc->ah, key->keyidx);
		ath5k_hw_reset_key(sc->ah, key->keyidx);
		__clear_bit(key->keyidx, sc->keymap);
		__clear_bit(key->keyidx, common->keymap);
		break;
		break;
	default:
	default:
		ret = -EINVAL;
		ret = -EINVAL;
+0 −2
Original line number Original line Diff line number Diff line
@@ -153,8 +153,6 @@ struct ath5k_softc {


	enum ath5k_int		imask;		/* interrupt mask copy */
	enum ath5k_int		imask;		/* interrupt mask copy */


	DECLARE_BITMAP(keymap, AR5K_KEYCACHE_SIZE); /* key use bit map */

	u8			bssidmask[ETH_ALEN];
	u8			bssidmask[ETH_ALEN];


	unsigned int		led_pin,	/* GPIO pin for driving LED */
	unsigned int		led_pin,	/* GPIO pin for driving LED */
+0 −2
Original line number Original line Diff line number Diff line
@@ -3025,8 +3025,6 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
		ATH5K_ERR(ah->ah_sc, "invalid tx power: %u\n", txpower);
		ATH5K_ERR(ah->ah_sc, "invalid tx power: %u\n", txpower);
		return -EINVAL;
		return -EINVAL;
	}
	}
	if (txpower == 0)
		txpower = AR5K_TUNE_DEFAULT_TXPOWER;


	/* Reset TX power values */
	/* Reset TX power values */
	memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
	memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
Loading