Changeset 34443


Ignore:
Timestamp:
2012-12-02T14:04:04+01:00 (5 years ago)
Author:
juhosg
Message:

Update linux-atm fixes to reflect the final upstream pull request

[juhosg: refresh the patches with quilt]

Signed-off-by: David Woodhouse <David.Woodhouse@…>
Signed-off-by: Gabor Juhos <juhosg@…>

Location:
trunk/target/linux/generic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/generic/patches-3.3/131-atm-fixes.patch

    r34410 r34443  
    1 commit 86768086727a60335b08c34b2966c784029a24cf 
     1commit d7d3d8f1ee4435e32bc6c93187798b7e2e3170a9 
     2Author: David Woodhouse <David.Woodhouse@intel.com> 
     3Date:   Thu Nov 29 23:28:30 2012 +0000 
     4 
     5    solos-pci: remove list_vccs() debugging function 
     6     
     7    No idea why we've gone so long dumping a list of VCCs with vci==0 on 
     8    every ->open() call... 
     9     
     10    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
     11 
     12commit c93967bfd3a3dffa759a3f28370167bf3cdbc3d0 
     13Author: David Woodhouse <David.Woodhouse@intel.com> 
     14Date:   Thu Nov 29 23:27:20 2012 +0000 
     15 
     16    solos-pci: use GFP_KERNEL where possible, not GFP_ATOMIC 
     17     
     18    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
     19 
     20commit ad6999e17ae4f7b99f6d28f425ae970acb115347 
     21Author: David Woodhouse <David.Woodhouse@intel.com> 
     22Date:   Thu Nov 29 23:15:30 2012 +0000 
     23 
     24    solos-pci: clean up pclose() function 
     25     
     26     - Flush pending TX skbs from the queue rather than waiting for them all to 
     27       complete (suggested by Krzysztof Mazur <krzysiek@podlesie.net>). 
     28     - Clear ATM_VF_ADDR only when the PKT_PCLOSE packet has been submitted. 
     29     - Don't clear ATM_VF_READY at all — vcc_destroy_socket() does that for us. 
     30     
     31    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
     32 
     33commit 2547e97f29d6d69d567947d5ef90b6b4fbcaf565 
    234Author: David Woodhouse <David.Woodhouse@intel.com> 
    335Date:   Wed Nov 28 10:15:05 2012 +0000 
     
    1143    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    1244 
    13 commit a009aa5fde926350f7a7e558a3ac0180e10eb24a 
     45commit 990b0884a2e9668c08e9daa4d70a54d65329cb6f 
    1446Author: Krzysztof Mazur <krzysiek@podlesie.net> 
    1547Date:   Wed Nov 28 09:08:04 2012 +0100 
     
    2759    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    2860 
    29 commit ae2169bcb6375fb214cadd0ea50ac54bcf39b0d6 
     61commit f49b6da01f0abebb17f6241473d53018d923f6b0 
    3062Author: Nathan Williams <nathan@traverse.com.au> 
    3163Date:   Tue Nov 27 17:34:09 2012 +1100 
     
    3870    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    3971 
    40 commit 6227612becaebe2f9f4ad7d0cdf27e298bb56687 
     72commit a61d37ff4a555886c4ebe31d2c6d893afb6f4d3c 
    4173Author: David Woodhouse <David.Woodhouse@intel.com> 
    4274Date:   Wed Nov 28 00:46:45 2012 +0000 
     
    5385    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    5486 
    55 commit 44abbb464896dc2270716d25e12fe47e57eeb1d3 
     87commit c52f40629884ddc62c7af445fd5d620fdb466fb2 
    5688Author: David Woodhouse <David.Woodhouse@intel.com> 
    5789Date:   Wed Nov 28 00:05:52 2012 +0000 
     
    70102    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    71103 
    72 commit c93eeac2ebee497dbc9b6ad39c235ff3061be141 
     104commit 35826e7372fe39b7db7930eda0267c82d68d1a4c 
     105Author: David Woodhouse <dwmw2@infradead.org> 
     106Date:   Tue Nov 27 23:28:36 2012 +0000 
     107 
     108    br2684: don't send frames on not-ready vcc 
     109     
     110    Avoid submitting packets to a vcc which is being closed. Things go badly 
     111    wrong when the ->pop method gets later called after everything's been 
     112    torn down. 
     113     
     114    Use the ATM socket lock for synchronisation with vcc_destroy_socket(), 
     115    which clears the ATM_VF_READY bit under the same lock. Otherwise, we 
     116    could end up submitting a packet to the device driver even after its 
     117    ->ops->close method has been called. And it could call the vcc's ->pop 
     118    method after the protocol has been shut down. Which leads to a panic. 
     119     
     120    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
     121    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
     122 
     123commit 7f940dde65de4a707f3dd723bb6ce9de90ca1eab 
    73124Author: David Woodhouse <David.Woodhouse@intel.com> 
    74125Date:   Wed Nov 28 00:03:11 2012 +0000 
    75126 
    76     atm: Add release_cb() callback to vcc 
     127    atm: add release_cb() callback to vcc 
    77128     
    78129    The immediate use case for this is that it will allow us to ensure that a 
     
    87138    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    88139 
    89 commit 9b3e2e224cc4326d8897243b24d778abf9098a8d 
    90 Author: David Woodhouse <dwmw2@infradead.org> 
    91 Date:   Tue Nov 27 23:28:36 2012 +0000 
    92  
    93     br2684: don't send frames on not-ready vcc 
    94      
    95     Avoid submitting packets to a vcc which is being closed. Things go badly 
    96     wrong when the ->pop method gets later called after everything's been 
    97     torn down. 
    98      
    99     Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    100     Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    101  
    102 commit 26c7c53318cf56a690ae553104f4a60181734fb5 
     140commit def1b2f9083f84d0a77730e537c76429914d17c1 
    103141Author: David Woodhouse <David.Woodhouse@intel.com> 
    104142Date:   Tue Nov 27 23:49:24 2012 +0000 
    105143 
    106     solos-pci: Wait for pending TX to complete when releasing vcc 
     144    solos-pci: wait for pending TX to complete when releasing vcc 
    107145     
    108146    We should no longer be calling the old pop routine for the vcc, after 
     
    112150    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    113151 
    114 commit 1a3304e89b9ba168340a37926014be11c3ad110e 
     152commit 397ff16dce53888ec693b3718640be2560204751 
    115153Author: Krzysztof Mazur <krzysiek@podlesie.net> 
    116154Date:   Tue Nov 6 23:17:02 2012 +0100 
     
    130168    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    131169 
    132 commit 294398bcd0fe26335059a185b59cfb5de1fc4c71 
     170commit 071d93931a75dc1f82f0baa9959613af81c5a032 
    133171Author: Krzysztof Mazur <krzysiek@podlesie.net> 
    134172Date:   Sat Nov 10 23:33:19 2012 +0100 
     
    136174    pppoatm: drop frames to not-ready vcc 
    137175     
    138     Patches "atm: detach protocol before closing vcc" 
    139     and "pppoatm: allow assign only on a connected socket" fixed 
    140     common cases where the pppoatm_send() crashes while sending 
    141     frame to not-ready vcc. However there are still some other cases 
    142     where we can send frames to vcc, which is flagged as ATM_VF_CLOSE 
    143     (for instance after vcc_release_async()) or it's opened but not 
    144     ready yet. 
     176    The vcc_destroy_socket() closes vcc before the protocol is detached 
     177    from vcc by calling vcc->push() with NULL skb. This leaves some time 
     178    window, where the protocol may call vcc->send() on closed vcc 
     179    and crash. 
    145180     
    146181    Now pppoatm_send(), like vcc_sendmsg(), checks for vcc flags that 
     
    278313    Signed-off-by: David S. Miller <davem@davemloft.net> 
    279314 
    280 diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c 
    281 index 9851093..6258961 100644 
    282315--- a/drivers/atm/solos-pci.c 
    283316+++ b/drivers/atm/solos-pci.c 
     
    290323        uint32_t dma_addr; 
    291324 }; 
    292 @@ -710,7 +711,8 @@ void solos_bh(unsigned long card_arg) 
     325@@ -164,7 +165,6 @@ static void fpga_queue(struct solos_card 
     326 static uint32_t fpga_tx(struct solos_card *); 
     327 static irqreturn_t solos_irq(int irq, void *dev_id); 
     328 static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); 
     329-static int list_vccs(int vci); 
     330 static int atm_init(struct solos_card *, struct device *); 
     331 static void atm_remove(struct solos_card *); 
     332 static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); 
     333@@ -710,7 +710,8 @@ void solos_bh(unsigned long card_arg) 
    293334                                                dev_warn(&card->dev->dev, "Received packet for unknown VPI.VCI %d.%d on port %d\n", 
    294335                                                         le16_to_cpu(header->vpi), le16_to_cpu(header->vci), 
     
    300341                                atm_charge(vcc, skb->truesize); 
    301342                                vcc->push(vcc, skb); 
    302 @@ -881,11 +883,18 @@ static void pclose(struct atm_vcc *vcc) 
     343@@ -790,44 +791,6 @@ static struct atm_vcc *find_vcc(struct a 
     344        return vcc; 
     345 } 
     346  
     347-static int list_vccs(int vci) 
     348-{ 
     349-       struct hlist_head *head; 
     350-       struct atm_vcc *vcc; 
     351-       struct hlist_node *node; 
     352-       struct sock *s; 
     353-       int num_found = 0; 
     354-       int i; 
     355- 
     356-       read_lock(&vcc_sklist_lock); 
     357-       if (vci != 0){ 
     358-               head = &vcc_hash[vci & (VCC_HTABLE_SIZE -1)]; 
     359-               sk_for_each(s, node, head) { 
     360-                       num_found ++; 
     361-                       vcc = atm_sk(s); 
     362-                       printk(KERN_DEBUG "Device: %d Vpi: %d Vci: %d\n", 
     363-                              vcc->dev->number, 
     364-                              vcc->vpi, 
     365-                              vcc->vci); 
     366-               } 
     367-       } else { 
     368-               for(i = 0; i < VCC_HTABLE_SIZE; i++){ 
     369-                       head = &vcc_hash[i]; 
     370-                       sk_for_each(s, node, head) { 
     371-                               num_found ++; 
     372-                               vcc = atm_sk(s); 
     373-                               printk(KERN_DEBUG "Device: %d Vpi: %d Vci: %d\n", 
     374-                                      vcc->dev->number, 
     375-                                      vcc->vpi, 
     376-                                      vcc->vci); 
     377-                       } 
     378-               } 
     379-       } 
     380-       read_unlock(&vcc_sklist_lock); 
     381-       return num_found; 
     382-} 
     383- 
     384- 
     385 static int popen(struct atm_vcc *vcc) 
     386 { 
     387        struct solos_card *card = vcc->dev->dev_data; 
     388@@ -840,7 +803,7 @@ static int popen(struct atm_vcc *vcc) 
     389                return -EINVAL; 
     390        } 
     391  
     392-       skb = alloc_skb(sizeof(*header), GFP_ATOMIC); 
     393+       skb = alloc_skb(sizeof(*header), GFP_KERNEL); 
     394        if (!skb) { 
     395                if (net_ratelimit()) 
     396                        dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n"); 
     397@@ -857,8 +820,6 @@ static int popen(struct atm_vcc *vcc) 
     398  
     399        set_bit(ATM_VF_ADDR, &vcc->flags); 
     400        set_bit(ATM_VF_READY, &vcc->flags); 
     401-       list_vccs(0); 
     402- 
     403  
     404        return 0; 
     405 } 
     406@@ -866,10 +827,21 @@ static int popen(struct atm_vcc *vcc) 
     407 static void pclose(struct atm_vcc *vcc) 
     408 { 
     409        struct solos_card *card = vcc->dev->dev_data; 
     410-       struct sk_buff *skb; 
     411+       unsigned char port = SOLOS_CHAN(vcc->dev); 
     412+       struct sk_buff *skb, *tmpskb; 
     413        struct pkt_hdr *header; 
     414  
     415-       skb = alloc_skb(sizeof(*header), GFP_ATOMIC); 
     416+       /* Remove any yet-to-be-transmitted packets from the pending queue */ 
     417+       spin_lock(&card->tx_queue_lock); 
     418+       skb_queue_walk_safe(&card->tx_queue[port], skb, tmpskb) { 
     419+               if (SKB_CB(skb)->vcc == vcc) { 
     420+                       skb_unlink(skb, &card->tx_queue[port]); 
     421+                       solos_pop(vcc, skb); 
     422+               } 
     423+       } 
     424+       spin_unlock(&card->tx_queue_lock); 
     425+ 
     426+       skb = alloc_skb(sizeof(*header), GFP_KERNEL); 
     427        if (!skb) { 
     428                dev_warn(&card->dev->dev, "Failed to allocate sk_buff in pclose()\n"); 
     429                return; 
     430@@ -881,15 +853,21 @@ static void pclose(struct atm_vcc *vcc) 
    303431        header->vci = cpu_to_le16(vcc->vci); 
    304432        header->type = cpu_to_le16(PKT_PCLOSE); 
    305433  
     434-       fpga_queue(card, SOLOS_CHAN(vcc->dev), skb, NULL); 
    306435+       init_completion(&SKB_CB(skb)->c); 
    307 + 
    308         fpga_queue(card, SOLOS_CHAN(vcc->dev), skb, NULL); 
    309   
    310         clear_bit(ATM_VF_ADDR, &vcc->flags); 
    311         clear_bit(ATM_VF_READY, &vcc->flags); 
    312   
    313 +       if (!wait_for_completion_timeout(&SKB_CB(skb)->c, 
    314 +                                        msecs_to_jiffies(5000))) 
     436  
     437-       clear_bit(ATM_VF_ADDR, &vcc->flags); 
     438-       clear_bit(ATM_VF_READY, &vcc->flags); 
     439+       fpga_queue(card, port, skb, NULL); 
     440+ 
     441+       if (!wait_for_completion_timeout(&SKB_CB(skb)->c, 5 * HZ)) 
    315442+               dev_warn(&card->dev->dev, "Timeout waiting for VCC close on port %d\n", 
    316 +                        SOLOS_CHAN(vcc->dev)); 
    317 + 
     443+                        port); 
     444  
    318445        /* Hold up vcc_destroy_socket() (our caller) until solos_bh() in the 
    319446           tasklet has finished processing any incoming packets (and, more to 
    320447           the point, using the vcc pointer). */ 
    321 @@ -1011,9 +1020,12 @@ static uint32_t fpga_tx(struct solos_card *card) 
     448        tasklet_unlock_wait(&card->tlet); 
     449+ 
     450+       clear_bit(ATM_VF_ADDR, &vcc->flags); 
     451+ 
     452        return; 
     453 } 
     454  
     455@@ -1010,9 +988,12 @@ static uint32_t fpga_tx(struct solos_car 
    322456                        if (vcc) { 
    323457                                atomic_inc(&vcc->stats->tx); 
     
    334468        } 
    335469        /* For non-DMA TX, write the 'TX start' bit for all four ports simultaneously */ 
    336 @@ -1345,6 +1357,8 @@ static struct pci_driver fpga_driver = { 
     470@@ -1246,7 +1227,7 @@ static int atm_init(struct solos_card *c 
     471                card->atmdev[i]->phy_data = (void *)(unsigned long)i; 
     472                atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_FOUND); 
     473  
     474-               skb = alloc_skb(sizeof(*header), GFP_ATOMIC); 
     475+               skb = alloc_skb(sizeof(*header), GFP_KERNEL); 
     476                if (!skb) { 
     477                        dev_warn(&card->dev->dev, "Failed to allocate sk_buff in atm_init()\n"); 
     478                        continue; 
     479@@ -1343,6 +1324,8 @@ static struct pci_driver fpga_driver = { 
    337480  
    338481 static int __init solos_pci_init(void) 
     
    343486        return pci_register_driver(&fpga_driver); 
    344487 } 
    345 diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h 
    346 index 22ef21c..c1da539 100644 
    347488--- a/include/linux/atmdev.h 
    348489+++ b/include/linux/atmdev.h 
    349 @@ -99,6 +99,7 @@ struct atm_vcc { 
     490@@ -307,6 +307,7 @@ struct atm_vcc { 
    350491        struct atm_dev  *dev;           /* device back pointer */ 
    351492        struct atm_qos  qos;            /* QOS */ 
     
    355496        void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */ 
    356497        int (*push_oam)(struct atm_vcc *vcc,void *cell); 
    357 @@ -106,6 +107,7 @@ struct atm_vcc { 
     498@@ -314,6 +315,7 @@ struct atm_vcc { 
    358499        void            *dev_data;      /* per-device data */ 
    359500        void            *proto_data;    /* per-protocol data */ 
     
    363504        short           itf;            /* interface number */ 
    364505        struct sockaddr_atmsvc local; 
    365 diff --git a/net/atm/br2684.c b/net/atm/br2684.c 
    366 index 4819d315..a4ee4ad 100644 
    367506--- a/net/atm/br2684.c 
    368507+++ b/net/atm/br2684.c 
    369 @@ -68,12 +68,14 @@ struct br2684_vcc { 
     508@@ -68,12 +68,15 @@ struct br2684_vcc { 
    370509        /* keep old push, pop functions for chaining */ 
    371510        void (*old_push)(struct atm_vcc *vcc, struct sk_buff *skb); 
    372511        void (*old_pop)(struct atm_vcc *vcc, struct sk_buff *skb); 
     512+       void (*old_release_cb)(struct atm_vcc *vcc); 
    373513+       struct module *old_owner; 
    374514        enum br2684_encaps encaps; 
     
    382522  
    383523 struct br2684_dev { 
    384 @@ -181,18 +183,15 @@ static struct notifier_block atm_dev_notifier = { 
     524@@ -181,18 +184,15 @@ static struct notifier_block atm_dev_not 
    385525 static void br2684_pop(struct atm_vcc *vcc, struct sk_buff *skb) 
    386526 { 
     
    406546  * Send a packet out a particular vcc.  Not to useful right now, but paves 
    407547  * the way for multiple vcc's per itf.  Returns true if we can send, 
    408 @@ -251,21 +250,30 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct net_device *dev, 
    409         skb_debug(skb); 
    410   
    411         ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc; 
    412 +       if (test_bit(ATM_VF_RELEASED, &atmvcc->flags) || 
    413 +           test_bit(ATM_VF_CLOSE, &atmvcc->flags) || 
    414 +           !test_bit(ATM_VF_READY, &atmvcc->flags)) { 
    415 +               dev_kfree_skb(skb); 
    416 +               return 0; 
    417 +       } 
    418         pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev); 
    419         atomic_add(skb->truesize, &sk_atm(atmvcc)->sk_wmem_alloc); 
     548@@ -256,16 +256,30 @@ static int br2684_xmit_vcc(struct sk_buf 
    420549        ATM_SKB(skb)->atm_options = atmvcc->atm_options; 
    421550        dev->stats.tx_packets++; 
     
    440569+          the stats are updated correctly */ 
    441570+       return !atmvcc->send(atmvcc, skb); 
     571+} 
     572+ 
     573+static void br2684_release_cb(struct atm_vcc *atmvcc) 
     574+{ 
     575+       struct br2684_vcc *brvcc = BR2684_VCC(atmvcc); 
     576+ 
     577+       if (atomic_read(&brvcc->qspace) > 0) 
     578+               netif_wake_queue(brvcc->device); 
     579+ 
     580+       if (brvcc->old_release_cb) 
     581+               brvcc->old_release_cb(atmvcc); 
    442582 } 
    443583  
    444584 static inline struct br2684_vcc *pick_outgoing_vcc(const struct sk_buff *skb, 
    445 @@ -378,8 +386,8 @@ static void br2684_close_vcc(struct br2684_vcc *brvcc) 
     585@@ -279,6 +293,8 @@ static netdev_tx_t br2684_start_xmit(str 
     586 { 
     587        struct br2684_dev *brdev = BRPRIV(dev); 
     588        struct br2684_vcc *brvcc; 
     589+       struct atm_vcc *atmvcc; 
     590+       netdev_tx_t ret = NETDEV_TX_OK; 
     591  
     592        pr_debug("skb_dst(skb)=%p\n", skb_dst(skb)); 
     593        read_lock(&devs_lock); 
     594@@ -289,9 +305,26 @@ static netdev_tx_t br2684_start_xmit(str 
     595                dev->stats.tx_carrier_errors++; 
     596                /* netif_stop_queue(dev); */ 
     597                dev_kfree_skb(skb); 
     598-               read_unlock(&devs_lock); 
     599-               return NETDEV_TX_OK; 
     600+               goto out_devs; 
     601        } 
     602+       atmvcc = brvcc->atmvcc; 
     603+ 
     604+       bh_lock_sock(sk_atm(atmvcc)); 
     605+ 
     606+       if (test_bit(ATM_VF_RELEASED, &atmvcc->flags) || 
     607+           test_bit(ATM_VF_CLOSE, &atmvcc->flags) || 
     608+           !test_bit(ATM_VF_READY, &atmvcc->flags)) { 
     609+               dev->stats.tx_dropped++; 
     610+               dev_kfree_skb(skb); 
     611+               goto out; 
     612+       } 
     613+ 
     614+       if (sock_owned_by_user(sk_atm(atmvcc))) { 
     615+               netif_stop_queue(brvcc->device); 
     616+               ret = NETDEV_TX_BUSY; 
     617+               goto out; 
     618+       } 
     619+ 
     620        if (!br2684_xmit_vcc(skb, dev, brvcc)) { 
     621                /* 
     622                 * We should probably use netif_*_queue() here, but that 
     623@@ -303,8 +336,11 @@ static netdev_tx_t br2684_start_xmit(str 
     624                dev->stats.tx_errors++; 
     625                dev->stats.tx_fifo_errors++; 
     626        } 
     627+ out: 
     628+       bh_unlock_sock(sk_atm(atmvcc)); 
     629+ out_devs: 
     630        read_unlock(&devs_lock); 
     631-       return NETDEV_TX_OK; 
     632+       return ret; 
     633 } 
     634  
     635 /* 
     636@@ -377,9 +413,10 @@ static void br2684_close_vcc(struct br26 
     637        list_del(&brvcc->brvccs); 
    446638        write_unlock_irq(&devs_lock); 
    447639        brvcc->atmvcc->user_back = NULL;        /* what about vcc->recvq ??? */ 
     640+       brvcc->atmvcc->release_cb = brvcc->old_release_cb; 
    448641        brvcc->old_push(brvcc->atmvcc, NULL);   /* pass on the bad news */ 
    449642+       module_put(brvcc->old_owner); 
     
    453646  
    454647 /* when AAL5 PDU comes in: */ 
    455 @@ -504,6 +512,13 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg) 
     648@@ -504,6 +541,13 @@ static int br2684_regvcc(struct atm_vcc 
    456649        brvcc = kzalloc(sizeof(struct br2684_vcc), GFP_KERNEL); 
    457650        if (!brvcc) 
     
    467660        net_dev = br2684_find_dev(&be.ifspec); 
    468661        if (net_dev == NULL) { 
    469 @@ -546,9 +561,11 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg) 
     662@@ -546,9 +590,13 @@ static int br2684_regvcc(struct atm_vcc 
    470663        brvcc->encaps = (enum br2684_encaps)be.encaps; 
    471664        brvcc->old_push = atmvcc->push; 
    472665        brvcc->old_pop = atmvcc->pop; 
     666+       brvcc->old_release_cb = atmvcc->release_cb; 
    473667+       brvcc->old_owner = atmvcc->owner; 
    474668        barrier(); 
    475669        atmvcc->push = br2684_push; 
    476670        atmvcc->pop = br2684_pop; 
     671+       atmvcc->release_cb = br2684_release_cb; 
    477672+       atmvcc->owner = THIS_MODULE; 
    478673  
    479674        /* initialize netdev carrier state */ 
    480675        if (atmvcc->dev->signal == ATM_PHY_SIG_LOST) 
    481 @@ -687,10 +704,13 @@ static int br2684_ioctl(struct socket *sock, unsigned int cmd, 
     676@@ -687,10 +735,13 @@ static int br2684_ioctl(struct socket *s 
    482677                        return -ENOIOCTLCMD; 
    483678                if (!capable(CAP_NET_ADMIN)) 
     
    495690        case BR2684_SETFILT: 
    496691                if (atmvcc->push != br2684_push) 
    497 diff --git a/net/atm/common.c b/net/atm/common.c 
    498 index 0c0ad93..806fc0a 100644 
    499692--- a/net/atm/common.c 
    500693+++ b/net/atm/common.c 
    501 @@ -126,10 +126,19 @@ static void vcc_write_space(struct sock *sk) 
     694@@ -126,10 +126,19 @@ static void vcc_write_space(struct sock 
    502695        rcu_read_unlock(); 
    503696 } 
     
    519712  
    520713 int vcc_create(struct net *net, struct socket *sock, int protocol, int family) 
    521 @@ -156,7 +165,9 @@ int vcc_create(struct net *net, struct socket *sock, int protocol, int family) 
     714@@ -156,7 +165,9 @@ int vcc_create(struct net *net, struct s 
    522715        atomic_set(&sk->sk_rmem_alloc, 0); 
    523716        vcc->push = NULL; 
     
    529722        vcc->atm_options = vcc->aal_options = 0; 
    530723        sk->sk_destruct = vcc_sock_destruct; 
    531 @@ -175,6 +186,7 @@ static void vcc_destroy_socket(struct sock *sk) 
     724@@ -175,6 +186,7 @@ static void vcc_destroy_socket(struct so 
    532725                        vcc->dev->ops->close(vcc); 
    533726                if (vcc->push) 
     
    537730                while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { 
    538731                        atm_return(vcc, skb->truesize); 
    539 diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c 
    540 index 226dca9..8c93267 100644 
    541732--- a/net/atm/pppoatm.c 
    542733+++ b/net/atm/pppoatm.c 
     
    550741        enum pppoatm_encaps encaps; 
    551742        atomic_t inflight; 
    552 @@ -107,6 +109,24 @@ static void pppoatm_wakeup_sender(unsigned long arg) 
     743@@ -107,6 +109,24 @@ static void pppoatm_wakeup_sender(unsign 
    553744        ppp_output_wakeup((struct ppp_channel *) arg); 
    554745 } 
     
    575766  * This gets called every time the ATM card has finished sending our 
    576767  * skb.  The ->old_pop will take care up normal atm flow control, 
    577 @@ -151,12 +171,11 @@ static void pppoatm_unassign_vcc(struct atm_vcc *atmvcc) 
     768@@ -151,12 +171,11 @@ static void pppoatm_unassign_vcc(struct 
    578769        pvcc = atmvcc_to_pvcc(atmvcc); 
    579770        atmvcc->push = pvcc->old_push; 
     
    589780  
    590781 /* Called when an AAL5 PDU comes in */ 
    591 @@ -165,9 +184,13 @@ static void pppoatm_push(struct atm_vcc *atmvcc, struct sk_buff *skb) 
     782@@ -165,9 +184,13 @@ static void pppoatm_push(struct atm_vcc 
    592783        struct pppoatm_vcc *pvcc = atmvcc_to_pvcc(atmvcc); 
    593784        pr_debug("\n"); 
     
    612803        /* 
    613804         * It's not clear that we need to bother with using atm_may_send() 
    614 @@ -269,10 +292,33 @@ static inline int pppoatm_may_send(struct pppoatm_vcc *pvcc, int size) 
     805@@ -269,10 +292,33 @@ static inline int pppoatm_may_send(struc 
    615806 static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) 
    616807 { 
     
    646837        case e_llc: 
    647838                if (skb_headroom(skb) < LLC_LEN) { 
    648 @@ -285,8 +331,10 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) 
     839@@ -285,8 +331,10 @@ static int pppoatm_send(struct ppp_chann 
    649840                        } 
    650                         consume_skb(skb); 
     841                        kfree_skb(skb); 
    651842                        skb = n; 
    652843-                       if (skb == NULL) 
     
    658849                        goto nospace; 
    659850                memcpy(skb_push(skb, LLC_LEN), pppllc, LLC_LEN); 
    660 @@ -296,6 +344,7 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) 
     851@@ -296,6 +344,7 @@ static int pppoatm_send(struct ppp_chann 
    661852                        goto nospace; 
    662853                break; 
     
    666857                kfree_skb(skb); 
    667858                return 1; 
    668 @@ -305,9 +354,12 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) 
     859@@ -305,9 +354,12 @@ static int pppoatm_send(struct ppp_chann 
    669860        ATM_SKB(skb)->atm_options = ATM_SKB(skb)->vcc->atm_options; 
    670861        pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", 
     
    680871         * We don't have space to send this SKB now, but we might have 
    681872         * already applied SC_COMP_PROT compression, so may need to undo 
    682 @@ -362,6 +414,8 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg) 
     873@@ -362,6 +414,8 @@ static int pppoatm_assign_vcc(struct atm 
    683874        atomic_set(&pvcc->inflight, NONE_INFLIGHT); 
    684875        pvcc->old_push = atmvcc->push; 
     
    689880        pvcc->chan.private = pvcc; 
    690881        pvcc->chan.ops = &pppoatm_ops; 
    691 @@ -377,7 +431,9 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg) 
     882@@ -377,7 +431,9 @@ static int pppoatm_assign_vcc(struct atm 
    692883        atmvcc->user_back = pvcc; 
    693884        atmvcc->push = pppoatm_push; 
     
    699890        /* re-process everything received between connection setup and 
    700891           backend setup */ 
    701 @@ -406,6 +462,8 @@ static int pppoatm_ioctl(struct socket *sock, unsigned int cmd, 
     892@@ -406,6 +462,8 @@ static int pppoatm_ioctl(struct socket * 
    702893                        return -ENOIOCTLCMD; 
    703894                if (!capable(CAP_NET_ADMIN)) 
  • trunk/target/linux/generic/patches-3.6/131-atm-fixes.patch

    r34410 r34443  
    1 commit 86768086727a60335b08c34b2966c784029a24cf 
     1commit d7d3d8f1ee4435e32bc6c93187798b7e2e3170a9 
     2Author: David Woodhouse <David.Woodhouse@intel.com> 
     3Date:   Thu Nov 29 23:28:30 2012 +0000 
     4 
     5    solos-pci: remove list_vccs() debugging function 
     6     
     7    No idea why we've gone so long dumping a list of VCCs with vci==0 on 
     8    every ->open() call... 
     9     
     10    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
     11 
     12commit c93967bfd3a3dffa759a3f28370167bf3cdbc3d0 
     13Author: David Woodhouse <David.Woodhouse@intel.com> 
     14Date:   Thu Nov 29 23:27:20 2012 +0000 
     15 
     16    solos-pci: use GFP_KERNEL where possible, not GFP_ATOMIC 
     17     
     18    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
     19 
     20commit ad6999e17ae4f7b99f6d28f425ae970acb115347 
     21Author: David Woodhouse <David.Woodhouse@intel.com> 
     22Date:   Thu Nov 29 23:15:30 2012 +0000 
     23 
     24    solos-pci: clean up pclose() function 
     25     
     26     - Flush pending TX skbs from the queue rather than waiting for them all to 
     27       complete (suggested by Krzysztof Mazur <krzysiek@podlesie.net>). 
     28     - Clear ATM_VF_ADDR only when the PKT_PCLOSE packet has been submitted. 
     29     - Don't clear ATM_VF_READY at all — vcc_destroy_socket() does that for us. 
     30     
     31    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
     32 
     33commit 2547e97f29d6d69d567947d5ef90b6b4fbcaf565 
    234Author: David Woodhouse <David.Woodhouse@intel.com> 
    335Date:   Wed Nov 28 10:15:05 2012 +0000 
     
    1143    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    1244 
    13 commit a009aa5fde926350f7a7e558a3ac0180e10eb24a 
     45commit 990b0884a2e9668c08e9daa4d70a54d65329cb6f 
    1446Author: Krzysztof Mazur <krzysiek@podlesie.net> 
    1547Date:   Wed Nov 28 09:08:04 2012 +0100 
     
    2759    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    2860 
    29 commit ae2169bcb6375fb214cadd0ea50ac54bcf39b0d6 
     61commit f49b6da01f0abebb17f6241473d53018d923f6b0 
    3062Author: Nathan Williams <nathan@traverse.com.au> 
    3163Date:   Tue Nov 27 17:34:09 2012 +1100 
     
    3870    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    3971 
    40 commit 6227612becaebe2f9f4ad7d0cdf27e298bb56687 
     72commit a61d37ff4a555886c4ebe31d2c6d893afb6f4d3c 
    4173Author: David Woodhouse <David.Woodhouse@intel.com> 
    4274Date:   Wed Nov 28 00:46:45 2012 +0000 
     
    5385    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    5486 
    55 commit 44abbb464896dc2270716d25e12fe47e57eeb1d3 
     87commit c52f40629884ddc62c7af445fd5d620fdb466fb2 
    5688Author: David Woodhouse <David.Woodhouse@intel.com> 
    5789Date:   Wed Nov 28 00:05:52 2012 +0000 
     
    70102    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    71103 
    72 commit c93eeac2ebee497dbc9b6ad39c235ff3061be141 
     104commit 35826e7372fe39b7db7930eda0267c82d68d1a4c 
     105Author: David Woodhouse <dwmw2@infradead.org> 
     106Date:   Tue Nov 27 23:28:36 2012 +0000 
     107 
     108    br2684: don't send frames on not-ready vcc 
     109     
     110    Avoid submitting packets to a vcc which is being closed. Things go badly 
     111    wrong when the ->pop method gets later called after everything's been 
     112    torn down. 
     113     
     114    Use the ATM socket lock for synchronisation with vcc_destroy_socket(), 
     115    which clears the ATM_VF_READY bit under the same lock. Otherwise, we 
     116    could end up submitting a packet to the device driver even after its 
     117    ->ops->close method has been called. And it could call the vcc's ->pop 
     118    method after the protocol has been shut down. Which leads to a panic. 
     119     
     120    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
     121    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
     122 
     123commit 7f940dde65de4a707f3dd723bb6ce9de90ca1eab 
    73124Author: David Woodhouse <David.Woodhouse@intel.com> 
    74125Date:   Wed Nov 28 00:03:11 2012 +0000 
    75126 
    76     atm: Add release_cb() callback to vcc 
     127    atm: add release_cb() callback to vcc 
    77128     
    78129    The immediate use case for this is that it will allow us to ensure that a 
     
    87138    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    88139 
    89 commit 9b3e2e224cc4326d8897243b24d778abf9098a8d 
    90 Author: David Woodhouse <dwmw2@infradead.org> 
    91 Date:   Tue Nov 27 23:28:36 2012 +0000 
    92  
    93     br2684: don't send frames on not-ready vcc 
    94      
    95     Avoid submitting packets to a vcc which is being closed. Things go badly 
    96     wrong when the ->pop method gets later called after everything's been 
    97     torn down. 
    98      
    99     Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    100     Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    101  
    102 commit 26c7c53318cf56a690ae553104f4a60181734fb5 
     140commit def1b2f9083f84d0a77730e537c76429914d17c1 
    103141Author: David Woodhouse <David.Woodhouse@intel.com> 
    104142Date:   Tue Nov 27 23:49:24 2012 +0000 
    105143 
    106     solos-pci: Wait for pending TX to complete when releasing vcc 
     144    solos-pci: wait for pending TX to complete when releasing vcc 
    107145     
    108146    We should no longer be calling the old pop routine for the vcc, after 
     
    112150    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    113151 
    114 commit 1a3304e89b9ba168340a37926014be11c3ad110e 
     152commit 397ff16dce53888ec693b3718640be2560204751 
    115153Author: Krzysztof Mazur <krzysiek@podlesie.net> 
    116154Date:   Tue Nov 6 23:17:02 2012 +0100 
     
    130168    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    131169 
    132 commit 294398bcd0fe26335059a185b59cfb5de1fc4c71 
     170commit 071d93931a75dc1f82f0baa9959613af81c5a032 
    133171Author: Krzysztof Mazur <krzysiek@podlesie.net> 
    134172Date:   Sat Nov 10 23:33:19 2012 +0100 
     
    136174    pppoatm: drop frames to not-ready vcc 
    137175     
    138     Patches "atm: detach protocol before closing vcc" 
    139     and "pppoatm: allow assign only on a connected socket" fixed 
    140     common cases where the pppoatm_send() crashes while sending 
    141     frame to not-ready vcc. However there are still some other cases 
    142     where we can send frames to vcc, which is flagged as ATM_VF_CLOSE 
    143     (for instance after vcc_release_async()) or it's opened but not 
    144     ready yet. 
     176    The vcc_destroy_socket() closes vcc before the protocol is detached 
     177    from vcc by calling vcc->push() with NULL skb. This leaves some time 
     178    window, where the protocol may call vcc->send() on closed vcc 
     179    and crash. 
    145180     
    146181    Now pppoatm_send(), like vcc_sendmsg(), checks for vcc flags that 
     
    278313    Signed-off-by: David S. Miller <davem@davemloft.net> 
    279314 
    280 diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c 
    281 index 9851093..6258961 100644 
    282315--- a/drivers/atm/solos-pci.c 
    283316+++ b/drivers/atm/solos-pci.c 
     
    290323        uint32_t dma_addr; 
    291324 }; 
    292 @@ -710,7 +711,8 @@ void solos_bh(unsigned long card_arg) 
     325@@ -164,7 +165,6 @@ static void fpga_queue(struct solos_card 
     326 static uint32_t fpga_tx(struct solos_card *); 
     327 static irqreturn_t solos_irq(int irq, void *dev_id); 
     328 static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); 
     329-static int list_vccs(int vci); 
     330 static int atm_init(struct solos_card *, struct device *); 
     331 static void atm_remove(struct solos_card *); 
     332 static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); 
     333@@ -710,7 +710,8 @@ void solos_bh(unsigned long card_arg) 
    293334                                                dev_warn(&card->dev->dev, "Received packet for unknown VPI.VCI %d.%d on port %d\n", 
    294335                                                         le16_to_cpu(header->vpi), le16_to_cpu(header->vci), 
     
    300341                                atm_charge(vcc, skb->truesize); 
    301342                                vcc->push(vcc, skb); 
    302 @@ -881,11 +883,18 @@ static void pclose(struct atm_vcc *vcc) 
     343@@ -790,44 +791,6 @@ static struct atm_vcc *find_vcc(struct a 
     344        return vcc; 
     345 } 
     346  
     347-static int list_vccs(int vci) 
     348-{ 
     349-       struct hlist_head *head; 
     350-       struct atm_vcc *vcc; 
     351-       struct hlist_node *node; 
     352-       struct sock *s; 
     353-       int num_found = 0; 
     354-       int i; 
     355- 
     356-       read_lock(&vcc_sklist_lock); 
     357-       if (vci != 0){ 
     358-               head = &vcc_hash[vci & (VCC_HTABLE_SIZE -1)]; 
     359-               sk_for_each(s, node, head) { 
     360-                       num_found ++; 
     361-                       vcc = atm_sk(s); 
     362-                       printk(KERN_DEBUG "Device: %d Vpi: %d Vci: %d\n", 
     363-                              vcc->dev->number, 
     364-                              vcc->vpi, 
     365-                              vcc->vci); 
     366-               } 
     367-       } else { 
     368-               for(i = 0; i < VCC_HTABLE_SIZE; i++){ 
     369-                       head = &vcc_hash[i]; 
     370-                       sk_for_each(s, node, head) { 
     371-                               num_found ++; 
     372-                               vcc = atm_sk(s); 
     373-                               printk(KERN_DEBUG "Device: %d Vpi: %d Vci: %d\n", 
     374-                                      vcc->dev->number, 
     375-                                      vcc->vpi, 
     376-                                      vcc->vci); 
     377-                       } 
     378-               } 
     379-       } 
     380-       read_unlock(&vcc_sklist_lock); 
     381-       return num_found; 
     382-} 
     383- 
     384- 
     385 static int popen(struct atm_vcc *vcc) 
     386 { 
     387        struct solos_card *card = vcc->dev->dev_data; 
     388@@ -840,7 +803,7 @@ static int popen(struct atm_vcc *vcc) 
     389                return -EINVAL; 
     390        } 
     391  
     392-       skb = alloc_skb(sizeof(*header), GFP_ATOMIC); 
     393+       skb = alloc_skb(sizeof(*header), GFP_KERNEL); 
     394        if (!skb) { 
     395                if (net_ratelimit()) 
     396                        dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n"); 
     397@@ -857,8 +820,6 @@ static int popen(struct atm_vcc *vcc) 
     398  
     399        set_bit(ATM_VF_ADDR, &vcc->flags); 
     400        set_bit(ATM_VF_READY, &vcc->flags); 
     401-       list_vccs(0); 
     402- 
     403  
     404        return 0; 
     405 } 
     406@@ -866,10 +827,21 @@ static int popen(struct atm_vcc *vcc) 
     407 static void pclose(struct atm_vcc *vcc) 
     408 { 
     409        struct solos_card *card = vcc->dev->dev_data; 
     410-       struct sk_buff *skb; 
     411+       unsigned char port = SOLOS_CHAN(vcc->dev); 
     412+       struct sk_buff *skb, *tmpskb; 
     413        struct pkt_hdr *header; 
     414  
     415-       skb = alloc_skb(sizeof(*header), GFP_ATOMIC); 
     416+       /* Remove any yet-to-be-transmitted packets from the pending queue */ 
     417+       spin_lock(&card->tx_queue_lock); 
     418+       skb_queue_walk_safe(&card->tx_queue[port], skb, tmpskb) { 
     419+               if (SKB_CB(skb)->vcc == vcc) { 
     420+                       skb_unlink(skb, &card->tx_queue[port]); 
     421+                       solos_pop(vcc, skb); 
     422+               } 
     423+       } 
     424+       spin_unlock(&card->tx_queue_lock); 
     425+ 
     426+       skb = alloc_skb(sizeof(*header), GFP_KERNEL); 
     427        if (!skb) { 
     428                dev_warn(&card->dev->dev, "Failed to allocate sk_buff in pclose()\n"); 
     429                return; 
     430@@ -881,15 +853,21 @@ static void pclose(struct atm_vcc *vcc) 
    303431        header->vci = cpu_to_le16(vcc->vci); 
    304432        header->type = cpu_to_le16(PKT_PCLOSE); 
    305433  
     434-       fpga_queue(card, SOLOS_CHAN(vcc->dev), skb, NULL); 
    306435+       init_completion(&SKB_CB(skb)->c); 
    307 + 
    308         fpga_queue(card, SOLOS_CHAN(vcc->dev), skb, NULL); 
    309   
    310         clear_bit(ATM_VF_ADDR, &vcc->flags); 
    311         clear_bit(ATM_VF_READY, &vcc->flags); 
    312   
    313 +       if (!wait_for_completion_timeout(&SKB_CB(skb)->c, 
    314 +                                        msecs_to_jiffies(5000))) 
     436  
     437-       clear_bit(ATM_VF_ADDR, &vcc->flags); 
     438-       clear_bit(ATM_VF_READY, &vcc->flags); 
     439+       fpga_queue(card, port, skb, NULL); 
     440+ 
     441+       if (!wait_for_completion_timeout(&SKB_CB(skb)->c, 5 * HZ)) 
    315442+               dev_warn(&card->dev->dev, "Timeout waiting for VCC close on port %d\n", 
    316 +                        SOLOS_CHAN(vcc->dev)); 
    317 + 
     443+                        port); 
     444  
    318445        /* Hold up vcc_destroy_socket() (our caller) until solos_bh() in the 
    319446           tasklet has finished processing any incoming packets (and, more to 
    320447           the point, using the vcc pointer). */ 
    321 @@ -1011,9 +1020,12 @@ static uint32_t fpga_tx(struct solos_card *card) 
     448        tasklet_unlock_wait(&card->tlet); 
     449+ 
     450+       clear_bit(ATM_VF_ADDR, &vcc->flags); 
     451+ 
     452        return; 
     453 } 
     454  
     455@@ -1011,9 +989,12 @@ static uint32_t fpga_tx(struct solos_car 
    322456                        if (vcc) { 
    323457                                atomic_inc(&vcc->stats->tx); 
     
    334468        } 
    335469        /* For non-DMA TX, write the 'TX start' bit for all four ports simultaneously */ 
    336 @@ -1345,6 +1357,8 @@ static struct pci_driver fpga_driver = { 
     470@@ -1248,7 +1229,7 @@ static int atm_init(struct solos_card *c 
     471                card->atmdev[i]->phy_data = (void *)(unsigned long)i; 
     472                atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_FOUND); 
     473  
     474-               skb = alloc_skb(sizeof(*header), GFP_ATOMIC); 
     475+               skb = alloc_skb(sizeof(*header), GFP_KERNEL); 
     476                if (!skb) { 
     477                        dev_warn(&card->dev->dev, "Failed to allocate sk_buff in atm_init()\n"); 
     478                        continue; 
     479@@ -1345,6 +1326,8 @@ static struct pci_driver fpga_driver = { 
    337480  
    338481 static int __init solos_pci_init(void) 
     
    343486        return pci_register_driver(&fpga_driver); 
    344487 } 
    345 diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h 
    346 index 22ef21c..c1da539 100644 
    347488--- a/include/linux/atmdev.h 
    348489+++ b/include/linux/atmdev.h 
    349 @@ -99,6 +99,7 @@ struct atm_vcc { 
     490@@ -308,6 +308,7 @@ struct atm_vcc { 
    350491        struct atm_dev  *dev;           /* device back pointer */ 
    351492        struct atm_qos  qos;            /* QOS */ 
     
    355496        void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */ 
    356497        int (*push_oam)(struct atm_vcc *vcc,void *cell); 
    357 @@ -106,6 +107,7 @@ struct atm_vcc { 
     498@@ -315,6 +316,7 @@ struct atm_vcc { 
    358499        void            *dev_data;      /* per-device data */ 
    359500        void            *proto_data;    /* per-protocol data */ 
     
    363504        short           itf;            /* interface number */ 
    364505        struct sockaddr_atmsvc local; 
    365 diff --git a/net/atm/br2684.c b/net/atm/br2684.c 
    366 index 4819d315..a4ee4ad 100644 
    367506--- a/net/atm/br2684.c 
    368507+++ b/net/atm/br2684.c 
    369 @@ -68,12 +68,14 @@ struct br2684_vcc { 
     508@@ -68,12 +68,15 @@ struct br2684_vcc { 
    370509        /* keep old push, pop functions for chaining */ 
    371510        void (*old_push)(struct atm_vcc *vcc, struct sk_buff *skb); 
    372511        void (*old_pop)(struct atm_vcc *vcc, struct sk_buff *skb); 
     512+       void (*old_release_cb)(struct atm_vcc *vcc); 
    373513+       struct module *old_owner; 
    374514        enum br2684_encaps encaps; 
     
    382522  
    383523 struct br2684_dev { 
    384 @@ -181,18 +183,15 @@ static struct notifier_block atm_dev_notifier = { 
     524@@ -181,18 +184,15 @@ static struct notifier_block atm_dev_not 
    385525 static void br2684_pop(struct atm_vcc *vcc, struct sk_buff *skb) 
    386526 { 
     
    406546  * Send a packet out a particular vcc.  Not to useful right now, but paves 
    407547  * the way for multiple vcc's per itf.  Returns true if we can send, 
    408 @@ -251,21 +250,30 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct net_device *dev, 
    409         skb_debug(skb); 
    410   
    411         ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc; 
    412 +       if (test_bit(ATM_VF_RELEASED, &atmvcc->flags) || 
    413 +           test_bit(ATM_VF_CLOSE, &atmvcc->flags) || 
    414 +           !test_bit(ATM_VF_READY, &atmvcc->flags)) { 
    415 +               dev_kfree_skb(skb); 
    416 +               return 0; 
    417 +       } 
    418         pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev); 
    419         atomic_add(skb->truesize, &sk_atm(atmvcc)->sk_wmem_alloc); 
     548@@ -256,16 +256,30 @@ static int br2684_xmit_vcc(struct sk_buf 
    420549        ATM_SKB(skb)->atm_options = atmvcc->atm_options; 
    421550        dev->stats.tx_packets++; 
     
    440569+          the stats are updated correctly */ 
    441570+       return !atmvcc->send(atmvcc, skb); 
     571+} 
     572+ 
     573+static void br2684_release_cb(struct atm_vcc *atmvcc) 
     574+{ 
     575+       struct br2684_vcc *brvcc = BR2684_VCC(atmvcc); 
     576+ 
     577+       if (atomic_read(&brvcc->qspace) > 0) 
     578+               netif_wake_queue(brvcc->device); 
     579+ 
     580+       if (brvcc->old_release_cb) 
     581+               brvcc->old_release_cb(atmvcc); 
    442582 } 
    443583  
    444584 static inline struct br2684_vcc *pick_outgoing_vcc(const struct sk_buff *skb, 
    445 @@ -378,8 +386,8 @@ static void br2684_close_vcc(struct br2684_vcc *brvcc) 
     585@@ -279,6 +293,8 @@ static netdev_tx_t br2684_start_xmit(str 
     586 { 
     587        struct br2684_dev *brdev = BRPRIV(dev); 
     588        struct br2684_vcc *brvcc; 
     589+       struct atm_vcc *atmvcc; 
     590+       netdev_tx_t ret = NETDEV_TX_OK; 
     591  
     592        pr_debug("skb_dst(skb)=%p\n", skb_dst(skb)); 
     593        read_lock(&devs_lock); 
     594@@ -289,9 +305,26 @@ static netdev_tx_t br2684_start_xmit(str 
     595                dev->stats.tx_carrier_errors++; 
     596                /* netif_stop_queue(dev); */ 
     597                dev_kfree_skb(skb); 
     598-               read_unlock(&devs_lock); 
     599-               return NETDEV_TX_OK; 
     600+               goto out_devs; 
     601        } 
     602+       atmvcc = brvcc->atmvcc; 
     603+ 
     604+       bh_lock_sock(sk_atm(atmvcc)); 
     605+ 
     606+       if (test_bit(ATM_VF_RELEASED, &atmvcc->flags) || 
     607+           test_bit(ATM_VF_CLOSE, &atmvcc->flags) || 
     608+           !test_bit(ATM_VF_READY, &atmvcc->flags)) { 
     609+               dev->stats.tx_dropped++; 
     610+               dev_kfree_skb(skb); 
     611+               goto out; 
     612+       } 
     613+ 
     614+       if (sock_owned_by_user(sk_atm(atmvcc))) { 
     615+               netif_stop_queue(brvcc->device); 
     616+               ret = NETDEV_TX_BUSY; 
     617+               goto out; 
     618+       } 
     619+ 
     620        if (!br2684_xmit_vcc(skb, dev, brvcc)) { 
     621                /* 
     622                 * We should probably use netif_*_queue() here, but that 
     623@@ -303,8 +336,11 @@ static netdev_tx_t br2684_start_xmit(str 
     624                dev->stats.tx_errors++; 
     625                dev->stats.tx_fifo_errors++; 
     626        } 
     627+ out: 
     628+       bh_unlock_sock(sk_atm(atmvcc)); 
     629+ out_devs: 
     630        read_unlock(&devs_lock); 
     631-       return NETDEV_TX_OK; 
     632+       return ret; 
     633 } 
     634  
     635 /* 
     636@@ -377,9 +413,10 @@ static void br2684_close_vcc(struct br26 
     637        list_del(&brvcc->brvccs); 
    446638        write_unlock_irq(&devs_lock); 
    447639        brvcc->atmvcc->user_back = NULL;        /* what about vcc->recvq ??? */ 
     640+       brvcc->atmvcc->release_cb = brvcc->old_release_cb; 
    448641        brvcc->old_push(brvcc->atmvcc, NULL);   /* pass on the bad news */ 
    449642+       module_put(brvcc->old_owner); 
     
    453646  
    454647 /* when AAL5 PDU comes in: */ 
    455 @@ -504,6 +512,13 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg) 
     648@@ -504,6 +541,13 @@ static int br2684_regvcc(struct atm_vcc 
    456649        brvcc = kzalloc(sizeof(struct br2684_vcc), GFP_KERNEL); 
    457650        if (!brvcc) 
     
    467660        net_dev = br2684_find_dev(&be.ifspec); 
    468661        if (net_dev == NULL) { 
    469 @@ -546,9 +561,11 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg) 
     662@@ -546,9 +590,13 @@ static int br2684_regvcc(struct atm_vcc 
    470663        brvcc->encaps = (enum br2684_encaps)be.encaps; 
    471664        brvcc->old_push = atmvcc->push; 
    472665        brvcc->old_pop = atmvcc->pop; 
     666+       brvcc->old_release_cb = atmvcc->release_cb; 
    473667+       brvcc->old_owner = atmvcc->owner; 
    474668        barrier(); 
    475669        atmvcc->push = br2684_push; 
    476670        atmvcc->pop = br2684_pop; 
     671+       atmvcc->release_cb = br2684_release_cb; 
    477672+       atmvcc->owner = THIS_MODULE; 
    478673  
    479674        /* initialize netdev carrier state */ 
    480675        if (atmvcc->dev->signal == ATM_PHY_SIG_LOST) 
    481 @@ -687,10 +704,13 @@ static int br2684_ioctl(struct socket *sock, unsigned int cmd, 
     676@@ -687,10 +735,13 @@ static int br2684_ioctl(struct socket *s 
    482677                        return -ENOIOCTLCMD; 
    483678                if (!capable(CAP_NET_ADMIN)) 
     
    495690        case BR2684_SETFILT: 
    496691                if (atmvcc->push != br2684_push) 
    497 diff --git a/net/atm/common.c b/net/atm/common.c 
    498 index 0c0ad93..806fc0a 100644 
    499692--- a/net/atm/common.c 
    500693+++ b/net/atm/common.c 
    501 @@ -126,10 +126,19 @@ static void vcc_write_space(struct sock *sk) 
     694@@ -126,10 +126,19 @@ static void vcc_write_space(struct sock 
    502695        rcu_read_unlock(); 
    503696 } 
     
    519712  
    520713 int vcc_create(struct net *net, struct socket *sock, int protocol, int family) 
    521 @@ -156,7 +165,9 @@ int vcc_create(struct net *net, struct socket *sock, int protocol, int family) 
     714@@ -156,7 +165,9 @@ int vcc_create(struct net *net, struct s 
    522715        atomic_set(&sk->sk_rmem_alloc, 0); 
    523716        vcc->push = NULL; 
     
    529722        vcc->atm_options = vcc->aal_options = 0; 
    530723        sk->sk_destruct = vcc_sock_destruct; 
    531 @@ -175,6 +186,7 @@ static void vcc_destroy_socket(struct sock *sk) 
     724@@ -175,6 +186,7 @@ static void vcc_destroy_socket(struct so 
    532725                        vcc->dev->ops->close(vcc); 
    533726                if (vcc->push) 
     
    537730                while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { 
    538731                        atm_return(vcc, skb->truesize); 
    539 diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c 
    540 index 226dca9..8c93267 100644 
    541732--- a/net/atm/pppoatm.c 
    542733+++ b/net/atm/pppoatm.c 
     
    550741        enum pppoatm_encaps encaps; 
    551742        atomic_t inflight; 
    552 @@ -107,6 +109,24 @@ static void pppoatm_wakeup_sender(unsigned long arg) 
     743@@ -107,6 +109,24 @@ static void pppoatm_wakeup_sender(unsign 
    553744        ppp_output_wakeup((struct ppp_channel *) arg); 
    554745 } 
     
    575766  * This gets called every time the ATM card has finished sending our 
    576767  * skb.  The ->old_pop will take care up normal atm flow control, 
    577 @@ -151,12 +171,11 @@ static void pppoatm_unassign_vcc(struct atm_vcc *atmvcc) 
     768@@ -151,12 +171,11 @@ static void pppoatm_unassign_vcc(struct 
    578769        pvcc = atmvcc_to_pvcc(atmvcc); 
    579770        atmvcc->push = pvcc->old_push; 
     
    589780  
    590781 /* Called when an AAL5 PDU comes in */ 
    591 @@ -165,9 +184,13 @@ static void pppoatm_push(struct atm_vcc *atmvcc, struct sk_buff *skb) 
     782@@ -165,9 +184,13 @@ static void pppoatm_push(struct atm_vcc 
    592783        struct pppoatm_vcc *pvcc = atmvcc_to_pvcc(atmvcc); 
    593784        pr_debug("\n"); 
     
    612803        /* 
    613804         * It's not clear that we need to bother with using atm_may_send() 
    614 @@ -269,10 +292,33 @@ static inline int pppoatm_may_send(struct pppoatm_vcc *pvcc, int size) 
     805@@ -269,10 +292,33 @@ static inline int pppoatm_may_send(struc 
    615806 static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) 
    616807 { 
     
    646837        case e_llc: 
    647838                if (skb_headroom(skb) < LLC_LEN) { 
    648 @@ -285,8 +331,10 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) 
     839@@ -285,8 +331,10 @@ static int pppoatm_send(struct ppp_chann 
    649840                        } 
    650841                        consume_skb(skb); 
     
    658849                        goto nospace; 
    659850                memcpy(skb_push(skb, LLC_LEN), pppllc, LLC_LEN); 
    660 @@ -296,6 +344,7 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) 
     851@@ -296,6 +344,7 @@ static int pppoatm_send(struct ppp_chann 
    661852                        goto nospace; 
    662853                break; 
     
    666857                kfree_skb(skb); 
    667858                return 1; 
    668 @@ -305,9 +354,12 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) 
     859@@ -305,9 +354,12 @@ static int pppoatm_send(struct ppp_chann 
    669860        ATM_SKB(skb)->atm_options = ATM_SKB(skb)->vcc->atm_options; 
    670861        pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", 
     
    680871         * We don't have space to send this SKB now, but we might have 
    681872         * already applied SC_COMP_PROT compression, so may need to undo 
    682 @@ -362,6 +414,8 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg) 
     873@@ -362,6 +414,8 @@ static int pppoatm_assign_vcc(struct atm 
    683874        atomic_set(&pvcc->inflight, NONE_INFLIGHT); 
    684875        pvcc->old_push = atmvcc->push; 
     
    689880        pvcc->chan.private = pvcc; 
    690881        pvcc->chan.ops = &pppoatm_ops; 
    691 @@ -377,7 +431,9 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg) 
     882@@ -377,7 +431,9 @@ static int pppoatm_assign_vcc(struct atm 
    692883        atmvcc->user_back = pvcc; 
    693884        atmvcc->push = pppoatm_push; 
     
    699890        /* re-process everything received between connection setup and 
    700891           backend setup */ 
    701 @@ -406,6 +462,8 @@ static int pppoatm_ioctl(struct socket *sock, unsigned int cmd, 
     892@@ -406,6 +462,8 @@ static int pppoatm_ioctl(struct socket * 
    702893                        return -ENOIOCTLCMD; 
    703894                if (!capable(CAP_NET_ADMIN)) 
  • trunk/target/linux/generic/patches-3.7/131-atm-fixes.patch

    r34410 r34443  
    1 commit 86768086727a60335b08c34b2966c784029a24cf 
     1commit d7d3d8f1ee4435e32bc6c93187798b7e2e3170a9 
     2Author: David Woodhouse <David.Woodhouse@intel.com> 
     3Date:   Thu Nov 29 23:28:30 2012 +0000 
     4 
     5    solos-pci: remove list_vccs() debugging function 
     6     
     7    No idea why we've gone so long dumping a list of VCCs with vci==0 on 
     8    every ->open() call... 
     9     
     10    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
     11 
     12commit c93967bfd3a3dffa759a3f28370167bf3cdbc3d0 
     13Author: David Woodhouse <David.Woodhouse@intel.com> 
     14Date:   Thu Nov 29 23:27:20 2012 +0000 
     15 
     16    solos-pci: use GFP_KERNEL where possible, not GFP_ATOMIC 
     17     
     18    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
     19 
     20commit ad6999e17ae4f7b99f6d28f425ae970acb115347 
     21Author: David Woodhouse <David.Woodhouse@intel.com> 
     22Date:   Thu Nov 29 23:15:30 2012 +0000 
     23 
     24    solos-pci: clean up pclose() function 
     25     
     26     - Flush pending TX skbs from the queue rather than waiting for them all to 
     27       complete (suggested by Krzysztof Mazur <krzysiek@podlesie.net>). 
     28     - Clear ATM_VF_ADDR only when the PKT_PCLOSE packet has been submitted. 
     29     - Don't clear ATM_VF_READY at all — vcc_destroy_socket() does that for us. 
     30     
     31    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
     32 
     33commit 2547e97f29d6d69d567947d5ef90b6b4fbcaf565 
    234Author: David Woodhouse <David.Woodhouse@intel.com> 
    335Date:   Wed Nov 28 10:15:05 2012 +0000 
     
    1143    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    1244 
    13 commit a009aa5fde926350f7a7e558a3ac0180e10eb24a 
     45commit 990b0884a2e9668c08e9daa4d70a54d65329cb6f 
    1446Author: Krzysztof Mazur <krzysiek@podlesie.net> 
    1547Date:   Wed Nov 28 09:08:04 2012 +0100 
     
    2759    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    2860 
    29 commit ae2169bcb6375fb214cadd0ea50ac54bcf39b0d6 
     61commit f49b6da01f0abebb17f6241473d53018d923f6b0 
    3062Author: Nathan Williams <nathan@traverse.com.au> 
    3163Date:   Tue Nov 27 17:34:09 2012 +1100 
     
    3870    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    3971 
    40 commit 6227612becaebe2f9f4ad7d0cdf27e298bb56687 
     72commit a61d37ff4a555886c4ebe31d2c6d893afb6f4d3c 
    4173Author: David Woodhouse <David.Woodhouse@intel.com> 
    4274Date:   Wed Nov 28 00:46:45 2012 +0000 
     
    5385    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    5486 
    55 commit 44abbb464896dc2270716d25e12fe47e57eeb1d3 
     87commit c52f40629884ddc62c7af445fd5d620fdb466fb2 
    5688Author: David Woodhouse <David.Woodhouse@intel.com> 
    5789Date:   Wed Nov 28 00:05:52 2012 +0000 
     
    70102    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    71103 
    72 commit c93eeac2ebee497dbc9b6ad39c235ff3061be141 
     104commit 35826e7372fe39b7db7930eda0267c82d68d1a4c 
     105Author: David Woodhouse <dwmw2@infradead.org> 
     106Date:   Tue Nov 27 23:28:36 2012 +0000 
     107 
     108    br2684: don't send frames on not-ready vcc 
     109     
     110    Avoid submitting packets to a vcc which is being closed. Things go badly 
     111    wrong when the ->pop method gets later called after everything's been 
     112    torn down. 
     113     
     114    Use the ATM socket lock for synchronisation with vcc_destroy_socket(), 
     115    which clears the ATM_VF_READY bit under the same lock. Otherwise, we 
     116    could end up submitting a packet to the device driver even after its 
     117    ->ops->close method has been called. And it could call the vcc's ->pop 
     118    method after the protocol has been shut down. Which leads to a panic. 
     119     
     120    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
     121    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
     122 
     123commit 7f940dde65de4a707f3dd723bb6ce9de90ca1eab 
    73124Author: David Woodhouse <David.Woodhouse@intel.com> 
    74125Date:   Wed Nov 28 00:03:11 2012 +0000 
    75126 
    76     atm: Add release_cb() callback to vcc 
     127    atm: add release_cb() callback to vcc 
    77128     
    78129    The immediate use case for this is that it will allow us to ensure that a 
     
    87138    Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    88139 
    89 commit 9b3e2e224cc4326d8897243b24d778abf9098a8d 
    90 Author: David Woodhouse <dwmw2@infradead.org> 
    91 Date:   Tue Nov 27 23:28:36 2012 +0000 
    92  
    93     br2684: don't send frames on not-ready vcc 
    94      
    95     Avoid submitting packets to a vcc which is being closed. Things go badly 
    96     wrong when the ->pop method gets later called after everything's been 
    97     torn down. 
    98      
    99     Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    100     Acked-by: Krzysztof Mazur <krzysiek@podlesie.net> 
    101  
    102 commit 26c7c53318cf56a690ae553104f4a60181734fb5 
     140commit def1b2f9083f84d0a77730e537c76429914d17c1 
    103141Author: David Woodhouse <David.Woodhouse@intel.com> 
    104142Date:   Tue Nov 27 23:49:24 2012 +0000 
    105143 
    106     solos-pci: Wait for pending TX to complete when releasing vcc 
     144    solos-pci: wait for pending TX to complete when releasing vcc 
    107145     
    108146    We should no longer be calling the old pop routine for the vcc, after 
     
    112150    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    113151 
    114 commit 1a3304e89b9ba168340a37926014be11c3ad110e 
     152commit 397ff16dce53888ec693b3718640be2560204751 
    115153Author: Krzysztof Mazur <krzysiek@podlesie.net> 
    116154Date:   Tue Nov 6 23:17:02 2012 +0100 
     
    130168    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> 
    131169 
    132 commit 294398bcd0fe26335059a185b59cfb5de1fc4c71 
     170commit 071d93931a75dc1f82f0baa9959613af81c5a032 
    133171Author: Krzysztof Mazur <krzysiek@podlesie.net> 
    134172Date:   Sat Nov 10 23:33:19 2012 +0100 
     
    136174    pppoatm: drop frames to not-ready vcc 
    137175     
    138     Patches "atm: detach protocol before closing vcc" 
    139     and "pppoatm: allow assign only on a connected socket" fixed 
    140     common cases where the pppoatm_send() crashes while sending 
    141     frame to not-ready vcc. However there are still some other cases 
    142     where we can send frames to vcc, which is flagged as ATM_VF_CLOSE 
    143     (for instance after vcc_release_async()) or it's opened but not 
    144     ready yet. 
     176    The vcc_destroy_socket() closes vcc before the protocol is detached 
     177    from vcc by calling vcc->push() with NULL skb. This leaves some time 
     178    window, where the protocol may call vcc->send() on closed vcc 
     179    and crash. 
    145180     
    146181    Now pppoatm_send(), like vcc_sendmsg(), checks for vcc flags that 
     
    278313    Signed-off-by: David S. Miller <davem@davemloft.net> 
    279314 
    280 diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c 
    281 index 9851093..6258961 100644 
    282315--- a/drivers/atm/solos-pci.c 
    283316+++ b/drivers/atm/solos-pci.c 
     
    290323        uint32_t dma_addr; 
    291324 }; 
    292 @@ -710,7 +711,8 @@ void solos_bh(unsigned long card_arg) 
     325@@ -164,7 +165,6 @@ static void fpga_queue(struct solos_card 
     326 static uint32_t fpga_tx(struct solos_card *); 
     327 static irqreturn_t solos_irq(int irq, void *dev_id); 
     328 static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); 
     329-static int list_vccs(int vci); 
     330 static int atm_init(struct solos_card *, struct device *); 
     331 static void atm_remove(struct solos_card *); 
     332 static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); 
     333@@ -710,7 +710,8 @@ void solos_bh(unsigned long card_arg) 
    293334                                                dev_warn(&card->dev->dev, "Received packet for unknown VPI.VCI %d.%d on port %d\n", 
    294335                                                         le16_to_cpu(header->vpi), le16_to_cpu(header->vci), 
     
    300341                                atm_charge(vcc, skb->truesize); 
    301342                                vcc->push(vcc, skb); 
    302 @@ -881,11 +883,18 @@ static void pclose(struct atm_vcc *vcc) 
     343@@ -790,44 +791,6 @@ static struct atm_vcc *find_vcc(struct a 
     344        return vcc; 
     345 } 
     346  
     347-static int list_vccs(int vci) 
     348-{ 
     349-       struct hlist_head *head; 
     350-       struct atm_vcc *vcc; 
     351-       struct hlist_node *node; 
     352-       struct sock *s; 
     353-       int num_found = 0; 
     354-       int i; 
     355- 
     356-       read_lock(&vcc_sklist_lock); 
     357-       if (vci != 0){ 
     358-               head = &vcc_hash[vci & (VCC_HTABLE_SIZE -1)]; 
     359-               sk_for_each(s, node, head) { 
     360-                       num_found ++; 
     361-                       vcc = atm_sk(s); 
     362-                       printk(KERN_DEBUG "Device: %d Vpi: %d Vci: %d\n", 
     363-                              vcc->dev->number, 
     364-                              vcc->vpi, 
     365-                              vcc->vci); 
     366-               } 
     367-       } else { 
     368-               for(i = 0; i < VCC_HTABLE_SIZE; i++){ 
     369-                       head = &vcc_hash[i]; 
     370-                       sk_for_each(s, node, head) { 
     371-                               num_found ++; 
     372-                               vcc = atm_sk(s); 
     373-                               printk(KERN_DEBUG "Device: %d Vpi: %d Vci: %d\n", 
     374-                                      vcc->dev->number, 
     375-                                      vcc->vpi, 
     376-                                      vcc->vci); 
     377-                       } 
     378-               } 
     379-       } 
     380-       read_unlock(&vcc_sklist_lock); 
     381-       return num_found; 
     382-} 
     383- 
     384- 
     385 static int popen(struct atm_vcc *vcc) 
     386 { 
     387        struct solos_card *card = vcc->dev->dev_data; 
     388@@ -840,7 +803,7 @@ static int popen(struct atm_vcc *vcc) 
     389                return -EINVAL; 
     390        } 
     391  
     392-       skb = alloc_skb(sizeof(*header), GFP_ATOMIC); 
     393+       skb = alloc_skb(sizeof(*header), GFP_KERNEL); 
     394        if (!skb) { 
     395                if (net_ratelimit()) 
     396                        dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n"); 
     397@@ -857,8 +820,6 @@ static int popen(struct atm_vcc *vcc) 
     398  
     399        set_bit(ATM_VF_ADDR, &vcc->flags); 
     400        set_bit(ATM_VF_READY, &vcc->flags); 
     401-       list_vccs(0); 
     402- 
     403  
     404        return 0; 
     405 } 
     406@@ -866,10 +827,21 @@ static int popen(struct atm_vcc *vcc) 
     407 static void pclose(struct atm_vcc *vcc) 
     408 { 
     409        struct solos_card *card = vcc->dev->dev_data; 
     410-       struct sk_buff *skb; 
     411+       unsigned char port = SOLOS_CHAN(vcc->dev); 
     412+       struct sk_buff *skb, *tmpskb; 
     413        struct pkt_hdr *header; 
     414  
     415-       skb = alloc_skb(sizeof(*header), GFP_ATOMIC); 
     416+       /* Remove any yet-to-be-transmitted packets from the pending queue */ 
     417+       spin_lock(&card->tx_queue_lock); 
     418+       skb_queue_walk_safe(&card->tx_queue[port], skb, tmpskb) { 
     419+               if (SKB_CB(skb)->vcc == vcc) { 
     420+                       skb_unlink(skb, &card->tx_queue[port]); 
     421+                       solos_pop(vcc, skb); 
     422+               } 
     423+       } 
     424+       spin_unlock(&card->tx_queue_lock); 
     425+ 
     426+       skb = alloc_skb(sizeof(*header), GFP_KERNEL); 
     427        if (!skb) { 
     428                dev_warn(&card->dev->dev, "Failed to allocate sk_buff in pclose()\n"); 
     429                return; 
     430@@ -881,15 +853,21 @@ static void pclose(struct atm_vcc *vcc) 
    303431        header->vci = cpu_to_le16(vcc->vci); 
    304432        header->type = cpu_to_le16(PKT_PCLOSE); 
    305433  
     434-       fpga_queue(card, SOLOS_CHAN(vcc->dev), skb, NULL); 
    306435+       init_completion(&SKB_CB(skb)->c); 
    307 + 
    308         fpga_queue(card, SOLOS_CHAN(vcc->dev), skb, NULL); 
    309   
    310         clear_bit(ATM_VF_ADDR, &vcc->flags); 
    311         clear_bit(ATM_VF_READY, &vcc->flags); 
    312   
    313 +       if (!wait_for_completion_timeout(&SKB_CB(skb)->c, 
    314 +                                        msecs_to_jiffies(5000))) 
     436  
     437-       clear_bit(ATM_VF_ADDR, &vcc->flags); 
     438-       clear_bit(ATM_VF_READY, &vcc->flags); 
     439+       fpga_queue(card, port, skb, NULL); 
     440+ 
     441+       if (!wait_for_completion_timeout(&SKB_CB(skb)->c, 5 * HZ)) 
    315442+               dev_warn(&card->dev->dev, "Timeout waiting for VCC close on port %d\n", 
    316 +                        SOLOS_CHAN(vcc->dev)); 
    317 + 
     443+                        port); 
     444  
    318445        /* Hold up vcc_destroy_socket() (our caller) until solos_bh() in the 
    319446           tasklet has finished processing any incoming packets (and, more to 
    320447           the point, using the vcc pointer). */ 
    321 @@ -1011,9 +1020,12 @@ static uint32_t fpga_tx(struct solos_card *card) 
     448        tasklet_unlock_wait(&card->tlet); 
     449+ 
     450+       clear_bit(ATM_VF_ADDR, &vcc->flags); 
     451+ 
     452        return; 
     453 } 
     454  
     455@@ -1011,9 +989,12 @@ static uint32_t fpga_tx(struct solos_car 
    322456                        if (vcc) { 
    323457                                atomic_inc(&vcc->stats->tx); 
     
    334468        } 
    335469        /* For non-DMA TX, write the 'TX start' bit for all four ports simultaneously */ 
    336 @@ -1345,6 +1357,8 @@ static struct pci_driver fpga_driver = { 
     470@@ -1248,7 +1229,7 @@ static int atm_init(struct solos_card *c 
     471                card->atmdev[i]->phy_data = (void *)(unsigned long)i; 
     472                atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_FOUND); 
     473  
     474-               skb = alloc_skb(sizeof(*header), GFP_ATOMIC); 
     475+               skb = alloc_skb(sizeof(*header), GFP_KERNEL); 
     476                if (!skb) { 
     477                        dev_warn(&card->dev->dev, "Failed to allocate sk_buff in atm_init()\n"); 
     478                        continue; 
     479@@ -1345,6 +1326,8 @@ static struct pci_driver fpga_driver = { 
    337480  
    338481 static int __init solos_pci_init(void) 
     
    343486        return pci_register_driver(&fpga_driver); 
    344487 } 
    345 diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h 
    346 index 22ef21c..c1da539 100644 
    347488--- a/include/linux/atmdev.h 
    348489+++ b/include/linux/atmdev.h 
     
    363504        short           itf;            /* interface number */ 
    364505        struct sockaddr_atmsvc local; 
    365 diff --git a/net/atm/br2684.c b/net/atm/br2684.c 
    366 index 4819d315..a4ee4ad 100644 
    367506--- a/net/atm/br2684.c 
    368507+++ b/net/atm/br2684.c 
    369 @@ -68,12 +68,14 @@ struct br2684_vcc { 
     508@@ -68,12 +68,15 @@ struct br2684_vcc { 
    370509        /* keep old push, pop functions for chaining */ 
    371510        void (*old_push)(struct atm_vcc *vcc, struct sk_buff *skb); 
    372511        void (*old_pop)(struct atm_vcc *vcc, struct sk_buff *skb); 
     512+       void (*old_release_cb)(struct atm_vcc *vcc); 
    373513+       struct module *old_owner; 
    374514        enum br2684_encaps encaps; 
     
    382522  
    383523 struct br2684_dev { 
    384 @@ -181,18 +183,15 @@ static struct notifier_block atm_dev_notifier = { 
     524@@ -181,18 +184,15 @@ static struct notifier_block atm_dev_not 
    385525 static void br2684_pop(struct atm_vcc *vcc, struct sk_buff *skb) 
    386526 { 
     
    406546  * Send a packet out a particular vcc.  Not to useful right now, but paves 
    407547  * the way for multiple vcc's per itf.  Returns true if we can send, 
    408 @@ -251,21 +250,30 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct net_device *dev, 
    409         skb_debug(skb); 
    410   
    411         ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc; 
    412 +       if (test_bit(ATM_VF_RELEASED, &atmvcc->flags) || 
    413 +           test_bit(ATM_VF_CLOSE, &atmvcc->flags) || 
    414 +           !test_bit(ATM_VF_READY, &atmvcc->flags)) { 
    415 +               dev_kfree_skb(skb); 
    416 +               return 0; 
    417 +       } 
    418         pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev); 
    419         atomic_add(skb->truesize, &sk_atm(atmvcc)->sk_wmem_alloc); 
     548@@ -256,16 +256,30 @@ static int br2684_xmit_vcc(struct sk_buf 
    420549        ATM_SKB(skb)->atm_options = atmvcc->atm_options; 
    421550        dev->stats.tx_packets++; 
     
    440569+          the stats are updated correctly */ 
    441570+       return !atmvcc->send(atmvcc, skb); 
     571+} 
     572+ 
     573+static void br2684_release_cb(struct atm_vcc *atmvcc) 
     574+{ 
     575+       struct br2684_vcc *brvcc = BR2684_VCC(atmvcc); 
     576+ 
     577+       if (atomic_read(&brvcc->qspace) > 0) 
     578+               netif_wake_queue(brvcc->device); 
     579+ 
     580+       if (brvcc->old_release_cb) 
     581+               brvcc->old_release_cb(atmvcc); 
    442582 } 
    443583  
    444584 static inline struct br2684_vcc *pick_outgoing_vcc(const struct sk_buff *skb, 
    445 @@ -378,8 +386,8 @@ static void br2684_close_vcc(struct br2684_vcc *brvcc) 
     585@@ -279,6 +293,8 @@ static netdev_tx_t br2684_start_xmit(str 
     586 { 
     587        struct br2684_dev *brdev = BRPRIV(dev); 
     588        struct br2684_vcc *brvcc; 
     589+       struct atm_vcc *atmvcc; 
     590+       netdev_tx_t ret = NETDEV_TX_OK; 
     591  
     592        pr_debug("skb_dst(skb)=%p\n", skb_dst(skb)); 
     593        read_lock(&devs_lock); 
     594@@ -289,9 +305,26 @@ static netdev_tx_t br2684_start_xmit(str 
     595                dev->stats.tx_carrier_errors++; 
     596                /* netif_stop_queue(dev); */ 
     597                dev_kfree_skb(skb); 
     598-               read_unlock(&devs_lock); 
     599-               return NETDEV_TX_OK; 
     600+               goto out_devs; 
     601        } 
     602+       atmvcc = brvcc->atmvcc; 
     603+ 
     604+       bh_lock_sock(sk_atm(atmvcc)); 
     605+ 
     606+       if (test_bit(ATM_VF_RELEASED, &atmvcc->flags) || 
     607+           test_bit(ATM_VF_CLOSE, &atmvcc->flags) || 
     608+           !test_bit(ATM_VF_READY, &atmvcc->flags)) { 
     609+               dev->stats.tx_dropped++; 
     610+               dev_kfree_skb(skb); 
     611+               goto out; 
     612+       } 
     613+ 
     614+       if (sock_owned_by_user(sk_atm(atmvcc))) { 
     615+               netif_stop_queue(brvcc->device); 
     616+               ret = NETDEV_TX_BUSY; 
     617+               goto out; 
     618+       } 
     619+ 
     620        if (!br2684_xmit_vcc(skb, dev, brvcc)) { 
     621                /* 
     622                 * We should probably use netif_*_queue() here, but that 
     623@@ -303,8 +336,11 @@ static netdev_tx_t br2684_start_xmit(str 
     624                dev->stats.tx_errors++; 
     625                dev->stats.tx_fifo_errors++; 
     626        } 
     627+ out: 
     628+       bh_unlock_sock(sk_atm(atmvcc)); 
     629+ out_devs: 
     630        read_unlock(&devs_lock); 
     631-       return NETDEV_TX_OK; 
     632+       return ret; 
     633 } 
     634  
     635 /* 
     636@@ -377,9 +413,10 @@ static void br2684_close_vcc(struct br26 
     637        list_del(&brvcc->brvccs); 
    446638        write_unlock_irq(&devs_lock); 
    447639        brvcc->atmvcc->user_back = NULL;        /* what about vcc->recvq ??? */ 
     640+       brvcc->atmvcc->release_cb = brvcc->old_release_cb; 
    448641        brvcc->old_push(brvcc->atmvcc, NULL);   /* pass on the bad news */ 
    449642+       module_put(brvcc->old_owner); 
     
    453646  
    454647 /* when AAL5 PDU comes in: */ 
    455 @@ -504,6 +512,13 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg) 
     648@@ -504,6 +541,13 @@ static int br2684_regvcc(struct atm_vcc 
    456649        brvcc = kzalloc(sizeof(struct br2684_vcc), GFP_KERNEL); 
    457650        if (!brvcc) 
     
    467660        net_dev = br2684_find_dev(&be.ifspec); 
    468661        if (net_dev == NULL) { 
    469 @@ -546,9 +561,11 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg) 
     662@@ -546,9 +590,13 @@ static int br2684_regvcc(struct atm_vcc 
    470663        brvcc->encaps = (enum br2684_encaps)be.encaps; 
    471664        brvcc->old_push = atmvcc->push; 
    472665        brvcc->old_pop = atmvcc->pop; 
     666+       brvcc->old_release_cb = atmvcc->release_cb; 
    473667+       brvcc->old_owner = atmvcc->owner; 
    474668        barrier(); 
    475669        atmvcc->push = br2684_push; 
    476670        atmvcc->pop = br2684_pop; 
     671+       atmvcc->release_cb = br2684_release_cb; 
    477672+       atmvcc->owner = THIS_MODULE; 
    478673  
    479674        /* initialize netdev carrier state */ 
    480675        if (atmvcc->dev->signal == ATM_PHY_SIG_LOST) 
    481 @@ -687,10 +704,13 @@ static int br2684_ioctl(struct socket *sock, unsigned int cmd, 
     676@@ -687,10 +735,13 @@ static int br2684_ioctl(struct socket *s 
    482677                        return -ENOIOCTLCMD; 
    483678                if (!capable(CAP_NET_ADMIN)) 
     
    495690        case BR2684_SETFILT: 
    496691                if (atmvcc->push != br2684_push) 
    497 diff --git a/net/atm/common.c b/net/atm/common.c 
    498 index 0c0ad93..806fc0a 100644 
    499692--- a/net/atm/common.c 
    500693+++ b/net/atm/common.c 
    501 @@ -126,10 +126,19 @@ static void vcc_write_space(struct sock *sk) 
     694@@ -126,10 +126,19 @@ static void vcc_write_space(struct sock 
    502695        rcu_read_unlock(); 
    503696 } 
     
    519712  
    520713 int vcc_create(struct net *net, struct socket *sock, int protocol, int family) 
    521 @@ -156,7 +165,9 @@ int vcc_create(struct net *net, struct socket *sock, int protocol, int family) 
     714@@ -156,7 +165,9 @@ int vcc_create(struct net *net, struct s 
    522715        atomic_set(&sk->sk_rmem_alloc, 0); 
    523716        vcc->push = NULL; 
     
    529722        vcc->atm_options = vcc->aal_options = 0; 
    530723        sk->sk_destruct = vcc_sock_destruct; 
    531 @@ -175,6 +186,7 @@ static void vcc_destroy_socket(struct sock *sk) 
     724@@ -175,6 +186,7 @@ static void vcc_destroy_socket(struct so 
    532725                        vcc->dev->ops->close(vcc); 
    533726                if (vcc->push) 
     
    537730                while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { 
    538731                        atm_return(vcc, skb->truesize); 
    539 diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c 
    540 index 226dca9..8c93267 100644 
    541732--- a/net/atm/pppoatm.c 
    542733+++ b/net/atm/pppoatm.c 
     
    550741        enum pppoatm_encaps encaps; 
    551742        atomic_t inflight; 
    552 @@ -107,6 +109,24 @@ static void pppoatm_wakeup_sender(unsigned long arg) 
     743@@ -107,6 +109,24 @@ static void pppoatm_wakeup_sender(unsign 
    553744        ppp_output_wakeup((struct ppp_channel *) arg); 
    554745 } 
     
    575766  * This gets called every time the ATM card has finished sending our 
    576767  * skb.  The ->old_pop will take care up normal atm flow control, 
    577 @@ -151,12 +171,11 @@ static void pppoatm_unassign_vcc(struct atm_vcc *atmvcc) 
     768@@ -151,12 +171,11 @@ static void pppoatm_unassign_vcc(struct 
    578769        pvcc = atmvcc_to_pvcc(atmvcc); 
    579770        atmvcc->push = pvcc->old_push; 
     
    589780  
    590781 /* Called when an AAL5 PDU comes in */ 
    591 @@ -165,9 +184,13 @@ static void pppoatm_push(struct atm_vcc *atmvcc, struct sk_buff *skb) 
     782@@ -165,9 +184,13 @@ static void pppoatm_push(struct atm_vcc 
    592783        struct pppoatm_vcc *pvcc = atmvcc_to_pvcc(atmvcc); 
    593784        pr_debug("\n"); 
     
    612803        /* 
    613804         * It's not clear that we need to bother with using atm_may_send() 
    614 @@ -269,10 +292,33 @@ static inline int pppoatm_may_send(struct pppoatm_vcc *pvcc, int size) 
     805@@ -269,10 +292,33 @@ static inline int pppoatm_may_send(struc 
    615806 static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) 
    616807 { 
     
    646837        case e_llc: 
    647838                if (skb_headroom(skb) < LLC_LEN) { 
    648 @@ -285,8 +331,10 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) 
     839@@ -285,8 +331,10 @@ static int pppoatm_send(struct ppp_chann 
    649840                        } 
    650841                        consume_skb(skb); 
     
    658849                        goto nospace; 
    659850                memcpy(skb_push(skb, LLC_LEN), pppllc, LLC_LEN); 
    660 @@ -296,6 +344,7 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) 
     851@@ -296,6 +344,7 @@ static int pppoatm_send(struct ppp_chann 
    661852                        goto nospace; 
    662853                break; 
     
    666857                kfree_skb(skb); 
    667858                return 1; 
    668 @@ -305,9 +354,12 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) 
     859@@ -305,9 +354,12 @@ static int pppoatm_send(struct ppp_chann 
    669860        ATM_SKB(skb)->atm_options = ATM_SKB(skb)->vcc->atm_options; 
    670861        pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", 
     
    680871         * We don't have space to send this SKB now, but we might have 
    681872         * already applied SC_COMP_PROT compression, so may need to undo 
    682 @@ -362,6 +414,8 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg) 
     873@@ -362,6 +414,8 @@ static int pppoatm_assign_vcc(struct atm 
    683874        atomic_set(&pvcc->inflight, NONE_INFLIGHT); 
    684875        pvcc->old_push = atmvcc->push; 
     
    689880        pvcc->chan.private = pvcc; 
    690881        pvcc->chan.ops = &pppoatm_ops; 
    691 @@ -377,7 +431,9 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg) 
     882@@ -377,7 +431,9 @@ static int pppoatm_assign_vcc(struct atm 
    692883        atmvcc->user_back = pvcc; 
    693884        atmvcc->push = pppoatm_push; 
     
    699890        /* re-process everything received between connection setup and 
    700891           backend setup */ 
    701 @@ -406,6 +462,8 @@ static int pppoatm_ioctl(struct socket *sock, unsigned int cmd, 
     892@@ -406,6 +462,8 @@ static int pppoatm_ioctl(struct socket * 
    702893                        return -ENOIOCTLCMD; 
    703894                if (!capable(CAP_NET_ADMIN)) 
Note: See TracChangeset for help on using the changeset viewer.