Skip to content

Commit 7ad3ead

Browse files
David WoodhouseDavid Woodhouse
authored andcommitted
solos-pci: wait for pending TX to complete when releasing vcc
We should no longer be calling the old pop routine for the vcc, after vcc_release() has completed. Make sure we wait for any pending TX skbs to complete, by waiting for our own PKT_PCLOSE control skb to be sent. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent 397ff16 commit 7ad3ead

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

‎drivers/atm/solos-pci.c‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ static int popen(struct atm_vcc *vcc)
866866
static void pclose(struct atm_vcc *vcc)
867867
{
868868
struct solos_card *card = vcc->dev->dev_data;
869+
unsigned char port = SOLOS_CHAN(vcc->dev);
869870
struct sk_buff *skb;
870871
struct pkt_hdr *header;
871872

@@ -881,11 +882,18 @@ static void pclose(struct atm_vcc *vcc)
881882
header->vci = cpu_to_le16(vcc->vci);
882883
header->type = cpu_to_le16(PKT_PCLOSE);
883884

884-
fpga_queue(card, SOLOS_CHAN(vcc->dev), skb, NULL);
885+
skb_get(skb);
886+
fpga_queue(card, port, skb, NULL);
885887

886888
clear_bit(ATM_VF_ADDR, &vcc->flags);
887889
clear_bit(ATM_VF_READY, &vcc->flags);
888890

891+
if (!wait_event_timeout(card->param_wq, !skb_shared(skb), 5 * HZ))
892+
dev_warn(&card->dev->dev,
893+
"Timeout waiting for VCC close on port %d\n", port);
894+
895+
dev_kfree_skb(skb);
896+
889897
/* Hold up vcc_destroy_socket() (our caller) until solos_bh() in the
890898
tasklet has finished processing any incoming packets (and, more to
891899
the point, using the vcc pointer). */
@@ -1011,9 +1019,10 @@ static uint32_t fpga_tx(struct solos_card *card)
10111019
if (vcc) {
10121020
atomic_inc(&vcc->stats->tx);
10131021
solos_pop(vcc, oldskb);
1014-
} else
1022+
} else {
10151023
dev_kfree_skb_irq(oldskb);
1016-
1024+
wake_up(&card->param_wq);
1025+
}
10171026
}
10181027
}
10191028
/* For non-DMA TX, write the 'TX start' bit for all four ports simultaneously */
@@ -1345,6 +1354,8 @@ static struct pci_driver fpga_driver = {
13451354

13461355
static int __init solos_pci_init(void)
13471356
{
1357+
BUILD_BUG_ON(sizeof(struct solos_skb_cb) > sizeof(((struct sk_buff *)0)->cb));
1358+
13481359
printk(KERN_INFO "Solos PCI Driver Version %s\n", VERSION);
13491360
return pci_register_driver(&fpga_driver);
13501361
}

0 commit comments

Comments
 (0)