rt2x00: Add dev_flags to rx descriptor
The rxdone_entry_desc structure contains 3 fields which are always 1 or 0. We can safe 8 bytes by replacing them with a single dev_flags fields which contain the flags for those settings. Additionally we can remove the OFDM flag since it is no longer used since the introduction of the SIGNAL_PLCP flag. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
e2839d8f50
commit
19d30e0299
|
@ -1076,12 +1076,13 @@ static void rt2400pci_fill_rxdone(struct queue_entry *entry,
|
||||||
* of the preamble bit (0x08).
|
* of the preamble bit (0x08).
|
||||||
*/
|
*/
|
||||||
rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL) & ~0x08;
|
rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL) & ~0x08;
|
||||||
rxdesc->signal_plcp = 1;
|
|
||||||
rxdesc->rssi = rt2x00_get_field32(word2, RXD_W3_RSSI) -
|
rxdesc->rssi = rt2x00_get_field32(word2, RXD_W3_RSSI) -
|
||||||
entry->queue->rt2x00dev->rssi_offset;
|
entry->queue->rt2x00dev->rssi_offset;
|
||||||
rxdesc->ofdm = 0;
|
|
||||||
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
||||||
rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
|
|
||||||
|
rxdesc->dev_flags = RXDONE_SIGNAL_PLCP;
|
||||||
|
if (rt2x00_get_field32(word0, RXD_W0_MY_BSS))
|
||||||
|
rxdesc->dev_flags |= RXDONE_MY_BSS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1225,13 +1225,16 @@ static void rt2500pci_fill_rxdone(struct queue_entry *entry,
|
||||||
* the signal is the PLCP value. If it was received with
|
* the signal is the PLCP value. If it was received with
|
||||||
* a CCK bitrate the signal is the rate in 100kbit/s.
|
* a CCK bitrate the signal is the rate in 100kbit/s.
|
||||||
*/
|
*/
|
||||||
rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
|
|
||||||
rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL);
|
rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL);
|
||||||
rxdesc->signal_plcp = rxdesc->ofdm;
|
|
||||||
rxdesc->rssi = rt2x00_get_field32(word2, RXD_W2_RSSI) -
|
rxdesc->rssi = rt2x00_get_field32(word2, RXD_W2_RSSI) -
|
||||||
entry->queue->rt2x00dev->rssi_offset;
|
entry->queue->rt2x00dev->rssi_offset;
|
||||||
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
||||||
rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
|
|
||||||
|
rxdesc->dev_flags = 0;
|
||||||
|
if (rt2x00_get_field32(word0, RXD_W0_OFDM))
|
||||||
|
rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP;
|
||||||
|
if (rt2x00_get_field32(word0, RXD_W0_MY_BSS))
|
||||||
|
rxdesc->dev_flags |= RXDONE_MY_BSS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1139,13 +1139,16 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry,
|
||||||
* the signal is the PLCP value. If it was received with
|
* the signal is the PLCP value. If it was received with
|
||||||
* a CCK bitrate the signal is the rate in 100kbit/s.
|
* a CCK bitrate the signal is the rate in 100kbit/s.
|
||||||
*/
|
*/
|
||||||
rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
|
|
||||||
rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
|
rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
|
||||||
rxdesc->signal_plcp = rxdesc->ofdm;
|
|
||||||
rxdesc->rssi = rt2x00_get_field32(word1, RXD_W1_RSSI) -
|
rxdesc->rssi = rt2x00_get_field32(word1, RXD_W1_RSSI) -
|
||||||
entry->queue->rt2x00dev->rssi_offset;
|
entry->queue->rt2x00dev->rssi_offset;
|
||||||
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
||||||
rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
|
|
||||||
|
rxdesc->dev_flags = 0;
|
||||||
|
if (rt2x00_get_field32(word0, RXD_W0_OFDM))
|
||||||
|
rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP;
|
||||||
|
if (rt2x00_get_field32(word0, RXD_W0_MY_BSS))
|
||||||
|
rxdesc->dev_flags |= RXDONE_MY_BSS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adjust the skb memory window to the frame boundaries.
|
* Adjust the skb memory window to the frame boundaries.
|
||||||
|
|
|
@ -580,8 +580,10 @@ void rt2x00lib_rxdone(struct queue_entry *entry,
|
||||||
for (i = 0; i < sband->n_bitrates; i++) {
|
for (i = 0; i < sband->n_bitrates; i++) {
|
||||||
rate = rt2x00_get_rate(sband->bitrates[i].hw_value);
|
rate = rt2x00_get_rate(sband->bitrates[i].hw_value);
|
||||||
|
|
||||||
if ((rxdesc->signal_plcp && rate->plcp == rxdesc->signal) ||
|
if (((rxdesc->dev_flags & RXDONE_SIGNAL_PLCP) &&
|
||||||
(!rxdesc->signal_plcp && rate->bitrate == rxdesc->signal)) {
|
(rate->plcp == rxdesc->signal)) ||
|
||||||
|
(!(rxdesc->dev_flags & RXDONE_SIGNAL_PLCP) &&
|
||||||
|
(rate->bitrate == rxdesc->signal))) {
|
||||||
idx = i;
|
idx = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -592,7 +594,7 @@ void rt2x00lib_rxdone(struct queue_entry *entry,
|
||||||
*/
|
*/
|
||||||
hdr = (struct ieee80211_hdr *)entry->skb->data;
|
hdr = (struct ieee80211_hdr *)entry->skb->data;
|
||||||
fc = le16_to_cpu(hdr->frame_control);
|
fc = le16_to_cpu(hdr->frame_control);
|
||||||
if (is_beacon(fc) && rxdesc->my_bss)
|
if (is_beacon(fc) && (rxdesc->dev_flags & RXDONE_MY_BSS))
|
||||||
rt2x00lib_update_link_stats(&rt2x00dev->link, rxdesc->rssi);
|
rt2x00lib_update_link_stats(&rt2x00dev->link, rxdesc->rssi);
|
||||||
|
|
||||||
rt2x00dev->link.qual.rx_success++;
|
rt2x00dev->link.qual.rx_success++;
|
||||||
|
|
|
@ -128,28 +128,36 @@ static inline struct skb_frame_desc* get_skb_frame_desc(struct sk_buff *skb)
|
||||||
return (struct skb_frame_desc *)&skb->cb[0];
|
return (struct skb_frame_desc *)&skb->cb[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enum rxdone_entry_desc_flags: Flags for &struct rxdone_entry_desc
|
||||||
|
*
|
||||||
|
* @RXDONE_SIGNAL_PLCP: Does the signal field contain the plcp value,
|
||||||
|
* or does it contain the bitrate itself.
|
||||||
|
* @RXDONE_MY_BSS: Does this frame originate from device's BSS.
|
||||||
|
*/
|
||||||
|
enum rxdone_entry_desc_flags {
|
||||||
|
RXDONE_SIGNAL_PLCP = 1 << 0,
|
||||||
|
RXDONE_MY_BSS = 1 << 1,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct rxdone_entry_desc: RX Entry descriptor
|
* struct rxdone_entry_desc: RX Entry descriptor
|
||||||
*
|
*
|
||||||
* Summary of information that has been read from the RX frame descriptor.
|
* Summary of information that has been read from the RX frame descriptor.
|
||||||
*
|
*
|
||||||
* @signal: Signal of the received frame.
|
* @signal: Signal of the received frame.
|
||||||
* @signal_plcp: Does the signal field contain the plcp value,
|
|
||||||
* or does it contain the bitrate itself.
|
|
||||||
* @rssi: RSSI of the received frame.
|
* @rssi: RSSI of the received frame.
|
||||||
* @ofdm: Was frame send with an OFDM rate.
|
|
||||||
* @size: Data size of the received frame.
|
* @size: Data size of the received frame.
|
||||||
* @flags: MAC80211 receive flags (See &enum mac80211_rx_flags).
|
* @flags: MAC80211 receive flags (See &enum mac80211_rx_flags).
|
||||||
* @my_bss: Does this frame originate from device's BSS.
|
* @dev_flags: Ralink receive flags (See &enum rxdone_entry_desc_flags).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
struct rxdone_entry_desc {
|
struct rxdone_entry_desc {
|
||||||
int signal;
|
int signal;
|
||||||
int signal_plcp;
|
|
||||||
int rssi;
|
int rssi;
|
||||||
int ofdm;
|
|
||||||
int size;
|
int size;
|
||||||
int flags;
|
int flags;
|
||||||
int my_bss;
|
int dev_flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1649,12 +1649,15 @@ static void rt61pci_fill_rxdone(struct queue_entry *entry,
|
||||||
* the signal is the PLCP value. If it was received with
|
* the signal is the PLCP value. If it was received with
|
||||||
* a CCK bitrate the signal is the rate in 100kbit/s.
|
* a CCK bitrate the signal is the rate in 100kbit/s.
|
||||||
*/
|
*/
|
||||||
rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
|
|
||||||
rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
|
rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
|
||||||
rxdesc->signal_plcp = rxdesc->ofdm;
|
|
||||||
rxdesc->rssi = rt61pci_agc_to_rssi(entry->queue->rt2x00dev, word1);
|
rxdesc->rssi = rt61pci_agc_to_rssi(entry->queue->rt2x00dev, word1);
|
||||||
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
||||||
rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
|
|
||||||
|
rxdesc->dev_flags = 0;
|
||||||
|
if (rt2x00_get_field32(word0, RXD_W0_OFDM))
|
||||||
|
rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP;
|
||||||
|
if (rt2x00_get_field32(word0, RXD_W0_MY_BSS))
|
||||||
|
rxdesc->dev_flags |= RXDONE_MY_BSS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1409,12 +1409,15 @@ static void rt73usb_fill_rxdone(struct queue_entry *entry,
|
||||||
* the signal is the PLCP value. If it was received with
|
* the signal is the PLCP value. If it was received with
|
||||||
* a CCK bitrate the signal is the rate in 100kbit/s.
|
* a CCK bitrate the signal is the rate in 100kbit/s.
|
||||||
*/
|
*/
|
||||||
rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
|
|
||||||
rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
|
rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
|
||||||
rxdesc->signal_plcp = rxdesc->ofdm;
|
|
||||||
rxdesc->rssi = rt73usb_agc_to_rssi(entry->queue->rt2x00dev, word1);
|
rxdesc->rssi = rt73usb_agc_to_rssi(entry->queue->rt2x00dev, word1);
|
||||||
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
||||||
rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
|
|
||||||
|
rxdesc->dev_flags = 0;
|
||||||
|
if (rt2x00_get_field32(word0, RXD_W0_OFDM))
|
||||||
|
rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP;
|
||||||
|
if (rt2x00_get_field32(word0, RXD_W0_MY_BSS))
|
||||||
|
rxdesc->dev_flags |= RXDONE_MY_BSS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adjust the skb memory window to the frame boundaries.
|
* Adjust the skb memory window to the frame boundaries.
|
||||||
|
|
Loading…
Reference in New Issue