// SPDX-License-Identifier: GPL-2.0-only /* * This file is part of wl1271 * * Copyright (C) 2009 Nokia Corporation * * Contact: Luciano Coelho <luciano.coelho@nokia.com>
*/
/* 11n support */ if (desc->rate <= wl->hw_min_ht_rate)
status->encoding = RX_ENC_HT;
/* * Read the signal level and antenna diversity indication. * The msb in the signal level is always set as it is a * negative number. * The antenna indication is the msb of the rssi.
*/
status->signal = ((desc->rssi & RSSI_LEVEL_BITMASK) | BIT(7));
status->antenna = ((desc->rssi & ANT_DIVERSITY_BITMASK) >> 7);
/* * FIXME: In wl1251, the SNR should be divided by two. In wl1271 we * need to divide by two for now, but TI has been discussing about * changing it. This needs to be rechecked.
*/
wl->noise = desc->rssi - (desc->snr >> 1);
/* * In PLT mode we seem to get frames and mac80211 warns about them, * workaround this by not retrieving them at all.
*/ if (unlikely(wl->plt)) return -EINVAL;
pkt_data_len = wlcore_hw_get_rx_packet_len(wl, data, length); if (!pkt_data_len) {
wl1271_error("Invalid packet arrived from HW. length %d",
length); return -EINVAL;
}
/* skb length not including rx descriptor */
skb = __dev_alloc_skb(pkt_data_len + reserved, GFP_KERNEL); if (!skb) {
wl1271_error("Couldn't allocate RX frame"); return -ENOMEM;
}
/* reserve the unaligned payload(if any) */
skb_reserve(skb, reserved);
/* * Copy packets from aggregation buffer to the skbs without rx * descriptor and with packet payload aligned care. In case of unaligned * packets copy the packets in offset of 2 bytes guarantee IP header * payload aligned to 4 bytes.
*/
skb_put_data(skb, data + sizeof(*desc), pkt_data_len); if (rx_align == WLCORE_RX_BUF_PADDED)
skb_pull(skb, RX_BUF_ALIGN);
*hlid = desc->hlid;
hdr = (struct ieee80211_hdr *)skb->data; if (ieee80211_is_beacon(hdr->frame_control))
beacon = 1; if (ieee80211_is_data_present(hdr->frame_control))
is_data = 1;
if (buf_size == 0) {
wl1271_warning("received empty data"); break;
}
/* Read all available packets at once */
des = le32_to_cpu(status->rx_pkt_descs[drv_rx_counter]);
ret = wlcore_hw_prepare_read(wl, des, buf_size); if (ret < 0) goto out;
ret = wlcore_read_data(wl, REG_SLV_MEM_DATA, wl->aggr_buf,
buf_size, true); if (ret < 0) goto out;
/* Split data into separate packets */
pkt_offset = 0; while (pkt_offset < buf_size) {
des = le32_to_cpu(status->rx_pkt_descs[drv_rx_counter]);
pkt_len = wlcore_rx_get_buf_size(wl, des);
rx_align = wlcore_hw_get_rx_buf_align(wl, des);
/* * the handle data call can only fail in memory-outage * conditions, in that case the received frame will just * be dropped.
*/ if (wl1271_rx_handle_data(wl,
wl->aggr_buf + pkt_offset,
pkt_len, rx_align,
&hlid) == 1) { if (hlid < wl->num_links)
__set_bit(hlid, active_hlids); else
WARN(1, "hlid (%d) exceeded MAX_LINKS\n",
hlid);
}
/* * Write the driver's packet counter to the FW. This is only required * for older hardware revisions
*/ if (wl->quirks & WLCORE_QUIRK_END_OF_TRANSACTION) {
ret = wlcore_write32(wl, WL12XX_REG_RX_DRIVER_COUNTER,
wl->rx_counter); if (ret < 0) goto out;
}
wl12xx_rearm_rx_streaming(wl, active_hlids);
out: return ret;
}
#ifdef CONFIG_PM int wl1271_rx_filter_enable(struct wl1271 *wl, int index, bool enable, struct wl12xx_rx_filter *filter)
{ int ret;
if (!!test_bit(index, wl->rx_filter_enabled) == enable) {
wl1271_warning("Request to enable an already " "enabled rx filter %d", index); return 0;
}
ret = wl1271_acx_set_rx_filter(wl, index, enable, filter);
if (ret) {
wl1271_error("Failed to %s rx data filter %d (err=%d)",
enable ? "enable" : "disable", index, ret); return ret;
}
if (enable)
__set_bit(index, wl->rx_filter_enabled); else
__clear_bit(index, wl->rx_filter_enabled);
return 0;
}
int wl1271_rx_filter_clear_all(struct wl1271 *wl)
{ int i, ret = 0;
for (i = 0; i < WL1271_MAX_RX_FILTERS; i++) { if (!test_bit(i, wl->rx_filter_enabled)) continue;
ret = wl1271_rx_filter_enable(wl, i, 0, NULL); if (ret) goto out;
}
out: return ret;
} #endif/* CONFIG_PM */
Messung V0.5
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.