aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-09-14 15:24:27 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-09-16 16:45:42 -0400
commit4245d31347bdc99a608dc1d1cfe64e44aa3d1771 (patch)
tree0e0dbf7f829660ad4abe2dc24dc68040f458104d /drivers
parent3afd21e7c5b3b6312193fbee628b000dce82ecf5 (diff)
ath9k: do not insert padding into tx buffers on AR9380+
With the new EDMA descriptor format, a single descriptor can contain up to four buffer pointers. By splitting the buffer into two parts, we can let the hardware add the padding internally instead of using memmove on the skb data. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c56
1 files changed, 37 insertions, 19 deletions
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index a0cd51f2859..2c6aefad372 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1017,6 +1017,8 @@ static void ath_tx_fill_desc(struct ath_softc *sc, struct ath_buf *bf,
1017 while (bf) { 1017 while (bf) {
1018 struct sk_buff *skb = bf->bf_mpdu; 1018 struct sk_buff *skb = bf->bf_mpdu;
1019 struct ath_frame_info *fi = get_frame_info(skb); 1019 struct ath_frame_info *fi = get_frame_info(skb);
1020 struct ieee80211_hdr *hdr;
1021 int padpos, padsize;
1020 1022
1021 info.type = get_hw_packet_type(skb); 1023 info.type = get_hw_packet_type(skb);
1022 if (bf->bf_next) 1024 if (bf->bf_next)
@@ -1024,8 +1026,20 @@ static void ath_tx_fill_desc(struct ath_softc *sc, struct ath_buf *bf,
1024 else 1026 else
1025 info.link = 0; 1027 info.link = 0;
1026 1028
1027 info.buf_addr[0] = bf->bf_buf_addr; 1029 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
1028 info.buf_len[0] = skb->len; 1030 hdr = (struct ieee80211_hdr *)skb->data;
1031 padpos = ath9k_cmn_padpos(hdr->frame_control);
1032 padsize = padpos & 3;
1033
1034 info.buf_addr[0] = bf->bf_buf_addr;
1035 info.buf_len[0] = padpos + padsize;
1036 info.buf_addr[1] = info.buf_addr[0] + padpos;
1037 info.buf_len[1] = skb->len - padpos;
1038 } else {
1039 info.buf_addr[0] = bf->bf_buf_addr;
1040 info.buf_len[0] = skb->len;
1041 }
1042
1029 info.pkt_len = fi->framelen; 1043 info.pkt_len = fi->framelen;
1030 info.keyix = fi->keyix; 1044 info.keyix = fi->keyix;
1031 info.keytype = fi->keytype; 1045 info.keytype = fi->keytype;
@@ -1878,15 +1892,17 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
1878 hdr->seq_ctrl |= cpu_to_le16(sc->tx.seq_no); 1892 hdr->seq_ctrl |= cpu_to_le16(sc->tx.seq_no);
1879 } 1893 }
1880 1894
1881 /* Add the padding after the header if this is not already done */ 1895 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)) {
1882 padpos = ath9k_cmn_padpos(hdr->frame_control); 1896 /* Add the padding after the header if this is not already done */
1883 padsize = padpos & 3; 1897 padpos = ath9k_cmn_padpos(hdr->frame_control);
1884 if (padsize && skb->len > padpos) { 1898 padsize = padpos & 3;
1885 if (skb_headroom(skb) < padsize) 1899 if (padsize && skb->len > padpos) {
1886 return -ENOMEM; 1900 if (skb_headroom(skb) < padsize)
1901 return -ENOMEM;
1887 1902
1888 skb_push(skb, padsize); 1903 skb_push(skb, padsize);
1889 memmove(skb->data, skb->data + padsize, padpos); 1904 memmove(skb->data, skb->data + padsize, padpos);
1905 }
1890 } 1906 }
1891 1907
1892 if ((vif && vif->type != NL80211_IFTYPE_AP && 1908 if ((vif && vif->type != NL80211_IFTYPE_AP &&
@@ -1936,15 +1952,17 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
1936 /* Frame was ACKed */ 1952 /* Frame was ACKed */
1937 tx_info->flags |= IEEE80211_TX_STAT_ACK; 1953 tx_info->flags |= IEEE80211_TX_STAT_ACK;
1938 1954
1939 padpos = ath9k_cmn_padpos(hdr->frame_control); 1955 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)) {
1940 padsize = padpos & 3; 1956 padpos = ath9k_cmn_padpos(hdr->frame_control);
1941 if (padsize && skb->len>padpos+padsize) { 1957 padsize = padpos & 3;
1942 /* 1958 if (padsize && skb->len>padpos+padsize) {
1943 * Remove MAC header padding before giving the frame back to 1959 /*
1944 * mac80211. 1960 * Remove MAC header padding before giving the frame back to
1945 */ 1961 * mac80211.
1946 memmove(skb->data + padsize, skb->data, padpos); 1962 */
1947 skb_pull(skb, padsize); 1963 memmove(skb->data + padsize, skb->data, padpos);
1964 skb_pull(skb, padsize);
1965 }
1948 } 1966 }
1949 1967
1950 if (sc->ps_flags & PS_WAIT_FOR_TX_ACK) { 1968 if (sc->ps_flags & PS_WAIT_FOR_TX_ACK) {