mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
solos-pci: clean up pclose() function
- Flush pending TX skbs from the queue rather than waiting for them all to complete (suggested by Krzysztof Mazur <krzysiek@podlesie.net>). - Clear ATM_VF_ADDR only when the PKT_PCLOSE packet has been submitted. - Don't clear ATM_VF_READY at all — vcc_destroy_socket() does that for us. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
parent
5b4d72080f
commit
213e85d389
@ -868,9 +868,19 @@ static void pclose(struct atm_vcc *vcc)
|
|||||||
{
|
{
|
||||||
struct solos_card *card = vcc->dev->dev_data;
|
struct solos_card *card = vcc->dev->dev_data;
|
||||||
unsigned char port = SOLOS_CHAN(vcc->dev);
|
unsigned char port = SOLOS_CHAN(vcc->dev);
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb, *tmpskb;
|
||||||
struct pkt_hdr *header;
|
struct pkt_hdr *header;
|
||||||
|
|
||||||
|
/* Remove any yet-to-be-transmitted packets from the pending queue */
|
||||||
|
spin_lock(&card->tx_queue_lock);
|
||||||
|
skb_queue_walk_safe(&card->tx_queue[port], skb, tmpskb) {
|
||||||
|
if (SKB_CB(skb)->vcc == vcc) {
|
||||||
|
skb_unlink(skb, &card->tx_queue[port]);
|
||||||
|
solos_pop(vcc, skb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spin_unlock(&card->tx_queue_lock);
|
||||||
|
|
||||||
skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
|
skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
|
||||||
if (!skb) {
|
if (!skb) {
|
||||||
dev_warn(&card->dev->dev, "Failed to allocate sk_buff in pclose()\n");
|
dev_warn(&card->dev->dev, "Failed to allocate sk_buff in pclose()\n");
|
||||||
@ -886,9 +896,6 @@ static void pclose(struct atm_vcc *vcc)
|
|||||||
skb_get(skb);
|
skb_get(skb);
|
||||||
fpga_queue(card, port, skb, NULL);
|
fpga_queue(card, port, skb, NULL);
|
||||||
|
|
||||||
clear_bit(ATM_VF_ADDR, &vcc->flags);
|
|
||||||
clear_bit(ATM_VF_READY, &vcc->flags);
|
|
||||||
|
|
||||||
if (!wait_event_timeout(card->param_wq, !skb_shared(skb), 5 * HZ))
|
if (!wait_event_timeout(card->param_wq, !skb_shared(skb), 5 * HZ))
|
||||||
dev_warn(&card->dev->dev,
|
dev_warn(&card->dev->dev,
|
||||||
"Timeout waiting for VCC close on port %d\n", port);
|
"Timeout waiting for VCC close on port %d\n", port);
|
||||||
@ -899,6 +906,9 @@ static void pclose(struct atm_vcc *vcc)
|
|||||||
tasklet has finished processing any incoming packets (and, more to
|
tasklet has finished processing any incoming packets (and, more to
|
||||||
the point, using the vcc pointer). */
|
the point, using the vcc pointer). */
|
||||||
tasklet_unlock_wait(&card->tlet);
|
tasklet_unlock_wait(&card->tlet);
|
||||||
|
|
||||||
|
clear_bit(ATM_VF_ADDR, &vcc->flags);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user