--- zzzz-none-000/linux-2.4.17/net/atm/pppoatm.c 2001-11-09 22:11:15.000000000 +0000 +++ sangam-fb-322/linux-2.4.17/net/atm/pppoatm.c 2004-11-24 13:22:05.000000000 +0000 @@ -47,9 +47,24 @@ #if 0 #define DPRINTK(format, args...) \ printk(KERN_DEBUG "pppoatm: " format, ##args) + #else #define DPRINTK(format, args...) #endif + +#if 0 +static void skb_debug(const struct sk_buff *skb) +{ +#define NUM2PRINT 50 +char buf[NUM2PRINT * 3 + 1]; /* 3 chars per byte */ +int i = 0; +for (i = 0; i < skb->len && i < NUM2PRINT; i++) { + sprintf(buf + i * 3, "%2.2x ", 0xff & skb->data[i]); + } +printk(KERN_DEBUG "pppoatm: skb: %s\n", buf); +} +#endif + enum pppoatm_encaps { e_autodetect = PPPOATM_ENCAPS_AUTODETECT, @@ -125,7 +140,7 @@ pvcc = atmvcc_to_pvcc(atmvcc); atmvcc->push = pvcc->old_push; atmvcc->pop = pvcc->old_pop; - tasklet_disable(&pvcc->wakeup_tasklet); + tasklet_kill(&pvcc->wakeup_tasklet); ppp_unregister_channel(&pvcc->chan); atmvcc->user_back = NULL; kfree(pvcc); @@ -137,6 +152,7 @@ static void pppoatm_push(struct atm_vcc *atmvcc, struct sk_buff *skb) { struct pppoatm_vcc *pvcc = atmvcc_to_pvcc(atmvcc); + struct sk_buff *clones; DPRINTK("pppoatm push\n"); if (skb == NULL) { /* VCC was closed */ DPRINTK("removing ATMPPP VCC %p\n", pvcc); @@ -147,9 +163,29 @@ atm_return(atmvcc, skb->truesize); switch (pvcc->encaps) { case e_llc: + DPRINTK("LLC: skb data ptr %p\n", skb->data); if (skb->len < LLC_LEN || memcmp(skb->data, pppllc, LLC_LEN)) goto error; + + /* There is no need to do alignment correction on the latest DSL driver + * as the drivers handle the alignment issue. + * NOTE: Be careful, this fix has a dependancy on the latest DSL Driver and + * PPP Daemon. */ +#if 0 + /* alignment correction: */ + clones = alloc_skb(skb->len + 2, GFP_ATOMIC); + if (clones == 0) { + printk(KERN_DEBUG "PPPoATM : no mem for cloned skb\n"); + goto error; + } + else { + skb_reserve(clones,2); + memcpy(skb_put(clones, skb->len), skb->data, skb->len); + kfree_skb(skb); + skb = clones; + } +#endif skb_pull(skb, LLC_LEN); break; case e_autodetect: @@ -170,13 +206,31 @@ pvcc->chan.mtu += LLC_LEN; break; } - DPRINTK("(unit %d): Couldn't autodetect yet " + DPRINTK(" Couldn't autodetect yet " "(skb: %02X %02X %02X %02X %02X %02X)\n", - pvcc->chan.unit, skb->data[0], skb->data[1], skb->data[2], skb->data[3], skb->data[4], skb->data[5]); goto error; - case e_vc: + case e_vc: + /* There is no need to do alignment correction on the latest DSL driver + * as the drivers handle the alignment issue. + * NOTE: Be careful, this fix has a dependancy on the latest DSL Driver and + * PPP Daemon. */ +#if 0 + /* alignment correction */ + clones = alloc_skb(skb->len + 2, GFP_ATOMIC); + if (clones == 0) { + printk(KERN_DEBUG "PPPoATM : no mem for cloned skb\n"); + goto error; + } + else { + skb_reserve(clones,2); + memcpy(skb_put(clones, skb->len), skb->data, skb->len); + kfree_skb(skb); + skb = clones; + } +#endif + DPRINTK("VC MUX: skb data ptr %p\n", skb->data); break; } ppp_input(&pvcc->chan, skb); @@ -200,8 +254,8 @@ { struct pppoatm_vcc *pvcc = chan_to_pvcc(chan); ATM_SKB(skb)->vcc = pvcc->atmvcc; - DPRINTK("(unit %d): pppoatm_send (skb=0x%p, vcc=0x%p)\n", - pvcc->chan.unit, skb, pvcc->atmvcc); + DPRINTK("pppoatm_send (skb=0x%p, vcc=0x%p)\n", + skb, pvcc->atmvcc); if (skb->data[0] == '\0' && (pvcc->flags & SC_COMP_PROT)) (void) skb_pull(skb, 1); switch (pvcc->encaps) { /* LLC encapsulation needed */ @@ -226,16 +280,15 @@ goto nospace; break; case e_autodetect: - DPRINTK("(unit %d): Trying to send without setting encaps!\n", - pvcc->chan.unit); + DPRINTK("Trying to send without setting encaps!\n"); kfree_skb(skb); return 1; } atomic_add(skb->truesize, &ATM_SKB(skb)->vcc->tx_inuse); ATM_SKB(skb)->iovcnt = 0; ATM_SKB(skb)->atm_options = ATM_SKB(skb)->vcc->atm_options; - DPRINTK("(unit %d): atm_skb(%p)->vcc(%p)->dev(%p)\n", - pvcc->chan.unit, skb, ATM_SKB(skb)->vcc, + DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", + skb, ATM_SKB(skb)->vcc, ATM_SKB(skb)->vcc->dev); return ATM_SKB(skb)->vcc->send(ATM_SKB(skb)->vcc, skb) ? DROP_PACKET : 1;