Skip to content

Commit

Permalink
p54: redo rx_status into skb->cb
Browse files Browse the repository at this point in the history
This patch slightly optimizes p54_rx_data's stack and code size.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Christian Lamparter authored and John W. Linville committed Jul 10, 2009
1 parent 9217998 commit 1795378
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions drivers/net/wireless/p54/p54common.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb)
{
struct p54_common *priv = dev->priv;
struct p54_rx_data *hdr = (struct p54_rx_data *) skb->data;
struct ieee80211_rx_status rx_status = {0};
struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
u16 freq = le16_to_cpu(hdr->freq);
size_t header_len = sizeof(*hdr);
u32 tsf32;
Expand All @@ -762,39 +762,37 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb)
}

if (hdr->decrypt_status == P54_DECRYPT_OK)
rx_status.flag |= RX_FLAG_DECRYPTED;
rx_status->flag |= RX_FLAG_DECRYPTED;
if ((hdr->decrypt_status == P54_DECRYPT_FAIL_MICHAEL) ||
(hdr->decrypt_status == P54_DECRYPT_FAIL_TKIP))
rx_status.flag |= RX_FLAG_MMIC_ERROR;
rx_status->flag |= RX_FLAG_MMIC_ERROR;

rx_status.signal = p54_rssi_to_dbm(dev, hdr->rssi);
rx_status.noise = priv->noise;
rx_status->signal = p54_rssi_to_dbm(dev, hdr->rssi);
rx_status->noise = priv->noise;
if (hdr->rate & 0x10)
rx_status.flag |= RX_FLAG_SHORTPRE;
rx_status->flag |= RX_FLAG_SHORTPRE;
if (dev->conf.channel->band == IEEE80211_BAND_5GHZ)
rx_status.rate_idx = (rate < 4) ? 0 : rate - 4;
rx_status->rate_idx = (rate < 4) ? 0 : rate - 4;
else
rx_status.rate_idx = rate;
rx_status->rate_idx = rate;

rx_status.freq = freq;
rx_status.band = dev->conf.channel->band;
rx_status.antenna = hdr->antenna;
rx_status->freq = freq;
rx_status->band = dev->conf.channel->band;
rx_status->antenna = hdr->antenna;

tsf32 = le32_to_cpu(hdr->tsf32);
if (tsf32 < priv->tsf_low32)
priv->tsf_high32++;
rx_status.mactime = ((u64)priv->tsf_high32) << 32 | tsf32;
rx_status->mactime = ((u64)priv->tsf_high32) << 32 | tsf32;
priv->tsf_low32 = tsf32;

rx_status.flag |= RX_FLAG_TSFT;
rx_status->flag |= RX_FLAG_TSFT;

if (hdr->flags & cpu_to_le16(P54_HDR_FLAG_DATA_ALIGN))
header_len += hdr->align[0];

skb_pull(skb, header_len);
skb_trim(skb, le16_to_cpu(hdr->len));

memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
ieee80211_rx_irqsafe(dev, skb);

queue_delayed_work(dev->workqueue, &priv->work,
Expand Down

0 comments on commit 1795378

Please sign in to comment.