#2451: [patch] Random madwifi AP crashes
----------------------------------+-----------------------------------------
      Reporter:  Przemek Bruski   |       Owner:       
          Type:  defect           |      Status:  new  
      Priority:  major            |   Milestone:       
     Component:  madwifi: driver  |     Version:  trunk
    Resolution:                   |    Keywords:       
Patch_attached:  1                |     Pending:  0    
----------------------------------+-----------------------------------------
Comment (by vir...@gmail.com):

 So to our problem with stability:
 I have downloaded madwifi-hal-0.10.5.6-r4126-20100324.tar.gz which due to
 kernel headers changes can't be compiled on new distros (in my case,
 Ubuntu 10.10).
 Then, I have applied this patch:
 {{{
 --- ath/if_ath.c        2010-01-18 15:21:22.000000000 +0100
 +++ ath/if_ath.c        2011-03-17 13:59:52.000000000 +0100
 @@ -4257,7 +4257,7 @@
  {
         struct ieee80211com *ic = &sc->sc_ic;
         struct ieee80211vap *vap;
 -       struct dev_mc_list *mc;
 +       struct netdev_hw_addr *ha;
         u_int32_t val;
         u_int8_t pos;

 @@ -4265,11 +4265,11 @@
         /* XXX locking */
         TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
                 struct net_device *dev = vap->iv_dev;
 -               for (mc = dev->mc_list; mc; mc = mc->next) {
 +               netdev_for_each_mc_addr(ha, dev) {
                         /* calculate XOR of eight 6-bit values */
 -                       val = LE_READ_4(mc->dmi_addr + 0);
 +                       val = LE_READ_4(ha->addr + 0);
                         pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^
 val;
 -                       val = LE_READ_4(mc->dmi_addr + 3);
 +                       val = LE_READ_4(ha->addr + 3);
                         pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^
 val;
                         pos &= 0x3f;
                         mfilt[pos / 32] |= (1 << (pos % 32));
 }}}
 to make it compile again, and afterwards, your patch:
 {{{
 --- ath/if_ath.c        (revision 4136)
 +++ ath/if_ath.c        (working copy)
 @@ -3277,6 +3277,7 @@
         int (*ath_ff_flushdonetest)(struct ath_txq *txq, struct ath_buf
 *bf))
  {
         struct ath_buf *bf_ff = NULL;
 +       struct sk_buff *bf_skb_encap = NULL;
         unsigned int pktlen;
         int framecnt;

 @@ -3297,14 +3298,15 @@
                 ATH_TXQ_UNLOCK_IRQ(txq);

                 /* encap and xmit */
 -               bf_ff->bf_skb = ieee80211_encap(ATH_BUF_NI(bf_ff),
 bf_ff->bf_skb,
 +               bf_skb_encap = ieee80211_encap(ATH_BUF_NI(bf_ff),
 bf_ff->bf_skb,
                                 &framecnt);
 -               if (bf_ff->bf_skb == NULL) {
 +               if (bf_skb_encap == NULL) {
                         DPRINTF(sc, ATH_DEBUG_XMIT | ATH_DEBUG_FF,
                                 "Dropping; encapsulation failure\n");
                         sc->sc_stats.ast_tx_encap++;
                         goto bad;
                 }
 +               bf_ff->bf_skb = bf_skb_encap;
                 pktlen = bf_ff->bf_skb->len;    /* NB: don't reference skb
 below */
                 if (ath_tx_start(sc->sc_dev, ATH_BUF_NI(bf_ff), bf_ff,
                                         bf_ff->bf_skb, 0) == 0)
 @@ -3475,6 +3477,7 @@
         struct sk_buff *original_skb  = __skb; /* ALWAYS FREE THIS ONE!!!
 */
         struct ath_node *an;
         struct sk_buff *skb = NULL;
 +       struct sk_buff *bf_skb_encap = NULL;
         /* We will use the requeue flag to denote when to stuff a skb back
 into
          * the OS queues.  This should NOT be done under low memory
 conditions,
          * such as skb allocation failure.  However, it should be done for
 the
 @@ -3655,14 +3658,15 @@
                         ATH_TXQ_UNLOCK_IRQ_EARLY(txq);

                         /* Encap. and transmit */
 -                       bf_ff->bf_skb = ieee80211_encap(ni, bf_ff->bf_skb,
 +                       bf_skb_encap = ieee80211_encap(ni, bf_ff->bf_skb,
                                         &framecnt);
 -                       if (bf_ff->bf_skb == NULL) {
 +                       if (bf_skb_encap == NULL) {
                                 DPRINTF(sc, ATH_DEBUG_XMIT,
                                         "Dropping; fast-frame flush encap.
 "
                                         "failure\n");
                                 sc->sc_stats.ast_tx_encap++;
                         } else {
 +                               bf_ff->bf_skb = bf_skb_encap;
                                 pktlen = bf_ff->bf_skb->len;    /* NB:
 don't reference skb below */
                                 if (!ath_tx_start(dev, ni, bf_ff,
                                                         bf_ff->bf_skb, 0))
 @@ -12471,12 +12475,14 @@
                 return bf;

         if (bf->bf_skbaddr) {
 -               bus_unmap_single(
 -                       sc->sc_bdev,
 -                       bf->bf_skbaddr,
 -                       (direction == BUS_DMA_FROMDEVICE ?
 -                               sc->sc_rxbufsize : bf->bf_skb->len),
 -                       direction);
 +               if (bf->bf_skb) {
 +                       bus_unmap_single(
 +                               sc->sc_bdev,
 +                               bf->bf_skbaddr,
 +                               (direction == BUS_DMA_FROMDEVICE ?
 +                                sc->sc_rxbufsize : bf->bf_skb->len),
 +                               direction);
 +               }
                 bf->bf_skbaddr = 0;
                 bf->bf_desc->ds_link = 0;
                 bf->bf_desc->ds_data = 0;
 }}}
 Now it seems to be rock solid.
 Thanks you very much.

 Anyway, can you please tell me, if I am right, when I am saying that
 madwifi-hal branch is newer then 0.9.4?

-- 
Ticket URL: <http://madwifi-project.org/ticket/2451#comment:10>
madwifi-project.org <http://madwifi-project.org/>
Multiband Atheros Driver for Wireless Fidelity
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Madwifi-tickets mailing list
Madwifi-tickets@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/madwifi-tickets

Reply via email to