Skip to content

Commit

Permalink
ath9k: simpify RX by calling ath_get_virt_hw() once
Browse files Browse the repository at this point in the history
ath_get_virt_hw() is required on RX to determine for which virtual
wiphy an skb came in for. Instead of searching for the hw twice do
it only once.

Cc: Jouni.Malinen <Jouni.Malinen@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Nov 11, 2009
1 parent 1bdf6c3 commit b4afffc
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions drivers/net/wireless/ath/ath9k/recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,23 +105,21 @@ static u64 ath_extend_tsf(struct ath_softc *sc, u32 rstamp)
* up the frame up to let mac80211 handle the actual error case, be it no
* decryption key or real decryption error. This let us keep statistics there.
*/
static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
static int ath_rx_prepare(struct ieee80211_hw *hw,
struct sk_buff *skb, struct ath_desc *ds,
struct ieee80211_rx_status *rx_status, bool *decrypt_error,
struct ath_softc *sc)
{
struct ieee80211_hdr *hdr;
u8 ratecode;
__le16 fc;
struct ieee80211_hw *hw;
struct ieee80211_sta *sta;
struct ath_node *an;
int last_rssi = ATH_RSSI_DUMMY_MARKER;


hdr = (struct ieee80211_hdr *)skb->data;
fc = hdr->frame_control;
memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
hw = ath_get_virt_hw(sc, hdr);

if (ds->ds_rxstat.rs_more) {
/*
Expand Down Expand Up @@ -616,7 +614,8 @@ static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb)
}
}

static void ath_rx_send_to_mac80211(struct ath_softc *sc, struct sk_buff *skb,
static void ath_rx_send_to_mac80211(struct ieee80211_hw *hw,
struct ath_softc *sc, struct sk_buff *skb,
struct ieee80211_rx_status *rx_status)
{
struct ieee80211_hdr *hdr;
Expand Down Expand Up @@ -648,7 +647,7 @@ static void ath_rx_send_to_mac80211(struct ath_softc *sc, struct sk_buff *skb,
} else {
/* Deliver unicast frames based on receiver address */
memcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status));
ieee80211_rx(ath_get_virt_hw(sc, hdr), skb);
ieee80211_rx(hw, skb);
}
}

Expand All @@ -664,6 +663,12 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
struct ieee80211_rx_status rx_status;
struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
/*
* The hw can techncically differ from common->hw when using ath9k
* virtual wiphy so to account for that we iterate over the active
* wiphys and find the appropriate wiphy and therefore hw.
*/
struct ieee80211_hw *hw = NULL;
struct ieee80211_hdr *hdr;
int hdrlen, padsize, retval;
bool decrypt_error = false;
Expand Down Expand Up @@ -743,6 +748,9 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
sc->rx.bufsize,
DMA_FROM_DEVICE);

hdr = (struct ieee80211_hdr *) skb->data;
hw = ath_get_virt_hw(sc, hdr);

/*
* If we're asked to flush receive queue, directly
* chain it back at the queue without processing it.
Expand All @@ -757,7 +765,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
if (sc->rx.bufsize < ds->ds_rxstat.rs_datalen)
goto requeue;

if (!ath_rx_prepare(skb, ds, &rx_status, &decrypt_error, sc))
if (!ath_rx_prepare(hw, skb, ds,
&rx_status, &decrypt_error, sc))
goto requeue;

/* Ensure we always have an skb to requeue once we are done
Expand All @@ -779,7 +788,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
skb_put(skb, ds->ds_rxstat.rs_datalen);

/* see if any padding is done by the hw and remove it */
hdr = (struct ieee80211_hdr *)skb->data;
hdrlen = ieee80211_get_hdrlen_from_skb(skb);
fc = hdr->frame_control;

Expand Down Expand Up @@ -826,7 +834,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
bf->bf_mpdu = NULL;
ath_print(common, ATH_DBG_FATAL,
"dma_mapping_error() on RX\n");
ath_rx_send_to_mac80211(sc, skb, &rx_status);
ath_rx_send_to_mac80211(hw, sc, skb, &rx_status);
break;
}
bf->bf_dmacontext = bf->bf_buf_addr;
Expand All @@ -847,7 +855,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
SC_OP_WAIT_FOR_PSPOLL_DATA)))
ath_rx_ps(sc, skb);

ath_rx_send_to_mac80211(sc, skb, &rx_status);
ath_rx_send_to_mac80211(hw, sc, skb, &rx_status);

requeue:
list_move_tail(&bf->list, &sc->rx.rxbuf);
Expand Down

0 comments on commit b4afffc

Please sign in to comment.