Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754609Ab2K0Wgf (ORCPT ); Tue, 27 Nov 2012 17:36:35 -0500 Received: from merlin.infradead.org ([205.233.59.134]:44047 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751764Ab2K0Wge (ORCPT ); Tue, 27 Nov 2012 17:36:34 -0500 Message-ID: <1354055783.2534.18.camel@shinybook.infradead.org> Subject: [PATCH] solos-pci: Wait for pending TX to complete when releasing vcc From: David Woodhouse To: chas williams - CONTRACTOR Cc: Krzysztof Mazur , davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, nathan@traverse.com.au Date: Tue, 27 Nov 2012 22:36:23 +0000 In-Reply-To: <20121127135434.0728cd4f@thirdoffive.cmf.nrl.navy.mil> References: <1350926091-12642-1-git-send-email-krzysiek@podlesie.net> <1350926091-12642-3-git-send-email-krzysiek@podlesie.net> <1354036592.2534.6.camel@shinybook.infradead.org> <20121127173906.GA11390@shrek.podlesie.net> <1354039349.2534.11.camel@shinybook.infradead.org> <20121127135434.0728cd4f@thirdoffive.cmf.nrl.navy.mil> Content-Type: multipart/signed; micalg="sha1"; protocol="application/x-pkcs7-signature"; boundary="=-Awn7Yk2utqKN++JGjNm4" X-Mailer: Evolution 3.6.1 (3.6.1-1.fc18) Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 11264 Lines: 204 --=-Awn7Yk2utqKN++JGjNm4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 --- On Tue, 2012-11-27 at 13:54 -0500, chas williams - CONTRACTOR wrote: > the driver's close routine should wait for any of the pending tx and > rx to complete. Nathan, does this help? I can test here to a certain extent, but when I use it in PPPoE mode and then crash the router, the DSLAM tends to refuse to talk to me for an arbitrary period of time after that. Which is something of a PITA. diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index 9851093..b5bb332 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c @@ -94,6 +94,7 @@ struct pkt_hdr { struct solos_skb_cb { struct atm_vcc *vcc; uint32_t dma_addr; + struct completion *c; }; =20 =20 @@ -868,6 +869,7 @@ static void pclose(struct atm_vcc *vcc) struct solos_card *card =3D vcc->dev->dev_data; struct sk_buff *skb; struct pkt_hdr *header; + DECLARE_COMPLETION_ONSTACK(c); =20 skb =3D alloc_skb(sizeof(*header), GFP_ATOMIC); if (!skb) { @@ -881,11 +883,15 @@ static void pclose(struct atm_vcc *vcc) header->vci =3D cpu_to_le16(vcc->vci); header->type =3D cpu_to_le16(PKT_PCLOSE); =20 + SKB_CB(skb)->c =3D &c; + fpga_queue(card, SOLOS_CHAN(vcc->dev), skb, NULL); =20 clear_bit(ATM_VF_ADDR, &vcc->flags); clear_bit(ATM_VF_READY, &vcc->flags); =20 + wait_for_completion(&c); + /* Hold up vcc_destroy_socket() (our caller) until solos_bh() in the tasklet has finished processing any incoming packets (and, more to the point, using the vcc pointer). */ @@ -1011,9 +1017,12 @@ static uint32_t fpga_tx(struct solos_card *card) if (vcc) { atomic_inc(&vcc->stats->tx); solos_pop(vcc, oldskb); - } else + } else { + struct pkt_hdr *header =3D (void *)oldskb->data; + if (le16_to_cpu(header->type) =3D=3D PKT_PCLOSE) + complete(SKB_CB(oldskb)->c); dev_kfree_skb_irq(oldskb); - + } } } /* For non-DMA TX, write the 'TX start' bit for all four ports simultaneo= usly */ --=20 David Woodhouse Open Source Technology Centre David.Woodhouse@intel.com Intel Corporation --=-Awn7Yk2utqKN++JGjNm4 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Disposition: attachment; filename="smime.p7s" Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzA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DVN0YXJ0Q29tIEx0ZC4xKzApBgNVBAsTIlNlY3VyZSBEaWdpdGFsIENlcnRp ZmljYXRlIFNpZ25pbmcxODA2BgNVBAMTL1N0YXJ0Q29tIENsYXNzIDEgUHJpbWFyeSBJbnRlcm1l ZGlhdGUgQ2xpZW50IENBAgMEJnowgacGCyqGSIb3DQEJEAILMYGXoIGUMIGMMQswCQYDVQQGEwJJ TDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlm aWNhdGUgU2lnbmluZzE4MDYGA1UEAxMvU3RhcnRDb20gQ2xhc3MgMSBQcmltYXJ5IEludGVybWVk aWF0ZSBDbGllbnQgQ0ECAwQmejANBgkqhkiG9w0BAQEFAASCAQB6Mt9aKkE2kWZYWcellBIDQ6v3 iny4ov5ip4HVucc6oiojPPnITbctHNDJ77h2CL5b67HmcpZ2v56rsjoV0SC8rABNi6y7hhUsLXsG 3VykENFBvdL/mNOxMMsxqrD/ZKKSCSVQLCIpF2kq6rkNrecrIXvtWSS/Fuyf9ST1dfhLx9IYv9px gjX80e8I9unubOEqaZ/SDasGXh5QaGmp/lvM98qRImuwOjPtDPW7OqkUtYw6yYaV5AamK0P4iYup C3jQ4d7wGOZTV4vZNAIXXWkjprSzSo4hAVblRD8zODFEmPM/dyXdZdIuiGX+ZDNbaeLnobtgh41s myPHmJK1Bv/tAAAAAAAA --=-Awn7Yk2utqKN++JGjNm4-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/