]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ath9k_hw: Compute pointer checksum over the link descriptor
authorVasanthakumar Thiagarajan <vasanth@atheros.com>
Thu, 15 Apr 2010 21:39:35 +0000 (17:39 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 16 Apr 2010 19:43:47 +0000 (15:43 -0400)
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ar9003_mac.c

index 1a8c1ba538b4c5a7d1e0cdd405dedd9e55eb842c..582c8805066471fa1ca8662f6c7a2faf92c5b788 100644 (file)
@@ -21,14 +21,33 @@ static void ar9003_hw_rx_enable(struct ath_hw *hw)
        REG_WRITE(hw, AR_CR, 0);
 }
 
+static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads)
+{
+       int checksum;
+
+       checksum = ads->info + ads->link
+               + ads->data0 + ads->ctl3
+               + ads->data1 + ads->ctl5
+               + ads->data2 + ads->ctl7
+               + ads->data3 + ads->ctl9;
+
+       return ((checksum & 0xffff) + (checksum >> 16)) & AR_TxPtrChkSum;
+}
+
 static void ar9003_hw_set_desc_link(void *ds, u32 ds_link)
 {
-       ((struct ar9003_txc *) ds)->link = ds_link;
+       struct ar9003_txc *ads = ds;
+
+       ads->link = ds_link;
+       ads->ctl10 &= ~AR_TxPtrChkSum;
+       ads->ctl10 |= ar9003_calc_ptr_chksum(ads);
 }
 
 static void ar9003_hw_get_desc_link(void *ds, u32 **ds_link)
 {
-       *ds_link = &((struct ar9003_txc *) ds)->link;
+       struct ar9003_txc *ads = ds;
+
+       *ds_link = &ads->link;
 }
 
 static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
@@ -168,19 +187,6 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
        return true;
 }
 
-static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads)
-{
-       int checksum;
-
-       checksum = ads->info + ads->link
-               + ads->data0 + ads->ctl3
-               + ads->data1 + ads->ctl5
-               + ads->data2 + ads->ctl7
-               + ads->data3 + ads->ctl9;
-
-       return ((checksum & 0xffff) + (checksum >> 16)) & AR_TxPtrChkSum;
-}
-
 static void ar9003_hw_fill_txdesc(struct ath_hw *ah, void *ds, u32 seglen,
                                  bool is_firstseg, bool is_lastseg,
                                  const void *ds0, dma_addr_t buf_addr,